24 March 2010, 11:29 | #141 | ||
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,517
|
Quote:
EDITQUOTE: Quote:
Last edited by Toni Wilen; 24 March 2010 at 11:36. |
||
24 March 2010, 19:26 | #142 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Hello boys.
Please see the attached *fixed* trackloader. This one works correctly no matter what start track is used - any valid track number, even *or* odd will work OK. The length increased slightly but is still a nice and small 408 bytes. All other shorter versions in this thread will work only if the start track is an even number so please use this one if you want one that works from any start track. Thanks to phx for putting a foot in my arse and making me test my code properly! EDIT: Code removed - get the fixed fixed version below. Last edited by pmc; 24 March 2010 at 20:30. |
24 March 2010, 20:04 | #143 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Hmm... I'm sorry to annoy you again, but the seek-code still looks suspicious to me.
Code:
.move_to_start: btst.l #0,d4 bne.s .odd_track bsr.s .lower_head bra.s .step_to_start .odd_track: bsr.s .upper_head subq.b #1,d4 .step_to_start: addq.b #1,d5 cmp.b d5,d4 beq.s .at_start bsr.s .step_heads bra.s .step_to_start Example: d5 = 0 (current track) d4 = 1 (start track to seek) Your function calls .upper_head and then decrements d4, which becomes 0. Then you increment d5 and compare it with d4 to see if the destination is reached. It will fail (for the next 255 steps )! Unless I'm completely confused (which might be possible) I think that this part of the trackloader will never work, because you still increment the current-track counter d5 by just *one* when you make a step to the next cylinder (which equals *two* tracks). |
24 March 2010, 20:11 | #144 | ||
Registered User
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
|
Quote:
Quote:
The bootblock checksum etc was included in the size measurement, so I included that optimization, while pmc said the load routine should be possible to use standalone so I didn't remove that stuff. |
||
24 March 2010, 20:22 | #145 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
@ phx - you're right about the track 1 thing - I forgot to include my little check for that - I'll sort it at some point - thanks for pointing it out.
Regarding d5 - although it's called "current track" in the code, I regard it as more of a "current cylinder" counter - for example, to get to track two *or* three from the start point of cylinder 0, the code steps the heads just once. Hence d5 == 1 when track == 2 or 3. Quote:
So, I say - keep annoying me! Edit: fixed fixed version (412 bytes), works for track 1 starts - thanks again to phx for giving me another kick. Last edited by pmc; 24 March 2010 at 22:08. |
|
24 March 2010, 20:59 | #146 |
Registered User
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
|
This could work, yes?
Code:
.move_to_start: lsr.b #1,d4 bcc.s .step_to_start bsr.s .upper_head .step_to_start: cmp.b d5,d4 beq.s .at_start bsr.s .step_heads addq.b #1,d5 bra.s .step_to_start Code:
.trackloader: bsr.s .read_trk bchg #2,(a6) bne.s .do_next bsr.s .step_heads .do_next: dbra d3,.trackloader |
24 March 2010, 21:40 | #147 | ||
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Quote:
Quote:
|
||
24 March 2010, 21:43 | #148 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
|
24 March 2010, 21:45 | #149 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Hey zaz - I thought you said you were out of practice!
|
24 March 2010, 21:56 | #150 |
Registered User
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
|
I hope you assembled & tested my suggestions before saying that -- I didn't
|
24 March 2010, 22:10 | #151 |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Funny you should say that zaz - I just amended, assembled and tested the source including your code in place of mine and it works like an absolute charm and is also now only 380 bytes!
Legendary work fella. I love seeing how really good coders think about and solve things in contrast to my decidedly amateur efforts. A richly deserved credit to you is now in the source too. Last edited by pmc; 03 June 2010 at 09:01. |
25 March 2010, 00:34 | #152 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,500
|
Very nice!
But something is missing. Although both stack pointers were relocated you didn't care to relocate the trackloader itself to a safe location. As you don't know where the OS had written the boot block there is always the danger that you overwrite it while reading from disk. This will bring you near to 400 bytes again. But you can delete the Forbid() call, because the interrupts are disabled anyway. |
25 March 2010, 07:32 | #153 | |
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
|
|
25 March 2010, 09:40 | #154 | |||||
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Quote:
Quote:
Quote:
Quote:
I know! Quote:
Could be even smaller (look above) Last edited by StingRay; 25 March 2010 at 09:51. |
|||||
25 March 2010, 11:45 | #155 |
move.l #$c0ff33,throat
Join Date: Dec 2005
Location: Berlin/Joymoney
Posts: 6,863
|
Just had a look at the new version of the trackloader and this is my version of the "move_to_start" routine:
Code:
.move_to_start: lsr.b #1,d4 beq.b .at_start bcc.s .step_to_start bclr.b #2,(a6) ;select upper disk head .step_to_start: bsr.b .step_heads subq.b #1,d4 bne.b .step_to_start Edit: optimized the "copy to safe location" routine, 398 bytes now. ;D Last edited by StingRay; 25 March 2010 at 13:59. Reason: 2 more bytes killed :) |
25 March 2010, 12:18 | #156 |
68k
Join Date: Sep 2005
Location: Somewhere
Posts: 828
|
I have questions. What is exactly happen when disk is inserted right after reboot ? Is there any documentation about it ?
When OS want to load bootblock somewhere then how he choose the place ( OS do AllocMem for bootblock or something ??? ). |
25 March 2010, 19:19 | #157 | |
WinUAE developer
Join Date: Aug 2001
Location: Hämeenlinna/Finland
Age: 49
Posts: 26,517
|
Quote:
A1 = trackdisk.device io request A6 = execbase I don't know if official documentation exists. |
|
25 March 2010, 19:24 | #158 |
Registered User
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
|
There's at least this from Devices:
http://amigadev.elowar.com/read/ADCD.../node007D.html |
25 March 2010, 19:25 | #159 | ||||||
gone
Join Date: Apr 2007
Location: completely gone
Posts: 1,596
|
Quote:
Quote:
The OS is for wimps - I thought you were real men! Quote:
Quote:
Quote:
Quote:
EDIT - too slow posting - Toni and zaz to the rescue. |
||||||
25 March 2010, 19:57 | #160 |
Registered User
Join Date: Mar 2010
Location: Lkpg/Swe
Posts: 12
|
372 bytes now.
Using dsklen as base register was discussed before; this version has it and keeps readability by using asmone/phxass/vasm BASEREG. Also some bset/bclr to CIA is collapsed to move/ori but should be in a safe manner. But what happens if $60000 is allocated already? Even with AllocAbs() the loader will fail if that happens... 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... opt_bb_trkldr_zaz.68k |
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 |
|
|