home *** CD-ROM | disk | FTP | other *** search
-
- J
-
- MOVE.W #$4000,$DFF09A
- BSR.S READTRACKS
- MOVE.W #$E02C,$DFF09A
- RTS
-
- READTRACKS
- LB_0000 MOVEM.L D0-A6,-(A7)
- LEA $00DFF000,A6
- LEA $00BFD100,A4
- LEA LB_0226(PC),A2 ; Track counter
- LEA $00160000,A1 ; BUFFER
- MOVE.L #$0000,D0 ; START SECTOR
- MOVE.L #$0400,D1 ; LENGHT
- MOVE.L #$170000,A0 ; DATA AREA
- MOVE.L A0,A5 ; load addr to a5
- ADDA.L D1,A5 ; add length to load addr
- MOVE.B #$7D,(A4) ; Activate drive
- BCLR #$03,(A4) ; Select drive 0
- BSR.B LB_007E ; wait
- CLR.L D4 ; clr d4
- DIVU.W #$1600,D0 ; d0 = Start
- SWAP D0
- MOVE.W D0,D4
- SWAP D0
- BSR.W LB_012C ; finds the desired start track
- MOVEQ #$05,D5 ; number of retryes
-
- LB_0044 BSR.B LB_0088 ; Read track
- BNE.B LB_006C ; Failed?
- BSR.W LB_0174 ; Decode
- BNE.B LB_006C ; Failed?
- CMPA.L A0,A5 ; Reading done?
- BLE.B LB_0058 ; if so return!
- BSR.W LB_00FE ; goto next track
- BRA.B LB_0044 ; read again
-
- LB_0058 MOVE.B #$FD,(A4) ; return to game!
- BCLR #$03,(A4)
- BSET #$03,(A4)
- BSR.B LB_007E ; wait for drive
- MOVEM.L (A7)+,D0-A6
- RTS ; back to game
-
- LB_006C SUBQ.L #1,D5 ; Fail !
- BNE.B LB_0044 ; try again (5 times!)
- LB_0070 MOVE.W D0,$0180(A6) ; FAIL! failed 5 times!
- ADDQ.L #1,D0
- BRA.B LB_0070
-
- ;--------------------------Wait rutines!------------------------------------
- LB_0078 MOVE.W #$1600,D1
- BRA.B LB_0082
- LB_007E MOVE.W #$3000,D1
- LB_0082 DBF D1,LB_0082
- RTS
- ;-----------------------------Read rutine!--------------------------
- LB_0088 CLR.L D0
- MOVE.L A1,$0020(A6)
- MOVE.W #$8210,$0096(A6)
- MOVE.W #$7F00,$009E(A6)
- MOVE.W #$9500,$009E(A6)
- MOVE.W #$4000,$0024(A6)
- MOVE.W #$4489,$007E(A6)
- LB_00AC BTST #$05,$0F01(A4)
- BNE.B LB_00AC
- MOVE.W #$9980,D1
- MOVE.W D1,$0024(A6)
- MOVE.W D1,$0024(A6)
- MOVE.L #$00025000,D2
- MOVE.W #$0002,$009C(A6)
- LB_00CC BTST #$01,$001F(A6)
- BNE.B LB_00DA
- SUBQ.L #1,D2
- BNE.B LB_00CC
- MOVEQ #-$01,D0
- LB_00DA TST.L D0
- RTS
-
- ;-------------------Wait for Drive rutine!-----------------------
- LB_00DE BTST #$05,$0F01(A4) ; Drive ready to receive commands?
- BNE.B LB_00DE ; of not!
- RTS ; return
-
-
- ;---------------Get Track zero rutine!------------------------
- LB_00E8 BTST #$04,$0F01(A4) ; Track zero?
- BEQ.B LB_00FA ; yes!
- BSET #$01,(A4) ; not! saet step direction udaf
- BSR.B LB_011A ; step!
- BSR.B LB_00DE ; wait for drive to be ready
- BRA.B LB_00E8 ; Check again!
- LB_00FA CLR.B (A2)
- RTS
-
-
- ;------------------------Jump to next track rutine-------------
- LB_00FE ADDQ.B #1,(A2) ; Add 1 to track count!
- MOVE.B (A2),D1 ;
- BTST #$00,D1 ;Change side?
- BNE.B LB_0110 ;if not equal change!
- BCLR #$01,(A4) ;step direction out
- BSR.B LB_011A ; do step
- BSR.B LB_00DE ; wait for drive
- LB_0110 BCHG #$02,(A4) ; Change side
- BSR.W LB_007E ; big wait
- RTS
-
- ;--------------------- Main step routine! --------------------
- LB_011A BCLR #$00,(A4) ; Step in desired direction
- NOP ; ---
- NOP ; ---
- BSET #$00,(A4) ; ---
- BSR.W LB_0078 ; Wait!
- BRA.B LB_00DE ; Wait for drive ready and return
-
- ;----------------Find step direction & step until desired track---------------
- LB_012C MOVEM.L D1/D2,-(A7)
- CMPI.B #$FF,(A2) ; on track zero?
- BNE.B LB_0138 ; if yes! go-on
- BSR.B LB_00E8 ; get Track zero
- LB_0138 CLR.L D1
- CLR.L D2
- MOVE.B (A2),D1 ; move zero indicator to d1
- MOVE.B D0,D2 ; Select side
- BSET #$02,(A4) ; set side 0 (undersiden)
- BTST #$00,D0 ; wich side?
- BEQ.B LB_014E ; if equal side 0
- BCLR #$02,(A4) ; set side 1 (oversiden)
- LB_014E LSR.W #1,D2
- LSR.W #1,D1
- SUB.W D1,D2
- BCS.B LB_0160 ; if lower then step in!
- BHI.B LB_015A ; if higher then step out
- BRA.B LB_016C ; Same!
-
- LB_015A BCLR #$01,(A4) ; set step direction out!
- BRA.B LB_0166
-
- LB_0160 NEG.W D2 ; set step direction in!
- BSET #$01,(A4)
-
- LB_0166 BSR.B LB_011A ; step
- SUBQ.W #1,D2
- BNE.B LB_0166 ; if not on track then step again
- LB_016C MOVE.B D0,(A2) ; save track count
- MOVEM.L (A7)+,D1/D2
- RTS
-
- ;-----------------------The decode rutine!-------------------------------
- LB_0174 MOVEM.L A1-A6,-(A7)
- MOVE.L A0,A2
- MOVE.L A0,A3
- ADDA.L D4,A3
- MOVE.L A0,A4
- CMPI.W #$4489,(A1)
- BNE.B LB_01D8
- MOVEQ #$0A,D5
- LB_0188 BSR.W LB_01DE
- MOVEQ #$7F,D6
- LB_018E MOVE.L $0200(A1),D1
- MOVE.L (A1)+,D0
- EOR.L D0,D2
- EOR.L D1,D2
- BSR.W LB_0214
- CMPA.L A3,A2
- BGE.B LB_01A4
- ADDQ.L #4,A2
- BRA.B LB_01B0
- LB_01A4 MOVE.L A2,A6
- ADDQ.L #4,A2
- SUBA.L D4,A6
- CMPA.L A5,A6
- BGE.B LB_01B0
- MOVE.L D0,(A6)+
- LB_01B0 DBF D6,LB_018E
- ANDI.L #$55555555,D2
- CMP.L D2,D7
- BNE.B LB_01D8
- DBF D5,LB_0188
- MOVE.L #$00001600,D0
- SUB.L D4,D0
- ADDA.L D0,A0
- CLR.L D0
- CLR.L D4
- LB_01D0 MOVEM.L (A7)+,A1-A6
- TST.L D0
- RTS
- LB_01D8 MOVE.L A4,A0
- MOVEQ #-$01,D0
- BRA.B LB_01D0
- LB_01DE MOVE.W #$4489,D1
- LB_01E2 CMP.W (A1)+,D1
- BNE.B LB_01E2
- CMP.W (A1),D1
- BNE.B LB_01EC
- ADDQ.L #2,A1
- LB_01EC MOVE.L $0030(A1),D0
- MOVE.L $0034(A1),D1
- BSR.W LB_0214
- MOVE.L D0,D7
- MOVE.L (A1),D0
- MOVE.L $0004(A1),D1
- BSR.B LB_0214
- LSR.W #8,D0
- LEA $0038(A1),A1
- ADD.W D0,D0
- ASL.W #8,D0
- LEA $00(A4,D0.W),A2
- CLR.L D2
- RTS
-
- LB_0214 ASL.L #1,D0
- ANDI.L #$AAAAAAAA,D0
- ANDI.L #$55555555,D1
- OR.L D1,D0
- RTS
-
- LB_0226 DC.B -1 ; Track zero indicator $FF=NOP
-