23 June 2009, 15:16 | #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) |
23 June 2009, 15:37 | #2 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Nice one mate.
Time to download and check. |
25 June 2009, 03:03 | #3 |
Registered User
Join Date: Apr 2006
Location: Sydney / Australia
Posts: 113
|
Thanks Vortex, especially for commenting the code so well.
|
17 March 2010, 14:47 | #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. |
17 March 2010, 14:50 | #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)
|
17 March 2010, 14:56 | #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:
|
|
17 March 2010, 15:00 | #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. |
17 March 2010, 15:01 | #8 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Nice one mate - I'll do more testing.
|
17 March 2010, 15:44 | #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... |
17 March 2010, 15:51 | #10 |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,583
|
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 |
17 March 2010, 15:52 | #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.
|
17 March 2010, 15:53 | #12 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
17 March 2010, 19:37 | #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! ) and found some *really* obvious mistakes. They've been fixed so now just some more testing... Last edited by pmc; 18 March 2010 at 09:37. |
19 March 2010, 15:35 | #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. |
19 March 2010, 15:41 | #15 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
Nice that you got it to work. It can easily be made smaller (mine is 494 bytes :P) and faster, you can access the CIA registers indirect like the HW regs f.e. =) Also, there is no need to start/stop motor for each track, just turn on the motor, check if the drive is ready, load your tracks and then turn the motor off.
|
19 March 2010, 15:49 | #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... |
|
19 March 2010, 15:58 | #17 | |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
I know.
Quote:
I'm sure you can do that! |
|
19 March 2010, 16:04 | #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 March 2010, 16:06 | #19 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,865
|
|
19 March 2010, 22:35 | #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 I did a bootblock trackloader and decruncher for an old crack of Strider I did when I was learning and then packed all datas on the disk with my own cruncher. I made sure it did depack stripes of course for that 'pro' touch
Once you've written your own trackloader the natural progression from there is cracking y'know Well, it was for me |
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 |
|
|