Kernel 0.9.2

This commit is contained in:
Rémy GIBERT 2018-07-06 16:42:20 +02:00
parent 2ee872a48b
commit 3b1a5ae4da
4 changed files with 146 additions and 219 deletions

Binary file not shown.

Binary file not shown.

View File

@ -39,6 +39,11 @@ XFer .EQ $C314 CS:M->X, VS:Use Aux ZP
*--------------------------------------
* $42-$47 ProDOS Block Device Drivers Main
*--------------------------------------
DRV.BLK.Cmd .EQ $42
DRV.BLK.UnitNum .EQ $43
DRV.BLK.Buf .EQ $44
DRV.BLK.BlkNum .EQ $47
*--------------------------------------
* $5E-$C8 RESERVED APPLESOFT Main/Aux (ROM Call, no need to switch back MainZP)
*--------------------------------------
SIGNFLG .EQ $16 COS,SIN,TAN

View File

@ -5,18 +5,14 @@ AUTO 4,1
* DRV.DiskII
* X = IOCTL
* Y,A = PTR to S.IOCTL
* pDev -> Dev Header AUX!!!
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
*--------------------------------------
DRV.DiskII cld
>STYA pIOCTL
jmp (.1,x)
.1 .DA DRV.DiskII.S status
.DA DRV.DiskII.RW Read
.DA DRV.DiskII.RW Write
.DA A2osX.BadCall Format
.1 .DA DRV.DiskII.STATUS
.DA DRV.BLK READ
.DA DRV.BLK WRITE
.DA A2osX.BadCall FORMAT
.DA A2osX.BadCall
.DA A2osX.BadCall
.DA A2osX.BadCall
@ -25,37 +21,12 @@ DRV.DiskII cld
.DA A2osX.BadCall
.DA A2osX.BadCall IRQ
*--------------------------------------
DRV.DiskII.S >LDYAI DRV.DiskII.Stat
clc
rts
DRV.DiskII.STATUS
>LDYAI DRV.DiskII.DSTAT
jmp DRV.STATUS.YA
*--------------------------------------
DRV.DiskII.RW >STYA A2osX.RW.SrcDst+1
jsr DRV.BlkDevice.GetCmdAndDevAX
*--------------------------------------
ldy #$D0
.HS 2C bit abs
A2osX.RamDrv.RW1
ldy #$FF
sty A2osX.RW.Drv+2
jsr GO.ProDOS
stx $42
sta $43
ldy #3
A2osX.RW.SrcDst lda $ffff,y Self Modified
sta $44,y
dey
bpl A2osX.RW.SrcDst
A2osX.RW.Drv jsr $0000
cli
jsr GO.A2osX
rts
*--------------------------------------
DRV.DiskII.Stat .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
DRV.DiskII.DSTAT
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
.DA 280
.DA #0
>PSTR "Disk II 5.25"
@ -67,18 +38,14 @@ DRV.DiskII.Stat .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
* DRV.RamDrive
* X = IOCTL
* Y,A = PTR to S.IOCTL
* pDev -> Dev Header AUX!!!
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
*--------------------------------------
DRV.RamDrive cld
>STYA pIOCTL
jmp (.1,x)
.1 .DA DRV.RamDrive.S status
.DA DRV.RamDrive.RW Read
.DA DRV.RamDrive.RW Write
.DA A2osX.BadCall Format
.1 .DA DRV.RamDrive.STATUS
.DA DRV.BLK READ
.DA DRV.BLK WRITE
.DA DRV.BLK FORMAT
.DA A2osX.BadCall
.DA A2osX.BadCall
.DA A2osX.BadCall
@ -87,25 +54,18 @@ DRV.RamDrive cld
.DA A2osX.BadCall
.DA A2osX.BadCall IRQ
*--------------------------------------
DRV.RamDrive.S jsr DRV.BlkDevice.GetCmdAndDevAX
jsr GO.ProDOS
stx $42
sta $43
jsr $FF00
jsr GO.A2osX
DRV.RamDrive.STATUS
jsr DRV.Blk
bcs .9
stx DRV.RamDrive.Stat+S.DSTAT.SIZE
sty DRV.RamDrive.Stat+S.DSTAT.SIZE+1
stx DRV.RamDrive.DSTAT+S.DSTAT.SIZE
sty DRV.RamDrive.DSTAT+S.DSTAT.SIZE+1
>LDYAI DRV.RamDrive.DSTAT
jmp DRV.STATUS.YA
>LDYAI DRV.RamDrive.Stat
clc
.9 rts
*--------------------------------------
DRV.RamDrive.RW >STYA A2osX.RW.SrcDst+1
jsr DRV.BlkDevice.GetCmdAndDevAX
bra A2osX.RamDrv.RW1
*--------------------------------------
DRV.RamDrive.Stat
DRV.RamDrive.DSTAT
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
.BS 3
>PSTR "ProDOS /RAM Disk"
@ -116,18 +76,14 @@ DRV.RamDrive.Stat
* DRV.BlkDevice
* X = IOCTL
* Y,A = PTR to S.IOCTL
* pDev -> Dev Header
* $42 Command Number
* $43 Unit Number
* $44-$45 Buffer Pointer
* $46-$47 Block Number
*--------------------------------------
DRV.BlkDevice cld
>STYA pIOCTL
jmp (.1,x)
.1 .DA DRV.BlkDevice.S status
.DA DRV.BlkDevice.RW
.DA DRV.BlkDevice.RW
.DA DRV.BlkDevice.F
.1 .DA DRV.BlkDevice.STATUS
.DA DRV.BLK READ
.DA DRV.BLK WRITE
.DA DRV.BLK FORMAT
.DA A2osX.BadCall
.DA A2osX.BadCall
.DA A2osX.BadCall
@ -136,54 +92,30 @@ DRV.BlkDevice cld
.DA A2osX.BadCall
.DA A2osX.BadCall IRQ
*--------------------------------------
DRV.BlkDevice.S jsr DRV.BlkDevice.GetCmdAndDev
jsr DRV.BlkDevice.Go
DRV.BlkDevice.STATUS
jsr DRV.Blk
bcs .9
stx DRV.BlkDevice.Stat+S.DSTAT.SIZE
sty DRV.BlkDevice.Stat+S.DSTAT.SIZE+1
stx DRV.BlkDevice.DSTAT+S.DSTAT.SIZE
sty DRV.BlkDevice.DSTAT+S.DSTAT.SIZE+1
>LDYAI DRV.BlkDevice.Stat
clc
>LDYAI DRV.BlkDevice.DSTAT
jmp DRV.STATUS.YA
.9 rts
*--------------------------------------
DRV.BlkDevice.RW
>STYA DRV.BlkDevice.GetParam.1+1
jsrDRV.BlkDevice.GetCmdAndDev
jsr DRV.BlkDevice.GetParam
bra DRV.BlkDevice.Go
DRV.BlkDevice.DSTAT
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
.BS 3
>PSTR "ProDOS Block Dev"
.DA #S.DSTAT.T.PRODOS
.DA #0
.DA KVER
*--------------------------------------
DRV.BlkDevice.F jsr DRV.BlkDevice.GetCmdAndDev
DRV.BlkDevice.Go
ldy #S.NODE.DEV.BUSPTR
lda (pDev),y
sta .8+1
iny
lda (pDev),y
sta .8+2
.8 jmp $ffff
* IOCTL to BLK protocol converter
* in : pIOCTL (AUX)
*--------------------------------------
DRV.BlkDevice.GetParam
ldy #3
DRV.BlkDevice.GetParam.1
lda $ffff,y Self Modified
sta $44,y
dey
bpl DRV.BlkDevice.GetParam.1
rts
*--------------------------------------
DRV.BlkDevice.GetCmdAndDev
jsr DRV.BlkDevice.GetCmdAndDevAX
stx $42
sta $43
rts
DRV.BlkDevice.GetCmdAndDevAX
txa
DRV.BLK txa
lsr
tax CMD
sta DRV.BLK.PARAMS CMD
ldy #S.NODE.DEV.DEVID Drive 1, or 2
lda (pDev),y
@ -201,81 +133,69 @@ DRV.BlkDevice.GetCmdAndDevAX
plp
ror DSSS0000
sta DRV.BLK.PARAMS+1 UNITNUM
ldx #3
ldy #S.IOCTL.BUFPTR+3
.1 lda (pIOCTL),y BUF,BLKNUM
sta DRV.BLK.PARAMS+2,x
dey
dex
bpl .1
ldy #S.NODE.DEV.BUSPTR
lda (pNode),y
sta .3+1
iny
lda (pNode),y
sta .3+2
jsr GO.ProDOS
ldx #5
.2 lda DRV.BLK.PARAMS,x
sta $42,x
dex
bpl .2
.3 jsr $ffff SELF MODIFIED
jsr GO.A2osX
rts
*--------------------------------------
DRV.BlkDevice.Stat
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
.BS 3
>PSTR "ProDOS Block Dev"
.DA #S.DSTAT.T.PRODOS
.DA #0
.DA KVER
DRV.BLK.PARAMS .BS 6
*--------------------------------------
* Smartport Driver
*--------------------------------------
DRV.SmartPort cld
jmp (.1,x)
.1 .DA DRV.SmartPort.S STATUS
.DA DRV.SmartPort.P BR
.DA DRV.SmartPort.P BW
.DA DRV.SmartPort.NP FORMAT
.DA DRV.SmartPort.P CONTROL
.DA DRV.SmartPort.NP INIT
.DA DRV.SmartPort.NP OPEN
.DA DRV.SmartPort.NP CLOSE
.DA DRV.SmartPort.P R
.DA DRV.SmartPort.P W
.DA A2osX.BADCALL IRQ
*--------------------------------------
DRV.SmartPort.S jsr DRV.SmartPort.GetDev
>LDYAI K.S.DSTAT
>STYA K.S.IOCTL+S.IOCTL.BUFPTR
lda #S.IOCTL.STATCODE.GETDIB
sta K.S.IOCTL+S.IOCTL.CTRLCODE
jsr DRV.SmartPort.Go
bcs .9
>LDYAI K.S.DSTAT
.9 rts
*--------------------------------------
DRV.SmartPort.P jsr DRV.SmartPort.GetParam
bra DRV.SmartPort.Go
DRV.SmartPort.NP
jsr DRV.SmartPort.GetDev
*--------------------------------------
DRV.SmartPort.Go
>STYA DRV.SmartPort.Go.IOCTL
txa
lsr
sta DRV.SmartPort.Go.Cmd
tax
lda DRV.SmartPort.Cnt,x
sta DRV.SmartPort.Go.Cmd
ldy #S.NODE.DEV.BUSPTR
lda (pDev),y
lda (pNode),y
sta .8+1
iny
lda (pDev),y
lda (pNode),y
sta .8+2
.8 jsr $ffff
DRV.SmartPort.Go.Cmd
.BS 1
.DA K.S.IOCTL
DRV.SmartPort.Go.IOCTL
.BS 2
rts
*--------------------------------------
DRV.SmartPort.GetParam
>STYA ZPDRV Get Ptr To ParamList
jsr DRV.BlkDevice.GetCmdAndDev
ldy #7
.1 lda (ZPDRV),y
sta K.S.IOCTL+2,y
dey
bpl .1
rts
*--------------------------------------
DRV.SmartPort.GetDev
txa
lsr
sta DRV.SmartPort.Go.Cmd
tax
lda DRV.SmartPort.Cnt,x
sta K.S.IOCTL+S.IOCTL.CNT
rts
DRV.SmartPort.Cnt
.HS 03030301030101010404
*--------------------------------------
@ -284,6 +204,7 @@ DRV.SmartPort.Cnt
* - READ returns EOF.
*--------------------------------------
DRV.NULL cld
>STYA pIOCTL
jmp (.1,x)
*--------------------------------------
.1 .DA DRV.NULL.STATUS
@ -298,41 +219,10 @@ DRV.NULL cld
.DA DRV.NULL.WRITE
.DA A2osX.BADCALL IRQ
*--------------------------------------
DRV.NULL.STATUS >STYA pIOCTL
DRV.NULL.STATUS >LDYAI DRV.NULL.DSTAT
jmp DRV.STATUS.YA
ldy #S.IOCTL.STATCODE
lda (pIOCTL),y
beq .1
cmp #S.IOCTL.STATCODE.GETDIB
bne .9
ldx #15
.HS 2C bit abs
.1 ldx #3
ldy #S.IOCTL.BUFPTR
lda (pIOCTL),y
sta .3+1
iny
lda (pIOCTL),y
sta .3+2
.2 lda DRV.NULL.DSTAT,x
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
.9 lda #MLI.E.BADCTL
sec
rts
DRV.NULL.READ >STYA pIOCTL
ldx #C.EOF
DRV.NULL.READ ldx #C.EOF
jmp DRV.READ.X
DRV.NULL.OPEN
@ -351,8 +241,9 @@ DRV.NULL.DSTAT .DA #S.DSTAT.S.WRITE+S.DSTAT.S.READ+S.DSTAT.S.OPENED
* SYS DEVICE
*--------------------------------------
DRV.SYS cld
>STYA pIOCTL
jmp (.1,x)
.1 .DA .2 STATUS
.1 .DA DRV.SYS.STATUS
.DA A2osX.BADCALL READBLOCK
.DA A2osX.BADCALL WRITEBLOCK
.DA A2osX.BADCALL FORMAT
@ -364,16 +255,8 @@ DRV.SYS cld
.DA DRV.SYS.Write
.DA A2osX.BADCALL IRQ
*--------------------------------------
.2 >LDYAI .3
clc
rts
*--------------------------------------
.3 .DA #S.DSTAT.S.WRITE+S.DSTAT.S.READ+S.DSTAT.S.OPENED
.DA #0,#0,#0
>PSTR "A2osX SYS Screen"
.DA #S.DSTAT.T.CHAR
.DA #0
.DA KVER
DRV.SYS.STATUS >LDYAI DRV.SYS.DSTAT
jmp DRV.STATUS.YA
*--------------------------------------
DRV.SYS.Open lda #DEVID.SYS
sta A2osX.SCRNDEVS+1
@ -612,12 +495,51 @@ DRV.SYS.SetBaseX
sta ZPDRV+1
rts
*--------------------------------------
DRV.SYS.DSTAT .DA #S.DSTAT.S.WRITE+S.DSTAT.S.READ+S.DSTAT.S.OPENED
.DA #0,#0,#0
>PSTR "A2osX SYS Screen"
.DA #S.DSTAT.T.CHAR
.DA #0
.DA KVER
*--------------------------------------
DRV.SYS.CH .BS 1
DRV.SYS.CV .BS 1
*--------------------------------------
DRV.SYS.BASEL .HS 00.80.00.80.00.80.00.80.28.A8.28.A8.28.A8.28.A8.50.D0.50.D0.50.D0.50.D0
DRV.SYS.BASEH .HS 08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B.08.08.09.09.0A.0A.0B.0B
*--------------------------------------
DRV.STATUS.YA >STYA .2+1
ldy #S.IOCTL.STATCODE
lda (pIOCTL),y
beq .1
cmp #S.IOCTL.STATCODE.GETDIB
bne .9
ldx #15
.HS 2C bit abs
.1 ldx #3
ldy #S.IOCTL.BUFPTR
lda (pIOCTL),y
sta .3+1
iny
lda (pIOCTL),y
sta .3+2
.2 lda $ffff,x SELF MODIFIED
.3 sta $ffff,x SELF MODIFIED
dex
bpl .2
clc
rts
.9 lda #MLI.E.BADCTL
sec
rts
*--------------------------------------
DRV.READ.X ldy #S.IOCTL.BYTECNT
lda #1
sta (pIOCTL),y