home *** CD-ROM | disk | FTP | other *** search
- ****************************************
- *A0 LOAD addr
- *A1 DISK buffer
- *d0 start trk
- *d1 nrs to read
- **********************
- * OK D0 = 0
- * ERROR D0 = -1
- **********************
-
- ;first 3,7 $60000
- ;next 10,$2c $800
-
- org $70000
- load $70000
- j: move.l #3,d0 ;START track
- move.l #41,d1 ;HOW many
- move.w #0,d2 ;SIDE 0,1 (0 or 1 in D2)
- lea $c80000,a0
- lea $75000,a1
- bsr LOADdata
- rts
-
- LOADdata:
- CLR.W drive
- ST track
- move.W d2,side
- lea $dff000,a6
- move.w #$7fff,$9a(a6)
- move.w #$7fff,$96(a6)
- MOVE.W #$8210,$96(a6)
- move.l a1,DISKbuffer
- bsr C148
- bmi.s notok
- moveq #0,d0
- bra.s ok
- notok: moveq #-1,d0
- ok: move.w #$87f0,$96(a6)
- move.w #$e02c,$9a(a6)
- rts
-
-
- driveside: dc.w 0
- drive: dc.w 0
- track: dc.w 0
- side: dc.w 0
- RETRY: dc.w 0
- DISKbuffer: dc.l 0
-
-
- C05C: LEA $0BFD000,A4
- MOVE.L #$55555555,D5
- MOVE.W drive,D2
- MOVEQ #0,D3
- ADD.W #3,D2
- BSET D2,D3
- MOVE.W side,D2
- BEQ.S C07E
- BSET #2,D3
- C07E: MOVE.B D3,driveside
- MOVE.B #$FF,$100(A4)
- MOVE.B #$7F,$100(A4)
- OR.B #$80,D3
- NOT.B D3
- MOVE.B D3,$100(A4)
- MOVE.W #$C000,D2
- C09C: MOVE.W D2,D4
- MULU D4,D4
- MULU D4,D4
- BTST #5,$1001(A4)
- DBEQ D2,C09C
- BNE C1EE
- MOVEQ #0,D4
- RTS
- C0B4: MOVE.B #$FF,$100(A4)
- MOVE.B #$BF,$100(A4)
- MOVE.B #$DF,$100(A4)
- MOVE.B #$EF,$100(A4)
- MOVE.B #$F7,$100(A4)
- MOVE.B #$FF,$100(A4)
- RTS
- C0DA: BTST #4,$1001(A4)
- BEQ.S C0EA
- MOVEQ #1,D0
- BSR C10A
- BRA.S C0DA
- C0EA: CLR.W track
- RTS
- C0F0: MOVE.W D0,D6
- TST.W track
- BPL.S C0FA
- BSR.S C0DA
- C0FA: SUB.W track,D6
- BEQ.S C146
- ADD.W D6,track
- MOVE.W D6,D0
- BPL.S C114
- NEG.W D0
- C10A: MOVE.B driveside,D1
- OR.B #$80,D1
- BRA.S C11C
- C114: MOVE.B driveside,D1
- OR.B #$82,D1
- C11C: MOVE.B D1,D2
- OR.B #1,D2
- NOT.B D1
- NOT.B D2
- SUBQ.W #1,D0
- C128: MOVE.B D2,$100(A4)
- NOP
- NOP
- C134: MOVE.B D1,$100(A4)
- MOVE.W #$208,D3
- C13C: MULU D4,D4
- DBRA D3,C13C
- DBRA D0,C128
- C146: RTS
- C148: SUBQ.W #1,D1
- BMI.S C17C
- BSR C05C
- BMI.S C17E
- C152: MOVE.W #4,RETRY
- C158: MOVEM.W D0/D1,-(SP)
- MOVE.L A0,-(SP)
- BSR.S C0F0
- BSR C19A
- BMI.S C186
- MOVE.L A0,A5
- BSR C1F2
- BMI.S C186
- MOVE.L A5,A0
- ADDQ.W #4,SP
- MOVEM.W (SP)+,D0/D1
- ADDQ.W #1,D0
- DBRA D1,C152
- C17C: MOVEQ #0,D4
- C17E: BSR C0B4
- TST.W D4
- RTS
- C186: MOVE.L (SP)+,A0
- MOVEM.W (SP)+,D0/D1
- SUBQ.W #1,RETRY
- BMI.S C17E
- BNE.S C158
- ST track
- BRA.S C158
-
- C19A: MOVE.W #$4000,$024(A6)
- MOVE.L DISKbuffer(PC),$020(A6)
- MOVE.l #$27f00,$09C(A6)
- MOVE.W #$9500,$09E(A6)
- MOVE.W #$4489,$07E(A6)
- MOVE.W #$9960,$024(A6)
- MOVE.W #$9960,$024(A6)
- MOVEQ #-1,D0
- C1CE: MULU D4,D4
- MOVE.W $01E(A6),D4
- AND.W #2,D4
- DBNE D0,C1CE
- BEQ.S C1E8
- MOVE.W #$4000,$024(A6)
- MOVEQ #0,D4
- RTS
- C1E8: MOVE.W #$4000,$024(A6)
- C1EE: MOVEQ #-1,D4
- RTS
- C1F2:
- ***************
- * MFM converter
- ***************
- move.l DISKbuffer(PC),a2
- moveq #10,d0
- decode_loop1: cmp.w #$4489,(a2)+
- bne.s decode_loop1
- cmp.w #$4489,(a2)+
- beq.s cont
- subq.w #2,a2
- cont: move.w #$ff,d1
- bsr Checksum
- bne.s Error
- bsr chkSEC
- bne.s Error
- lea $38(a2),a2
- moveq #$7f,d1
- decode_loop2: move.l 512(a2),d7
- move.l (a2)+,d2
- bsr convbit
- move.l d2,(a0)+
- dbf d1,decode_loop2
- noconv: lea $1f8(a2),a2
- dbf d0,decode_loop1
- add.w #$1600,a5
- moveq #0,d4
- uji: tst.l d4
- rts
- error: moveq #-1,d4
- bra.s uji
- checksum: lea $30(a2),a0
- movem.l (A0)+,d2/d7
- bsr convbit
- moveq #0,d6
- checksum_loop: move.l (a0)+,d7
- eor.l d7,d6
- dbf d1,checksum_loop
- and.l d5,d6
- cmp.l d2,d6
- rts
- chkSec: movem.l (a2),d2/d7
- bsr convbit
- and.w #$ff00,d2
- add.w d2,d2
- move.l a5,a0
- add.w d2,a0
- swap d2
- MOVE.W track(PC),D1
- ADD.W D1,D1
- MOVE.W side(PC),D7
- and.w #1,d7
- ADD.W d7,D1
- cmp.b d2,d1
- rts
- convbit: and.l d5,d2
- and.l d5,d7
- asl.l #1,d2
- or.l d7,d2
- rts
- j1:
-