Kernel version 0.9 : Block Device Support, Disk II & Generic BLk ok

This commit is contained in:
Rémy GIBERT 2017-03-20 17:54:27 +01:00
parent 9a65e64885
commit 82b83a26e8
6 changed files with 230 additions and 144 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -35,7 +35,9 @@ CS.START cld
.DA CS.QUIT
L.MSG0 .DA MSG0
L.MSG1 .DA MSG1
L.MSG2 .DA MSG2
L.MSG2.C .DA MSG2.C
L.MSG2.B .DA MSG2.B
L.DEV.SIZE .DA DEV.SIZE
.DA 0
*--------------------------------------
CS.INIT clc
@ -49,49 +51,85 @@ CS.RUN >LDYA L.MSG0
lda DEV.ID
.1 >SYSCALL GetDevByIDA
bcc .10
jmp .71
bcs .7
.10 >STYA pDev
>STYA ZPPTR1
ldy #S.DEV.DRV.JMP+1
>PUSHB (pDev),y
jsr DumpHeader
bcs .9
lda DEV.ID
>SYSCALL GetDevByIDA
>STYA pDev
ldx #DEVMGR.STATUS
jsr pDevJmp
bcs .6
>STYA ZPPTR2
jsr DumpStatus
bcs .9
.6 lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
.7 inc DEV.ID
lda DEV.ID
cmp #K.DEV.MAX
bne .1
.8 lda #0 tell TSKMGR that all done ok, but
.9 sec we do not want to stay in memory
rts
*--------------------------------------
DumpHeader ldy #S.DEV.DRV.JMP+1
>PUSHB (ZPPTR1),y
dey
>PUSHB (pDev),y
>PUSHB (ZPPTR1),y
lda #S.DEV.NAME
clc
adc pDev
adc ZPPTR1
tay
lda /S.DEV.NAME
adc pDev+1
adc ZPPTR1+1
>PUSHYA
ldy #S.DEV.F
>PUSHB (pDev),y
>PUSHB (ZPPTR1),y
ldy #S.DEV.S
>PUSHB (pDev),y
>PUSHB (ZPPTR1),y
sta DEV.S
>PUSHB DEV.ID
>LDYA L.MSG1
>SYSCALL CPrintFYA
bcs .9
rts
*--------------------------------------
DumpStatus bit DEV.S
bpl .1
>LDYA ZPPTR1
>STYA pDev
ldy #S.DEVSTAT.SIZE
lda (ZPPTR2),y
sta DEV.SIZE
iny
lda (ZPPTR2),y
sta DEV.SIZE+1
iny
lda (ZPPTR2),y
sta DEV.SIZE+2
>PUSHW L.DEV.SIZE
ldx #DEVMGR.STATUS
jsr pDevJmp
bcs .7
>STYA ZPPTR2
ldy #S.DEVSTAT.VERSION+1
.1 ldy #S.DEVSTAT.VERSION+1
>PUSHB (ZPPTR2),y
dey
>PUSHB (ZPPTR2),y
@ -110,23 +148,14 @@ CS.RUN >LDYA L.MSG0
dey
>PUSHB (ZPPTR2),y
>LDYA L.MSG2
>SYSCALL CPrintFYA
bcs .9
bit DEV.S
bpl .2
.7 lda #13
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
>LDYA L.MSG2.B
bra .3
.2 >LDYA L.MSG2.C
.71 inc DEV.ID
lda DEV.ID
cmp #K.DEV.MAX
beq .8
jmp .1
.8 lda #0 tell TSKMGR that all done ok, but
.9 sec we do not want to stay in memory
.3 >SYSCALL CPrintFYA
rts
*--------------------------------------
CS.EVENT sec
@ -136,11 +165,14 @@ CS.QUIT clc
rts
*--------------------------------------
CS.END
MSG0 >CSTR "ID Status Flags Name Addr. Typ/Sub IDString Version\r\n"
MSG0 >CSTR "ID Status Flags Name Addr. Typ/Sub IDString Version Size (BLK)\r\n"
MSG1 >CSTR "%03d %b %b %4S $%H "
MSG2 >CSTR "$%h/$%h %16S %03d.%03d"
MSG2.B >CSTR "$%h/$%h %16S %03d.%03d %10u"
MSG2.C >CSTR "$%h/$%h %16S %03d.%03d n/a"
*--------------------------------------
DEV.ID .BS 1
DEV.S .BS 1
DEV.SIZE .BS 4
MAN
SAVE BIN/LSDEV.S
ASM

View File

@ -28,20 +28,6 @@ AUTO 6
* A = Param Count
*--------------------------------------
jmp A2osX.MLICALL1
*--------------------------------------
* BLKCALL (AUXLC to MAINLC)
* Used by Kernel
* In:
* Y,A = Ptr To Param Block
*--------------------------------------
jmp A2osX.BLKCALL1
*--------------------------------------
* PRTCALL (AUXLC to MAINLC)
* Used by Kernel
* In:
* Y,A = Ptr To Param Block
*--------------------------------------
jmp A2osX.PRTCALL1
*--------------------------------------
.BS $BD10-*
*--------------------------------------
@ -103,55 +89,39 @@ A2osX.MLICALL1 stx .1
jsr GO.A2osX
rts
*--------------------------------------
* BLKCALL.PARAMS
* (To be moved to MainZP/LC For DII)
* A2osX.DIIDrv,A2osX.BlkDrv
* X = DEVMGR.cmd
* Y,A = PTR to Params
* pDev -> Dev Header
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
* X = DEVMGR.cmd
* pDev -> Dev Header
*--------------------------------------
A2osX.BLKCALL1 >STYA .2+1 setup device entry point $Cnxx
jsr GO.ProDOS
ldx #5
.1 lda BLKCALL.PARAMS,x
sta $42,x setup ZP in main memory for this block device call
dex
bpl .1
.2 jsr $ffff
jsr GO.A2osX
rts
A2osX.DIIDrv .DA A2osX.DIIDrv.S status
.DA A2osX.DIIDrv.RW Read
.DA A2osX.DIIDrv.RW Write
.DA A2osX.DRV.BadCall Format
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
*--------------------------------------
A2osX.DIIDrv txa Status ?
beq .2
jsr GO.ProDOS
asl
sta $42
ldx #5
.1 lda BLKCALL.PARAMS,x
sta $42,x setup ZP in main memory for this block device call
dex
bne .1
jsr $D000
jsr GO.A2osX
rts
.2 >LDYAI A2osx.DIIStat
A2osX.DIIDrv.S >LDYAI A2osx.DIIStat
clc
rts
*--------------------------------------
A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
A2osX.DIIDrv.RW jsr A2osX.Prt2Blk
jsr GO.ProDOS
jsr $D000
jsr GO.A2osX
rts
*--------------------------------------
A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA 280
.DA #0
>PSTR "DISK II 5.25"
@ -160,7 +130,45 @@ A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA #0
.DA #0,#9
*--------------------------------------
A2osx.GenStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
* Generic Blk Device
*--------------------------------------
A2osX.BlkDrv .DA A2osX.BlkDrv.S status
.DA A2osX.BlkDrv.RW
.DA A2osX.BlkDrv.RW
.DA A2osX.BlkDrv.F
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
*--------------------------------------
A2osX.BlkDrv.S jsr A2osX.Prt2Blk.NoParam
jsr A2osX.BlkDrv.Go
bcs *
stx A2osx.BlkStat+S.DEVSTAT.SIZE
sty A2osx.BlkStat+S.DEVSTAT.SIZE+1
>LDYAI A2osx.BlkStat
clc
rts
*--------------------------------------
A2osX.BlkDrv.RW jsr A2osX.Prt2Blk
bra A2osX.BlkDrv.Go
*--------------------------------------
A2osX.BlkDrv.F jsr A2osX.Prt2Blk.NoParam
A2osX.BlkDrv.Go ldy #S.DEV.ROM.JMP
lda (pDev),y
sta .8+1
iny
lda (pDev),y
sta .8+2
.8 jmp $ffff
*--------------------------------------
A2osx.BlkStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.BS 3
>PSTR "Generic Blk Dev"
.BS 1
@ -168,21 +176,62 @@ A2osx.GenStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA #0
.DA #0,#9
*--------------------------------------
* Smartport Call
*--------------------------------------
A2osX.PRTCALL1 >STYA .1+1
txa
lsr
sta .2
tax
lda A2osX.PRTCALL.Cnt,x
sta PRTCALL.PARAMS
.1 jsr $ffff
.2 .BS 1 CMD
.DA PRTCALL.PARAMS
A2osX.Prt2Blk >STYA ZPDRV Get Ptr To ParamList
jsr A2osX.Prt2Blk.NoParam
ldy #3
.1 lda (ZPDRV),y
sta ($44),y
dey
bpl .1
rts
A2osX.Prt2Blk.NoParam
txa
asl
sta $42 CMD
ldy #S.DEV.DEVID Drive 1, or 2
lda (pDev),y
dec O or 1
lsr in Carry
php
ldy #S.DEV.BUSID
lda (pDev),y
asl
asl
asl
asl
asl
plp
ror
sta $43 DSSS0000
rts
*--------------------------------------
* Smartport
*--------------------------------------
*A2osX.PrtDrv >STYA .1+1
* txa
* beq STATUS
* lsr
* sta .2
* tax
* lda A2osX.PRTCALL.Cnt,x
* sta PRTCALL.PARAMS
*.1 jsr $ffff
*.2 .BS 1 CMD
* .DA PRTCALL.PARAMS
* rts
*A2osX.PRTCALL.Cnt
* .HS 03030301030101010404
*--------------------------------------
A2osX.DRV.BadCall
lda #MLI.ERR.BADCALL
sec
rts
A2osX.PRTCALL.Cnt
.HS 03030301030101010404
*--------------------------------------
GO.ProDOS lda $D000 We re coming from AUXLC, saving bank...
sta GO.A2osX.BNK+1

View File

@ -252,10 +252,13 @@ DEVSIG.Value .HS 38180120D6
DevMgrInit stz ZPPtr1
lda #$C1
sta ZPPtr1+1
lda #'1'
sta DEV.HEADER+S.DEV.NAME+4 S1Dy
lda #1
sta DEV.HEADER+S.DEV.BUSID
.1 ldx #SmartPort.SIG-SmartPort.OFS-1
.1 lda #1
sta DEV.HEADER+S.DEV.DEVID
ldx #SmartPort.SIG-SmartPort.OFS-1
.2 ldy SmartPort.OFS,x Check if there is a smartport firmware
lda (ZPPtr1),y
@ -292,7 +295,7 @@ DevMgrInit stz ZPPtr1
tya
sta A2osX.SLOTS,x
.8 inc DEV.HEADER+5
.8 inc DEV.HEADER+S.DEV.BUSID
inc ZPPtr1+1
lda ZPPtr1+1
cmp #$C8
@ -301,6 +304,28 @@ DevMgrInit stz ZPPtr1
clc
rts
*--------------------------------------
DevMgrInit.DII >LDYAI A2osX.DIIDrv
>STYA DEV.HEADER+S.DEV.DRV.JMP
jsr DevMgrInit.AddDev
inc DEV.HEADER+S.DEV.DEVID
jsr DevMgrInit.AddDev
rts
*--------------------------------------
DevMgrInit.BLK sta DEV.HEADER+S.DEV.ROM.JMP
lda ZPPtr1+1
sta DEV.HEADER+S.DEV.ROM.JMP+1
>LDYAI A2osX.BlkDrv
>STYA DEV.HEADER+S.DEV.DRV.JMP
jsr DevMgrInit.AddDev
inc DEV.HEADER+S.DEV.DEVID
jsr DevMgrInit.AddDev
rts
DevMgrInit.BLK.JMP
jmp (DEV.HEADER+S.DEV.ROM.JMP)
*--------------------------------------
DevMgrInit.SP ldy #$ff
lda (ZPPtr1),y
clc
@ -341,28 +366,30 @@ DevMgrInit.SP ldy #$ff
.9 rts
*--------------------------------------
DevMgrInit.DII >LDYAI A2osX.DIIDrv
>STYA DEV.HEADER+S.DEV.ROM.JMP
rts
*--------------------------------------
DevMgrInit.BLK
rts
*--------------------------------------
DevMgrInit.AddDev
lda DevMgr.Count
cmp #K.DEV.MAX
beq .9
inc DevMgr.Count
jsr K.GetDevByIDA
>STYA ZPPtr1
>SYSCALL GetDevByIDA
>STYA ZPPtr2
lda DEV.HEADER+S.DEV.BUSID
ora #$30
sta DEV.HEADER+S.DEV.NAME+2 SnDy
lda DEV.HEADER+S.DEV.DEVID
ora #$30
sta DEV.HEADER+S.DEV.NAME+4 SxDn
ldy #S.DEV-1
.1 lda DEV.HEADER,y
sta (ZPPtr1),y
sta (ZPPtr2),y
dey
bne .1
bpl .1
clc
rts
@ -394,28 +421,6 @@ SP.DEV.STATUS .DA #3
SP.STATUS1 .BS 4
SP.STATUS2 .BS S.DEVSTAT
*--------------------------------------
SP.DRV cld
ldy #7
lda (pDev),y
and #$f
sta PRTCALL.PARAMS+1 dev
SP.DRV.lo ldy #$ff
SP.DRV.hi lda #$ff
jmp A2osX.PRTCALL
*--------------------------------------
DII.DRV cld
lda #$ff DSSS0000
cpx #DEVMGR.CONTROL
bcs .9
.9 lda #MLI.ERR.BADCALL
rts
*--------------------------------------
BLK.DRV
*--------------------------------------
EvtMgrInit lda #$A5
sta A2osX.TIMER16
lda #$9B