2016-12-12 16:41:39 +00:00
|
|
|
|
PR#3
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2016-12-12 16:41:39 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
|
|
|
|
.OP 65C02
|
|
|
|
|
.OR $2000
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.TF /A2OSX.BUILD/SYS/KM.VSDRIVE
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.BUILD/INC/MACROS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/IO.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/MONITOR.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/PRODOS.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/MLI.ERR.I
|
|
|
|
|
.INB /A2OSX.BUILD/INC/COM.6551.I
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
TmpPtr1 .EQ $0
|
2016-12-13 16:32:37 +00:00
|
|
|
|
VS.CMD .EQ $C5 "E": Virtual Drive Command Envelope
|
|
|
|
|
DRV.EntryPoint .EQ $BF41
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.Init >LDAXI VSDRIVE.MSG0
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2017-11-05 21:23:21 +00:00
|
|
|
|
|
2016-12-12 16:41:39 +00:00
|
|
|
|
jsr VSDRIVE.Check
|
2017-02-19 20:11:44 +00:00
|
|
|
|
bcs .90
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
.1 lda #$C1 Self Modified
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
.2 jsr SSC.Detect
|
|
|
|
|
bcs .99
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
stx DRV+2 DRV.Slotn0
|
|
|
|
|
sta .1+1 SlotCn
|
|
|
|
|
|
|
|
|
|
and #$0F
|
|
|
|
|
pha slot n
|
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
>LDAXI VSDRIVE.SSCOK
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
jsr VSDRIVE.Ping
|
2017-11-06 16:25:40 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
bcs .92
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
>LDAXI VSDRIVE.SRVOK
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2017-11-06 16:25:40 +00:00
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
jsr VSDRIVE.SetSlot
|
2017-02-19 20:11:44 +00:00
|
|
|
|
bcs .91
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
pha save slot
|
2016-12-13 16:32:37 +00:00
|
|
|
|
pha 2 times
|
2017-01-23 21:32:06 +00:00
|
|
|
|
>LDAXI VSDRIVE.DEVOK
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2017-11-06 16:25:40 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
jsr VSDRIVE.Install
|
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
>LDAXI VSDRIVE.OK
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2017-02-19 20:11:44 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.90 >LDAXI VSDRIVE.DRVKO
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2017-02-19 20:11:44 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.91 >LDAXI VSDRIVE.NOSLOT
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2017-02-19 20:11:44 +00:00
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.92 >LDAXI VSDRIVE.SRVKO
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
inc .1+1
|
|
|
|
|
lda .1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .2 Go try next SSC....
|
2017-11-05 21:23:21 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
.99 >LDAXI VSDRIVE.SSCKO
|
2017-05-02 15:56:43 +00:00
|
|
|
|
jsr PrintFAX
|
2016-12-12 16:41:39 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +00:00
|
|
|
|
VSDRIVE.Check bit RRAMWRAMBNK2
|
|
|
|
|
bit RRAMWRAMBNK2
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
|
|
|
|
clc
|
2016-12-13 16:32:37 +00:00
|
|
|
|
lda $D001
|
|
|
|
|
eor DRV
|
|
|
|
|
bne .8
|
|
|
|
|
lda $D002
|
|
|
|
|
eor DRV+1
|
|
|
|
|
bne .8
|
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.8 bit RROMBNK1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +00:00
|
|
|
|
SSC.Detect stz TmpPtr1
|
|
|
|
|
sta TmpPtr1+1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
.1 ldx #DEVSIG.Value-DEVSIG.Offset-1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
.2 ldy DEVSIG.Offset,x
|
|
|
|
|
lda (TmpPtr1),y
|
|
|
|
|
cmp DEVSIG.Value,x
|
|
|
|
|
bne .3
|
2017-02-19 20:11:44 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2017-02-19 20:11:44 +00:00
|
|
|
|
|
|
|
|
|
lda TmpPtr1+1 A=SlotCN
|
2016-12-13 16:32:37 +00:00
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
|
|
|
|
asl
|
2017-02-19 20:11:44 +00:00
|
|
|
|
tax X=SlotN0
|
2016-12-15 16:49:33 +00:00
|
|
|
|
|
|
|
|
|
stz SSC.RESET,x
|
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
pha zzzzzzz...
|
|
|
|
|
pla
|
|
|
|
|
|
2017-05-02 15:56:43 +00:00
|
|
|
|
lda #SSC.CTL.CLKEXT+SSC.CTL.B115200+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
|
2016-12-15 16:49:33 +00:00
|
|
|
|
sta SSC.CTL,x
|
|
|
|
|
|
2017-04-10 08:58:45 +00:00
|
|
|
|
lda #SSC.CMD.RIRQDIS+SSC.CMD.TE+SSC.CMD.DTR
|
2016-12-15 16:49:33 +00:00
|
|
|
|
sta SSC.CMD,x
|
2017-02-19 20:11:44 +00:00
|
|
|
|
lda TmpPtr1+1
|
2016-12-15 16:49:33 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
clc
|
2017-02-19 20:11:44 +00:00
|
|
|
|
rts X=SlotN0, A=SlotCN
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
.3 inc TmpPtr1+1 no match, try next slot....
|
|
|
|
|
lda TmpPtr1+1
|
|
|
|
|
cmp #$C8
|
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
2016-12-12 16:41:39 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-23 21:32:06 +00:00
|
|
|
|
VSDRIVE.Ping ldx DRV+2 DRV.Slotn0
|
|
|
|
|
|
2017-01-24 13:49:20 +00:00
|
|
|
|
stz VSDRIVE.Ping.TO
|
|
|
|
|
stz VSDRIVE.Ping.TO+1
|
|
|
|
|
|
2017-01-25 16:17:25 +00:00
|
|
|
|
ldy #10
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-02-19 20:11:44 +00:00
|
|
|
|
.1 lda SSC.STATUS,x
|
|
|
|
|
bit #SSC.STATUS.TDRE Ready for transmit?
|
2017-01-23 21:32:06 +00:00
|
|
|
|
bne .2
|
2017-02-19 20:11:44 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
jsr VSDRIVE.IncTimer Wait.......
|
2017-02-19 20:11:44 +00:00
|
|
|
|
bne .1
|
2017-01-24 13:49:20 +00:00
|
|
|
|
dey
|
2017-02-19 20:11:44 +00:00
|
|
|
|
bne .1
|
2017-01-24 13:49:20 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda #1
|
|
|
|
|
.9 sec
|
|
|
|
|
rts Time Out.....
|
2017-02-19 20:11:44 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
ldy #4 Five bytes to send
|
2017-01-24 13:49:20 +00:00
|
|
|
|
|
|
|
|
|
stz VSDRIVE.Ping.TO
|
|
|
|
|
stz VSDRIVE.Ping.TO+1
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.2 lda VSDRIVE.Ping.CMD,y
|
|
|
|
|
sta SSC.DATA,x
|
|
|
|
|
|
|
|
|
|
.3 lda SSC.STATUS,x
|
|
|
|
|
bit #SSC.STATUS.TDRE char transmitted?
|
2017-02-19 20:11:44 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
jsr VSDRIVE.IncTimer
|
|
|
|
|
bne .3
|
|
|
|
|
lda #2
|
|
|
|
|
bra .9
|
2017-02-19 20:11:44 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.4 dey
|
|
|
|
|
bpl .2 next byte
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
lda #518^$ff
|
|
|
|
|
sta VSDRIVE.Ping.BC
|
|
|
|
|
lda /518^$ff
|
|
|
|
|
sta VSDRIVE.Ping.BC+1
|
2017-11-05 21:23:21 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
stz VSDRIVE.Ping.TO
|
|
|
|
|
stz VSDRIVE.Ping.TO+1
|
|
|
|
|
ldy #20
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
.5 lda SSC.STATUS,x
|
2017-01-23 21:32:06 +00:00
|
|
|
|
and #SSC.STATUS.RDRF incoming char?
|
2017-11-05 21:23:21 +00:00
|
|
|
|
bne .6
|
2017-11-06 16:25:40 +00:00
|
|
|
|
|
|
|
|
|
jsr VSDRIVE.IncTimer
|
|
|
|
|
bne .5
|
|
|
|
|
dey
|
|
|
|
|
bne .5
|
|
|
|
|
|
|
|
|
|
lda #3
|
|
|
|
|
bra .9
|
|
|
|
|
|
|
|
|
|
.6 lda SSC.DATA,x
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-11-06 16:25:40 +00:00
|
|
|
|
inc VSDRIVE.Ping.BC 518 bytes to recieve
|
|
|
|
|
bne .5
|
|
|
|
|
inc VSDRIVE.Ping.BC+1
|
|
|
|
|
bne .5
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
clc
|
2016-12-12 16:41:39 +00:00
|
|
|
|
rts
|
2017-11-06 16:25:40 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.IncTimer
|
|
|
|
|
inc VSDRIVE.Ping.TO
|
|
|
|
|
bne .8
|
|
|
|
|
inc VSDRIVE.Ping.TO+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
VSDRIVE.Ping.CMD .HS C4000001C5 C4=C5 eor 01 eor 00 eor 00
|
|
|
|
|
VSDRIVE.Ping.TO .BS 2
|
|
|
|
|
VSDRIVE.Ping.BC .BS 2
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +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
|
|
|
|
|
lda DEVPTRS+1,x
|
|
|
|
|
cmp DEVPTRS+1
|
|
|
|
|
bne .2
|
|
|
|
|
lda DEVPTRS+16,x Drive2
|
|
|
|
|
cmp DEVPTRS
|
|
|
|
|
bne .2
|
|
|
|
|
lda DEVPTRS+17,x
|
|
|
|
|
cmp DEVPTRS+1
|
|
|
|
|
bne .2
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +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
|
2017-01-23 07:16:06 +00:00
|
|
|
|
ora #$0D
|
2016-12-13 16:32:37 +00:00
|
|
|
|
ldy DEVCNT
|
|
|
|
|
iny
|
|
|
|
|
sta DEVLST,y add Drv1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
ora #$80
|
|
|
|
|
iny
|
2016-12-13 16:32:37 +00:00
|
|
|
|
sta DEVLST,y add Drv2
|
|
|
|
|
sty DEVCNT
|
|
|
|
|
|
|
|
|
|
txa
|
2017-01-23 17:09:17 +00:00
|
|
|
|
lsr exit with A=SLOT
|
2016-12-13 16:32:37 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.2 inx
|
|
|
|
|
inx
|
|
|
|
|
cpx #16
|
2016-12-12 16:41:39 +00:00
|
|
|
|
bne .1
|
2016-12-13 16:32:37 +00:00
|
|
|
|
rts sec from CPX
|
|
|
|
|
*--------------------------------------
|
2017-01-23 07:16:06 +00:00
|
|
|
|
VSDRIVE.Install ldx #PATCH.SIZE
|
|
|
|
|
|
|
|
|
|
.1 lda PATCH-1,x
|
|
|
|
|
sta DRV.EntryPoint-1,x
|
2016-12-13 16:32:37 +00:00
|
|
|
|
dex
|
2017-01-23 07:16:06 +00:00
|
|
|
|
bne .1
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
|
|
|
|
|
ldx #DRV.SIZE
|
2017-01-23 07:16:06 +00:00
|
|
|
|
|
2016-12-13 16:32:37 +00:00
|
|
|
|
.2 lda DRV-1,x
|
|
|
|
|
sta $D000,x
|
|
|
|
|
dex
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
bit RROMBNK1
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-03-29 15:48:15 +00:00
|
|
|
|
.INB /A2OSX.SRC/X.PRINTF.S
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +00:00
|
|
|
|
DEVSIG.Offset .HS 05070B0C
|
|
|
|
|
DEVSIG.Value .HS 38180131
|
2017-01-23 21:32:06 +00:00
|
|
|
|
VSDRIVE.MSG0 >CSTR "VSDRIVE (ADTPro Vitual Serial HD) Driver For A2osX\n"
|
|
|
|
|
VSDRIVE.DRVKO >CSTR "VSDRIVE (Or other custom Driver) Already Installed.\n"
|
|
|
|
|
VSDRIVE.SSCKO >CSTR "SSC Not Detected.\n"
|
2017-02-04 22:07:06 +00:00
|
|
|
|
VSDRIVE.SSCOK >CSTR "SSC Found At Slot %d.\nContacting ADTPro Server..."
|
2017-01-23 21:32:06 +00:00
|
|
|
|
VSDRIVE.SRVKO >CSTR "No Response From ADTPro Server.\n"
|
|
|
|
|
VSDRIVE.SRVOK >CSTR "ADTPro Server Is Online.\n"
|
|
|
|
|
VSDRIVE.NOSLOT >CSTR "No ProDOS device slot available.\n"
|
|
|
|
|
VSDRIVE.DEVOK >CSTR "VSDRIVE Installed 2 devices at S%d,D1 & S%d,D2.\n"
|
|
|
|
|
VSDRIVE.OK >CSTR "VSDRIVE Driver Successfully Installed.\n"
|
2016-12-13 16:32:37 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* ProDOS $BE41->$BE4B Patch for switching to BANK2 (10 bytes)
|
|
|
|
|
*--------------------------------------
|
2017-01-23 07:16:06 +00:00
|
|
|
|
PATCH .PH DRV.EntryPoint
|
2016-12-13 16:32:37 +00:00
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
jsr $D001
|
|
|
|
|
bit RRAMWRAMBNK1
|
|
|
|
|
rts
|
|
|
|
|
.EP
|
2017-01-23 07:16:06 +00:00
|
|
|
|
PATCH.SIZE .EQ *-PATCH
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* Driver
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
* OP = 2 : Write drv1
|
|
|
|
|
* OP = 3 : Read drv1
|
|
|
|
|
* OP = 4 : Write drv2
|
|
|
|
|
* OP = 5 : Read drv2
|
2016-12-16 13:38:57 +00:00
|
|
|
|
* CMD = $C5+OP+BLKLO+BLKHI+CHKSUM
|
2016-12-13 16:32:37 +00:00
|
|
|
|
* DO NOT trash DRV.COMMAND...DRV.BLKNUM as ProDOS
|
|
|
|
|
* reuses them after Block operation
|
|
|
|
|
* A1,A2 are used by Disk II Driver,
|
|
|
|
|
* so we use it safely as Tmp Ptr
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +00:00
|
|
|
|
DRV.A1L .EQ $3C
|
|
|
|
|
DRV.A1H .EQ $3D
|
2016-12-12 16:41:39 +00:00
|
|
|
|
DRV.A2L .EQ $3E
|
|
|
|
|
DRV.A2H .EQ $3F
|
|
|
|
|
DRV.COMMAND .EQ $42
|
|
|
|
|
DRV.UNITNUM .EQ $43
|
|
|
|
|
DRV.BUFF .EQ $44
|
|
|
|
|
DRV.BLKNUM .EQ $46
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV .EQ *
|
2016-12-13 16:32:37 +00:00
|
|
|
|
.PH $D001 Main LC Bnk 2 $D001->$DFFF
|
2016-12-12 16:41:39 +00:00
|
|
|
|
cld
|
|
|
|
|
DRV.Slotn0 ldx #$ff Self Modified
|
2016-12-16 13:38:57 +00:00
|
|
|
|
lda DRV.COMMAND S=0,R=1,W=2,F=3
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne .1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
ldx #$ff return Status
|
2016-12-12 16:41:39 +00:00
|
|
|
|
ldy #$ff
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.8 lda #0
|
2016-12-12 16:41:39 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 cmp #3
|
|
|
|
|
beq .8 Format ....
|
2017-01-23 17:09:17 +00:00
|
|
|
|
* bcs DRV.DO.CMD.ERR more....IO error
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
|
|
|
|
ora #2 W=2,R=3
|
2017-01-23 07:16:06 +00:00
|
|
|
|
ldy DRV.UNITNUM
|
2017-01-23 17:09:17 +00:00
|
|
|
|
bpl .2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
adc #2 CC from bcs
|
|
|
|
|
|
|
|
|
|
.2 sta DRV.CmdBuf.Cmd store cmd
|
2016-12-13 16:32:37 +00:00
|
|
|
|
eor #VS.CMD
|
2016-12-15 16:49:33 +00:00
|
|
|
|
eor DRV.BLKNUM
|
|
|
|
|
eor DRV.BLKNUM+1
|
2016-12-16 13:38:57 +00:00
|
|
|
|
sta DRV.CmdBuf.Sum Compute & store CheckSum
|
2016-12-15 16:49:33 +00:00
|
|
|
|
|
2016-12-16 13:38:57 +00:00
|
|
|
|
lda DRV.BLKNUM
|
|
|
|
|
sta DRV.CmdBuf.BlkLo
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2016-12-16 13:38:57 +00:00
|
|
|
|
lda DRV.BLKNUM+1
|
|
|
|
|
sta DRV.CmdBuf.BlkHi
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
|
|
|
|
* send CMD+CS
|
2016-12-16 13:38:57 +00:00
|
|
|
|
ldy #4 Send 5 bytes including Sum
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
.3 lda DRV.CmdBuf.Sum,y
|
2016-12-12 16:41:39 +00:00
|
|
|
|
jsr DRV.SSCSend
|
2016-12-16 13:38:57 +00:00
|
|
|
|
dey
|
2017-01-23 17:09:17 +00:00
|
|
|
|
bpl .3
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
ldy #8
|
|
|
|
|
|
|
|
|
|
.5 lda DRV.READWRITE,y
|
|
|
|
|
sta $100,y
|
|
|
|
|
dey
|
|
|
|
|
bpl .5
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +00:00
|
|
|
|
lda DRV.COMMAND
|
2016-12-16 13:38:57 +00:00
|
|
|
|
dec 1-1=0 if read
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne DRV.DO.CMD.W go write
|
|
|
|
|
*--------------------------------------
|
2017-01-23 21:32:06 +00:00
|
|
|
|
* Read block
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-23 21:32:06 +00:00
|
|
|
|
DRV.DO.CMD.R ldy #3 Read Back and check 4 bytes
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 jsr DRV.SSCGet
|
2017-01-23 21:32:06 +00:00
|
|
|
|
eor DRV.CmdBuf.BlkHi,y
|
|
|
|
|
bne DRV.DO.CMD.ERR
|
|
|
|
|
dey
|
|
|
|
|
bpl .1
|
|
|
|
|
|
|
|
|
|
ldy #4 Read 4 bytes DATE/TIME + 1 Byte Checksum
|
|
|
|
|
|
|
|
|
|
.2 jsr DRV.SSCGet
|
2016-12-15 16:49:33 +00:00
|
|
|
|
|
2016-12-12 16:41:39 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
2016-12-15 16:49:33 +00:00
|
|
|
|
dey
|
2017-01-23 21:32:06 +00:00
|
|
|
|
bpl .2
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
tay Last EOR was with Checksum, must be 0
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne DRV.DO.CMD.ERR
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
* Y=0 from TAY
|
2017-01-23 17:09:17 +00:00
|
|
|
|
|
|
|
|
|
stz DRV.CmdBuf.Sum
|
|
|
|
|
sec
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.3 jsr DRV.SSCGet
|
2017-01-23 17:09:17 +00:00
|
|
|
|
jsr $100
|
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
2016-12-13 16:32:37 +00:00
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne .3
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
bcc .4
|
|
|
|
|
inc DRV.BUFF+1
|
|
|
|
|
clc
|
|
|
|
|
bcc .3
|
|
|
|
|
|
|
|
|
|
.4 dec DRV.BUFF+1
|
|
|
|
|
|
2016-12-12 16:41:39 +00:00
|
|
|
|
jsr DRV.SSCGet
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2016-12-16 13:38:57 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne DRV.DO.CMD.ERR
|
2017-01-23 17:09:17 +00:00
|
|
|
|
rts A=0,CC from bcc .4
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.DO.CMD.ERR1 pla
|
|
|
|
|
pla
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
DRV.DO.CMD.ERR lda #MLI.E.IO
|
2017-01-23 17:09:17 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-13 16:32:37 +00:00
|
|
|
|
* Write Block
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-23 17:09:17 +00:00
|
|
|
|
DRV.DO.CMD.W lda #$B1 lda (),y
|
2016-12-15 16:49:33 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
sta $103
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
stz DRV.CmdBuf.Sum
|
2017-01-23 21:32:06 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
sec
|
|
|
|
|
|
|
|
|
|
.1 jsr $100
|
2016-12-15 16:49:33 +00:00
|
|
|
|
jsr DRV.SSCSend
|
2017-01-23 17:09:17 +00:00
|
|
|
|
eor DRV.CmdBuf.Sum
|
|
|
|
|
sta DRV.CmdBuf.Sum
|
2016-12-15 16:49:33 +00:00
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne .1
|
2016-12-13 16:32:37 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
bcc .2
|
|
|
|
|
|
|
|
|
|
inc DRV.BUFF+1
|
|
|
|
|
clc
|
|
|
|
|
bcc .1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2017-01-23 17:09:17 +00:00
|
|
|
|
.2 dec DRV.BUFF+1
|
|
|
|
|
|
|
|
|
|
* A = DRV.CmdBuf.Sum
|
|
|
|
|
|
2016-12-15 16:49:33 +00:00
|
|
|
|
jsr DRV.SSCSend
|
|
|
|
|
|
2017-01-23 21:32:06 +00:00
|
|
|
|
* read back CMD
|
|
|
|
|
|
2016-12-16 13:38:57 +00:00
|
|
|
|
ldy #4 Read 5 bytes (echo from server)
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.3 jsr DRV.SSCGet
|
2016-12-16 13:38:57 +00:00
|
|
|
|
|
|
|
|
|
eor DRV.CmdBuf.Sum,y Check 5 bytes (including block Sum)
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bne DRV.DO.CMD.ERR
|
2016-12-16 13:38:57 +00:00
|
|
|
|
dey
|
2017-01-12 17:43:45 +00:00
|
|
|
|
bpl .3
|
2016-12-12 16:41:39 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-12-15 16:49:33 +00:00
|
|
|
|
DRV.SSCSend sta .2+1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2016-12-12 16:41:39 +00:00
|
|
|
|
.1 lda SSC.STATUS,x
|
2017-01-23 17:09:17 +00:00
|
|
|
|
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR
|
|
|
|
|
* beq DRV.DO.CMD.ERR1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
|
2016-12-12 16:41:39 +00:00
|
|
|
|
and #SSC.STATUS.TDRE Outgoing char?
|
2016-12-13 16:32:37 +00:00
|
|
|
|
beq .1
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
2016-12-15 16:49:33 +00:00
|
|
|
|
.2 lda #$ff
|
2016-12-12 16:41:39 +00:00
|
|
|
|
sta SSC.DATA,x
|
|
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
DRV.SSCGet lda SSC.STATUS,x
|
2017-01-23 17:09:17 +00:00
|
|
|
|
* bit #SSC.STATUS.DCD+SSC.STATUS.DSR
|
|
|
|
|
* beq DRV.DO.CMD.ERR1
|
2016-12-15 16:49:33 +00:00
|
|
|
|
|
2016-12-12 16:41:39 +00:00
|
|
|
|
and #SSC.STATUS.RDRF incoming char?
|
2017-01-12 17:43:45 +00:00
|
|
|
|
beq DRV.SSCGet
|
2016-12-12 16:41:39 +00:00
|
|
|
|
|
|
|
|
|
lda SSC.DATA,x
|
|
|
|
|
rts
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
2017-01-23 17:09:17 +00:00
|
|
|
|
DRV.READWRITE bit RRAMWRAMBNK1
|
|
|
|
|
sta (DRV.BUFF),y
|
|
|
|
|
bit RRAMWRAMBNK2
|
|
|
|
|
rts
|
2017-01-23 21:32:06 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
DRV.CmdBuf.Sum .BS 1 Reverse order for dey
|
|
|
|
|
DRV.CmdBuf.BlkHi .BS 1
|
|
|
|
|
DRV.CmdBuf.BlkLo .BS 1
|
|
|
|
|
DRV.CmdBuf.Cmd .BS 1
|
|
|
|
|
DRV.CmdBuf.Env .DA #VS.CMD
|
2017-01-12 17:43:45 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-12 16:41:39 +00:00
|
|
|
|
.EP
|
|
|
|
|
*--------------------------------------
|
2016-12-15 16:49:33 +00:00
|
|
|
|
.LIST ON
|
2016-12-12 16:41:39 +00:00
|
|
|
|
DRV.SIZE .EQ *-DRV
|
2016-12-15 16:49:33 +00:00
|
|
|
|
.LIST OFF
|
2016-12-12 16:41:39 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
* CONTROL SECTION :
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
.DO DRV.SIZE>255
|
2016-12-15 16:49:33 +00:00
|
|
|
|
* ERROR:DRV.SIZE too big
|
2016-12-12 16:41:39 +00:00
|
|
|
|
.FIN
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KM.VSDRIVE.S
|
2016-12-12 16:41:39 +00:00
|
|
|
|
ASM
|