![]() |
![]() |
#61 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
|
![]() |
![]() |
#62 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
Possible pointless "advanced" optimization: start DMA, wait for 2 wordsync interrupts, decode first sector, wait for next wordsync, decode next sector. More Amiga-like!
![]() (I did it like this in Digital Disco II's track loader, not sure why..) |
![]() |
![]() |
#63 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
|
![]() |
![]() |
#64 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Some more optimizations:
Code:
move.w (a3)+,d6 cmp.w #$4489,d6 --> cmp.w #$4489,(a3)+ Also you may want to change "lsl.l #1,Dn" into "add.l Dn,Dn", which saves no byte but is faster on 68000. |
![]() |
![]() |
#65 | ||
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Quote:
@ phx - superb stuff - thanks for those optimisations. ![]() Thanks to those, here's a 420 byte version of the trackloader. I also fixed the timer offsets so that they're more readable. ![]() EDIT: 420 byte version removed. Last edited by pmc; 23 March 2010 at 11:06. |
||
![]() |
![]() |
#66 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
It still does not handle condition when the very first word isn't $4489 (cmp.w #$4489,(a3)+ always skips first word) but also remember extra words in gap when fixing this.
|
![]() |
![]() |
#67 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Toni - the comparison for $4489 steps through the MFM buffer one word at a time until it hits a $4489 and then makes sure it hits a second $4489 word before decoding the sector header.
I thought cmp.w $4489,(a3)+ didn't skip the first word - it's post increment isn't it? - as in check what's in (a3) then increment + .w As disk read is triggered at $4489 (as set in the dsksync register) would there ever actually be a situation where this routine won't sync properly? I'm just trying to avoid adding any code I can get away with not adding if at all possible. ![]() |
![]() |
![]() |
#68 | ||
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
![]() Quote:
- use AllocMem to allocate memory for your bootblock code (you could also use absolute addresses but I don't really like this) - copy the code into the just allocated memory space - check if your code is running on a OS2.0+ machine and if so, call Exec's CacheClearU to flush caches - execute the code you just copied to the safe location code - have fun ![]() 420 bytes is quite cool, I'm waiting for your first bootblock intro. =) Last edited by StingRay; 22 March 2010 at 18:21. Reason: typo |
||
![]() |
![]() |
#69 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
@ Stinger - thanks for that explanation mate.
Just out of further curiosity what's the cache flush for...? I've seen stuff from you before where you've admonished people for not clearing caches. ![]() Yeah, 420 bytes is nice. ![]() A bootblock intro is something I'll surely attempt at some point. ![]() |
![]() |
![]() |
#70 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
![]() Flushing cache is required on CPU's with cache (yeah, hard to guess eh? ![]() |
|
![]() |
![]() |
#71 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
OK cool.
Quote:
![]() Last edited by pmc; 22 March 2010 at 18:36. Reason: Some text removed - didn't want to stir too much... :) |
|
![]() |
![]() |
#72 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
Only reason I can think of would be a corrupt sector or smth, e.g. wrong/no sync markers. |
|
![]() |
![]() |
#73 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Yeah, I thought so - nice one Stinger.
![]() I know I *could* check for errors (bad syncs, bad checksums etc.) but it seems like overkill to me - even if I do check for errors a disk won't load or be read properly under those conditions so I'm not really too bothered if something corrupt == crash. |
![]() |
![]() |
#74 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
No, it isn't, if first word isn't 4489 (it isn't a special case), first sector data is completely skipped. It still technically works fine if DMA length is big enough (first sector repeats completely at the end) but...
|
![]() |
![]() |
#75 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
What would be a better (ie.works in all cases) solution for the sector start comparison Toni...?
|
![]() |
![]() |
#76 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
I don't really get this, $4489 is the SYNC marker so why is it wrong to search for it? Also, I suppose about 99% of all trackloaders are buggy then as I can hardly remember one that doesn't do a cmp.w #SYNC,(ax)+. =) Can you explain a bit more please?
|
![]() |
![]() |
#77 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,553
|
Quote:
btw, I was wrong, no 4489 at the start is very rare condition, it can only happen if dma is started when disk position is just after first bit of first 4489 and before start of next 4489. |
|
![]() |
![]() |
#78 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 829
|
size optimization: instead of $8000 you should choose something like $7fffe then you can use lea $7fffe.w,a4 instead of lea $8000.l,a4.
Last edited by Asman; 23 March 2010 at 08:42. Reason: typo |
![]() |
![]() |
#79 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
![]() Last edited by StingRay; 23 March 2010 at 09:53. Reason: some more info added |
|
![]() |
![]() |
#80 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,537
|
Quote:
Code:
.decode_header: movea.l a2,a4 ;restore start of this track's decode b cmp.w #$4489,(a3)+ bne.s .decode_header cmp.w #$4489,(a3) beq.s .decode_header EDIT: Or is the first detected sync skipped by the hardware and not written into the buffer? I cannot remember ATM. In this case you're right, of course! |
|
![]() |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
![]() |
||||
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 |
|
|