mirror of
https://github.com/A2osX/A2osX.git
synced 2024-12-29 01:33:40 +00:00
KERNEL:Cleanup to make room for DHGR Driver
This commit is contained in:
parent
c4c7d406d5
commit
a40be0d7a4
BIN
A2OSX.BOOT.po
BIN
A2OSX.BOOT.po
Binary file not shown.
BIN
A2OSX.SRC.po
BIN
A2OSX.SRC.po
Binary file not shown.
@ -620,18 +620,18 @@ HIDECUR.RTS clc
|
||||
*--------------------------------------
|
||||
DRV.CS.END
|
||||
*--------------------------------------
|
||||
Shift0.lo .BS 1
|
||||
Shift0.hi .BS 1
|
||||
Shift1.lo .BS 1
|
||||
Shift1.hi .BS 1
|
||||
Shift2.lo .BS 1
|
||||
Shift2.hi .BS 1
|
||||
Shift3.lo .BS 1
|
||||
Shift3.hi .BS 1
|
||||
Shift4.lo .BS 1
|
||||
Shift4.hi .BS 1
|
||||
Shift5.lo .BS 1
|
||||
Shift5.hi .BS 1
|
||||
Shift0.lo .BS 128
|
||||
Shift0.hi .BS 128
|
||||
Shift1.lo .BS 128
|
||||
Shift1.hi .BS 128
|
||||
Shift2.lo .BS 128
|
||||
Shift2.hi .BS 128
|
||||
Shift3.lo .BS 128
|
||||
Shift3.hi .BS 128
|
||||
Shift4.lo .BS 128
|
||||
Shift4.hi .BS 128
|
||||
Shift5.lo .BS 128
|
||||
Shift5.hi .BS 128
|
||||
Shift6.lo .BS 128
|
||||
Shift6.hi .BS 128
|
||||
*--------------------------------------
|
||||
|
@ -130,10 +130,6 @@ A2osX.RANDOM16 .EQ $BEEE
|
||||
*--------------------------------------
|
||||
A2osX.HZ .EQ $BEF0
|
||||
*--------------------------------------
|
||||
* Kernel Entry Point
|
||||
*--------------------------------------
|
||||
KERNEL.SYSCALL .EQ $E000
|
||||
*--------------------------------------
|
||||
H.BIN.HEADER .EQ 0
|
||||
H.BIN.HEADER.DRV65 .EQ $4CD8 6502:cld,jmp abs
|
||||
H.BIN.HEADER.LIB65 .EQ $7CD8 6502:cld,jmp (abs,x)
|
||||
@ -165,7 +161,7 @@ SYS.FreeStockObject .EQ $0E
|
||||
SYS.NewPStrYA .EQ $10
|
||||
SYS.PStrCpyA .EQ $12
|
||||
SYS.PStrCat .EQ $14
|
||||
SYS.PStrCmp .EQ $16
|
||||
|
||||
|
||||
SYS.PStrGetTkn .EQ $18
|
||||
|
||||
|
@ -96,8 +96,15 @@ S.LoadBinA sta S.LoadBinA.hFilename save file path
|
||||
sta R.DH
|
||||
|
||||
>LDYA ZPQuickPtr1
|
||||
|
||||
bit RRAMWRAMBNK2
|
||||
bit RRAMWRAMBNK2
|
||||
|
||||
jsr S.BinRelocateYA
|
||||
|
||||
bit RRAMWRAMBNK1
|
||||
bit RRAMWRAMBNK1
|
||||
|
||||
bcs .98 relocation error, dicard Code segment
|
||||
|
||||
lda S.LoadBinA.hFilename get back bin path
|
||||
|
@ -55,16 +55,15 @@ S.GetDevByNameYA
|
||||
|
||||
ldx #0
|
||||
|
||||
.1 lda (ZPQuickPtr1)
|
||||
cmp (ZPQuickPtr2)
|
||||
bne .3
|
||||
|
||||
tay
|
||||
.1 ldy #0
|
||||
|
||||
.2 lda (ZPQuickPtr1),y
|
||||
cmp (ZPQuickPtr2),y
|
||||
bne .3
|
||||
|
||||
dey
|
||||
tya
|
||||
iny
|
||||
cmp (ZPQuickPtr1)
|
||||
bne .2
|
||||
|
||||
lda ZPQuickPtr2
|
||||
@ -293,17 +292,7 @@ DevMgr.SYS.Scroll
|
||||
bpl .3
|
||||
|
||||
cpx #23
|
||||
bne .1
|
||||
|
||||
ldy #39
|
||||
lda #$A0
|
||||
.4 sta SETWRITEAUX
|
||||
sta (ZPDRV+2),y
|
||||
sta CLRWRITEAUX
|
||||
sta (ZPDRV+2),y
|
||||
dey
|
||||
bpl .4
|
||||
rts
|
||||
bne .1 Fall in ClrLineAtX for last line
|
||||
*--------------------------------------
|
||||
DevMgr.SYS.ClrLineAtX
|
||||
lda DevMgr.SYS.BASEL,x
|
||||
@ -314,17 +303,14 @@ DevMgr.SYS.ClrLineAtX
|
||||
lda #$A0
|
||||
|
||||
ldy #39
|
||||
sta SETWRITEAUX
|
||||
.1 sta (ZPDRV),y
|
||||
|
||||
.1 sta SETWRITEAUX
|
||||
sta (ZPDRV),y
|
||||
sta CLRWRITEAUX
|
||||
sta (ZPDRV),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
ldy #39
|
||||
sta CLRWRITEAUX
|
||||
.2 sta (ZPDRV),y
|
||||
dey
|
||||
bpl .2
|
||||
|
||||
rts
|
||||
*--------------------------------------
|
||||
DevMgr.SYS.Home ldx #23
|
||||
@ -372,7 +358,7 @@ DevMgr.SYS.CPULOADC .AS -"|/-\"
|
||||
DevMgr.SYS.TITLE >CSTRING "A2osX System Screen"
|
||||
DevMgr.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
|
||||
DevMgr.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
|
||||
*--------------------------------------*--------------------------------------
|
||||
*--------------------------------------
|
||||
DevMgr.End .EQ *
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.DEV
|
||||
|
@ -44,7 +44,14 @@ S.LoadDrvA >PUSHA push Cmd Line for S.PStrGetTkn
|
||||
|
||||
bcs .95
|
||||
|
||||
bit RRAMWRAMBNK2
|
||||
bit RRAMWRAMBNK2
|
||||
|
||||
jsr S.InsDrv
|
||||
|
||||
bit RRAMWRAMBNK1
|
||||
bit RRAMWRAMBNK1
|
||||
|
||||
bcs .95
|
||||
|
||||
jsr .95
|
||||
@ -89,195 +96,7 @@ S.LoadDrv.Srch .BS 1
|
||||
S.LoadDrv.FullName .BS 1
|
||||
S.LoadDrv.hMem .BS 1
|
||||
*--------------------------------------
|
||||
* pDrv = .DRV File Loaded Address
|
||||
*--------------------------------------
|
||||
S.InsDrv ldy #H.BIN.DRV.CODE.LEN
|
||||
lda (pDrv),y
|
||||
sta R.AL
|
||||
iny
|
||||
lda (pDrv),y
|
||||
sta R.AH
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc S.LoadBinA.AuxType
|
||||
sta R.BL
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc S.LoadBinA.AuxType+1
|
||||
sta R.BH set BX=End Of Code
|
||||
|
||||
lda S.LoadBinA.AuxType
|
||||
clc
|
||||
adc S.LoadBinA.FileLen
|
||||
sta R.CL
|
||||
lda S.LoadBinA.AuxType+1
|
||||
adc S.LoadBinA.FileLen+1
|
||||
sta R.CH set CX=End Of Range
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda S.LoadBinA.FileLen
|
||||
sec
|
||||
sbc (pDrv),y
|
||||
sta S.InsDrv.DRVLen
|
||||
iny
|
||||
lda S.LoadBinA.FileLen+1
|
||||
sbc (pDrv),y
|
||||
sta S.InsDrv.DRVLen+1 Compute DRV Len
|
||||
|
||||
lda DevMgr.Free
|
||||
clc
|
||||
adc S.InsDrv.DRVLen
|
||||
sta S.InsDrv.DRVEnd
|
||||
lda DevMgr.Free+1
|
||||
adc S.InsDrv.DRVLen+1
|
||||
sta S.InsDrv.DRVEnd+1
|
||||
|
||||
bcs .98 we crossed $FFFF, out of mem
|
||||
|
||||
lda S.InsDrv.DRVEnd
|
||||
sec
|
||||
sbc #DevMgr.HiMem
|
||||
lda S.InsDrv.DRVEnd+1
|
||||
sbc /DevMgr.HiMem
|
||||
bcs .98 No More Room to load Driver....
|
||||
|
||||
lda DevMgr.LastDevID
|
||||
inc
|
||||
cmp #K.DEV.MAX
|
||||
beq .99 No Device Handle Left
|
||||
|
||||
sta DevMgr.LastDevID
|
||||
|
||||
ldy #H.BIN.DEV.HEADER.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #S.DEV.JMP
|
||||
|
||||
lda DevMgr.Free
|
||||
sec
|
||||
sbc (ZPQuickPtr1),y
|
||||
sta R.DL
|
||||
lda DevMgr.Free+1
|
||||
iny
|
||||
sbc (ZPQuickPtr1),y
|
||||
sta R.DH set DX=Offset
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
pha
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
ply
|
||||
|
||||
jsr S.DrvRelocateYA
|
||||
|
||||
jsr S.InsDrv.Move
|
||||
|
||||
>LDYA S.InsDrv.DrvEnd
|
||||
>STYA DevMgr.Free
|
||||
clc
|
||||
rts
|
||||
|
||||
.98 lda #DEVMGR.ERROOM
|
||||
sec
|
||||
rts
|
||||
|
||||
.99 lda #DEVMGR.ERROOH
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.InsDrv.Move ldy #H.BIN.DEV.HEADER.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #S.DEV.JMP Relocate Main JMP
|
||||
lda (ZPQuickPtr1),y
|
||||
clc
|
||||
adc R.DL
|
||||
sta (ZPQuickPtr1),y
|
||||
iny
|
||||
lda (ZPQuickPtr1),y
|
||||
adc R.DH
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
lda DevMgr.LastDevID
|
||||
jsr S.GetDevByIDA
|
||||
>STYA pDev
|
||||
|
||||
ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0
|
||||
lda #0
|
||||
sta (pDev),y
|
||||
dey
|
||||
|
||||
.1 lda (ZPQuickPtr1),y Copy DRV.Header
|
||||
sta (pDev),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
lda DevMgr.LastDevID Save Dev.ID in the driver for SELECT
|
||||
ldy #S.DEV.ID
|
||||
sta (pDev),y
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1 Make ZPQuickPtr1=DRV.CODE
|
||||
|
||||
lda DevMgr.Free
|
||||
sta ZPQuickPtr2
|
||||
lda DevMgr.Free+1
|
||||
sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location
|
||||
|
||||
ldy S.InsDrv.DrvLen
|
||||
ldx S.InsDrv.DrvLen+1
|
||||
|
||||
.2 lda (ZPQuickPtr1)
|
||||
sta (ZPQuickPtr2)
|
||||
|
||||
inc ZPQuickPtr1
|
||||
bne .3
|
||||
inc ZPQuickPtr1+1
|
||||
|
||||
.3 inc ZPQuickPtr2
|
||||
bne .4
|
||||
inc ZPQuickPtr2+1
|
||||
|
||||
.4 tya
|
||||
bne .5
|
||||
txa
|
||||
beq .8
|
||||
dex
|
||||
|
||||
.5 dey
|
||||
bra .2
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
ENV.DRV >PSTRING "DRV"
|
||||
S.InsDrv.DrvLen .BS 2
|
||||
S.InsDrv.DrvEnd .BS 2
|
||||
*--------------------------------------
|
||||
MAN
|
||||
SAVE SYS/KERNEL.S.DRV
|
||||
|
@ -479,7 +479,7 @@ S.ListDirNextAD stz R.DL Reset Return Record hMem
|
||||
bne .31
|
||||
|
||||
>PUSHWI TmpFileName push Filename PTR
|
||||
jsr S.PStrMatchP
|
||||
jsr S.PStrMatch
|
||||
bcs .5 no match
|
||||
|
||||
.30 ldy #S.LISTDIR.EL Get Entry length
|
||||
|
@ -5,9 +5,9 @@ INC 1
|
||||
AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
* $E000-E0FF KERNEL.SYSCALL Jmp Table
|
||||
* $D000-D0FF KERNEL.SYSCALL Jmp Table
|
||||
*--------------------------------------
|
||||
.DA S.GetMem $00
|
||||
KERNEL.SYSCALL .DA S.GetMem $00
|
||||
.DA S.FreeMemA
|
||||
.DA S.GetMemPtrA
|
||||
.DA S.GetMemByIDA
|
||||
@ -19,7 +19,7 @@ AUTO 6
|
||||
.DA S.NewPStrYA $10
|
||||
.DA S.PStrCpyA
|
||||
.DA S.PStrCat
|
||||
.DA S.PStrCmp
|
||||
.DA 0
|
||||
.DA S.PStrGetTkn
|
||||
.DA 0
|
||||
.DA S.GetArgCount
|
||||
|
@ -37,20 +37,19 @@ S.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
||||
sta SETREADAUX Aux Mem requested,switch to AUX
|
||||
sta SETWRITEAUX
|
||||
|
||||
.11 >PULLW MemMgr.ReqSize Store requested size
|
||||
lda MemMgr.ReqSize align REQS to 16 bytes
|
||||
and #$0F
|
||||
.11 >PULLAX Store requested size
|
||||
bit #$0F
|
||||
beq .10
|
||||
|
||||
lda MemMgr.ReqSize
|
||||
and #$F0
|
||||
clc
|
||||
adc #$10
|
||||
sta MemMgr.ReqSize
|
||||
bcc .10
|
||||
inc MemMgr.ReqSize+1
|
||||
inx
|
||||
|
||||
.10 >LDYAI MemMgr.Table
|
||||
.10 >STAX MemMgr.ReqSize
|
||||
|
||||
>LDYAI MemMgr.Table
|
||||
>STYA ZPMemMgrSPtr
|
||||
|
||||
ldx #0 Current slot=0
|
||||
@ -110,8 +109,9 @@ S.GetMem >PULLB MemMgr.ReqFlags store requested flags
|
||||
|
||||
and #S.MEM.F.INIT0
|
||||
beq .8
|
||||
|
||||
phx save hMem
|
||||
jsr MemMgr.Init0
|
||||
plx restore hMem
|
||||
|
||||
.8 lda #0
|
||||
ldy #S.MEM.BIN
|
||||
@ -207,34 +207,35 @@ MemMgr.NextSlot lda ZPMemMgrSPtr
|
||||
*--------------------------------------
|
||||
MemMgr.Init0 ldy #S.MEM.PTR
|
||||
lda (ZPMemMgrSPtr),y ZPMemMgrSPtr already set
|
||||
sta ZPMemMgrTmp1 set ZPMemMgrTmp1 to Mem Ptr
|
||||
sta .2+1
|
||||
iny
|
||||
lda (ZPMemMgrSPtr),y
|
||||
sta ZPMemMgrTmp1+1
|
||||
sta .2+2
|
||||
|
||||
ldy #S.MEM.LEN
|
||||
lda (ZPMemMgrSPtr),y
|
||||
sta ZPMemMgrTmp2 set ZPMemMgrTmp2 to mem size
|
||||
eor #$ff
|
||||
pha
|
||||
|
||||
iny
|
||||
lda (ZPMemMgrSPtr),y
|
||||
sta ZPMemMgrTmp2+1
|
||||
|
||||
lda #0
|
||||
|
||||
.1 ldy ZPMemMgrTmp2
|
||||
bne .2
|
||||
ldy ZPMemMgrTmp2+1
|
||||
beq .3
|
||||
dec ZPMemMgrTmp2+1
|
||||
.2 dec ZPMemMgrTmp2
|
||||
eor #$ff a=not hi count
|
||||
|
||||
sta (ZPMemMgrTmp1)
|
||||
inc ZPMemMgrTmp1
|
||||
bne .1
|
||||
inc ZPMemMgrTmp1+1
|
||||
bra .1
|
||||
ply y=not lo count
|
||||
ldx #0
|
||||
|
||||
.3 rts
|
||||
.1 iny
|
||||
bne .2
|
||||
inc
|
||||
beq .8
|
||||
|
||||
.2 stz $ffff,x
|
||||
inx
|
||||
bne .1
|
||||
inc .2+2
|
||||
bne .1
|
||||
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
MemMgr.SlotCnt .BS 1
|
||||
MemMgr.ReqFlags .BS 1 store requested Flags
|
||||
@ -336,12 +337,14 @@ S.GetMemByIDA stz ZPMemMgrSPtr+1
|
||||
asl
|
||||
rol ZPMemMgrSPtr+1
|
||||
|
||||
clc
|
||||
* clc IMPLICIT
|
||||
|
||||
adc #MemMgr.Table
|
||||
sta ZPMemMgrSPtr
|
||||
tay
|
||||
lda ZPMemMgrSPtr+1
|
||||
adc /MemMgr.Table
|
||||
|
||||
sty ZPMemMgrSPtr
|
||||
sta ZPMemMgrSPtr+1
|
||||
rts
|
||||
*--------------------------------------
|
||||
|
@ -124,6 +124,195 @@ S.CodeRelocate lda ZPQuickPtr1
|
||||
clc
|
||||
rts
|
||||
*--------------------------------------
|
||||
* pDrv = .DRV File Loaded Address
|
||||
*--------------------------------------
|
||||
S.InsDrv ldy #H.BIN.DRV.CODE.LEN
|
||||
lda (pDrv),y
|
||||
sta R.AL
|
||||
iny
|
||||
lda (pDrv),y
|
||||
sta R.AH
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc S.LoadBinA.AuxType
|
||||
sta R.BL
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc S.LoadBinA.AuxType+1
|
||||
sta R.BH set BX=End Of Code
|
||||
|
||||
lda S.LoadBinA.AuxType
|
||||
clc
|
||||
adc S.LoadBinA.FileLen
|
||||
sta R.CL
|
||||
lda S.LoadBinA.AuxType+1
|
||||
adc S.LoadBinA.FileLen+1
|
||||
sta R.CH set CX=End Of Range
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda S.LoadBinA.FileLen
|
||||
sec
|
||||
sbc (pDrv),y
|
||||
sta S.InsDrv.DRVLen
|
||||
iny
|
||||
lda S.LoadBinA.FileLen+1
|
||||
sbc (pDrv),y
|
||||
sta S.InsDrv.DRVLen+1 Compute DRV Len
|
||||
|
||||
lda DevMgr.Free
|
||||
clc
|
||||
adc S.InsDrv.DRVLen
|
||||
sta S.InsDrv.DRVEnd
|
||||
lda DevMgr.Free+1
|
||||
adc S.InsDrv.DRVLen+1
|
||||
sta S.InsDrv.DRVEnd+1
|
||||
|
||||
bcs .98 we crossed $FFFF, out of mem
|
||||
|
||||
lda S.InsDrv.DRVEnd
|
||||
sec
|
||||
sbc #DevMgr.HiMem
|
||||
lda S.InsDrv.DRVEnd+1
|
||||
sbc /DevMgr.HiMem
|
||||
bcs .98 No More Room to load Driver....
|
||||
|
||||
lda DevMgr.LastDevID
|
||||
inc
|
||||
cmp #K.DEV.MAX
|
||||
beq .99 No Device Handle Left
|
||||
|
||||
sta DevMgr.LastDevID
|
||||
|
||||
ldy #H.BIN.DEV.HEADER.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #S.DEV.JMP
|
||||
|
||||
lda DevMgr.Free
|
||||
sec
|
||||
sbc (ZPQuickPtr1),y
|
||||
sta R.DL
|
||||
lda DevMgr.Free+1
|
||||
iny
|
||||
sbc (ZPQuickPtr1),y
|
||||
sta R.DH set DX=Offset
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
pha
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
ply
|
||||
|
||||
jsr S.DrvRelocateYA
|
||||
|
||||
jsr S.InsDrv.Move
|
||||
|
||||
>LDYA S.InsDrv.DrvEnd
|
||||
>STYA DevMgr.Free
|
||||
clc
|
||||
rts
|
||||
|
||||
.98 lda #DEVMGR.ERROOM
|
||||
sec
|
||||
rts
|
||||
|
||||
.99 lda #DEVMGR.ERROOH
|
||||
sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
S.InsDrv.Move ldy #H.BIN.DEV.HEADER.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1
|
||||
|
||||
ldy #S.DEV.JMP Relocate Main JMP
|
||||
lda (ZPQuickPtr1),y
|
||||
clc
|
||||
adc R.DL
|
||||
sta (ZPQuickPtr1),y
|
||||
iny
|
||||
lda (ZPQuickPtr1),y
|
||||
adc R.DH
|
||||
sta (ZPQuickPtr1),y
|
||||
|
||||
lda DevMgr.LastDevID
|
||||
jsr S.GetDevByIDA
|
||||
>STYA pDev
|
||||
|
||||
ldy #S.DEV.SIZE Make sure DevMgr.Table Ends with 0
|
||||
lda #0
|
||||
sta (pDev),y
|
||||
dey
|
||||
|
||||
.1 lda (ZPQuickPtr1),y Copy DRV.Header
|
||||
sta (pDev),y
|
||||
dey
|
||||
bpl .1
|
||||
|
||||
lda DevMgr.LastDevID Save Dev.ID in the driver for SELECT
|
||||
ldy #S.DEV.ID
|
||||
sta (pDev),y
|
||||
|
||||
ldy #H.BIN.DRV.CODE.O
|
||||
lda (pDrv),y
|
||||
clc
|
||||
adc pDrv
|
||||
sta ZPQuickPtr1
|
||||
iny
|
||||
lda (pDrv),y
|
||||
adc pDrv+1
|
||||
sta ZPQuickPtr1+1 Make ZPQuickPtr1=DRV.CODE
|
||||
|
||||
lda DevMgr.Free
|
||||
sta ZPQuickPtr2
|
||||
lda DevMgr.Free+1
|
||||
sta ZPQuickPtr2+1 Make ZPQuickPtr2=Dest Ram Location
|
||||
|
||||
ldy S.InsDrv.DrvLen
|
||||
ldx S.InsDrv.DrvLen+1
|
||||
|
||||
.2 lda (ZPQuickPtr1)
|
||||
sta (ZPQuickPtr2)
|
||||
|
||||
inc ZPQuickPtr1
|
||||
bne .3
|
||||
inc ZPQuickPtr1+1
|
||||
|
||||
.3 inc ZPQuickPtr2
|
||||
bne .4
|
||||
inc ZPQuickPtr2+1
|
||||
|
||||
.4 tya
|
||||
bne .5
|
||||
txa
|
||||
beq .8
|
||||
dex
|
||||
|
||||
.5 dey
|
||||
bra .2
|
||||
.8 rts
|
||||
*--------------------------------------
|
||||
S.InsDrv.DrvLen .BS 2
|
||||
S.InsDrv.DrvEnd .BS 2
|
||||
*--------------------------------------
|
||||
* 65C02 OPCODES
|
||||
* Bit 7 : 1 absolute addressing
|
||||
* Bit 1-0 : opcode + @ length
|
||||
|
@ -6,13 +6,8 @@ AUTO 6
|
||||
.LIST OFF
|
||||
*--------------------------------------
|
||||
S.KernelRun jsr S.TskMgrRun
|
||||
bcc S.KernelRun.EVT
|
||||
jsr DevMgr.SYS.Select
|
||||
>LDYAI MSG.KRNLPANIC
|
||||
jsr S.PSTROutYA
|
||||
bra *
|
||||
|
||||
S.KernelRun.EVT
|
||||
bcs .9
|
||||
|
||||
jsr S.GetEvents
|
||||
bcs S.KernelRun CS=no event
|
||||
|
||||
@ -34,7 +29,7 @@ S.KernelRun.EVT
|
||||
lda (pEvent),y
|
||||
bpl .7
|
||||
|
||||
ldy #S.EVT.DATALO
|
||||
dey S.EVT.DATALO
|
||||
lda (pEvent),y
|
||||
|
||||
cmp #'1'
|
||||
@ -64,7 +59,13 @@ S.KernelRun.EVT
|
||||
sta A2osX.ASCREEN
|
||||
bra .8
|
||||
|
||||
.7 jsr S.DumpEvent
|
||||
.7 ldy #S.EVT.DATAW2+1
|
||||
.71 >PUSHB (pEvent),y
|
||||
dey
|
||||
bpl .71
|
||||
|
||||
>LDYAI MSG.DumpEvent
|
||||
jsr S.PSTROutYA
|
||||
|
||||
.8 jsr S.DestroyEvent
|
||||
|
||||
@ -74,29 +75,13 @@ S.KernelRun.EVT
|
||||
sta pEvent
|
||||
lda EVTMGR.COUNT
|
||||
bne .1
|
||||
jmp S.KernelRun
|
||||
*--------------------------------------
|
||||
S.DumpEvent ldy #S.EVT.DATAW2+1
|
||||
>PUSHB (pEvent),y
|
||||
dey
|
||||
>PUSHB (pEvent),y
|
||||
|
||||
ldy #S.EVT.DATAW1+1
|
||||
>PUSHB (pEvent),y
|
||||
dey
|
||||
>PUSHB (pEvent),y
|
||||
|
||||
ldy #S.EVT.DATAHI
|
||||
>PUSHB (pEvent),y
|
||||
ldy #S.EVT.DATALO
|
||||
>PUSHB (pEvent),y
|
||||
|
||||
ldy #S.EVT.hDEV
|
||||
>PUSHB (pEvent),y
|
||||
beq S.KernelRun
|
||||
|
||||
>PUSHB (pEvent)
|
||||
>LDYAI MSG.DumpEvent
|
||||
jmp S.PSTROutYA
|
||||
.9 jsr DevMgr.SYS.Select
|
||||
>LDYAI MSG.KRNLPANIC
|
||||
jsr S.PSTROutYA
|
||||
bra *
|
||||
*--------------------------------------
|
||||
MSG.DumpEvent >PSTRING "!Unhandled Event:Flags=%h,DevID=%h,DATALO=%h,DATAHI=%h,W1=%H,W2=%H\n"
|
||||
MSG.KRNLPANIC >PSTRING "\n!!!Kernel Panic!!!\n"
|
||||
|
@ -93,53 +93,18 @@ S.PStrCat >PULLA
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* S.PStrCmp
|
||||
* IN:
|
||||
* PULLB = hMem to S1 (PSTRING)
|
||||
* PULLB = hMem to S2 (PSTRING)
|
||||
* OUT:
|
||||
* cc or cs
|
||||
*--------------------------------------
|
||||
S.PStrCmp >PULLA
|
||||
jsr S.GetMemPtrA
|
||||
>STYA ZPQuickPtr1 save S1
|
||||
>PULLA
|
||||
jsr S.GetMemPtrA
|
||||
>STYA ZPQuickPtr2 save S2
|
||||
lda (ZPQuickPtr1)
|
||||
tay
|
||||
cmp (ZPQuickPtr2)
|
||||
bne .9
|
||||
.1 lda (ZPQuickPtr1),y
|
||||
cmp (ZPQuickPtr2),y
|
||||
bne .9
|
||||
dey
|
||||
bne .1
|
||||
clc
|
||||
rts
|
||||
.9 sec
|
||||
rts
|
||||
*--------------------------------------
|
||||
* S.PStrMatch
|
||||
* IN:
|
||||
* PULLB = hMem to String (PSTRING)
|
||||
* PULLB = hMem to Pattern (PSTRING)
|
||||
* PULLB = PTR to String (PSTRING)
|
||||
* PULLB = PTR to Pattern (PSTRING)
|
||||
* OUT:
|
||||
* cc = match
|
||||
* cs = no match
|
||||
*--------------------------------------
|
||||
S.PStrMatch >PULLA
|
||||
jsr S.GetMemPtrA
|
||||
>STYA ZPQuickPtr2 save String
|
||||
>PULLA
|
||||
jsr S.GetMemPtrA
|
||||
>STYA ZPQuickPtr1 save Pattern
|
||||
bra S.PStrMatch1
|
||||
|
||||
S.PStrMatchP >PULLW ZPQuickPtr2 pull String
|
||||
S.PStrMatch >PULLW ZPQuickPtr2 pull String
|
||||
>PULLW ZPQuickPtr1 pull Pattern
|
||||
|
||||
S.PStrMatch1 lda (ZPQuickPTR1) Keep Pattern Length in X
|
||||
lda (ZPQuickPTR1) Keep Pattern Length in X
|
||||
tax
|
||||
beq .8 Match always if empty
|
||||
ldy #0
|
||||
|
@ -104,15 +104,13 @@ S.DispatchEvents
|
||||
sta TSKMGR.COUNT
|
||||
|
||||
.1 lda (pPs) get S.PS.F
|
||||
and #S.PS.F.INUSE In use ?
|
||||
bit #S.PS.F.INUSE In use ?
|
||||
beq .4
|
||||
|
||||
lda (pPs) get S.PS.F
|
||||
and #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
||||
bit #S.PS.F.HOLD Waiting for Another Task to Terminate?
|
||||
bne .4
|
||||
|
||||
lda (pPs) get S.PS.F
|
||||
and #S.PS.F.EVENT Accept Events ?
|
||||
bit #S.PS.F.EVENT Accept Events ?
|
||||
beq .4
|
||||
|
||||
jsr S.SelectProcess
|
||||
@ -285,29 +283,25 @@ S.GetPSByIDA sta S.GetPSByIDA.PS
|
||||
*--------------------------------------
|
||||
S.GetPSByIDA.PS .BS 1
|
||||
*--------------------------------------
|
||||
S.Sleep ldy #S.PS.hCS
|
||||
lda (pPs),y
|
||||
>SYSCALL SYS.GetMemPtrA
|
||||
>STYA S.Sleep.SaveCS
|
||||
ldy #S.PS.PC
|
||||
pla get PC LO
|
||||
S.Sleep pla get PC LO
|
||||
plx get PC HI
|
||||
|
||||
inc Advance PC one Byte
|
||||
bne .1
|
||||
inx
|
||||
|
||||
.1 sec
|
||||
sbc S.Sleep.SaveCS
|
||||
|
||||
sbc pCode
|
||||
ldy #S.PS.PC
|
||||
sta (pPs),y
|
||||
iny
|
||||
txa
|
||||
sbc S.Sleep.SaveCS+1
|
||||
sbc pCode+1
|
||||
iny
|
||||
sta (pPs),y
|
||||
clc No error,
|
||||
rts back to Kernel
|
||||
*--------------------------------------
|
||||
S.Sleep.SaveCS .BS 2
|
||||
*--------------------------------------
|
||||
* PRIVATE
|
||||
*--------------------------------------
|
||||
* S.CreateChildProcess
|
||||
@ -398,14 +392,11 @@ S.CreateChildProcess
|
||||
sta (R.AX),y
|
||||
|
||||
.8 ldy #S.PS.hINDEV
|
||||
lda (pPs),y
|
||||
sta (R.AX),y
|
||||
ldy #S.PS.hOUTDEV
|
||||
lda (pPs),y
|
||||
sta (R.AX),y
|
||||
ldy #S.PS.hERRDEV
|
||||
lda (pPs),y
|
||||
.81 lda (pPs),y
|
||||
sta (R.AX),y
|
||||
iny
|
||||
cpy #S.PS.hERRDEV+1
|
||||
bne .81
|
||||
|
||||
ldy #S.PS.ID
|
||||
lda (pPs),y
|
||||
|
@ -216,11 +216,13 @@ A2osX.BE00.END .EQ *
|
||||
*--------------------------------------
|
||||
A2osX.D001 .EQ *
|
||||
.PH $D000
|
||||
.INB SYS/KERNEL.S.JMP
|
||||
.INB SYS/KERNEL.S.STR
|
||||
.INB SYS/KERNEL.S.CIO
|
||||
.INB SYS/KERNEL.S.FIO
|
||||
.INB SYS/KERNEL.S.MLI
|
||||
.INB SYS/KERNEL.S.ENV
|
||||
.INB SYS/KERNEL.S.EVT
|
||||
.EP
|
||||
A2osX.D001.END .EQ *
|
||||
*--------------------------------------
|
||||
@ -228,7 +230,7 @@ A2osX.D001.END .EQ *
|
||||
*--------------------------------------
|
||||
A2osX.D002 .EQ *
|
||||
.PH $D000
|
||||
cld
|
||||
.INB SYS/KERNEL.S.REL
|
||||
.EP
|
||||
A2osX.D002.END .EQ *
|
||||
*--------------------------------------
|
||||
@ -236,16 +238,13 @@ A2osX.D002.END .EQ *
|
||||
*--------------------------------------
|
||||
A2osX.E000 .EQ *
|
||||
.PH $E000
|
||||
.INB SYS/KERNEL.S.JMP
|
||||
.INB SYS/KERNEL.S.RUN
|
||||
.INB SYS/KERNEL.S.IRQ
|
||||
.INB SYS/KERNEL.S.MEM
|
||||
.INB SYS/KERNEL.S.BIN
|
||||
.INB SYS/KERNEL.S.DRV
|
||||
.INB SYS/KERNEL.S.LIB
|
||||
.INB SYS/KERNEL.S.REL
|
||||
.INB SYS/KERNEL.S.TSK
|
||||
.INB SYS/KERNEL.S.EVT
|
||||
*--------------------------------------
|
||||
* Make sure KERNEL.S.DEV is the last one
|
||||
*--------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user