English Amiga Board


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

 
 
Thread Tools
Old 23 March 2010, 09:55   #81
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Quote:
Originally Posted by StingRay View Post
This is kinda useless (sorry) because load address is not constant.
Life is hard to save some bytes

So another possible size optimization: put $55555555 into some free register ( I guess we can use d7 ) and then do andi.l's in .mfm_decode.
Asman is offline  
Old 23 March 2010, 10:00   #82
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
@ Asman - Correct but if I remember my own source correctly (bad memory - need to check! ) there are no free regs for the MFM decode mask...
pmc is offline  
Old 23 March 2010, 10:02   #83
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Asman, I bow - looks like d7 would be OK.
pmc is offline  
Old 23 March 2010, 10:06   #84
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Sting & Asman - legendary work guys.

I already implemented Asman's d7 save, I'll implement Sting's pea save too.

416 byte version of the trackloader to come! \o/

EDIT: Where'd Sting's pea save post just go...? Maybe only a 418 byte version to come...
pmc is offline  
Old 23 March 2010, 10:06   #85
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Asman View Post
Life is hard to save some bytes
I know And I edited my post and added some more explanations.
StingRay is offline  
Old 23 March 2010, 10:08   #86
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by pmc View Post
Sting & Asman - legendary work guys.

I already implemented Asman's d7 save, I'll implement Sting's pea save too.

416 byte version of the trackloader to come! \o/

Sorry, I was wrong (and deleted my post). (Didn't have enough coffee yet it seems). But see if you can find a free address register so you can do
lea $8000,a0
...
jmp (a0)

f.e.
StingRay is offline  
Old 23 March 2010, 10:08   #87
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
@StingRay

Awesome

@pmc
Agree, you should put move.l #$5555555,d7 before first bsr.s .mfm_decode.
And please post newest version of source.
Asman is offline  
Old 23 March 2010, 10:09   #88
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Sting - after yesterday's shrinking there's two free address regs - a0 and a1 if I remember correctly.

Maybe we might get below 418 yet!
pmc is offline  
Old 23 March 2010, 10:13   #89
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by pmc View Post
Sting - after yesterday's shrinking there's two free address regs - a0 and a1 if I remember correctly.

Maybe we might get below 418 yet!

Use the pea optimization, easier. ;D Turns out I wasn't wrong and it is indeed 2 bytes smaller. ;D (too stressful to do "fun code" when boss is around ;D)

And since I deleted my original post, I'll post the pea optimization again.

pea $8000
move.l (a7),a4
...
rts

instead of
lea $8000,a4
....
jmp $8000

Last edited by StingRay; 23 March 2010 at 10:23. Reason: added "lost" pea version again :D
StingRay is offline  
Old 23 March 2010, 11:08   #90
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
OK boys, after implementing Sting's and Asman's additional size optimisations here's the 416 byte version!

Anyone who's helped in this is now credited in the source as having done so - thanks guys - much appreciated!

416 byte version removed.

Last edited by pmc; 23 March 2010 at 12:40.
pmc is offline  
Old 23 March 2010, 11:28   #91
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
So we have one free register a1. Right after comment ; Setup disk controls you should put $4489 into a1 and change a bit source, mean replace all $4489 into a1.

I need some extra coffee. We have also a0 free.

Last edited by Asman; 23 March 2010 at 11:49. Reason: added forget register a0
Asman is offline  
Old 23 March 2010, 11:31   #92
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Not tested but:
andi.l #$0000ff00,d1 ;isolate sector number
add.l d1,d1 ;*2 to get byte offset to place this sector in the decode buffer
adda.w d1,a4 ;add the offset to the decode data buffer address

could be done like this:
sf d1
add.w d1,d1
add.w d1,a4
StingRay is offline  
Old 23 March 2010, 11:54   #93
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Next one (maybe 400 bytes version is possible )

moveq.l #71,d7 ;head settle time
bra.s .wait_timer
.upper_head:
bclr.b #2,(a6) ;select upper disk head
moveq.l #71,d7 ;head sett

can be replaced with:
bra.b .w_timer71
.upper_head:
bclr.b #2,(a6) ;select upper disk head
.w_timer71
moveq.l #71,d7 ;head sett
StingRay is offline  
Old 23 March 2010, 12:02   #94
Asman
68k
 
Asman's Avatar
 
Join Date: Sep 2005
Location: Somewhere
Posts: 828
Quote:
Originally Posted by StingRay View Post
Next one (maybe 400 bytes version is possible )

moveq.l #71,d7 ;head settle time
bra.s .wait_timer
.upper_head:
bclr.b #2,(a6) ;select upper disk head
moveq.l #71,d7 ;head sett

can be replaced with:
bra.b .w_timer71
.upper_head:
bclr.b #2,(a6) ;select upper disk head
.w_timer71
moveq.l #71,d7 ;head sett
Damn, I don't catch this ( I'm going to drink coffee ). Could you explain a bit. Thank you.
Asman is offline  
Old 23 March 2010, 12:03   #95
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by StingRay
Next one (maybe 400 bytes version is possible )
LOL. Smaller than 416 is definitely possivle - not sure 400 is!

Wait 71 timer branch optimisation implemented - trackloader now 414 bytes.

Quote:
Originally Posted by StingRay
Not tested but:
andi.l #$0000ff00,d1 ;isolate sector number
add.l d1,d1 ;*2 to get byte offset to place this sector in the decode buffer
adda.w d1,a4 ;add the offset to the decode data buffer address

could be done like this:
sf d1
add.w d1,d1
add.w d1,a4
Probably being stupid but - sf d1...?
pmc is offline  
Old 23 March 2010, 12:04   #96
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by Asman
Damn, I don't catch this ( I'm going to drink coffee ). Could you explain a bit. Thank you.
Sting cleverly spotted that you could use the same moveq.l #71 for both head settle times by using a branch to the second one in place of the first one.
pmc is offline  
Old 23 March 2010, 12:04   #97
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by pmc View Post
Probably being stupid but - sf d1...?

s.et f.alse = d1.b = 0.
StingRay is offline  
Old 23 March 2010, 12:06   #98
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by Asman View Post
Damn, I don't catch this ( I'm going to drink coffee ). Could you explain a bit. Thank you.
I explained this in one of my earlier posts.

Quote:
Originally Posted by StingRay
- "chain" your routines, e.g.
move.w #val,d7
bra.w .wait_timer
; some other code
move.w #val,d7
bra.w .wait_timer
; some other code
move.w #val,d7
bra.w .wait_timer


can be changed to:
move.w #val,d7
bra.b .w_timer
; some other code
move.w #val,d7
bra.b .w_timer
; some other code
move.w #val,d7
.w_timer
bra.w .wait_timer
StingRay is offline  
Old 23 March 2010, 12:10   #99
pmc
gone
 
pmc's Avatar
 
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
Quote:
Originally Posted by StingRay
s.et f.alse = d1.b = 0.
Ah, OK - set false. I'm being dumb though cos I still don't get how that enables replacing the andi that isolates the sector number from the decoded sector header longword.
pmc is offline  
Old 23 March 2010, 12:13   #100
StingRay
move.l #$c0ff33,throat
 
StingRay's Avatar
 
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
Quote:
Originally Posted by pmc View Post
Ah, OK - set false. I'm being dumb though cos I still don't get how that enables replacing the andi that isolates the sector number from the decoded sector header longword.
;d1: $ABCD1234
and.l #$0000ff00,d1 ; d1 = $00001200

;d1: $ABCD1234
sf.b d1 ; d1: $ABCD1200

since we only do .w operations, it doesn't matter what's in the high word of d1

thus: and.l #$0000ff00,d1 = sf.b d1

StingRay is offline  
 


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 21:56
Game loader stuck on certain track after save state restore andreas support.WinUAE 2 26 March 2011 19:59
Can't transfer Supaplex cause of CSL track loader ! Vollldo support.Games 4 12 March 2011 21:51
Hardware File Loader h0ffman Coders. General 9 02 December 2010 16:40
mfm/custom regs/track loader snyp Coders. General 9 06 June 2006 19: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 22:04.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.10109 seconds with 14 queries