On Wed 31 Oct 2001 at 14:56:27 +0100, Baltissen, R (Ruud) wrote: > Hallo allemaal, > > When formatting a floppy using the New command, the routine at $EE0D. At > $EE3D it calls $C8C6. So far no problem. > > ;** Format disk [C8C6] > > FormatFloppy LDA #$4C ; JMP-command > STA BUF3 > LDA #<(E_FAC7) > STA A_0601 > LDA #>(E_FAC7) > STA A_0602 ; JMP $FAC7 in $600 to $602 > > LDA #$03 > JSR P_D6D3 ; set track and sector number > LDA DRVNMB ; drive number > ORA #$E0 ; command code for > formatting > STA JOBSZP+3 ; transmit > > B_C8E0 LDA JOBSZP+3 > BMI B_C8E0 ; wait until formatting done > > CMP #$02 > BCC B_C8EF ; smaller than two, then ok > > LDA #$03 > LDX #$00 > JMP PrepErrMsg ; 21, 'read error' > > B_C8EF RTS > > $C8C6 places the command "JMP $FAC7" at address $0600, sets the track and > sectornumber, fills JOBSZP+3 and then starts waiting until bit 7 of this > variable is reset. > It's logical to assume that the IRQ routine does reset this bit somewhere. > The original IRQ routine calls $F2B0. At $F2E9 it checks $0020. I don't know > where this variable is intialised. Following both possibilities $F2F9 or > $F99C I have no idea where the JMP instruction at $0600 is executed. > As you see JOBSZP+x ($00+x) is filled with a code. Where is this code > examined and acted upon? I'm doing this totally from memory, so it may be inaccurate. JOBSZP must be the "job queue", which has 1 byte per buffer, which is a command that must be performed on the buffer. (There are associated locations for the track and sector numbers.) All commands have the high bit set, and I think the low bit is used for the drive number. When the command is finished it is replaced with a result code (with the high bit clear). This queue is checked on "the other CPU", or in the case of 1541 and the like, in the IRQ routine somewhere. The queue is examined extensively, so that the job which needs a disk sector which is nearest will be done first (and otherwise the head is set into motion into the right direction, etc). The command used for formatting is "execute buffer", and as you noted, all it does is jump into the ROM somewhere for the real work. IIRC, the buffer is executed many many times during formatting, doing one track at a time or even less. Then, when it is finally done, it replaces the command with a result code. I can't give oyu exact memory locations like this but maybe this explanation helps you to understand the disassembly better. > Why do I need this info? Replacing the FD by a harddisk means some routines > won't work at all, especially the formatting routine. It seems logical that > this routine can be found at $FAC7 but how can I be very sure? And other > codes are used as well and I haven't found the corresponding routines yet :( I think you can just replace the code you show above with whatever you need to get the formatting job done. When it works, you might want to split it up so that it it "time-sliced", if that brings any advantage that is. In the 1541 it is only like that because it used to be executed on the other processor. > Any help is welcome. Thanks. > / / |_/ Groetjes, Ruud -Olaf. -- ___ Olaf 'Rhialto' Seibert - rhialto@ --Soep van de dag, wat zal dat zijn \X/ xs4all.nl --wat kan dat wezen, beter maar het ergste vrezen -Boy Bensdorp Message was sent through the cbm-hackers mailing list
Archive generated by hypermail 2.1.1.