Kernel 0.92+

This commit is contained in:
Rémy GIBERT 2019-03-13 16:29:24 +00:00
parent c0c16c4215
commit 5ed5171f8b
8 changed files with 118 additions and 42 deletions

Binary file not shown.

View File

@ -532,8 +532,37 @@ CMD.RD lda (ZPArgVBufPtr)
.9 jmp CMD.Exec.CSYN .9 jmp CMD.Exec.CSYN
*-------------------------------------- *--------------------------------------
CMD.FUNC CMD.FUNC lda (ZPArgVBufPtr)
beq .9
jsr CORE.StkGetCtx
bcc .9 NO context allowed
>LDA.G hFuncList
bne .1
>SYSCALL SListNew
bcs .9
>STA.G hFuncList
.1 >PUSHW ZPArgVBufPtr
>LDA.G hFuncList
>SYSCALL SListNewKey
bcs .99
phy
jsr CORE.StkPush
ply
bcs .99
tya
jsr CORE.StkPush
bcs .99
lda #$C0+C.FUNC
jmp CORE.StkPush
.9 jmp CMD.Exec.CSYN .9 jmp CMD.Exec.CSYN
.99 rts
*-------------------------------------- *--------------------------------------
CMD.RETURN CMD.RETURN
.9 jmp CMD.Exec.CSYN .9 jmp CMD.Exec.CSYN
@ -586,6 +615,8 @@ CMD.CASE jsr CORE.StkGetCtx Get context in CORE.Test
bcs .9 bcs .9
tax
and #$3F and #$3F
cmp #C.SWITCH cmp #C.SWITCH
beq .1 beq .1
@ -593,7 +624,14 @@ CMD.CASE jsr CORE.StkGetCtx Get context in CORE.Test
cmp #C.CASE cmp #C.CASE
bne .9 bne .9
jsr CORE.StkPull remove C.CASE txa previous case was true ?
bpl .10
jsr EXP.GET skip expression
bcs .9
rts keep existing context
.10 jsr CORE.StkPull remove previous C.CASE
bra CMD.CASE bra CMD.CASE
.1 jsr EXP.GET .1 jsr EXP.GET
@ -639,6 +677,9 @@ CMD.END jsr CORE.StkGetCtx Get context in CORE.Test
bcs CMD.END.CSYN bcs CMD.END.CSYN
and #$3F and #$3F
cmp #C.FUNC
beq .3
cmp #C.SWITCH cmp #C.SWITCH
beq .2 beq .2
@ -654,6 +695,10 @@ CMD.END jsr CORE.StkGetCtx Get context in CORE.Test
jsr CORE.StkPull get hVALUE jsr CORE.StkPull get hVALUE
>SYSCALL freemem >SYSCALL freemem
rts rts
.3 jsr CORE.StkPull remove C.FUNC
jsr CORE.StkPull remove KeyID
jmp CORE.StkPull remove KeyID
CMD.END.CSYN jmp CMD.Exec.CSYN CMD.END.CSYN jmp CMD.Exec.CSYN
*-------------------------------------- *--------------------------------------
@ -704,10 +749,11 @@ FOR.LIST sec
bcs .99 bcs .99
phy phy
jsr CORE.StkPush Push hLIST jsr CORE.StkPush Push listPtr
ply
bcs .99 bcs .99
pla tya
jsr CORE.StkPush Push hLIST jsr CORE.StkPush Push listptr
bcs .99 bcs .99
txa txa

View File

@ -9,9 +9,15 @@ CORE.Init >LDYAI 256
>STYA ZPArgVBuf >STYA ZPArgVBuf
txa txa
>STA.G CORE.hArgVBuf >STA.G CORE.hArgVBuf
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
CORE.Quit >LDA.G CORE.hArgVBuf CORE.Quit >LDA.G hFuncList
beq .1
>SYSCALL SListFree
.1 >LDA.G CORE.hArgVBuf
beq .9 beq .9
>SYSCALL FreeMem >SYSCALL FreeMem
@ -86,7 +92,7 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
.3 cmp #C.CR .3 cmp #C.CR
beq .80 empty line ? beq .80 empty line ?
.10 cmp #'#' commented line? cmp #'#' commented line?
bne .2 bne .2
.12 jsr CORE.GetNextCharNB .12 jsr CORE.GetNextCharNB
@ -103,7 +109,18 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
clc clc
.9 rts EOL, CS,A=0 .9 rts EOL, CS,A=0
.2 cmp #'.' .2 jsr CORE.StkGet
bcs .13
cmp #$C0+C.FUNC
beq .12
.13 jsr CORE.GetCharNB
cmp #'.'
bne .4 bne .4
ldy #1 ldy #1

View File

@ -685,6 +685,7 @@ DS.START
CORE.STACK .BS CORE.STACK.MAX+1 pData (0 = Stack Ptr) CORE.STACK .BS CORE.STACK.MAX+1 pData (0 = Stack Ptr)
PUSHD.STACK .BS PUSHD.STACK.MAX+1 PUSHD.STACK .BS PUSHD.STACK.MAX+1
hFuncList .BS 1
hInputBuf .BS 1 hInputBuf .BS 1
bReadMode .BS 1 bReadMode .BS 1

View File

@ -290,7 +290,7 @@ SYS.SListGetData .EQ $F2
SYS.SListSetData .EQ $F4 SYS.SListSetData .EQ $F4
SYS.SListGetByID .EQ $F6 SYS.SListGetByID .EQ $F6
SYS.SListAddKey .EQ $F8 SYS.SListNewKey .EQ $F8
SYS.SListLookup .EQ $FA SYS.SListLookup .EQ $FA
SYS.SListNew .EQ $FC SYS.SListNew .EQ $FC
SYS.SListFree .EQ $FE SYS.SListFree .EQ $FE

View File

@ -151,7 +151,7 @@ K.SYSCALL.JMP .DA K.GetMemStat $00
.DA K.SListSetData .DA K.SListSetData
.DA K.SListGetByID .DA K.SListGetByID
.DA K.SListAddKey .DA K.SListNewKey
.DA K.SListLookup .DA K.SListLookup
.DA K.SListNew .DA K.SListNew
.DA K.SListFree .DA K.SListFree

View File

@ -394,6 +394,7 @@ MEM.GetMemByID sta ZPMemMgrSPtr
* ## RETURN VALUE * ## RETURN VALUE
* Y,A = Next DataID * Y,A = Next DataID
*\-------------------------------------- *\--------------------------------------
K.SListAddData
*/-------------------------------------- */--------------------------------------
* # SListGetData * # SListGetData
* ## ASM * ## ASM
@ -404,6 +405,7 @@ MEM.GetMemByID sta ZPMemMgrSPtr
* ## RETURN VALUE * ## RETURN VALUE
* Y,A = Next DataID * Y,A = Next DataID
*\-------------------------------------- *\--------------------------------------
K.SListGetData
*/-------------------------------------- */--------------------------------------
* # SListSetData * # SListSetData
* ## ASM * ## ASM
@ -414,8 +416,6 @@ MEM.GetMemByID sta ZPMemMgrSPtr
* ## RETURN VALUE * ## RETURN VALUE
* Y,A = Next DataID * Y,A = Next DataID
*\-------------------------------------- *\--------------------------------------
K.SListAddData
K.SListGetData
K.SListSetData pha K.SListSetData pha
>PULLW ZPSListID >PULLW ZPSListID
bra K.SListPullA bra K.SListPullA
@ -434,16 +434,15 @@ K.SListGetByID pha
>PULLW ZPSListKeyPtr >PULLW ZPSListKeyPtr
bra K.SListPullA bra K.SListPullA
*/-------------------------------------- */--------------------------------------
* # SListAddKey * # SListNewKey
* ## ASM * ## ASM
* `PUSHW KeyPtr` * `PUSHW KeyPtr`
* `lda hSList` * `lda hSList`
* `>SYSCALL SListAddKey` * `>SYSCALL SListNewKey`
* ## RETURN VALUE * ## RETURN VALUE
* A = Key Length * Y,A = KeyID
* X,Y = KeyID
*\-------------------------------------- *\--------------------------------------
K.SListAddKey K.SListNewKey
*/-------------------------------------- */--------------------------------------
* # SListLookup * # SListLookup
* ## ASM * ## ASM

View File

@ -3,14 +3,16 @@ PREFIX
AUTO 4,1 AUTO 4,1
*-------------------------------------- *--------------------------------------
X.SLIST jmp (.1-SYS.SListAddData,x) X.SLIST jmp (.1-SYS.SListAddData,x)
.1 .DA SLIST.Add .1 .DA SLIST.AddData
.DA SLIST.Lookup .DA SLIST.GetData
.DA SLIST.SetData
.DA SLIST.GetByID .DA SLIST.GetByID
.DA SLIST.UpdateByID .DA SLIST.NewKey
.DA SLIST.Lookup
.DA SLIST.New .DA SLIST.New
.DA SLIST.Free .DA SLIST.Free
*-------------------------------------- *--------------------------------------
SLIST.Add jsr SLIST.Search SLIST.AddData jsr SLIST.Search
bcc .99 Lookup succeeded...DUP bcc .99 Lookup succeeded...DUP
ldy #$ff ldy #$ff
@ -60,28 +62,13 @@ SLIST.Add jsr SLIST.Search
ldy ZPSListID+1 ldy ZPSListID+1
.9 rts .9 rts
*-------------------------------------- *--------------------------------------
SLIST.Lookup jsr SLIST.Search SLIST.GetData
*--------------------------------------
bcs .9 SLIST.SetData
clc
sty .8+1 Save Key Length rts
jsr SLIST.GetBlockByte
tax
jsr MEM.SetDataByte
.1 jsr SLIST.GetNextBlockByte
jsr MEM.SetDataByte
dex
bne .1
.8 lda #$ff SELF MODIFIED
ldx ZPSListID
ldy ZPSListID+1
clc
.9 rts
*-------------------------------------- *--------------------------------------
SLIST.GetByID jsr SLIST.Select SLIST.GetByID jsr SLIST.Select
@ -120,6 +107,10 @@ SLIST.GetByID jsr SLIST.Select
ldy SLIST.IndexOfs ldy SLIST.IndexOfs
rts rts
*-------------------------------------- *--------------------------------------
SLIST.NewKey
clc
rts
*--------------------------------------
SLIST.UpdateByID SLIST.UpdateByID
jsr SLIST.Select jsr SLIST.Select
@ -145,6 +136,28 @@ SLIST.UpdateByID
clc clc
rts rts
*-------------------------------------- *--------------------------------------
SLIST.Lookup jsr SLIST.Search
bcs .9
sty .8+1 Save Key Length
jsr SLIST.GetBlockByte
tax
jsr MEM.SetDataByte
.1 jsr SLIST.GetNextBlockByte
jsr MEM.SetDataByte
dex
bne .1
.8 lda #$ff SELF MODIFIED
ldx ZPSListID
ldy ZPSListID+1
clc
.9 rts
*--------------------------------------
SLIST.New >LDYAI 160 40k Max before out of memory!!! SLIST.New >LDYAI 160 40k Max before out of memory!!!
jsr K.GetMem0 jsr K.GetMem0
bcs .9 bcs .9