# HG changeset patch # User boisy # Date 1074796934 0 # Node ID 30c1d42f3913050761c3f30a800339d98f90ab9e # Parent b7d6cb1df8349187396a65a8fd5c4d721bce543f Added comments, slow optimization progress diff -r b7d6cb1df834 -r 30c1d42f3913 level1/modules/boot_1773.asm --- a/level1/modules/boot_1773.asm Tue Jan 20 02:43:23 2004 +0000 +++ b/level1/modules/boot_1773.asm Thu Jan 22 18:42:14 2004 +0000 @@ -28,6 +28,10 @@ use rbfdefs ENDC +* Sector Size +SECTSIZE equ 256 + + * Step Rate: * $00 = 6ms * $01 = @@ -48,14 +52,14 @@ mod eom,name,tylg,atrv,start,size -u0000 rmb 2 +drvsel rmb 1 buffptr rmb 2 currtrak rmb 1 -ddfmt rmb 1 +*ddfmt rmb 1 ddtks rmb 1 no. of sectors per track -u0007 rmb 1 +*ddtot rmb 1 dblsided rmb 1 -u0009 rmb 1 +side rmb 1 size equ . name fcs /Boot/ @@ -71,20 +75,19 @@ ldx #DPort+8 lda #$D0 sta ,x - lbsr L01AA + lbsr Delay2 delay a bit lda ,x lda #$FF - sta currtrak,u - leax >NMIRtn,pcr + sta currtrak,u set current track to 255 + leax >NMIRtn,pcr point to NMI routine IFGT Level-1 - stx D.XNMI+1 + stx >D.XNMI+1 save address lda #$7E sta >D.XNMI - lda #$08+BootDr permit alternate drives ENDC + lda #$08+BootDr permit alternate drives sta >DPort * delay loop @@ -106,66 +109,69 @@ subd #$0001 bne L003A -* search for a free page (to use as a 256 byte disk buffer) - pshs u,y,x,b,a - ldd #$0001 - os9 F$SRqMem - bcs L00AA - tfr u,d - ldu $06,s - std buffptr,u +* search for memory to use as a sector buffer + pshs u,y,x,b,a save regs + ldd #SECTSIZE get sector size in D + os9 F$SRqMem request that much memory + bcs L00AA branch if there is an error + tfr u,d move pointer to D temporarily + ldu $06,s restore U (saved earlier) + std buffptr,u save alloced mem pointer in statics clrb * go get LSN0 - ldx #$0000 - bsr ReadSect - bcs L00AA + ldx #$0000 we want LSN0 + bsr ReadSect go get it + bcs L00AA branch if error -* get bootfile size from LSN0 and allocate memory for it - ldd DD.TOT+1,y - std u0007,u +* From LSN0, we get various pieces of info. +* ldd DD.TOT+1,y +* std ddtot,u lda DPort+8 - ldb ,u + ldb drvsel,u * Notes on the next line: * The byte in question comes after telling the controller that it should -* read a sector. RegB is then loaded (ldb ,u) which means it is set to $29 +* read a sector. RegB is then loaded (ldb drvsel,u) which means it is set to $29 * (%00101001) or the default boot drive if sub L00B7 has been run. At this * point an orb #$30 or orb #%00110000 means that write precomp and double * density flags are or'd in. This does not make any sense at all for a @@ -226,18 +232,18 @@ * 09/02/03: Futher investigation shows that the OS-9 Level One Booter will * FAIL if orb #$28 is used. It does not fail if orb #$30 is used. ???? orb #$30 was $30 which RG thinks is an error - tst u0009,u + tst side,u beq L0107 orb #$40 L0107 stb >DPort - lbsr L01AA + lbsr Delay2 orb #$80 * lda #$02 *L0111 bita >DPort+8 * bne L0123 * leay -$01,y * bne L0111 -* lda ,u +* lda drvsel,u * sta >DPort * puls y * bra L0138 @@ -251,7 +257,7 @@ nop bra L0123 -NMIRtn leas R$Size,s +NMIRtn leas R$Size,s adjust stack puls y ldb >DPort+8 bitb #$04 @@ -260,20 +266,21 @@ ldb #E$Read rts -L013C lda #$08+BootDr permit alternate drives - sta ,u - clr u0009,u +L013C lda #$08+BootDr permit alternate drives + sta drvsel,u + clr side,u assume side 0 tfr x,d cmpd #$0000 beq L016C - clr ,-s + clr ,-s clear space on stack tst dblsided,u disk double sided? beq L0162 branch if not bra L0158 -L0152 com u0009,u +* Double-sided code +L0152 com side,u bne L0158 inc ,s -L0158 subb ddtks,u +L0158 subb ddtks,u sbca #$00 bcc L0152 bra L0168 @@ -304,33 +311,35 @@ bne L0138 clrb rts -L0195 bsr L01A8 +L0195 bsr Delay1 L0197 ldb >DPort+8 bitb #$01 bne L0197 rts -L019F lda ,u +L019F lda drvsel,u sta >DPort stb >DPort+$08 rts -L01A8 + +* Delay branches +Delay1 IFNE H6309 nop ENDC bsr L019F -L01AA +Delay2 IFNE H6309 nop nop ENDC - lbsr L01AD -L01AD + lbsr Delay3 +Delay3 IFNE H6309 nop nop ENDC - lbsr L01B0 -L01B0 + lbsr Delay4 +Delay4 IFNE H6309 nop ENDC