Kernel version 0.8 : KM.VSDRIVE, work in progress

This commit is contained in:
Rémy GIBERT 2016-12-13 17:32:37 +01:00
parent be7ee09659
commit 8f5c5f448b
5 changed files with 215 additions and 51 deletions

Binary file not shown.

Binary file not shown.

View File

@ -139,7 +139,7 @@ DumpProDOSDev >LDYA L.MSG2
sta ZPPTR2+1
cmp #$C1
bcc .8 3rd Party Driver loaded in RAM...
bcc .6 3rd Party Driver loaded in RAM...
cmp #$C8
bcs .4 In ProDOS Space.../RAM or DisK II

View File

@ -15,65 +15,190 @@ AUTO 6
*--------------------------------------
TmpPtr1 .EQ $0
TmpPtr2 .EQ $2
VS.CMD .EQ $C5 "E": Virtual Drive Command Envelope
DRV.EntryPoint .EQ $BF41
*--------------------------------------
.INB DRV/X.SER.6551.S
*--------------------------------------
VSDRIVE.Init >LDAXI VSDRIVE.MSG0
jsr VSDRIVE.Print
jsr PrintCStrAX
jsr VSDRIVE.Check
bcc .1
>LDAXI VSDRIVE.MSG1
jsr VSDRIVE.Print
jsr PrintCStrAX
rts
.1 jsr VSDRIVE.Detect
.1 jsr SSC.Detect
bcc .2
>LDAXI VSDRIVE.MSG2
jsr VSDRIVE.Print
jsr PrintCStrAX
rts
.2 jsr VSDRIVE.Install
.2 sta DRV+2 DRV.Slotn0
lsr
lsr
lsr
lsr
pha
>LDAXI VSDRIVE.MSG3
jsr VSDRIVE.Print
jsr PrintCStrAX
jsr VSDRIVE.SetSlot
bcc .3
>LDAXI VSDRIVE.MSG4
jsr PrintCStrAX
rts
.3 pha save slot
pha 2 times
>LDAXI VSDRIVE.MSG5
jsr PrintCStrAX
jsr VSDRIVE.Install
>LDAXI VSDRIVE.MSG6
jsr PrintCStrAX
>DEBUG
rts
*--------------------------------------
VSDRIVE.Check
VSDRIVE.Check bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
clc
lda $D001
eor DRV
bne .8
lda $D002
eor DRV+1
bne .8
sec
.8 bit RROMBNK1
rts
*--------------------------------------
SSC.Detect stz TmpPtr1
lda #$C1
sta TmpPtr1+1
.1 ldx #DEVSIG.Value-DEVSIG.Offset-1
.2 ldy DEVSIG.Offset,x
lda (TmpPtr1),y
cmp DEVSIG.Value,x
bne .3
dex
bpl .2
lda TmpPtr1+1
asl
asl
asl
asl
clc
rts
.3 inc TmpPtr1+1 no match, try next slot....
lda TmpPtr1+1
cmp #$C8
bne .1
.9 sec
rts
*--------------------------------------
VSDRIVE.Ping
clc
rts
*--------------------------------------
VSDRIVE.Detect
* 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
.9 clc
rts
*--------------------------------------
*--------------------------------------
VSDRIVE.Install
rts
*--------------------------------------
VSDRIVE.Print >STAX TmpPtr1
ldy #0
lda #DRV.EntryPoint
sta DEVPTRS,x
sta DEVPTRS+16,x
lda /DRV.EntryPoint
sta DEVPTRS+1,x
sta DEVPTRS+17,x
.1 lda (TmpPtr1),y
beq .9
ora #$80
jsr COUT
txa
asl
asl
asl
ldy DEVCNT
iny
sta DEVLST,y add Drv1
ora #$80
iny
sta DEVLST,y add Drv2
sty DEVCNT
txa
lsr
clc
rts
.2 inx
inx
cpx #16
bne .1
.9 jmp CROUT
rts sec from CPX
*--------------------------------------
VSDRIVE.MSG0 >CSTR "VSDRIVE ('Vitual Serial Hard Drive') Driver For A2osX"
VSDRIVE.MSG1 >CSTR "VSDRIVE Already Installed."
VSDRIVE.MSG2 >CSTR "SSC Not Detected."
VSDRIVE.MSG3 >CSTR "VSDRIVE Driver Successfully Installed."
VSDRIVE.Install ldx #9
.1 lda ProDOS.PATCH,x
sta DRV.EntryPoint,x
dex
bpl .1
bit RRAMWRAMBNK2
bit RRAMWRAMBNK2
ldx #DRV.SIZE
.2 lda DRV-1,x
sta $D000,x
dex
bne .2
bit RROMBNK1
clc
rts
*--------------------------------------
.INB X.PRINTF.S
*--------------------------------------
DEVSIG.Offset .HS 05070B0C
DEVSIG.Value .HS 38180131
VSDRIVE.MSG0 >CSTR "VSDRIVE (ADT Vitual Serial Hard Drive) Driver For A2osX\n"
VSDRIVE.MSG1 >CSTR "VSDRIVE (Or other custom Driver) Already Installed.\n"
VSDRIVE.MSG2 >CSTR "SSC Not Detected.\n"
VSDRIVE.MSG3 >CSTR "SCC Found At Slot %d.\n"
VSDRIVE.MSG4 >CSTR "No ProDOS device slot available.\n"
VSDRIVE.MSG5 >CSTR "VSDRIVE Installed 2 devices at S%dD1 & S%dD2.\n"
VSDRIVE.MSG6 >CSTR "VSDRIVE Driver Successfully Installed.\n"
*--------------------------------------
* ProDOS $BE41->$BE4B Patch for switching to BANK2 (10 bytes)
*--------------------------------------
ProDOS.PATCH .PH DRV.EntryPoint
bit RRAMWRAMBNK2
jsr $D001
bit RRAMWRAMBNK1
rts
.EP
*--------------------------------------
* Driver
*--------------------------------------
@ -82,7 +207,13 @@ VSDRIVE.MSG3 >CSTR "VSDRIVE Driver Successfully Installed."
* OP = 4 : Write drv2
* OP = 5 : Read drv2
* CMD = $CE+OP+BLKLO+BLKHI+CHKSUM
* 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
*--------------------------------------
DRV.A1L .EQ $3C
DRV.A1H .EQ $3D
DRV.A2L .EQ $3E
DRV.A2H .EQ $3F
DRV.COMMAND .EQ $42
@ -91,7 +222,7 @@ DRV.BUFF .EQ $44
DRV.BLKNUM .EQ $46
*--------------------------------------
DRV .EQ *
.PH $D001 Main LC Bnk 1 $D001->$DFFF
.PH $D001 Main LC Bnk 2 $D001->$DFFF
cld
DRV.Slotn0 ldx #$ff Self Modified
lda DRV.COMMAND
@ -118,8 +249,8 @@ DRV.Slotn0 ldx #$ff Self Modified
.9 lda #MLI.ERR.IO
rts
*--------------------------------------
DRV.DO.CMD sta DRVDRV.CmdBuf.Cmd store cmd
eor #$CE
DRV.DO.CMD sta DRV.CmdBuf.Cmd store cmd
eor #VS.CMD
sta DRV.CmdBuf.Sum
lda DRV.BLKNUM
@ -132,6 +263,12 @@ DRV.DO.CMD sta DRVDRV.CmdBuf.Cmd store cmd
eor DRV.CmdBuf.Sum
sta DRV.CmdBuf.Sum
lda DRV.BUFF
sta DRV.A2L
lda DRV.BUFF+1
inc
sta DRV.A2H
stz SSC.RESET,x
lda #SSC.CTL.B115200+SSC.CTL.8D+SSC.CTL.1S+SSC.CMD.NOP
@ -159,8 +296,15 @@ DRV.DO.CMD sta DRVDRV.CmdBuf.Cmd store cmd
iny
cpy #4
bne .2
* skip CS
iny
* Get ProDOS Date/time send from server if READ (3 or 5)
lda DRV.COMMAND
cmp #1
bne .6
* Read block
iny Skip Checksum
.3 jsr DRV.SSCGet
bcs .9
@ -170,31 +314,53 @@ DRV.DO.CMD sta DRVDRV.CmdBuf.Cmd store cmd
iny
cpy #9
bne .3
* recieve Header CS and check
jsr DRV.SSCGet
bcs .9
cmp DRV.CmdBuf.Sum
bne .9
ldy #0
.4 jsr DRV.SSCGet
bcs .9
sta (DRV.BUFF),y
iny
bne .4
.5 jsr DRV.SSCGet
bcs .9
sta (DRV.A2L),y
iny
bne .5
jsr DRV.BufCheckSum
sta DRV.CmdBuf.Sum
jsr DRV.SSCGet
bcs .9
cmp DRV.CmdBuf.Sum
bne .9
clc
rts
* Write Block
.6
clc
rts
.9 sec
rts
*--------------------------------------
DRV.CmdBuf .HS $CE
DRV.CmdBuf .DA #VS.CMD
DRV.CmdBuf.Cmd .BS 1
DRV.CmdBuf.Blk .BS 2
DRV.CmdBuf.Sum .BS 1
DRV.CmdBuf.Time .BS 4
DRV.CmdBuf.Sum .BS 1
*--------------------------------------
DRV.BufCheckSum lda DRV.BUFF
sta DRV.A2L
lda DRV.BUFF+1
inc
sta DRV.A2H
lda #0
DRV.BufCheckSum lda #0
tay
.1 eor (DRV.BUFF),y
@ -203,13 +369,13 @@ DRV.BufCheckSum lda DRV.BUFF
bne .1
rts
*--------------------------------------
DRV.SSCSend
DRV.SSCSend pha
.1 lda SSC.STATUS,x
bit #SSC.STATUS.DCD+SSC.STATUS.DSR
beq .9
and #SSC.STATUS.TDRE Outgoing char?
bne .1
beq .1
pla
sta SSC.DATA,x
@ -231,9 +397,7 @@ DRV.SSCGet
clc
rts
*--------------------------------------
.BS 4 Time,Date
.EP
*--------------------------------------
DRV.SIZE .EQ *-DRV
*--------------------------------------

View File

@ -34,7 +34,7 @@ PrintCStrAX >STAX TmpPtr1
lda (TmpPtr1),y
beq .9
cmp #'%'
bne .4
bne .5
.11 iny
lda (TmpPtr1),y