2020-05-09 19:08:20 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2MotorControl >PULLB MotorOn
|
|
|
|
|
>PULLB DrvSlt
|
|
|
|
|
jsr CheckDiskII
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
lda MotorOn
|
|
|
|
|
asl
|
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
lda #IO.D2.DrvOff
|
2020-05-09 19:08:20 +00:00
|
|
|
|
adc Slotn0
|
|
|
|
|
tax
|
|
|
|
|
lda $C000,x
|
|
|
|
|
|
2020-06-27 18:30:09 +00:00
|
|
|
|
clc
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2Recalibrate >PULLB DrvSlt
|
|
|
|
|
jsr CheckDiskII
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
ldx Slotn0
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda IO.D2.DrvOn,x
|
|
|
|
|
|
2020-06-17 19:05:36 +00:00
|
|
|
|
ldy #168
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
.1 lda IO.D2.Ph0Off,x
|
2020-06-17 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
dey
|
|
|
|
|
dey
|
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
tya
|
2020-06-11 21:04:56 +00:00
|
|
|
|
|
2020-06-13 19:27:06 +00:00
|
|
|
|
and #6
|
|
|
|
|
ora Slotn0
|
|
|
|
|
tax
|
|
|
|
|
lda IO.D2.Ph0On,x
|
|
|
|
|
|
2020-06-22 05:59:53 +00:00
|
|
|
|
lda #IO.D2.SeekTime
|
2020-06-13 19:27:06 +00:00
|
|
|
|
jsr D2.Wait100usecA
|
2020-06-17 19:05:36 +00:00
|
|
|
|
|
2020-06-27 18:30:09 +00:00
|
|
|
|
tya
|
2020-06-13 19:27:06 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2020-06-17 19:05:36 +00:00
|
|
|
|
jsr D2.Wait25600usec
|
|
|
|
|
|
2020-06-11 21:04:56 +00:00
|
|
|
|
ldx Slotn0
|
|
|
|
|
lda IO.D2.Ph0Off,x
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2MoveHead >PULLB MoveTo
|
|
|
|
|
>PULLB MoveFrom
|
|
|
|
|
>PULLB DrvSlt
|
|
|
|
|
jsr CheckDiskII
|
2020-05-28 21:13:52 +00:00
|
|
|
|
bcs .9
|
2020-06-05 19:26:34 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
jsr D2MoveHead.1
|
2020-06-26 19:34:12 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
|
|
|
|
|
2020-06-25 15:39:51 +00:00
|
|
|
|
D2MoveHead.1
|
|
|
|
|
.1 lda MoveFrom
|
|
|
|
|
pha
|
2020-05-28 21:13:52 +00:00
|
|
|
|
|
2020-07-06 12:03:05 +00:00
|
|
|
|
and #6
|
|
|
|
|
ora Slotn0
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
pha
|
|
|
|
|
inc
|
|
|
|
|
and #6
|
|
|
|
|
ora Slotn0
|
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
|
lda IO.D2.Ph0On,x
|
2020-07-13 19:29:31 +00:00
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-07-06 12:03:05 +00:00
|
|
|
|
lda IO.D2.Ph0On,y
|
2020-07-13 19:29:31 +00:00
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-07-06 12:03:05 +00:00
|
|
|
|
|
|
|
|
|
lda #IO.D2.SeekTime
|
|
|
|
|
jsr D2.Wait100usecA
|
2020-06-25 15:39:51 +00:00
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
cmp MoveTo
|
2020-07-13 19:29:31 +00:00
|
|
|
|
beq .7
|
2020-05-17 17:34:32 +00:00
|
|
|
|
|
2020-06-25 15:39:51 +00:00
|
|
|
|
bcs .2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-06-05 19:26:34 +00:00
|
|
|
|
* Current < Target, must move in
|
2020-06-25 15:39:51 +00:00
|
|
|
|
|
2020-06-05 19:26:34 +00:00
|
|
|
|
inc
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-06-25 15:39:51 +00:00
|
|
|
|
.HS B0 BCS
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-06-25 15:39:51 +00:00
|
|
|
|
* Current > Target, must move out
|
2020-05-26 14:23:09 +00:00
|
|
|
|
|
2020-06-25 15:39:51 +00:00
|
|
|
|
.2 dec
|
2020-06-17 19:05:36 +00:00
|
|
|
|
|
|
|
|
|
sta MoveFrom
|
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
jsr .8
|
2020-05-17 17:34:32 +00:00
|
|
|
|
bra .1
|
2020-06-27 18:30:09 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
.7 jsr D2.Wait25600usec
|
|
|
|
|
|
|
|
|
|
.8 lda IO.D2.Ph0Off,y
|
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-06-25 15:39:51 +00:00
|
|
|
|
lda IO.D2.Ph0Off,x
|
2020-07-13 19:29:31 +00:00
|
|
|
|
nop
|
|
|
|
|
nop
|
2020-06-25 15:39:51 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-06-09 13:40:21 +00:00
|
|
|
|
D2.Wait25600usec
|
|
|
|
|
lda #0
|
2020-05-12 15:17:25 +00:00
|
|
|
|
|
2020-06-29 05:49:24 +00:00
|
|
|
|
D2.Wait100usecA
|
2020-07-06 12:03:05 +00:00
|
|
|
|
phx (3)
|
|
|
|
|
|
2020-06-17 19:08:08 +00:00
|
|
|
|
.1 ldx #18 (2)
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-05-30 20:38:47 +00:00
|
|
|
|
.2 dex (2)
|
|
|
|
|
bne .2 (3)
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-06-05 19:26:34 +00:00
|
|
|
|
ldx Slotn0 (3)
|
2020-06-17 19:05:36 +00:00
|
|
|
|
bit IO.D2.DrvOn,x (4) Slow down ACC boards
|
2020-06-05 19:26:34 +00:00
|
|
|
|
|
2020-06-17 19:05:36 +00:00
|
|
|
|
sec (2)
|
2020-06-07 08:06:51 +00:00
|
|
|
|
sbc #1 (2)
|
|
|
|
|
bne .1 (3)
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-07-06 12:03:05 +00:00
|
|
|
|
plx (4)
|
|
|
|
|
|
2020-06-17 19:05:36 +00:00
|
|
|
|
rts (6)
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
2020-06-17 19:05:36 +00:00
|
|
|
|
* # D2TrkRead16s
|
|
|
|
|
* Write a track (16 sectors)
|
|
|
|
|
* PUSHB = DSSS0000
|
|
|
|
|
* PUSHB = TrackNum * 4 : 0->136+
|
|
|
|
|
* PUSHW = Ptr to 16*256 buffer
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC : success, A = VolNum
|
|
|
|
|
* CS : A = Error
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*\--------------------------------------
|
2020-06-17 19:05:36 +00:00
|
|
|
|
D2TrkRead16s >PULLW ZPPtr1
|
|
|
|
|
>PULLB TrkNum
|
|
|
|
|
>PULLB DrvSlt
|
|
|
|
|
|
|
|
|
|
jsr CheckDiskII
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lda VolNum
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # D2TrkWrite16s
|
|
|
|
|
* Write a track (16 sectors)
|
|
|
|
|
* PUSHB = DSSS0000
|
|
|
|
|
* PUSHB = TrackNum * 4 : 0->136+
|
|
|
|
|
* PUSHW = Ptr to 16*256 buffer
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC : success
|
|
|
|
|
* CS : A = Error
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2TrkWrite16s >PULLW ZPPtr1
|
|
|
|
|
>PULLB TrkNum
|
|
|
|
|
>PULLB VolNum
|
|
|
|
|
>PULLB DrvSlt
|
|
|
|
|
|
|
|
|
|
jsr CheckDiskII
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>LDYAI TRACK16.LEN+1
|
|
|
|
|
>SYSCALL2 getmem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr2
|
|
|
|
|
stx hTrkBuf
|
|
|
|
|
|
|
|
|
|
stz SectNum
|
|
|
|
|
|
|
|
|
|
ldy #TRACK16.GAP1
|
|
|
|
|
jsr PutSyncBytePtr2
|
|
|
|
|
|
|
|
|
|
.1 jsr PutAddrHeadPtr2
|
|
|
|
|
|
|
|
|
|
jsr HeaderCheckSum
|
|
|
|
|
|
|
|
|
|
ldy #3
|
|
|
|
|
|
|
|
|
|
.2 lda Checksum,y
|
|
|
|
|
jsr PutByte44Ptr2
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
jsr PutTailPtr2
|
|
|
|
|
|
|
|
|
|
ldy #TRACK16.GAP2
|
|
|
|
|
jsr PutSyncBytePtr2
|
|
|
|
|
|
|
|
|
|
jsr PutDataHeadPtr2
|
|
|
|
|
|
|
|
|
|
jsr PutData
|
|
|
|
|
|
|
|
|
|
jsr PutTailPtr2
|
|
|
|
|
ldy #TRACK16.GAP3
|
|
|
|
|
jsr PutSyncBytePtr2
|
|
|
|
|
|
|
|
|
|
inc ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
inc SectNum
|
|
|
|
|
lda SectNum
|
|
|
|
|
cmp #16
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr2)
|
|
|
|
|
|
|
|
|
|
jsr D2WriteTrackPtr2
|
|
|
|
|
php
|
|
|
|
|
pha
|
|
|
|
|
lda hTrkBuf
|
|
|
|
|
>SYSCALL2 FreeMem
|
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2TrkReadNIB
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # D2TrkWriteNIB
|
|
|
|
|
* Write a track (NIBBLE)
|
|
|
|
|
* **In:**
|
|
|
|
|
* PUSHB = DSSS0000
|
|
|
|
|
* PUSHW = Ptr to NIBBLE buffer (0 ended)
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC : success
|
|
|
|
|
* CS : A = Error
|
|
|
|
|
* A=0, currently starting/seeking...
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2TrkWriteNIB >PULLW ZPPtr1
|
|
|
|
|
>PULLB DrvSlt
|
|
|
|
|
|
|
|
|
|
jsr CheckDiskII was it a DISK II ?
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* A=DSSS0000
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
CheckDiskII pha
|
|
|
|
|
and #$70 only 0SSS
|
|
|
|
|
sta Slotn0
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
ora #$C0 make Cn
|
|
|
|
|
sta ZPPtr3+1
|
|
|
|
|
stz ZPPtr3
|
|
|
|
|
|
|
|
|
|
ldx #3 4 bytes to check
|
|
|
|
|
|
|
|
|
|
.1 ldy DiskII.OFS,x
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr3),y
|
|
|
|
|
cmp DiskII.SIG,x
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
pla all bytes match, Disk II
|
|
|
|
|
asl
|
|
|
|
|
lda #0
|
|
|
|
|
adc #IO.D2.DrvSel1
|
|
|
|
|
adc Slotn0
|
|
|
|
|
tax
|
|
|
|
|
lda $C000,x
|
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
lda #MLI.E.NODEV
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* A=DSSS0000
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DrvSpinCheck ldy #0
|
|
|
|
|
|
|
|
|
|
lda IO.D2.RData,x
|
|
|
|
|
.1 cmp IO.D2.RData,x
|
|
|
|
|
bne .8 spinning
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc CC:not spinning
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutSyncBytePtr2 lda #$7f
|
|
|
|
|
|
|
|
|
|
.1 jsr PutBytePtr2
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutAddrHeadPtr2 ldy #2
|
|
|
|
|
|
|
|
|
|
.1 lda ADDR.Head,y
|
|
|
|
|
jsr PutBytePtr2
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutDataHeadPtr2 ldy #2
|
|
|
|
|
|
|
|
|
|
.1 lda DATA.Head,y
|
|
|
|
|
jsr PutBytePtr2
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutTailPtr2 ldy #2
|
|
|
|
|
|
|
|
|
|
.1 lda TAIL,y
|
|
|
|
|
jsr PutBytePtr2
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
HeaderCheckSum lda VolNum
|
|
|
|
|
eor TrkNum
|
|
|
|
|
eor SectNum
|
|
|
|
|
|
|
|
|
|
sta Checksum
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutData stz Checksum
|
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
ldy ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
adc #86
|
|
|
|
|
bcc .1
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
clc
|
|
|
|
|
|
|
|
|
|
.1 sta ZPPtr3
|
|
|
|
|
sty ZPPtr3+1
|
|
|
|
|
|
|
|
|
|
adc #86
|
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
|
|
|
|
|
.2 sta ZPPtr4
|
|
|
|
|
sty ZPPtr4+1
|
|
|
|
|
|
|
|
|
|
ldy #85
|
|
|
|
|
|
|
|
|
|
.3 lda (ZPPtr1),y
|
|
|
|
|
and #3
|
|
|
|
|
tax
|
2020-05-12 15:17:25 +00:00
|
|
|
|
lda D2.XX000000,x
|
2020-05-09 19:08:20 +00:00
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
and #3
|
|
|
|
|
tax
|
|
|
|
|
pla
|
2020-05-12 15:17:25 +00:00
|
|
|
|
ora D2.00XX0000,x
|
2020-05-09 19:08:20 +00:00
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
lda (ZPPtr4),y
|
|
|
|
|
and #3
|
|
|
|
|
tax
|
|
|
|
|
pla
|
2020-05-12 15:17:25 +00:00
|
|
|
|
ora D2.0000XX00,x
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
tax
|
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
eor Checksum
|
|
|
|
|
sta Checksum
|
|
|
|
|
|
|
|
|
|
lda FC2Nib,x
|
|
|
|
|
|
|
|
|
|
jsr PutBytePtr2
|
|
|
|
|
dey
|
|
|
|
|
bpl .3
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
2020-05-10 16:03:51 +00:00
|
|
|
|
.4 lda (ZPPtr1),y
|
2020-05-09 19:08:20 +00:00
|
|
|
|
and #$FC
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
eor Checksum
|
|
|
|
|
sta Checksum
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
lda FC2Nib,x
|
2020-07-13 19:29:31 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
jsr PutBytePtr2
|
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
ldx Checksum
|
|
|
|
|
lda FC2Nib,x
|
|
|
|
|
jsr PutBytePtr2
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutByte44Ptr2 pha
|
|
|
|
|
ror
|
|
|
|
|
jsr .1
|
|
|
|
|
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
.1 ora #$AA
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
PutBytePtr2 sta (ZPPtr2)
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .8
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
D2WriteTrackPtr2
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
ldy #TrkWriter.Size
|
|
|
|
|
|
|
|
|
|
.1 lda TrkWriter-1,y
|
|
|
|
|
sta $1ff,y
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
lda hTrkBuf
|
|
|
|
|
>SYSCALL2 GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
ldx Slotn0
|
|
|
|
|
|
|
|
|
|
jsr $200
|
|
|
|
|
|
2020-05-25 14:01:28 +00:00
|
|
|
|
cli
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-05-26 14:23:09 +00:00
|
|
|
|
SAVE usr/src/lib/libblkdev.s.d2
|
|
|
|
|
LOAD usr/src/lib/libblkdev.s
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ASM
|