Kernel version 0.9 : Implementing Block Device Support

This commit is contained in:
Rémy GIBERT 2017-03-14 17:47:02 +01:00
parent 99f27d1c23
commit 6324272f4f
6 changed files with 91 additions and 54 deletions

Binary file not shown.

Binary file not shown.

View File

@ -45,16 +45,13 @@ CS.INIT clc
CS.RUN >LDYA L.MSG0
>SYSCALL CPrintFYA
>LDYAI DevMgr.Table
>STYA ZPPTR1
stz DEV.ID
.1 lda DEV.ID
lda DEV.ID
>SYSCALL GetDevByIDA
.1 >SYSCALL GetDevByIDA
bcc .10
jmp .8
jmp .71
.10 >STYA ZPPTR1
@ -125,16 +122,12 @@ CS.RUN >LDYA L.MSG0
>SYSCALL PutCA
lda #10
>SYSCALL PutCA
inc DEV.ID
lda ZPPTR1
clc
adc #S.DEV
sta ZPPTR1
bcc .3
inc ZPPTR1+1
.3 jmp .1
.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

View File

@ -104,11 +104,14 @@ A2osX.MLICALL1 stx .1
jsr GO.A2osX
rts
*--------------------------------------
* BLKCALL.PARAMS moved to MainZP/LC
* BLKCALL.PARAMS
* (To be moved to MainZP/LC For DII)
* $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
@ -117,7 +120,7 @@ A2osX.BLKCALL1 >STYA .2+1 setup device entry point $Cnxx
ldx #5
.1 lda BLKCALL.PARAMS,x
sta $42,x setup ZP in main memory for this block device calll
sta $42,x setup ZP in main memory for this block device call
dex
bpl .1
@ -126,6 +129,46 @@ A2osX.BLKCALL1 >STYA .2+1 setup device entry point $Cnxx
jsr GO.A2osX
rts
*--------------------------------------
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
clc
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"
.BS 4
.DA #S.DEVSTAT.TYPE.5.25
.DA #0
.DA #0,#9
*--------------------------------------
A2osx.GenStat .DA #S.DEVSTAT.S.BLOCK+S.DEVSTAT.S.WRITE+S.DEVSTAT.S.READ
.BS 3
>PSTR "Generic Blk Dev"
.BS 1
.DA #S.DEVSTAT.TYPE.HD
.DA #0
.DA #0,#9
*--------------------------------------
* Smartport Call
*--------------------------------------
A2osX.PRTCALL1 >STYA .1+1

View File

@ -146,7 +146,6 @@ DevMgr.SYS .DA DevMgr.SYS.Code
SETMOUSE .EQ $12 Sets mouse mode
SERVEMOUSE .EQ $13 Services mouse interrupt
READMOUSE .EQ $14 Reads mouse position
INITMOUSE .EQ $19 Resets mouse clamps to default values,sets mouse position to 0,0
*--------------------------------------
IrqMgrInit php
sei
@ -214,10 +213,6 @@ IrqMgrInit php
bit RROMBNK2 Renable ROM to allow MOUSE II firmware works properly
* ldy #INITMOUSE Reset
* jsr GOMOUSE
* bcs *
ldx K.IrqMgrVBL.0n
lda $7F8,x
and #$0F
@ -252,7 +247,7 @@ DevMgrInit stz ZPPtr1
lda #$C1
sta ZPPtr1+1
lda #'1'
sta SP.DEV+5 S1Dy
sta DEV.HEADER+5 S1Dy
.1 ldx #SmartPort.SIG-SmartPort.OFS-1
@ -291,7 +286,7 @@ DevMgrInit stz ZPPtr1
tya
sta A2osX.SLOTS,x
.8 inc SP.DEV+5
.8 inc DEV.HEADER+5
inc ZPPtr1+1
lda ZPPtr1+1
cmp #$C8
@ -306,11 +301,11 @@ DevMgrInit.SP ldy #$ff
adc #3 Compute smartport entry point
sta .1+1
sta .3+1
sta SP.DEV+S.DEV.JMP
sta DEV.HEADER+S.DEV.JMP
lda ZPPtr1+1
sta .1+2
sta .3+2
sta SP.DEV+S.DEV.JMP+1
sta DEV.HEADER+S.DEV.JMP+1
.1 jsr $ffff Self Modified
.DA #0 Status
@ -320,23 +315,23 @@ DevMgrInit.SP ldy #$ff
beq .9 no device
.2 lda #1
sta SP.DEV.STATUS+1
sta DEV.HEADER.STATUS+1
lda #'1'
sta SP.DEV+7 SxD1
sta DEV.HEADER+7 SxD1
.3 jsr $ffff Self Modified
.DA #0 Status
.DA SP.DEV.STATUS
.DA DEV.HEADER.STATUS
bcs .7
lda SP.STATUS2+S.DEVSTAT.S
sta SP.DEV+S.DEV.S
sta DEV.HEADER+S.DEV.S
.7 inc SP.DEV+7
.7 inc DEV.HEADER+7
dec SP.STATUS1
bne .3
@ -350,20 +345,28 @@ DevMgrInit.BLK
*--------------------------------------
DevMgrInit.AddDev
lda DevMgr.Count
cmp #K.DEV.MAX
beq .9
inc DevMgr.Count
jsr K.GetDevByIDA
>STYA ZPPtr1
ldy #S.DEV-1
.1 lda SP.DEV,y
.1 lda DEV.HEADER,y
sta (ZPPtr1),y
dey
bne .1
clc
rts
.9 lda #DEVMGR.ERROOH
sec
rts
*--------------------------------------
SP.DEV .BS 2 JMP
.DA #S.DEV.S.BLOCK S
DEV.HEADER .BS 2 JMP
DEV.HEADER.STATUS .DA #S.DEV.S.BLOCK S
>PSTR "S1D1" 5 bytes
*--------------------------------------
SmartPort.OFS .HS 07010305

View File

@ -19,9 +19,9 @@ ZPPtr1 .EQ ZPKERNEL Temp Ptrs for use in very limited scope
ZPPtr2 .EQ ZPKERNEL+2 (could be trashed by any JSR)
ZPPtr3 .EQ ZPKERNEL+4
ZPPtr4 .EQ ZPKERNEL+6
*--------------------------------------
* Kernel Init Stage 2
*--------------------------------------
sei
ldx #$FF init 6502 stack to highest
txs
@ -36,9 +36,9 @@ ZPPtr4 .EQ ZPKERNEL+6
jsr Kernel.Init2
>DEBUGOA
*--------------------------------------
* Kernel Init Stage 3
*--------------------------------------
sta SETALTZP
bit RRAMWRAMBNK1
bit RRAMWRAMBNK1
@ -49,15 +49,15 @@ ZPPtr4 .EQ ZPKERNEL+6
.INB SYS/KERNEL.S.INIT3
*--------------------------------------
* Global Page
*--------------------------------------
A2osX.GP .EQ *
.PH $BD00
.INB SYS/KERNEL.S.GP
.EP
A2osX.GP.END .EQ *
*--------------------------------------
* LC AUX $D000 BANK1 API Calls $00-$3E
*--------------------------------------
A2osX.D001 .EQ *
.PH $D000
.DA #RRAMWRAMBNK1
@ -67,14 +67,14 @@ A2osX.D001 .EQ *
.INB SYS/KERNEL.S.TIME
.INB SYS/KERNEL.S.FILE
.INB SYS/KERNEL.S.DIR
*--------------------------------------
.INB SYS/KERNEL.S.PFT
.INB SYS/KERNEL.S.BIN
.EP
A2osX.D001.END .EQ *
*--------------------------------------
* LC AUX $D000 BANK2 API Calls $40-$8E
*--------------------------------------
A2osX.D002 .EQ *
.PH $D000
.DA #RRAMWRAMBNK2
@ -84,15 +84,15 @@ A2osX.D002 .EQ *
.INB SYS/KERNEL.S.PS
.INB SYS/KERNEL.S.ARG
.INB SYS/KERNEL.S.ENV
*--------------------------------------
.INB SYS/KERNEL.S.RUN
.INB SYS/KERNEL.S.EVT
.INB SYS/KERNEL.S.TSK
.EP
A2osX.D002.END .EQ *
*--------------------------------------
* LC AUX $E000 API Calls $80-$FE
*--------------------------------------
A2osX.E000 .EQ *
.PH $E000
.INB SYS/KERNEL.S.JMP
@ -111,22 +111,20 @@ PullPtr1Ptr2 clc
bcc .9
>PULLW ZPPtr3
.9 rts
*--------------------------------------
* Make sure KERNEL.S.D01 is the last one
*--------------------------------------
.INB SYS/KERNEL.S.D01
.EP
A2osX.E000.END .EQ *
*--------------------------------------
* CONTROL SECTION :
*--------------------------------------
.LIST ON
*--------------------------------------
A2osX.GP.SIZE .EQ A2osX.GP.END-A2osX.GP
A2osX.D001.SIZE .EQ A2osX.D001.END-A2osX.D001
A2osX.D002.SIZE .EQ A2osX.D002.END-A2osX.D002
A2osX.E000.SIZE .EQ A2osX.E000.END-A2osX.E000
*--------------------------------------
.LIST OFF
.DO A2osX.GP.SIZE>$1E0
.LIST ON
@ -143,7 +141,7 @@ A2osX.E000.SIZE .EQ A2osX.E000.END-A2osX.E000
* !!!!!!!!! ERROR:BNK2 too big !!!!!!!!
.LIST OFF
.FIN
*--------------------------------------
MAN
SAVE SYS/KERNEL.S
ASM