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 .DA CS.QUIT
L.MSG0 .DA MSG0 L.MSG0 .DA MSG0
L.MSG1 .DA MSG1 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 .DA 0
*-------------------------------------- *--------------------------------------
CS.INIT clc CS.INIT clc
@ -49,49 +51,85 @@ CS.RUN >LDYA L.MSG0
lda DEV.ID lda DEV.ID
.1 >SYSCALL GetDevByIDA .1 >SYSCALL GetDevByIDA
bcc .10 bcs .7
jmp .71
.10 >STYA pDev
>STYA ZPPTR1 >STYA ZPPTR1
ldy #S.DEV.DRV.JMP+1 jsr DumpHeader
>PUSHB (pDev),y
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 dey
>PUSHB (pDev),y >PUSHB (ZPPTR1),y
lda #S.DEV.NAME lda #S.DEV.NAME
clc clc
adc pDev adc ZPPTR1
tay tay
lda /S.DEV.NAME lda /S.DEV.NAME
adc pDev+1 adc ZPPTR1+1
>PUSHYA >PUSHYA
ldy #S.DEV.F ldy #S.DEV.F
>PUSHB (pDev),y >PUSHB (ZPPTR1),y
ldy #S.DEV.S ldy #S.DEV.S
>PUSHB (pDev),y >PUSHB (ZPPTR1),y
sta DEV.S
>PUSHB DEV.ID >PUSHB DEV.ID
>LDYA L.MSG1 >LDYA L.MSG1
>SYSCALL CPrintFYA >SYSCALL CPrintFYA
bcs .9 rts
*--------------------------------------
DumpStatus bit DEV.S
bpl .1
>LDYA ZPPTR1 ldy #S.DEVSTAT.SIZE
>STYA pDev 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 .1 ldy #S.DEVSTAT.VERSION+1
jsr pDevJmp
bcs .7
>STYA ZPPTR2
ldy #S.DEVSTAT.VERSION+1
>PUSHB (ZPPTR2),y >PUSHB (ZPPTR2),y
dey dey
>PUSHB (ZPPTR2),y >PUSHB (ZPPTR2),y
@ -110,23 +148,14 @@ CS.RUN >LDYA L.MSG0
dey dey
>PUSHB (ZPPTR2),y >PUSHB (ZPPTR2),y
>LDYA L.MSG2 bit DEV.S
>SYSCALL CPrintFYA bpl .2
bcs .9
.7 lda #13 >LDYA L.MSG2.B
>SYSCALL PutCA bra .3
lda #10 .2 >LDYA L.MSG2.C
>SYSCALL PutCA
.71 inc DEV.ID .3 >SYSCALL CPrintFYA
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
rts rts
*-------------------------------------- *--------------------------------------
CS.EVENT sec CS.EVENT sec
@ -136,11 +165,14 @@ CS.QUIT clc
rts rts
*-------------------------------------- *--------------------------------------
CS.END 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 " 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.ID .BS 1
DEV.S .BS 1
DEV.SIZE .BS 4
MAN MAN
SAVE BIN/LSDEV.S SAVE BIN/LSDEV.S
ASM ASM

View File

@ -28,20 +28,6 @@ AUTO 6
* A = Param Count * A = Param Count
*-------------------------------------- *--------------------------------------
jmp A2osX.MLICALL1 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-* .BS $BD10-*
*-------------------------------------- *--------------------------------------
@ -103,53 +89,37 @@ A2osX.MLICALL1 stx .1
jsr GO.A2osX jsr GO.A2osX
rts rts
*-------------------------------------- *--------------------------------------
* BLKCALL.PARAMS * A2osX.DIIDrv,A2osX.BlkDrv
* (To be moved to MainZP/LC For DII) * X = DEVMGR.cmd
* Y,A = PTR to Params
* pDev -> Dev Header
* $42 Command Number * $42 Command Number
* $43 Unit Number * $43 Unit Number
* $44-$45 Buffer Pointer * $44-$45 Buffer Pointer
* $46-$47 Block Number * $46-$47 Block Number
* X = DEVMGR.cmd
* pDev -> Dev Header
*-------------------------------------- *--------------------------------------
A2osX.BLKCALL1 >STYA .2+1 setup device entry point $Cnxx A2osX.DIIDrv .DA A2osX.DIIDrv.S status
.DA A2osX.DIIDrv.RW Read
jsr GO.ProDOS .DA A2osX.DIIDrv.RW Write
.DA A2osX.DRV.BadCall Format
ldx #5 .DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.1 lda BLKCALL.PARAMS,x .DA A2osX.DRV.BadCall
sta $42,x setup ZP in main memory for this block device call .DA A2osX.DRV.BadCall
dex .DA A2osX.DRV.BadCall
bpl .1 .DA A2osX.DRV.BadCall
.DA A2osX.DRV.BadCall
.2 jsr $ffff *--------------------------------------
A2osX.DIIDrv.S >LDYAI A2osx.DIIStat
jsr GO.A2osX clc
rts rts
*-------------------------------------- *--------------------------------------
A2osX.DIIDrv txa Status ? A2osX.DIIDrv.RW jsr A2osX.Prt2Blk
beq .2
jsr GO.ProDOS 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 $D000
jsr GO.A2osX jsr GO.A2osX
rts rts
.2 >LDYAI A2osx.DIIStat
clc
rts
*-------------------------------------- *--------------------------------------
A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA 280 .DA 280
@ -160,7 +130,45 @@ A2osx.DIIStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.DA #0 .DA #0
.DA #0,#9 .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 .BS 3
>PSTR "Generic Blk Dev" >PSTR "Generic Blk Dev"
.BS 1 .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
.DA #0,#9 .DA #0,#9
*-------------------------------------- *--------------------------------------
* Smartport Call A2osX.Prt2Blk >STYA ZPDRV Get Ptr To ParamList
*-------------------------------------- jsr A2osX.Prt2Blk.NoParam
A2osX.PRTCALL1 >STYA .1+1
txa ldy #3
lsr
sta .2 .1 lda (ZPDRV),y
tax sta ($44),y
lda A2osX.PRTCALL.Cnt,x dey
sta PRTCALL.PARAMS bpl .1
.1 jsr $ffff rts
.2 .BS 1 CMD
.DA PRTCALL.PARAMS 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 rts
A2osX.PRTCALL.Cnt
.HS 03030301030101010404
*-------------------------------------- *--------------------------------------
GO.ProDOS lda $D000 We re coming from AUXLC, saving bank... GO.ProDOS lda $D000 We re coming from AUXLC, saving bank...
sta GO.A2osX.BNK+1 sta GO.A2osX.BNK+1

View File

@ -252,10 +252,13 @@ DEVSIG.Value .HS 38180120D6
DevMgrInit stz ZPPtr1 DevMgrInit stz ZPPtr1
lda #$C1 lda #$C1
sta ZPPtr1+1 sta ZPPtr1+1
lda #'1' lda #1
sta DEV.HEADER+S.DEV.NAME+4 S1Dy 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 .2 ldy SmartPort.OFS,x Check if there is a smartport firmware
lda (ZPPtr1),y lda (ZPPtr1),y
@ -292,7 +295,7 @@ DevMgrInit stz ZPPtr1
tya tya
sta A2osX.SLOTS,x sta A2osX.SLOTS,x
.8 inc DEV.HEADER+5 .8 inc DEV.HEADER+S.DEV.BUSID
inc ZPPtr1+1 inc ZPPtr1+1
lda ZPPtr1+1 lda ZPPtr1+1
cmp #$C8 cmp #$C8
@ -301,6 +304,28 @@ DevMgrInit stz ZPPtr1
clc clc
rts 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 DevMgrInit.SP ldy #$ff
lda (ZPPtr1),y lda (ZPPtr1),y
clc clc
@ -341,28 +366,30 @@ DevMgrInit.SP ldy #$ff
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
DevMgrInit.DII >LDYAI A2osX.DIIDrv
>STYA DEV.HEADER+S.DEV.ROM.JMP
rts
*--------------------------------------
DevMgrInit.BLK
rts
*--------------------------------------
DevMgrInit.AddDev DevMgrInit.AddDev
lda DevMgr.Count lda DevMgr.Count
cmp #K.DEV.MAX cmp #K.DEV.MAX
beq .9 beq .9
inc DevMgr.Count inc DevMgr.Count
jsr K.GetDevByIDA >SYSCALL GetDevByIDA
>STYA ZPPtr1 >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 ldy #S.DEV-1
.1 lda DEV.HEADER,y .1 lda DEV.HEADER,y
sta (ZPPtr1),y sta (ZPPtr2),y
dey dey
bne .1 bpl .1
clc clc
rts rts
@ -394,28 +421,6 @@ SP.DEV.STATUS .DA #3
SP.STATUS1 .BS 4 SP.STATUS1 .BS 4
SP.STATUS2 .BS S.DEVSTAT 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 EvtMgrInit lda #$A5
sta A2osX.TIMER16 sta A2osX.TIMER16
lda #$9B lda #$9B