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 * $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) * $5E-$C8 RESERVED APPLESOFT Main/Aux (ROM Call, no need to switch back MainZP)
*-------------------------------------- *--------------------------------------
SIGNFLG .EQ $16 COS,SIN,TAN SIGNFLG .EQ $16 COS,SIN,TAN

View File

@ -5,18 +5,14 @@ AUTO 4,1
* DRV.DiskII * DRV.DiskII
* X = IOCTL * X = IOCTL
* Y,A = PTR to S.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 DRV.DiskII cld
>STYA pIOCTL
jmp (.1,x) jmp (.1,x)
.1 .DA DRV.DiskII.S status .1 .DA DRV.DiskII.STATUS
.DA DRV.DiskII.RW Read .DA DRV.BLK READ
.DA DRV.DiskII.RW Write .DA DRV.BLK WRITE
.DA A2osX.BadCall Format .DA A2osX.BadCall FORMAT
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall .DA A2osX.BadCall
@ -25,37 +21,12 @@ DRV.DiskII cld
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall IRQ .DA A2osX.BadCall IRQ
*-------------------------------------- *--------------------------------------
DRV.DiskII.S >LDYAI DRV.DiskII.Stat DRV.DiskII.STATUS
clc >LDYAI DRV.DiskII.DSTAT
rts jmp DRV.STATUS.YA
*-------------------------------------- *--------------------------------------
DRV.DiskII.RW >STYA A2osX.RW.SrcDst+1 DRV.DiskII.DSTAT
jsr DRV.BlkDevice.GetCmdAndDevAX .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
*--------------------------------------
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
.DA 280 .DA 280
.DA #0 .DA #0
>PSTR "Disk II 5.25" >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 * DRV.RamDrive
* X = IOCTL * X = IOCTL
* Y,A = PTR to S.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 DRV.RamDrive cld
>STYA pIOCTL
jmp (.1,x) jmp (.1,x)
.1 .DA DRV.RamDrive.S status .1 .DA DRV.RamDrive.STATUS
.DA DRV.RamDrive.RW Read .DA DRV.BLK READ
.DA DRV.RamDrive.RW Write .DA DRV.BLK WRITE
.DA A2osX.BadCall Format .DA DRV.BLK FORMAT
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall .DA A2osX.BadCall
@ -87,25 +54,18 @@ DRV.RamDrive cld
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall IRQ .DA A2osX.BadCall IRQ
*-------------------------------------- *--------------------------------------
DRV.RamDrive.S jsr DRV.BlkDevice.GetCmdAndDevAX DRV.RamDrive.STATUS
jsr GO.ProDOS jsr DRV.Blk
stx $42
sta $43
jsr $FF00
jsr GO.A2osX
bcs .9 bcs .9
stx DRV.RamDrive.Stat+S.DSTAT.SIZE stx DRV.RamDrive.DSTAT+S.DSTAT.SIZE
sty DRV.RamDrive.Stat+S.DSTAT.SIZE+1 sty DRV.RamDrive.DSTAT+S.DSTAT.SIZE+1
>LDYAI DRV.RamDrive.DSTAT
jmp DRV.STATUS.YA
>LDYAI DRV.RamDrive.Stat
clc
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
DRV.RamDrive.RW >STYA A2osX.RW.SrcDst+1 DRV.RamDrive.DSTAT
jsr DRV.BlkDevice.GetCmdAndDevAX
bra A2osX.RamDrv.RW1
*--------------------------------------
DRV.RamDrive.Stat
.DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
.BS 3 .BS 3
>PSTR "ProDOS /RAM Disk" >PSTR "ProDOS /RAM Disk"
@ -116,18 +76,14 @@ DRV.RamDrive.Stat
* DRV.BlkDevice * DRV.BlkDevice
* X = IOCTL * X = IOCTL
* Y,A = PTR to S.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 DRV.BlkDevice cld
>STYA pIOCTL
jmp (.1,x) jmp (.1,x)
.1 .DA DRV.BlkDevice.S status .1 .DA DRV.BlkDevice.STATUS
.DA DRV.BlkDevice.RW .DA DRV.BLK READ
.DA DRV.BlkDevice.RW .DA DRV.BLK WRITE
.DA DRV.BlkDevice.F .DA DRV.BLK FORMAT
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall .DA A2osX.BadCall
@ -136,54 +92,30 @@ DRV.BlkDevice cld
.DA A2osX.BadCall .DA A2osX.BadCall
.DA A2osX.BadCall IRQ .DA A2osX.BadCall IRQ
*-------------------------------------- *--------------------------------------
DRV.BlkDevice.S jsr DRV.BlkDevice.GetCmdAndDev DRV.BlkDevice.STATUS
jsr DRV.Blk
jsr DRV.BlkDevice.Go
bcs .9 bcs .9
stx DRV.BlkDevice.Stat+S.DSTAT.SIZE stx DRV.BlkDevice.DSTAT+S.DSTAT.SIZE
sty DRV.BlkDevice.Stat+S.DSTAT.SIZE+1 sty DRV.BlkDevice.DSTAT+S.DSTAT.SIZE+1
>LDYAI DRV.BlkDevice.Stat >LDYAI DRV.BlkDevice.DSTAT
clc jmp DRV.STATUS.YA
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
DRV.BlkDevice.RW DRV.BlkDevice.DSTAT
>STYA DRV.BlkDevice.GetParam.1+1 .DA #S.DSTAT.S.BLOCK+S.DSTAT.S.WRITE+S.DSTAT.S.READ
.BS 3
jsrDRV.BlkDevice.GetCmdAndDev >PSTR "ProDOS Block Dev"
.DA #S.DSTAT.T.PRODOS
jsr DRV.BlkDevice.GetParam .DA #0
bra DRV.BlkDevice.Go .DA KVER
*-------------------------------------- *--------------------------------------
DRV.BlkDevice.F jsr DRV.BlkDevice.GetCmdAndDev * IOCTL to BLK protocol converter
* in : pIOCTL (AUX)
DRV.BlkDevice.Go
ldy #S.NODE.DEV.BUSPTR
lda (pDev),y
sta .8+1
iny
lda (pDev),y
sta .8+2
.8 jmp $ffff
*-------------------------------------- *--------------------------------------
DRV.BlkDevice.GetParam DRV.BLK txa
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
lsr lsr
tax CMD sta DRV.BLK.PARAMS CMD
ldy #S.NODE.DEV.DEVID Drive 1, or 2 ldy #S.NODE.DEV.DEVID Drive 1, or 2
lda (pDev),y lda (pDev),y
@ -201,81 +133,69 @@ DRV.BlkDevice.GetCmdAndDevAX
plp plp
ror DSSS0000 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 rts
*--------------------------------------
DRV.BlkDevice.Stat DRV.BLK.PARAMS .BS 6
.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
*-------------------------------------- *--------------------------------------
* Smartport Driver * Smartport Driver
*-------------------------------------- *--------------------------------------
DRV.SmartPort cld DRV.SmartPort cld
jmp (.1,x) >STYA DRV.SmartPort.Go.IOCTL
.1 .DA DRV.SmartPort.S STATUS
.DA DRV.SmartPort.P BR txa
.DA DRV.SmartPort.P BW lsr
.DA DRV.SmartPort.NP FORMAT sta DRV.SmartPort.Go.Cmd
.DA DRV.SmartPort.P CONTROL tax
.DA DRV.SmartPort.NP INIT
.DA DRV.SmartPort.NP OPEN lda DRV.SmartPort.Cnt,x
.DA DRV.SmartPort.NP CLOSE sta DRV.SmartPort.Go.Cmd
.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
ldy #S.NODE.DEV.BUSPTR ldy #S.NODE.DEV.BUSPTR
lda (pDev),y lda (pNode),y
sta .8+1 sta .8+1
iny iny
lda (pDev),y lda (pNode),y
sta .8+2 sta .8+2
.8 jsr $ffff .8 jsr $ffff
DRV.SmartPort.Go.Cmd DRV.SmartPort.Go.Cmd
.BS 1 .BS 1
.DA K.S.IOCTL DRV.SmartPort.Go.IOCTL
.BS 2
rts 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 DRV.SmartPort.Cnt
.HS 03030301030101010404 .HS 03030301030101010404
*-------------------------------------- *--------------------------------------
@ -284,6 +204,7 @@ DRV.SmartPort.Cnt
* - READ returns EOF. * - READ returns EOF.
*-------------------------------------- *--------------------------------------
DRV.NULL cld DRV.NULL cld
>STYA pIOCTL
jmp (.1,x) jmp (.1,x)
*-------------------------------------- *--------------------------------------
.1 .DA DRV.NULL.STATUS .1 .DA DRV.NULL.STATUS
@ -298,41 +219,10 @@ DRV.NULL cld
.DA DRV.NULL.WRITE .DA DRV.NULL.WRITE
.DA A2osX.BADCALL IRQ .DA A2osX.BADCALL IRQ
*-------------------------------------- *--------------------------------------
DRV.NULL.STATUS >STYA pIOCTL DRV.NULL.STATUS >LDYAI DRV.NULL.DSTAT
jmp DRV.STATUS.YA
ldy #S.IOCTL.STATCODE DRV.NULL.READ ldx #C.EOF
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
jmp DRV.READ.X jmp DRV.READ.X
DRV.NULL.OPEN 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 * SYS DEVICE
*-------------------------------------- *--------------------------------------
DRV.SYS cld DRV.SYS cld
>STYA pIOCTL
jmp (.1,x) jmp (.1,x)
.1 .DA .2 STATUS .1 .DA DRV.SYS.STATUS
.DA A2osX.BADCALL READBLOCK .DA A2osX.BADCALL READBLOCK
.DA A2osX.BADCALL WRITEBLOCK .DA A2osX.BADCALL WRITEBLOCK
.DA A2osX.BADCALL FORMAT .DA A2osX.BADCALL FORMAT
@ -364,16 +255,8 @@ DRV.SYS cld
.DA DRV.SYS.Write .DA DRV.SYS.Write
.DA A2osX.BADCALL IRQ .DA A2osX.BADCALL IRQ
*-------------------------------------- *--------------------------------------
.2 >LDYAI .3 DRV.SYS.STATUS >LDYAI DRV.SYS.DSTAT
clc jmp DRV.STATUS.YA
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.Open lda #DEVID.SYS DRV.SYS.Open lda #DEVID.SYS
sta A2osX.SCRNDEVS+1 sta A2osX.SCRNDEVS+1
@ -612,12 +495,51 @@ DRV.SYS.SetBaseX
sta ZPDRV+1 sta ZPDRV+1
rts 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.CH .BS 1
DRV.SYS.CV .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.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.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 DRV.READ.X ldy #S.IOCTL.BYTECNT
lda #1 lda #1
sta (pIOCTL),y sta (pIOCTL),y