2020-05-09 19:08:20 +00:00
|
|
|
|
NEW
|
|
|
|
|
AUTO 3,1
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.MotorControl >PULLB D2.MotorOn
|
|
|
|
|
>PULLB D2.DrvSlt
|
|
|
|
|
jsr D2.CheckDiskII
|
2020-05-09 19:08:20 +00:00
|
|
|
|
bcs .9
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
lda D2.MotorOn
|
2020-05-09 19:08:20 +00:00
|
|
|
|
asl
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
lda #IO.D2.DrvOff
|
2021-03-26 17:30:56 +00:00
|
|
|
|
adc D2.Slotn0
|
2020-05-09 19:08:20 +00:00
|
|
|
|
tax
|
|
|
|
|
lda $C000,x
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-06-27 18:30:09 +00:00
|
|
|
|
clc
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.Recalibrate >PULLB D2.DrvSlt
|
|
|
|
|
jsr D2.CheckDiskII
|
2020-05-28 21:13:52 +00:00
|
|
|
|
bcs .9
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
ldy D2.Slotn0
|
2021-02-17 16:15:43 +00:00
|
|
|
|
lda IO.D2.Ph0On,y
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
|
|
|
|
lda #IO.D2.SeekTimeR
|
|
|
|
|
jsr D2.Wait100usecA
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda #160 40 x 4 Qtracks
|
|
|
|
|
|
|
|
|
|
php
|
|
|
|
|
sei
|
2022-06-22 06:26:44 +00:00
|
|
|
|
|
2021-02-17 16:15:43 +00:00
|
|
|
|
.1 dec
|
|
|
|
|
dec
|
|
|
|
|
|
|
|
|
|
pha
|
|
|
|
|
|
|
|
|
|
phy
|
|
|
|
|
plx
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jsr D2.SeekPhOnY
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-09-11 15:01:48 +00:00
|
|
|
|
lda #IO.D2.SeekTimeR
|
2020-07-26 19:16:13 +00:00
|
|
|
|
jsr D2.Wait100usecA
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2021-02-17 16:15:43 +00:00
|
|
|
|
lda IO.D2.Ph0Off,x
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-02-17 16:15:43 +00:00
|
|
|
|
lda #IO.D2.SeekTimeR
|
|
|
|
|
jsr D2.Wait100usecA
|
2020-06-22 05:59:53 +00:00
|
|
|
|
|
2021-02-17 16:15:43 +00:00
|
|
|
|
pla
|
|
|
|
|
bne .1
|
2021-02-20 10:18:02 +00:00
|
|
|
|
|
2020-09-11 15:01:48 +00:00
|
|
|
|
jsr D2.Wait25600usec
|
|
|
|
|
|
2021-02-17 16:15:43 +00:00
|
|
|
|
lda IO.D2.Ph0Off,y
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
plp
|
2023-06-02 20:31:09 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
* clc
|
2023-06-02 20:31:09 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
jmp D2.Wait25600usec
|
2021-04-08 20:30:18 +00:00
|
|
|
|
|
2020-05-28 21:13:52 +00:00
|
|
|
|
.9 rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
2022-05-25 18:46:02 +00:00
|
|
|
|
D2.HeadSelect >PULLB D2.HeadNum
|
|
|
|
|
>PULLB D2.DrvSlt
|
|
|
|
|
|
|
|
|
|
jsr D2.CheckDiskII
|
|
|
|
|
bcs .9
|
2022-06-12 20:42:22 +00:00
|
|
|
|
|
2022-05-25 18:46:02 +00:00
|
|
|
|
lda D2.HeadNum A = 0/1
|
|
|
|
|
|
|
|
|
|
asl A = 0/2
|
|
|
|
|
|
|
|
|
|
ora D2.Slotn0
|
|
|
|
|
tax x=n0/n2
|
|
|
|
|
|
|
|
|
|
lda IO.D2.Ph0On,x
|
|
|
|
|
lda IO.D2.Ph0On+4,x
|
|
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
|
jsr D2.Wait100usecA
|
|
|
|
|
|
|
|
|
|
lda IO.D2.Ph0Off,x
|
|
|
|
|
lda IO.D2.Ph0Off+4,x
|
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.MoveHead >PULLB D2.TargetQTrack
|
|
|
|
|
>PULLB D2.CurrentQTrack
|
|
|
|
|
>PULLB D2.DrvSlt
|
|
|
|
|
jsr D2.CheckDiskII
|
2022-09-04 20:12:49 +00:00
|
|
|
|
bcs .99
|
2020-06-05 19:26:34 +00:00
|
|
|
|
|
2020-11-19 15:34:02 +00:00
|
|
|
|
php
|
|
|
|
|
sei
|
2020-07-25 07:05:25 +00:00
|
|
|
|
|
2022-09-04 20:12:49 +00:00
|
|
|
|
lda D2.CurrentQTrack
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bit #1 A = Current QT
|
2022-06-12 20:42:22 +00:00
|
|
|
|
beq .2 we are on 0/4 or 2/4 track
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
pha
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
cmp D2.TargetQTrack we are on 1/4 or 3/4 track
|
|
|
|
|
bcc .1 if CC, C < T, must move in
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
inc move out: X = Ph(N+1)
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2022-06-18 06:16:39 +00:00
|
|
|
|
.1 jsr D2.SeekPhOnY move in : X = Ph(N)
|
|
|
|
|
|
|
|
|
|
tya
|
2022-06-12 20:42:22 +00:00
|
|
|
|
tax
|
2020-05-17 17:34:32 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
pla
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
bcs .2 if CS, C > T, must move out
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
inc move in : Y = Ph(N+1)
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2022-06-12 20:42:22 +00:00
|
|
|
|
.2 jsr D2.SeekPhOnY move out: Y = Ph(N)
|
2020-05-26 14:23:09 +00:00
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
bra .9 Ph ON to go to 0/4 or 2/4, no wait
|
2021-03-26 17:30:56 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.3 bcs .4 if CS, C > T, must move out
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
inc CC: C < T, ON next PH
|
2020-06-17 19:05:36 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.HS B0 BCS
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.4 dec CS: C > T, ON prev PH
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
sta D2.CurrentQTrack
|
2020-09-28 15:43:38 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
bit #1
|
2021-04-08 20:30:18 +00:00
|
|
|
|
bne .5
|
2020-09-13 19:05:38 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
lda IO.D2.Ph0Off,x we must go to 0/4 or 2/4 : Off Prev Ph
|
|
|
|
|
bra .8 go wait....
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.5 phy we must go on 1/4 or 3/4
|
|
|
|
|
plx Y already ON, -> X for Ph0Off,x
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
bcs .6 if CS, C > T, must move out
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
inc CC: C < T, ON next PH
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2021-04-08 20:30:18 +00:00
|
|
|
|
.6 jsr D2.SeekPhOnY now X and Y on
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.8 lda #IO.D2.SeekTimeF
|
2022-08-20 14:37:37 +00:00
|
|
|
|
|
2021-06-22 18:59:02 +00:00
|
|
|
|
jsr D2.Wait100usecA ...wait...
|
2021-02-20 10:18:02 +00:00
|
|
|
|
|
2021-06-22 18:59:02 +00:00
|
|
|
|
.9 lda D2.CurrentQTrack
|
2021-03-26 17:30:56 +00:00
|
|
|
|
cmp D2.TargetQTrack
|
|
|
|
|
bne .3
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
* lsr CS if X,Y on
|
2021-06-22 18:59:02 +00:00
|
|
|
|
|
2021-02-11 22:08:22 +00:00
|
|
|
|
jsr D2.Wait25600usec
|
2021-04-15 14:03:04 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
ldy D2.Slotn0
|
2022-08-20 14:37:37 +00:00
|
|
|
|
lda IO.D2.Ph0Off,y
|
2023-06-02 20:31:09 +00:00
|
|
|
|
lda IO.D2.Ph0Off+2,y
|
2023-05-16 16:53:52 +00:00
|
|
|
|
lda IO.D2.Ph0Off+4,y
|
2023-06-02 20:31:09 +00:00
|
|
|
|
lda IO.D2.Ph0Off+6,y
|
2023-05-16 16:53:52 +00:00
|
|
|
|
|
|
|
|
|
* lda IO.D2.Ph0Off,y
|
2023-06-02 20:31:09 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
* bcc .10
|
2023-06-02 20:31:09 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
* lda IO.D2.Ph0Off,x
|
|
|
|
|
* clc
|
|
|
|
|
* lda IO.D2.Ph0Off,y
|
2023-06-02 20:31:09 +00:00
|
|
|
|
|
2023-05-16 16:53:52 +00:00
|
|
|
|
*.10 jsr D2.Wait25600usec
|
2022-09-04 20:12:49 +00:00
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
.99 rts
|
2021-06-23 17:43:04 +00:00
|
|
|
|
*--------------------------------------
|
2021-04-08 20:30:18 +00:00
|
|
|
|
D2.SeekPhOnY and #6
|
2021-03-26 17:30:56 +00:00
|
|
|
|
ora D2.Slotn0
|
|
|
|
|
tay
|
|
|
|
|
lda IO.D2.Ph0On,y
|
2020-11-19 15:34:02 +00:00
|
|
|
|
rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
2022-05-25 18:46:02 +00:00
|
|
|
|
* # D2TrkFmt16s
|
|
|
|
|
* Write a track (16 sectors)
|
|
|
|
|
* PUSHB DSSS0000
|
|
|
|
|
* PUSHB VolNum
|
|
|
|
|
* PUSHB HeadNum (0,1)
|
|
|
|
|
* PUSHB TrackNum
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC : success
|
|
|
|
|
* CS : A = Error
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
D2.TrkFmt16s >PULLB D2.TrkNum
|
|
|
|
|
>PULLB D2.VolNum
|
|
|
|
|
>PULLB D2.DrvSlt
|
|
|
|
|
|
|
|
|
|
jsr D2.CheckDiskII
|
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
php
|
|
|
|
|
sei
|
|
|
|
|
|
|
|
|
|
lda D2.VolNum
|
|
|
|
|
sta X.TRKFMT.VolNum
|
|
|
|
|
|
|
|
|
|
lda D2.TrkNum
|
|
|
|
|
sta X.TRKFMT.TrkNum
|
|
|
|
|
|
|
|
|
|
ldy #D2.TrkFormat.Size
|
|
|
|
|
|
|
|
|
|
.1 lda D2.TrkFormat-1,y
|
|
|
|
|
sta $1ff,y
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
ldx D2.Slotn0
|
|
|
|
|
lda IO.D2.ReadProt,x
|
|
|
|
|
lda IO.D2.ReadMode,x
|
|
|
|
|
bmi .9 Write protected
|
|
|
|
|
|
|
|
|
|
jsr $200
|
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 lda #MLI.E.WRTPROT
|
|
|
|
|
|
|
|
|
|
plp
|
|
|
|
|
sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*/--------------------------------------
|
2020-06-17 19:05:36 +00:00
|
|
|
|
* # D2TrkRead16s
|
|
|
|
|
* Write a track (16 sectors)
|
2022-05-25 18:46:02 +00:00
|
|
|
|
* PUSHB DSSS0000
|
|
|
|
|
* PUSHB TrackNum
|
|
|
|
|
* PUSHW Ptr to 16*256 buffer
|
2020-06-17 19:05:36 +00:00
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC : success, A = VolNum
|
|
|
|
|
* CS : A = Error
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.TrkRead16s >PULLW ZPPtr1
|
|
|
|
|
>PULLB D2.TrkNum
|
|
|
|
|
>PULLB D2.DrvSlt
|
2020-06-17 19:05:36 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.CheckDiskII
|
2020-06-17 19:05:36 +00:00
|
|
|
|
bcs .9
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
lda D2.VolNum
|
2020-06-17 19:05:36 +00:00
|
|
|
|
clc
|
2021-02-20 10:18:02 +00:00
|
|
|
|
.9
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.TrkRead16s.RTS
|
2021-02-20 10:18:02 +00:00
|
|
|
|
rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # D2TrkWrite16s
|
|
|
|
|
* Write a track (16 sectors)
|
2022-05-25 18:46:02 +00:00
|
|
|
|
* PUSHB DSSS0000
|
|
|
|
|
* PUSHB VolNum
|
|
|
|
|
* PUSHB TrackNum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
* PUSHW = Ptr to 16*256 buffer
|
|
|
|
|
* ## RETURN VALUE
|
|
|
|
|
* CC : success
|
|
|
|
|
* CS : A = Error
|
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.TrkWrite16s >PULLW ZPPtr1
|
|
|
|
|
>PULLB D2.TrkNum
|
|
|
|
|
>PULLB D2.VolNum
|
|
|
|
|
>PULLB D2.DrvSlt
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.CheckDiskII
|
|
|
|
|
bcs D2.TrkRead16s.RTS
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
|
|
|
|
>LDYAI TRACK16.LEN+256+1
|
2020-08-23 19:46:37 +00:00
|
|
|
|
>SYSCALL2 GetMem
|
2021-03-26 17:30:56 +00:00
|
|
|
|
bcs D2.TrkRead16s.RTS
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
>STYA ZPPtr2
|
2021-03-26 17:30:56 +00:00
|
|
|
|
stx D2.hTrkBuf
|
|
|
|
|
|
|
|
|
|
stz D2.SectNum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2021-01-12 21:14:13 +00:00
|
|
|
|
ldy #0 put 256 FF sync bytes for slooooow drives
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutSyncBytePtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldy #TRACK16.GAP1
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutSyncBytePtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.1 jsr D2.PutAddrHeadPtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.HeaderCheckSum
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldy #3
|
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.2 lda D2.Checksum,y
|
|
|
|
|
jsr D2.PutByte44Ptr2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutTailPtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldy #TRACK16.GAP2
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutSyncBytePtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutDataHeadPtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda ZPPtr1+1
|
|
|
|
|
bne .7
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
ldy #$57
|
|
|
|
|
ldx #2
|
|
|
|
|
lda #$96
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
.3 sta (ZPPtr2)
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .4
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
|
|
|
|
|
.4 dey
|
|
|
|
|
bne .3
|
|
|
|
|
dex
|
|
|
|
|
bne .3
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
bra .8
|
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.7 jsr D2.PutData
|
2021-03-11 21:40:55 +00:00
|
|
|
|
inc ZPPtr1+1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.8 jsr D2.PutTailPtr2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldy #TRACK16.GAP3
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutSyncBytePtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
inc D2.SectNum
|
|
|
|
|
lda D2.SectNum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
cmp #16
|
|
|
|
|
bne .1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
lda #0
|
|
|
|
|
sta (ZPPtr2)
|
2021-06-11 17:20:35 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.HeadSelect
|
2021-02-20 10:18:02 +00:00
|
|
|
|
|
2022-05-25 18:46:02 +00:00
|
|
|
|
jsr D2.WriteTrackPtr2
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
php
|
|
|
|
|
pha
|
2021-03-26 17:30:56 +00:00
|
|
|
|
lda D2.hTrkBuf
|
2020-05-09 19:08:20 +00:00
|
|
|
|
>SYSCALL2 FreeMem
|
|
|
|
|
pla
|
|
|
|
|
plp
|
|
|
|
|
|
2021-02-20 10:18:02 +00:00
|
|
|
|
rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.TrkReadNIB
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* # 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...
|
|
|
|
|
*\--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.TrkWriteNIB >PULLW ZPPtr1
|
|
|
|
|
>PULLB D2.DrvSlt
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.CheckDiskII was it a DISK II ?
|
2022-05-25 18:46:02 +00:00
|
|
|
|
bcs .99
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2022-05-25 18:46:02 +00:00
|
|
|
|
.99 rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* A=DSSS0000
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.CheckDiskII pha
|
2020-05-09 19:08:20 +00:00
|
|
|
|
and #$70 only 0SSS
|
2021-03-26 17:30:56 +00:00
|
|
|
|
sta D2.Slotn0
|
2020-05-09 19:08:20 +00:00
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
ora #$C0 make Cn
|
|
|
|
|
sta ZPPtr3+1
|
|
|
|
|
stz ZPPtr3
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldx #3 4 bytes to check
|
|
|
|
|
|
|
|
|
|
.1 ldy DiskII.OFS,x
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr3),y
|
|
|
|
|
cmp DiskII.SIG,x
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bpl .1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
pla all bytes match, Disk II
|
|
|
|
|
asl
|
|
|
|
|
lda #0
|
|
|
|
|
adc #IO.D2.DrvSel1
|
2021-03-26 17:30:56 +00:00
|
|
|
|
adc D2.Slotn0
|
2020-05-09 19:08:20 +00:00
|
|
|
|
tax
|
|
|
|
|
lda $C000,x
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
ldx D2.Slotn0
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
|
|
|
|
lda IO.D2.ReadMode,x
|
|
|
|
|
lda IO.D2.RData,x
|
|
|
|
|
|
2021-01-24 19:44:43 +00:00
|
|
|
|
clc
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 pla
|
|
|
|
|
lda #MLI.E.NODEV
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* A=DSSS0000
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.DrvSpinCheck ldy #0
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
|
|
|
|
lda IO.D2.RData,x
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2021-01-12 21:14:13 +00:00
|
|
|
|
.1 pha
|
|
|
|
|
pla
|
|
|
|
|
|
|
|
|
|
cmp IO.D2.RData,x
|
2020-05-09 19:08:20 +00:00
|
|
|
|
bne .8 spinning
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc CC:not spinning
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.8 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-02-20 10:18:02 +00:00
|
|
|
|
D2.Wait25600usec
|
|
|
|
|
lda #0
|
|
|
|
|
|
|
|
|
|
D2.Wait100usecA phx
|
|
|
|
|
|
2022-08-20 14:37:37 +00:00
|
|
|
|
.1 ldx #19 (2)
|
2021-02-20 10:18:02 +00:00
|
|
|
|
|
|
|
|
|
.2 dex (2)
|
|
|
|
|
bne .2 (3)
|
|
|
|
|
|
|
|
|
|
dec (2)
|
|
|
|
|
bne .1 (3)
|
|
|
|
|
|
|
|
|
|
plx
|
|
|
|
|
|
|
|
|
|
rts (6)
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutSyncBytePtr2
|
|
|
|
|
lda #$7f
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2021-04-15 14:03:04 +00:00
|
|
|
|
.1 sta (ZPPtr2)
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
|
|
|
|
|
.2 dey
|
2020-05-09 19:08:20 +00:00
|
|
|
|
bne .1
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutAddrHeadPtr2
|
|
|
|
|
ldy #2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
|
|
|
|
.1 lda ADDR.Head,y
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutBytePtr2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutDataHeadPtr2
|
|
|
|
|
ldy #2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
|
|
|
|
.1 lda DATA.Head,y
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutBytePtr2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutTailPtr2 ldy #2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
|
|
|
|
.1 lda TAIL,y
|
2021-03-26 17:30:56 +00:00
|
|
|
|
jsr D2.PutBytePtr2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2020-11-19 15:34:02 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.HeaderCheckSum
|
|
|
|
|
lda D2.VolNum
|
|
|
|
|
eor D2.TrkNum
|
|
|
|
|
eor D2.SectNum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
sta D2.Checksum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutData stz D2.Checksum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
|
|
|
|
lda ZPPtr1
|
|
|
|
|
ldy ZPPtr1+1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
adc #86
|
|
|
|
|
bcc .1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
iny
|
|
|
|
|
clc
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
.1 sta ZPPtr3
|
|
|
|
|
sty ZPPtr3+1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
adc #86
|
|
|
|
|
bcc .2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
iny
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
.2 sta ZPPtr4
|
|
|
|
|
sty ZPPtr4+1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldy #85
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
.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
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
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
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
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
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
eor D2.Checksum
|
|
|
|
|
sta D2.Checksum
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
lda FC2Nib,x
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-04-15 14:03:04 +00:00
|
|
|
|
* jsr D2.PutBytePtr2
|
|
|
|
|
|
|
|
|
|
sta (ZPPtr2)
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .31
|
|
|
|
|
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
|
|
|
|
|
.31 dey
|
2020-05-09 19:08:20 +00:00
|
|
|
|
bpl .3
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ldy #0
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-10 16:03:51 +00:00
|
|
|
|
.4 lda (ZPPtr1),y
|
2020-05-09 19:08:20 +00:00
|
|
|
|
and #$FC
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-07-13 19:29:31 +00:00
|
|
|
|
tax
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
eor D2.Checksum
|
|
|
|
|
sta D2.Checksum
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
lda FC2Nib,x
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-04-15 14:03:04 +00:00
|
|
|
|
* jsr D2.PutBytePtr2
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-04-15 14:03:04 +00:00
|
|
|
|
sta (ZPPtr2)
|
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .41
|
|
|
|
|
|
|
|
|
|
inc ZPPtr2+1
|
|
|
|
|
|
|
|
|
|
.41 iny
|
2020-05-09 19:08:20 +00:00
|
|
|
|
bne .4
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
ldx D2.Checksum
|
2020-05-09 19:08:20 +00:00
|
|
|
|
lda FC2Nib,x
|
2021-04-15 14:03:04 +00:00
|
|
|
|
bra D2.PutBytePtr2
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutByte44Ptr2
|
|
|
|
|
pha
|
2020-05-09 19:08:20 +00:00
|
|
|
|
ror
|
|
|
|
|
jsr .1
|
|
|
|
|
|
|
|
|
|
pla
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
.1 ora #$AA
|
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.PutBytePtr2 sta (ZPPtr2)
|
2020-05-09 19:08:20 +00:00
|
|
|
|
inc ZPPtr2
|
|
|
|
|
bne .8
|
2021-04-15 14:03:04 +00:00
|
|
|
|
|
2020-05-09 19:08:20 +00:00
|
|
|
|
inc ZPPtr2+1
|
2021-04-15 14:03:04 +00:00
|
|
|
|
|
2021-01-12 21:14:13 +00:00
|
|
|
|
.8 rts
|
2020-05-09 19:08:20 +00:00
|
|
|
|
*--------------------------------------
|
2021-03-26 17:30:56 +00:00
|
|
|
|
D2.WriteTrackPtr2
|
|
|
|
|
lda D2.hTrkBuf
|
2020-09-22 05:56:28 +00:00
|
|
|
|
>SYSCALL2 GetMemPtr
|
|
|
|
|
>STYA ZPPtr1
|
|
|
|
|
|
|
|
|
|
php
|
2020-05-09 19:08:20 +00:00
|
|
|
|
sei
|
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
ldy #D2.TrkWriter.Size
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
.1 lda D2.TrkWriter-1,y
|
2020-05-09 19:08:20 +00:00
|
|
|
|
sta $1ff,y
|
|
|
|
|
dey
|
|
|
|
|
bne .1
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-03-26 17:30:56 +00:00
|
|
|
|
ldx D2.Slotn0
|
2020-05-09 19:08:20 +00:00
|
|
|
|
|
|
|
|
|
jsr $200
|
2021-01-12 21:14:13 +00:00
|
|
|
|
|
2021-01-14 21:39:36 +00:00
|
|
|
|
bcs .9
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2020-09-22 05:56:28 +00:00
|
|
|
|
plp
|
2021-01-14 21:39:36 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-01-24 19:44:43 +00:00
|
|
|
|
|
2021-01-14 21:39:36 +00:00
|
|
|
|
.9 plp
|
|
|
|
|
sec
|
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
|