English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General > Coders. Tutorials

 
 
Thread Tools
Old 25 March 2010, 21:05   #161
zaz
Registered User
 
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
Quote:
Originally Posted by StingRay View Post
I think I remember some trainers you made back in the day. If you are the same zaz that was in Dual Crew on Amiga too that is ;D
Yep, that's me. Incidentally the super cars ii trainer was also an exercise in size optimization, but that's another story.
zaz is offline  
AdSense AdSense  
Old 25 March 2010, 21:06   #162
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,586
Quote:
Originally Posted by zaz View Post
372 bytes now.
Cool! Gotta check your version in a sec! "I'm a bit rusty", yeah, right. ;P

Quote:
Originally Posted by zaz View Post
But what happens if $60000 is allocated already? Even with AllocAbs() the loader will fail if that happens...
This is a very "dirty" solution anyway which I really do not like. However, in case of using AllocAbs you could call AllocAbs in a loop until it succeeds. F.e. $40000 first, fails -> increase by say $1000 bytes -> loop

Quote:
Originally Posted by zaz View Post
After the system is killed we could copy the loader to $c0 or some low address and just assume the bootblock is not loaded there (like with the stack relocations), but then it's no longer safe to use library calls to flush the cache...
This is the same as my "copy to $60000" approach then (as I also assume that the bootblock isn't loaded there, AFAIK OS loads bootblock quite low into memory). Cleanest approach would be to call AllocMem and copy the code then (I used exactly that approach in the Bootblock intro I made for FAP) but then the stack relocation wouldn't be safe anymore which is why I didn't use it.
StingRay is offline  
Old 25 March 2010, 21:18   #163
zaz
Registered User
 
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
After loading an unspecified number of tracks to $8000 AllocMem() would not have helped, so might as well leave it as it is.

I had a brief idea about AllocMem()ing a big chunk for the loader, MFM buffer, and loaded program, but the loaded program itself is presumably assembled for an absolute address etc... Coming up: bootblock trackloader with amiga hunk loader & relocator? I think not

EDIT: loader is already AllocMem()ed of course but still...

Last edited by zaz; 25 March 2010 at 21:28. Reason: improving
zaz is offline  
Old 25 March 2010, 21:37   #164
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,586
Quote:
Originally Posted by zaz View Post
After loading an unspecified number of tracks to $8000 AllocMem() would not have helped, so might as well leave it as it is.
That was exactly the reason why I didn't use it. Absolute addresses for the MFM buffer/stacks = good bye AllocMem.

Quote:
Originally Posted by zaz View Post
I had a brief idea about AllocMem()ing a big chunk for the loader, MFM buffer, and loaded program
That thought actually crossed my mind too. But it would only work if there are no absolute addresses used anywhere. It would be clean and safe!

Last edited by StingRay; 25 March 2010 at 21:43. Reason: "typed too fast" typo ;D
StingRay is offline  
Old 25 March 2010, 21:52   #165
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,586
I checked your version and I can show you what I meant with "I wanted to keep the code readable" and thus didn't use lea dsklen,a5:

Code:
	move.w	#%0000000000000010,intreq(a5)	;clear disk interrupt bit
This is a bug, a5 is not $dff000 anymore. So it would have to be:
Code:
	move.w	#%0000000000000010,intreq-dsklen(a5)	;clear disk interrupt bit
StingRay is offline  
Old 25 March 2010, 22:09   #166
Asman
68k

Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 628
@Toni, zaz - Thank you for information.

If I understand correctly. Bootblock code is allocated by AllocMem and is not necessary to think about stack pointers relocation, right ?
Mean we should use AllocMem for buffer.

I know The OS is for wimps
Asman is offline  
Old 25 March 2010, 22:10   #167
zaz
Registered User
 
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
@StingRay: Check again, this is what BASEREG does and why I changed all custom reg EQU from $000 etc to $dff000 etc.

Last edited by zaz; 25 March 2010 at 22:11. Reason: clarified who the comment was directed at
zaz is offline  
Old 25 March 2010, 23:26   #168
phx
Natteravn

phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 1,019
Quote:
Originally Posted by StingRay View Post
This is the same as my "copy to $60000" approach then (as I also assume that the bootblock isn't loaded there, AFAIK OS loads bootblock quite low into memory).
Exactly. The OS always starts to allocate lowest regions first.

Quote:
Cleanest approach would be to call AllocMem and copy the code then
When we take over the machine it doesn't make sense to call AllocMem. There can never be much memory allocated in this early phase when the bootblock is read, so I would simply relocate to a high region which exists on all Amigas, as you did, and we are safe.
phx is offline  
Old 25 March 2010, 23:36   #169
zaz
Registered User
 
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
Ok 360 bytes version attached.
Attached Files
File Type: 68k opt_bb_trkldr_zaz_366.68k (10.6 KB, 330 views)

Last edited by zaz; 25 March 2010 at 23:40. Reason: Am I going cross-eyed? Source assembles to 360 bytes, not 366
zaz is offline  
Old 26 March 2010, 10:35   #170
StingRay
move.l #$c0ff33,throat

StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 5,586
Quote:
Originally Posted by zaz View Post
@StingRay: Check again, this is what BASEREG does and why I changed all custom reg EQU from $000 etc to $dff000 etc.
I checked again and I have to say: Nice one!
Edit: I never used BASEREG, looks like a nifty feature! =)
And I missed that you changed the custom reg equates, now it does make sense to me.

Quote:
Originally Posted by phx View Post
When we take over the machine it doesn't make sense to call AllocMem. There can never be much memory allocated in this early phase when the bootblock is read, so I would simply relocate to a high region which exists on all Amigas, as you did, and we are safe.
Allocating memory works w/o any problem in the bootblock (see my Bootblock intro for a proof). Besides, the machine has not been taken over at the time I'd allocate memory so it is still the safest (=cleanest) approach as long as no absolute addresses are used anywhere.

Last edited by StingRay; 26 March 2010 at 10:51.
StingRay is offline  
Old 18 May 2013, 12:07   #171
FrenchShark
FPGAmiga rulez!
FrenchShark's Avatar
 
Join Date: Dec 2007
Location: South of France
Age: 44
Posts: 155
Hello,

FYI, I am using the trackloader code in a verilog testbench to check the correct functionning of Paula / disk emulation.
I think I spotted a bug line 403:
bne.s .time_not_expired
It should be a BEQ not a BNE since ICR bit is set when timer A transitions from 0000 to FFFF.
What do you think ?

Regards,

Frederic
FrenchShark is offline  
Old 18 May 2013, 19:12   #172
pmc
rebooting...
pmc's Avatar
 
Join Date: Apr 2007
Location: Elsewhere
Posts: 1,595
Yes, it should. Already fixed in my own version of the trackloader a long time ago - just never said anything about it here.
pmc is offline  
Old 18 May 2013, 21:44   #173
FrenchShark
FPGAmiga rulez!
FrenchShark's Avatar
 
Join Date: Dec 2007
Location: South of France
Age: 44
Posts: 155
Quote:
Originally Posted by pmc View Post
Yes, it should. Already fixed in my own version of the trackloader a long time ago - just never said anything about it here.
Ok, thanks.
There is actually another one in the Disk DMA enable instruction, it should be:
move.w #%1000001000010000,(a0) ;enable disk DMA
Bit #9 has to be set too.

Regards,

Frederic
FrenchShark is offline  
AdSense AdSense  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
HD loader example st! Coders. General 4 16 October 2012 22:56
Game loader stuck on certain track after save state restore andreas support.WinUAE 2 26 March 2011 20:59
Can't transfer Supaplex cause of CSL track loader ! Vollldo support.Games 4 12 March 2011 22:51
Hardware File Loader h0ffman Coders. General 9 02 December 2010 17:40
mfm/custom regs/track loader snyp Coders. General 9 06 June 2006 20:42

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 20:45.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Page generated in 0.29092 seconds with 15 queries