2018-01-09 16:37:08 +00:00
|
|
|
|
NEW
|
2020-08-31 15:29:32 +00:00
|
|
|
|
AUTO 3,1
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2020-08-31 15:29:32 +00:00
|
|
|
|
.TF sys/km.vsdrive
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
2020-07-23 10:18:11 +00:00
|
|
|
|
.INB inc/macros.i
|
|
|
|
|
.INB inc/io.i
|
|
|
|
|
.INB inc/monitor.i
|
|
|
|
|
.INB inc/mli.i
|
|
|
|
|
.INB inc/mli.e.i
|
|
|
|
|
.INB inc/com.6551.i
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TmpPtr1 .EQ $0
|
|
|
|
|
ADT.CMD.VSD .EQ $C5 "E": Virtual Drive Command Envelope
|
|
|
|
|
ADT.CMD.PING .EQ $D9 "Y": PING
|
|
|
|
|
DRV.EntryPoint .EQ $BF41
|
|
|
|
|
*--------------------------------------
|
2018-07-12 15:20:39 +00:00
|
|
|
|
VSDRIVE.Init >LDYAI VSDRIVE.MSG0
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
jsr VSDRIVE.Check
|
|
|
|
|
bcs .90
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
stz TmpPtr1
|
|
|
|
|
lda #$C1
|
|
|
|
|
sta TmpPtr1+1
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
.2 jsr SSC.Detect
|
|
|
|
|
bcs .99
|
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda TmpPtr1+1 Slot Cn
|
2018-01-09 16:37:08 +00:00
|
|
|
|
and #$0F
|
|
|
|
|
pha slot n
|
2018-07-12 15:20:39 +00:00
|
|
|
|
>LDYAI VSDRIVE.SSCOK
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
jsr VSDRIVE.Ping
|
|
|
|
|
bcs .92
|
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
>LDYAI VSDRIVE.SRVOK
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
jsr VSDRIVE.SetSlot
|
|
|
|
|
bcs .91
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
pha Push slot
|
|
|
|
|
pha 2 times
|
2018-07-12 15:20:39 +00:00
|
|
|
|
>LDYAI VSDRIVE.DEVOK
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
jsr VSDRIVE.Install
|
2018-07-12 15:20:39 +00:00
|
|
|
|
>LDYAI VSDRIVE.OK
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.90 >LDYAI VSDRIVE.DRVKO
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.91 >LDYAI VSDRIVE.NOSLOT
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.92 pha Push EC
|
2018-07-12 15:20:39 +00:00
|
|
|
|
>LDYAI VSDRIVE.SRVKO
|
|
|
|
|
jsr PrintFYA
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
|
|
|
|
inc TmpPtr1+1
|
|
|
|
|
lda TmpPtr1+1
|
2018-01-09 16:37:08 +00:00
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .2 Go try next SSC....
|
|
|
|
|
|
2018-07-12 15:20:39 +00:00
|
|
|
|
.99 >LDYAI VSDRIVE.SSCKO
|
|
|
|
|
jsr PrintFYA
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
VSDRIVE.Check ldx #COPYRIGHT.LEN
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
sec
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
|
|
|
|
.1 lda DRV.EntryPoint-1,x
|
2021-03-11 21:40:55 +00:00
|
|
|
|
eor COPYRIGHT-1,x
|
2021-02-11 22:08:22 +00:00
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
clc
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2021-02-11 22:08:22 +00:00
|
|
|
|
.9 rts
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
SSC.Detect
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.1 ldx #DEVSIG.Value-DEVSIG.Offset-1
|
|
|
|
|
|
|
|
|
|
.2 ldy DEVSIG.Offset,x
|
|
|
|
|
lda (TmpPtr1),y
|
|
|
|
|
cmp DEVSIG.Value,x
|
|
|
|
|
bne .3
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.3 inc TmpPtr1+1 no match, try next slot....
|
|
|
|
|
lda TmpPtr1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.Ping lda TmpPtr1+1 A=SlotCN
|
2018-01-09 16:37:08 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
2021-02-11 22:08:22 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #$8F
|
2018-01-09 16:37:08 +00:00
|
|
|
|
tax X=SlotN0
|
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
php
|
|
|
|
|
sei
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
stz SSC.RESET-$8F,x
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda #SSC.CTL.1S+SSC.CTL.8D+SSC.CTL.CLKINT+SSC.CTL.B115200
|
|
|
|
|
sta SSC.CTL-$8F,x
|
|
|
|
|
|
|
|
|
|
lda #SSC.CMD.NOP+SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
|
|
|
|
sta SSC.CMD-$8F,x
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda SSC.DATA-$8F,x discard any garbage byte
|
|
|
|
|
lda SSC.STATUS-$8F,x clear any IRQ pending
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
stz VSDRIVE.Ping.TO
|
|
|
|
|
stz VSDRIVE.Ping.TO+1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.10 jsr VSDRIVE.IncTimer Wait.......
|
|
|
|
|
bne .10
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldy #10
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
|
|
|
|
.1 lda SSC.STATUS-$8F,x
|
2021-03-11 21:40:55 +00:00
|
|
|
|
and #SSC.STATUS.nDCD Ready for transmit?
|
|
|
|
|
beq .20
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
jsr VSDRIVE.IncTimer Wait.......
|
|
|
|
|
bne .1
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .1
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda #1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
bra .9 Time Out.....
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
.20 ldy #5 5 bytes to send
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
.2 lda VSDRIVE.CMDS-1,y
|
2021-02-11 22:08:22 +00:00
|
|
|
|
sta SSC.DATA-$8F,x
|
|
|
|
|
|
|
|
|
|
.3 lda SSC.STATUS-$8F,x
|
2018-01-09 16:37:08 +00:00
|
|
|
|
and #SSC.STATUS.TDRE char transmitted?
|
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
jsr VSDRIVE.IncTimer
|
|
|
|
|
bne .3
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda #2
|
2021-03-11 21:40:55 +00:00
|
|
|
|
bra .9
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.4 dey
|
|
|
|
|
bne .2 next byte
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda #521^$ffff 522 bytes to receive
|
2018-01-09 16:37:08 +00:00
|
|
|
|
sta VSDRIVE.Ping.BC
|
|
|
|
|
lda /521^$ffff
|
|
|
|
|
sta VSDRIVE.Ping.BC+1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
stz VSDRIVE.Ping.TO
|
|
|
|
|
stz VSDRIVE.Ping.TO+1
|
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
ldy #3 EC=3 if no byte received
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
|
|
|
|
.5 lda SSC.STATUS-$8F,x
|
2018-01-09 16:37:08 +00:00
|
|
|
|
and #SSC.STATUS.RDRF incoming char?
|
|
|
|
|
bne .6
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
jsr VSDRIVE.IncTimer
|
|
|
|
|
bne .5
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
tya
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
|
|
|
|
.9 stz SSC.RESET-$8F,x
|
2021-09-07 12:32:31 +00:00
|
|
|
|
stz SSC.CMD-$8F,x Applewin Bug ???
|
2021-03-11 21:40:55 +00:00
|
|
|
|
plp
|
2018-01-09 16:37:08 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.6 ldy #4 EC=4 if recieved only partial reply
|
|
|
|
|
|
2021-02-11 22:08:22 +00:00
|
|
|
|
lda SSC.DATA-$8F,x
|
2018-01-09 16:37:08 +00:00
|
|
|
|
inc VSDRIVE.Ping.BC
|
|
|
|
|
bne .5
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
inc VSDRIVE.Ping.BC+1
|
|
|
|
|
bne .5
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda #SSC.CMD.NOP+SSC.CMD.RIRQDIS+SSC.CMD.TE
|
|
|
|
|
sta SSC.CMD-$8F,x
|
|
|
|
|
|
|
|
|
|
plp
|
2018-01-09 16:37:08 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.IncTimer
|
|
|
|
|
inc VSDRIVE.Ping.TO
|
|
|
|
|
bne .8
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
inc VSDRIVE.Ping.TO+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.CMDS .HS C6.00.00.03
|
|
|
|
|
.DA #ADT.CMD.VSD
|
2019-10-03 06:25:27 +00:00
|
|
|
|
* C6=C5 eor 03 eor 00 eor 00
|
2018-01-09 16:37:08 +00:00
|
|
|
|
VSDRIVE.Ping.TO .BS 2
|
2021-02-17 16:15:43 +00:00
|
|
|
|
VSDRIVE.Ping.BC .BS 2
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Find 2 free slots in DEVPTRS (D1 & D2)
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.SetSlot ldx #2 Starts at Slot1
|
|
|
|
|
|
|
|
|
|
.1 lda DEVPTRS,x Drive1
|
|
|
|
|
cmp DEVPTRS pointing to S0D1 NODEV ?
|
|
|
|
|
bne .2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda DEVPTRS+1,x
|
|
|
|
|
cmp DEVPTRS+1
|
|
|
|
|
bne .2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda DEVPTRS+16,x Drive2
|
|
|
|
|
cmp DEVPTRS
|
|
|
|
|
bne .2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda DEVPTRS+17,x
|
|
|
|
|
cmp DEVPTRS+1
|
|
|
|
|
bne .2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda #DRV.EntryPoint
|
|
|
|
|
sta DEVPTRS,x
|
|
|
|
|
sta DEVPTRS+16,x
|
|
|
|
|
lda /DRV.EntryPoint
|
|
|
|
|
sta DEVPTRS+1,x
|
|
|
|
|
sta DEVPTRS+17,x
|
|
|
|
|
txa
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
ora #$0D
|
|
|
|
|
ldy DEVCNT
|
|
|
|
|
iny
|
|
|
|
|
sta DEVLST,y add Drv1
|
|
|
|
|
ora #$80
|
|
|
|
|
iny
|
|
|
|
|
sta DEVLST,y add Drv2
|
|
|
|
|
sty DEVCNT
|
|
|
|
|
txa
|
|
|
|
|
lsr exit with A=SLOT
|
|
|
|
|
clc
|
|
|
|
|
rts
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.2 inx
|
|
|
|
|
inx
|
|
|
|
|
cpx #16
|
|
|
|
|
bne .1
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts sec from CPX
|
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
VSDRIVE.Install ldx #PATCH.LEN
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
.1 lda PATCH-1,x
|
|
|
|
|
sta DRV.EntryPoint-1,x
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
bit RRAMWRAMBNK2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldx #DRV.SIZE
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.2 lda DRV-1,x
|
|
|
|
|
sta $D000,x
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
lda TmpPtr1+1 A=SlotCN
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
|
|
|
|
|
ora #SSC.DATA
|
2021-08-10 10:20:41 +00:00
|
|
|
|
sta DRV.SSCWrite.D+1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
sta DRV.SSCSend.D+1
|
|
|
|
|
sta DRV.SSCGet.D+1
|
|
|
|
|
|
|
|
|
|
inc #SSC.STATUS
|
|
|
|
|
|
2021-08-10 10:20:41 +00:00
|
|
|
|
sta DRV.SSCWrite.S+1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
sta DRV.SSCSend.S+1
|
|
|
|
|
sta DRV.SSCGet.S+1
|
|
|
|
|
sta DRV.SSCClose.S+1
|
|
|
|
|
|
|
|
|
|
inc #SSC.CMD
|
|
|
|
|
|
|
|
|
|
sta DRV.INIT.C+1
|
|
|
|
|
sta DRV.SSCClose.C+1
|
|
|
|
|
|
|
|
|
|
lda TmpPtr1+1 A=SlotCN
|
|
|
|
|
and #$0F
|
|
|
|
|
sta DRV.START
|
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
bit RROMBNK1
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2020-07-23 10:18:11 +00:00
|
|
|
|
.INB usr/src/shared/x.printf.s
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DEVSIG.Offset .HS 05070B0C
|
|
|
|
|
DEVSIG.Value .HS 38180131
|
2021-06-04 19:22:18 +00:00
|
|
|
|
VSDRIVE.MSG0 .AZ "VSDRIVE (ADTPro Virtual Serial HD) Driver For A2osX\n"
|
2018-04-11 15:35:51 +00:00
|
|
|
|
VSDRIVE.DRVKO .AZ "VSDRIVE (Or other custom Driver) Already Installed.\n"
|
|
|
|
|
VSDRIVE.SSCKO .AZ "SSC Not Detected.\n"
|
|
|
|
|
VSDRIVE.SSCOK .AZ "SSC Found At Slot %d.\nContacting ADTPro Server..."
|
|
|
|
|
VSDRIVE.SRVKO .AZ "No Response From ADTPro Server (EC=%d).\n"
|
|
|
|
|
VSDRIVE.SRVOK .AZ "ADTPro Server Is Online.\n"
|
|
|
|
|
VSDRIVE.NOSLOT .AZ "No ProDOS device slot available.\n"
|
|
|
|
|
VSDRIVE.DEVOK .AZ "VSDRIVE Installed 2 devices at S%d,D1 & S%d,D2.\n"
|
|
|
|
|
VSDRIVE.OK .AZ "VSDRIVE Driver Successfully Installed.\n"
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ProDOS $BE41->$BE4B Patch for switching to BANK2 (10 bytes)
|
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
COPYRIGHT .AS "(C)APPLE "
|
|
|
|
|
COPYRIGHT.LEN .EQ *-COPYRIGHT
|
2018-01-09 16:37:08 +00:00
|
|
|
|
PATCH .PH DRV.EntryPoint
|
2021-02-26 20:13:48 +00:00
|
|
|
|
bit RRAMWRAMBNK2
|
2021-03-11 21:40:55 +00:00
|
|
|
|
jsr $D002
|
2021-02-26 20:13:48 +00:00
|
|
|
|
bit RRAMWRAMBNK1
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
|
|
|
|
.EP
|
2021-03-11 21:40:55 +00:00
|
|
|
|
PATCH.LEN .EQ *-PATCH
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* OP = 2 : Write drv1
|
|
|
|
|
* OP = 3 : Read drv1
|
|
|
|
|
* OP = 4 : Write drv2
|
|
|
|
|
* OP = 5 : Read drv2
|
|
|
|
|
* CMD = $C5+OP+BLKLO+BLKHI+CHKSUM
|
2021-02-17 16:15:43 +00:00
|
|
|
|
* DO NOT trash DRV.COMMAND...DRV.BLKNUM as ProDOS
|
2018-01-09 16:37:08 +00:00
|
|
|
|
* reuses them after Block operation
|
2021-03-11 21:40:55 +00:00
|
|
|
|
* PC,A1,A2 are used by Disk II Driver,
|
2018-01-09 16:37:08 +00:00
|
|
|
|
* so we use it safely as Tmp Ptr
|
|
|
|
|
*--------------------------------------
|
2021-08-10 10:20:41 +00:00
|
|
|
|
*DRV.PCL .EQ $3A
|
|
|
|
|
*DRV.PCH .EQ $3B
|
|
|
|
|
*DRV.A1L .EQ $3C
|
|
|
|
|
*DRV.A1H .EQ $3D
|
|
|
|
|
*DRV.A2L .EQ $3E
|
|
|
|
|
*DRV.A2H .EQ $3F
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DUMMY
|
|
|
|
|
.OR $3A
|
|
|
|
|
DRV.CmdBuf.Sum .BS 1 Reverse order for dey
|
|
|
|
|
DRV.CmdBuf.BlkH .BS 1
|
|
|
|
|
DRV.CmdBuf.BlkL .BS 1
|
|
|
|
|
DRV.CmdBuf.Cmd .BS 1
|
|
|
|
|
DRV.CmdBuf.Env .BS 1
|
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
2018-01-09 16:37:08 +00:00
|
|
|
|
DRV.COMMAND .EQ $42
|
|
|
|
|
DRV.UNITNUM .EQ $43
|
2021-02-17 16:15:43 +00:00
|
|
|
|
DRV.BUFF .EQ $44
|
2018-01-09 16:37:08 +00:00
|
|
|
|
DRV.BLKNUM .EQ $46
|
|
|
|
|
*--------------------------------------
|
2021-02-11 22:08:22 +00:00
|
|
|
|
DRV .PH $D001 Main LC Bnk 2 $D001->$DFFF
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
DRV.START .BS 1 SELF MODIFIED slot 0n
|
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda DRV.COMMAND S=0,R=1,W=2,F=3
|
|
|
|
|
bne .1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldx #$ff return Status
|
|
|
|
|
ldy #$ff
|
2021-02-11 22:08:22 +00:00
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
.8 lda #0
|
2018-01-09 16:37:08 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.1 cmp #3
|
|
|
|
|
beq .8 Format ....
|
2021-03-11 21:40:55 +00:00
|
|
|
|
bcc DRV.START.OK
|
|
|
|
|
|
|
|
|
|
DRV.START.IO lda #MLI.E.IO
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
DRV.START.OK tax
|
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ora #2 W=2,R=3
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2021-08-10 10:20:41 +00:00
|
|
|
|
bit DRV.UNITNUM
|
2018-01-09 16:37:08 +00:00
|
|
|
|
bpl .2
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
adc #2 CC from bcs
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.2 sta DRV.CmdBuf.Cmd store cmd
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2021-08-10 10:20:41 +00:00
|
|
|
|
lda #ADT.CMD.VSD
|
|
|
|
|
sta DRV.CmdBuf.Env
|
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
lda DRV.BLKNUM
|
|
|
|
|
sta DRV.CmdBuf.BlkL
|
|
|
|
|
|
|
|
|
|
lda DRV.BLKNUM+1
|
|
|
|
|
sta DRV.CmdBuf.BlkH
|
2021-08-10 10:20:41 +00:00
|
|
|
|
|
|
|
|
|
stz DRV.CmdBuf.Sum
|
2021-02-17 16:15:43 +00:00
|
|
|
|
*--------------------------------------
|
2018-01-09 16:37:08 +00:00
|
|
|
|
* send CMD+CS
|
2021-02-17 16:15:43 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
php
|
|
|
|
|
sei
|
2021-08-10 10:20:41 +00:00
|
|
|
|
|
|
|
|
|
phx
|
|
|
|
|
|
|
|
|
|
ldy #DRV.200.LEN-1
|
|
|
|
|
|
|
|
|
|
.1 lda DRV.200,y
|
|
|
|
|
sta $200,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
|
|
|
|
* lda #SSC.CMD.NOP+SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
|
|
|
|
DRV.INIT.C inc SSC.CMD SELF MODIFIED
|
2021-02-17 16:15:43 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldy #4 Send 5 bytes including Sum
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.3 lda DRV.CmdBuf.Sum,y
|
|
|
|
|
jsr DRV.SSCSend
|
2021-08-10 10:20:41 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
2018-01-09 16:37:08 +00:00
|
|
|
|
dey
|
2021-08-10 10:20:41 +00:00
|
|
|
|
bne .3
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
2021-08-10 10:20:41 +00:00
|
|
|
|
jsr DRV.SSCSend A = Sum
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-08-10 10:20:41 +00:00
|
|
|
|
plx
|
2021-03-11 21:40:55 +00:00
|
|
|
|
dex 1-1=0 if read
|
2018-01-09 16:37:08 +00:00
|
|
|
|
bne DRV.DO.CMD.W go write
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Read block
|
|
|
|
|
*--------------------------------------
|
2021-08-10 10:20:41 +00:00
|
|
|
|
DRV.DO.CMD.R ldy #4 Read Back and check 4 bytes
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.1 jsr DRV.SSCGet
|
2021-08-10 10:20:41 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum,y
|
2018-01-09 16:37:08 +00:00
|
|
|
|
bne DRV.DO.CMD.ERR
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
dey
|
2021-08-10 10:20:41 +00:00
|
|
|
|
bne .1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldy #4 Read 4 bytes DATE/TIME + 1 Byte Checksum
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
.2 jsr DRV.SSCGet
|
|
|
|
|
|
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
|
|
|
|
dey
|
|
|
|
|
bpl .2
|
|
|
|
|
|
|
|
|
|
tay Last EOR was with Checksum, must be 0
|
|
|
|
|
bne DRV.DO.CMD.ERR
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
* Y=0 from TAY
|
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
* stz DRV.CmdBuf.Sum
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
sec
|
2021-03-11 21:40:55 +00:00
|
|
|
|
.HS 90 BCC
|
|
|
|
|
.3 clc
|
|
|
|
|
|
|
|
|
|
.4 jsr DRV.SSCGet
|
2021-08-05 18:00:05 +00:00
|
|
|
|
jsr $200
|
2018-01-09 16:37:08 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
|
|
|
|
iny
|
2021-03-11 21:40:55 +00:00
|
|
|
|
bne .4
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
inc DRV.BUFF+1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
bcs .3
|
|
|
|
|
|
|
|
|
|
dec DRV.BUFF+1
|
|
|
|
|
dec DRV.BUFF+1
|
2018-01-09 16:37:08 +00:00
|
|
|
|
|
|
|
|
|
jsr DRV.SSCGet
|
|
|
|
|
eor DRV.CmdBuf.Sum
|
2021-03-11 21:40:55 +00:00
|
|
|
|
beq DRV.DO.CMD.OK
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
DRV.DO.CMD.ERR jsr DRV.SSCClose
|
|
|
|
|
jmp DRV.START.IO
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
2019-10-03 06:25:27 +00:00
|
|
|
|
* Write Block
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.DO.CMD.W lda #$B1 lda (),y
|
|
|
|
|
|
2021-08-05 18:00:05 +00:00
|
|
|
|
sta $203
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
stz DRV.CmdBuf.Sum
|
|
|
|
|
|
|
|
|
|
sec
|
2021-03-11 21:40:55 +00:00
|
|
|
|
.HS 90 BCC
|
2021-08-10 10:20:41 +00:00
|
|
|
|
DRV.SSCWrite.1 clc
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2021-08-10 10:20:41 +00:00
|
|
|
|
DRV.SSCWrite.2 jsr $200
|
|
|
|
|
|
|
|
|
|
tax
|
|
|
|
|
|
|
|
|
|
DRV.SSCWrite.S lda SSC.STATUS SELF MODIFIED
|
|
|
|
|
and #SSC.STATUS.TDRE Outgoing char?
|
|
|
|
|
beq DRV.SSCWrite.S
|
|
|
|
|
|
|
|
|
|
DRV.SSCWrite.D stx SSC.DATA SELF MODIFIED
|
|
|
|
|
|
|
|
|
|
txa
|
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
|
|
|
|
iny
|
2021-08-10 10:20:41 +00:00
|
|
|
|
bne DRV.SSCWrite.2
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
inc DRV.BUFF+1
|
2021-08-10 10:20:41 +00:00
|
|
|
|
bcs DRV.SSCWrite.1
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
|
|
|
|
dec DRV.BUFF+1
|
|
|
|
|
dec DRV.BUFF+1
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
* A = DRV.CmdBuf.Sum
|
|
|
|
|
|
|
|
|
|
jsr DRV.SSCSend
|
|
|
|
|
|
2019-10-03 06:25:27 +00:00
|
|
|
|
* read back CMD
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ldy #4 Read 5 bytes (echo from server)
|
|
|
|
|
|
2020-08-31 15:29:32 +00:00
|
|
|
|
.3 jsr DRV.SSCGet
|
2018-01-09 16:37:08 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum,y Check 5 bytes (including block Sum)
|
|
|
|
|
bne DRV.DO.CMD.ERR
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
dey
|
|
|
|
|
bpl .3
|
2021-03-11 21:40:55 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.DO.CMD.OK
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.SSCClose
|
|
|
|
|
* lda #SSC.CMD.NOP+SSC.CMD.RIRQDIS+SSC.CMD.TE
|
|
|
|
|
DRV.SSCClose.C dec SSC.CMD SELF MODIFIED
|
|
|
|
|
DRV.SSCClose.S bit SSC.STATUS SELF MODIFIED
|
|
|
|
|
bmi DRV.SSCClose.S
|
2021-08-10 10:20:41 +00:00
|
|
|
|
|
2021-02-17 16:15:43 +00:00
|
|
|
|
plp
|
|
|
|
|
clc
|
2021-03-11 21:40:55 +00:00
|
|
|
|
rts
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
2021-08-10 10:20:41 +00:00
|
|
|
|
DRV.SSCSend tax
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
DRV.SSCSend.S lda SSC.STATUS SELF MODIFIED
|
2018-01-09 16:37:08 +00:00
|
|
|
|
and #SSC.STATUS.TDRE Outgoing char?
|
2021-03-11 21:40:55 +00:00
|
|
|
|
beq DRV.SSCSend.S
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2021-08-10 10:20:41 +00:00
|
|
|
|
DRV.SSCSend.D stx SSC.DATA SELF MODIFIED
|
|
|
|
|
|
|
|
|
|
txa Restore A for checksumming
|
2021-03-11 21:40:55 +00:00
|
|
|
|
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-03-11 21:40:55 +00:00
|
|
|
|
DRV.SSCGet
|
|
|
|
|
DRV.SSCGet.S lda SSC.STATUS SELF MODIFIED
|
2018-01-09 16:37:08 +00:00
|
|
|
|
and #SSC.STATUS.RDRF incoming char?
|
|
|
|
|
beq DRV.SSCGet
|
2020-08-31 15:29:32 +00:00
|
|
|
|
|
2021-03-11 21:40:55 +00:00
|
|
|
|
DRV.SSCGet.D lda SSC.DATA SELF MODIFIED
|
2018-01-09 16:37:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2021-08-05 18:00:05 +00:00
|
|
|
|
DRV.200 bit RRAMWRAMBNK1
|
2018-01-09 16:37:08 +00:00
|
|
|
|
sta (DRV.BUFF),y
|
|
|
|
|
bit RRAMWRAMBNK2
|
2021-03-11 21:40:55 +00:00
|
|
|
|
rts
|
2021-08-05 18:00:05 +00:00
|
|
|
|
DRV.200.LEN .EQ *-DRV.200
|
2018-01-09 16:37:08 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
.EP
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.LIST ON
|
|
|
|
|
DRV.SIZE .EQ *-DRV
|
|
|
|
|
.LIST OFF
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* CONTROL SECTION :
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO DRV.SIZE>255
|
|
|
|
|
* ERROR:DRV.SIZE too big
|
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2020-07-23 10:18:11 +00:00
|
|
|
|
SAVE usr/src/sys/km.vsdrive.s
|
2018-01-09 16:37:08 +00:00
|
|
|
|
ASM
|