![]() |
![]() |
#1 |
Used Register
Join Date: Nov 2008
Location: Headvillage / The Nethervoids
Age: 50
Posts: 103
|
ASM: Hardware Track Loader
Gentlemen,
Attached is the code for a basic hardware track loader. Tested it on a real Amiga 500, and df0: is still alive ![]() Some remarks: - Hardly any checks in there. For instance, if you want to try and read track 2000..., the result will be ehhhm.. undefined. - It can probably be coded a little more compact, but at least it's readable now ![]() - Uses df0: (hardcoded). - The example loads track 0 and 1 from disk and then exits. use D DecodeBuffer or H DecodeBuffer to see what has been read (Both ASMOne). Enjoy, and comments are always welcome. Cheers, V. Last edited by Vortex; 23 June 2009 at 15:18. Reason: (forgot attachment) |
![]() |
![]() |
#2 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Nice one mate.
![]() Time to download and check. ![]() |
![]() |
![]() |
#3 |
Registered User
Join Date: Apr 2006
Location: Sydney / Australia
Posts: 113
|
Thanks Vortex, especially for commenting the code so well.
![]() |
![]() |
![]() |
#4 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Watcha chaps.
![]() I made a small trackloader routine that can be installed on a bootblock (526 bytes total) and I'm trying to test it to see if it works OK. I wrote the trackloader bootblock to disk using Asm-One and calculated the checksum and the disk is bootable so that seems to have worked. I can see that when it boots it finds track 0 OK, moves to the required track OK and reads that track. But then it just sits there. If I hit the HRTMon freeze button I can see that where it's sitting is in a loop looking for the $44894489 MFM sync mark longword. This is making me think I'm not writing my test binary routine that I want to load and execute with the trackloader to disk correctly with Asm-One. Well, either that or my code isn't working as I think it should... Anyone got any advice either about using Asm-One correctly or whether the approach I've used in my code is OK? EDIT: Old version of code removed. Last edited by pmc; 17 March 2010 at 19:32. |
![]() |
![]() |
#5 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
Had a quick look and can't see anywhere that you properly "kill" the system and stuff. Which is most probably the reason for your problem (track not loaded correctly, no SYNC marker => bang bang you're dead)
|
![]() |
![]() |
#6 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
OK so I still have to do all the forbid stuff up front then...?
Quote:
|
|
![]() |
![]() |
#7 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
Yeah, just kill interrupts/dma etc and then enable disk dma. for a very quick (and dirty) test a move.w #$4000,$dff09a might be enough.
If you're using ASM1 to write the track then there shouldn't be any problems. |
![]() |
![]() |
#8 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Nice one mate - I'll do more testing.
![]() |
![]() |
![]() |
#9 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Added a jsr forbid, and move.w $7fff to intena, dmacon and intreq to the code and now when it boots it just gurus out.
![]() More testing needed I think... |
![]() |
![]() |
#10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,611
|
Sync check is bad, always use word comparison because there can be 0 to 2 sync words at the beginning depending on disk position when DMA was started. (and position of Paula's internal word counter)
EDIT: or was it 0 to 1? I don't remember and too lazy to check ![]() |
![]() |
![]() |
#11 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Cheers Toni - I'll swap longword cmp over to two word cmp's.
![]() |
![]() |
![]() |
#12 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
![]() |
![]() |
#13 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
OK - new version of code attached.
This one forbids multitasking and turns off dma and interrupts and doesn't guru out in doing so. Also, it now locates the $4489 sync words a word at a time instead of as one longword and seems to find the syncs as it doesn't freeze anymore. However, what it does now is in some ways worse! It starts stepping the heads and runs away and tries to step them up and beyond cylinder 79. Ooooops! So - DON'T run this version on a real Amiga!! Glad I'm testing this on WinUAE or I might now have a dead drive! ![]() More bugfixing to do but I'm nearly there I think... EDIT: Bad code described above removed - I looked at the decode routine again this morning (I always spot bugs in code in the morning! ![]() Last edited by pmc; 18 March 2010 at 09:37. |
![]() |
![]() |
#14 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
OK chaps forget all about my previous trackloader attempt per my posts above - I was trying to cut way too many corners with that one and, in short, it was a load of crap.
![]() Anyways, I went away, actually *thought* about it and recoded it from scratch. So, tested working bootblock trackloader (736 bytes total size) attached. ![]() Last edited by pmc; 21 March 2010 at 00:20. |
![]() |
![]() |
#15 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
Quote:
![]() ![]() |
|
![]() |
![]() |
#16 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
![]() One step at a time! I was just glad to get it working! ![]() Thanks for the advice on some of the savings I can make - now that it's working OK I can go back and optimise. ![]() This is probably a silly question but has your bootblock trackloader got enough space left over to also do decrunch of the loaded data...? I just wonder whether it might be posslble for me, after I trim the existing loader down, to add a decrunch routine too... |
|
![]() |
![]() |
#17 | ||
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
I know.
![]() Quote:
![]() ![]() Quote:
![]() |
||
![]() |
![]() |
#18 | ||
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
![]() Quote:
![]() For my trackloader though, 736 + 328 = 1064 ![]() I better get optimising! ![]() |
||
![]() |
![]() |
#19 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
![]() |
![]() |
#20 |
move.w #$4489,$dff07e
Join Date: Sep 2005
Location: Norfolk, UK
Age: 43
Posts: 2,351
|
Yes, as Dr Sting says it can be done with room to spare
![]() ![]() Once you've written your own trackloader the natural progression from there is cracking y'know ![]() ![]() |
![]() |
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 |
|
|