Kernel 0.92+

This commit is contained in:
Rémy GIBERT 2019-03-14 16:51:02 +00:00
parent caacecbc3e
commit fac33c60ce
8 changed files with 207 additions and 112 deletions

View File

@ -449,8 +449,9 @@ Y,A = PTR to MemBlock
# SListAddData
## ASM
`PUSHB Data`
`PUSHW DataID`
`PUSHB DataLen`
`PUSHB DataPtr`
`PUSHW KeyID`
`lda hSList`
`>SYSCALL SListAddData`
@ -460,24 +461,24 @@ Y,A = PTR to MemBlock
# SListGetData
## ASM
`PUSHB Data`
`PUSHW DataID`
`PUSHB DataLen`
`PUSHB DataPtr`
`PUSHW KeyID`
`lda hSList`
`>SYSCALL SListGetData`
## RETURN VALUE
Y,A = Next DataID
# SListSetData
## ASM
`PUSHB Data`
`PUSHW DataID`
`PUSHB DataLen`
`PUSHB DataPtr`
`PUSHW KeyID`
`lda hSList`
`>SYSCALL SListSetData`
## RETURN VALUE
Y,A = Next DataID
# SListGetByID
@ -490,16 +491,16 @@ Y,A = PTR to MemBlock
## RETURN VALUE
Y,A = Next KeyID
# SListAddKey
# SListNewKey
## ASM
`PUSHW KeyPtr`
`lda hSList`
`>SYSCALL SListAddKey`
`>SYSCALL SListNewKey`
## RETURN VALUE
A = Key Length
X,Y = KeyID
Y,A = KeyID
X = KeyLen
# SListLookup
@ -536,7 +537,6 @@ A=hSList
`>SYSCALL GetStkObjData`
## RETURN VALUE
Y,A = Property Value
# NewStkObj
Y,A = Size Requested

Binary file not shown.

View File

@ -559,7 +559,13 @@ CMD.FUNC lda (ZPArgVBufPtr)
bcs .99
lda #$C0+C.FUNC
jmp CORE.StkPush
jsr CORE.StkPush
bcs .99
lda #$ff
>STA.G bFuncMode
clc
rts
.9 jmp CMD.Exec.CSYN
.99 rts
@ -678,7 +684,7 @@ CMD.END jsr CORE.StkGetCtx Get context in CORE.Test
and #$3F
cmp #C.FUNC
beq .3
beq CMD.END.FUNC
cmp #C.SWITCH
beq .2
@ -696,7 +702,7 @@ CMD.END jsr CORE.StkGetCtx Get context in CORE.Test
>SYSCALL freemem
rts
.3 jsr CORE.StkPull remove C.FUNC
CMD.END.FUNC jsr CORE.StkPull remove C.FUNC
jsr CORE.StkPull remove KeyID
jmp CORE.StkPull remove KeyID

View File

@ -47,7 +47,7 @@ CORE.Quit >LDA.G hFuncList
* set hStdIn = hStdOut
* set hStdOut = Std
*--------------------------------------
CORE.Run.CSYN lda #E.SYN
CORE.Run.SYN lda #E.SYN
sec
rts
@ -81,7 +81,7 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
bcs .9
jsr CORE.GetNextCharNB Skip |
bcs CORE.Run.CSYN
bcs CORE.Run.SYN
bra .3
@ -89,19 +89,16 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
jsr IO.Reset
pla
.3 cmp #C.CR
beq .80 empty line ?
.3 cmp #C.CR empty line ?
bne .33
cmp #'#' commented line?
jsr CORE.GetNextChar skip CR...
bra .8
.33 cmp #'#' commented line?
bne .2
.12 jsr CORE.GetNextCharNB
bcs .8 EOF
cmp #C.CR
bne .12 EOL
.80 jsr CORE.GetNextChar skip CR...
.12 jsr CORE.SkipLine
.8 jsr IO.Reset
@ -109,15 +106,10 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
clc
.9 rts EOL, CS,A=0
.2 jsr CORE.StkGet
bcs .13
cmp #$C0+C.FUNC
beq .12
.2 >LDA.G bFuncMode
bpl .13
jmp CORE.Run.Func skip line
.13 jsr CORE.GetCharNB
cmp #'.'
@ -180,7 +172,7 @@ CORE.Run >LDYA ZPInputBufPtr Save Actual cmd for looping
.44 jsr CORE.GetNextCharNB Skip EoL char
clc
.99 rts
*--------------------------------------
.5 >LDYA L.CORE.IO
jsr CORE.LookupInputBuf
bcs .6
@ -258,6 +250,87 @@ CORE.ExecExtCmd.Exit
.8 clc
.9 rts
*--------------------------------------
CORE.Run.Func ldy #$ff
.1 iny
lda (ZPInputBufPtr),y
beq .9
cmp #C.SPACE
beq .1
jsr ToUpperCase
cmp #'E'
bne .8
iny
lda (ZPInputBufPtr),y
beq .9
jsr ToUpperCase
cmp #'N'
bne .8
iny
lda (ZPInputBufPtr),y
beq .9
jsr ToUpperCase
cmp #'D'
bne .8
iny
lda (ZPInputBufPtr),y
beq .9
cmp #C.SPACE
beq .7
cmp #C.CR
bne .9
.7 jsr CORE.SkipLine
lda #0
>STA.G bFuncMode
jmp CMD.END.FUNC Cleanup Stk
.9 jmp CORE.Run.SYN
.8 ldy #0
.80 lda (ZPInputBufPtr),y
iny
beq .82
cmp #C.CR
bne .80
.82 lda #0
>PUSHYA DataLen
>PUSHW ZPInputBufPtr DataPtr
lda (pData)
tay
dey skip C.FUNC
lda (pData),y KeyID
>PUSHA
dey
lda (pData),y KeyID
>PUSHA
>LDA.G hFuncList
>SYSCALL SListAddData
bcs .9
*--------------------------------------
CORE.SkipLine jsr CORE.GetNextCharNB
bcs .8 EOF
cmp #C.CR EOL
bne CORE.SkipLine
jsr CORE.GetNextChar skip CR...
.8 rts
*--------------------------------------
* search ZPInputBufPtr/ZPArgVBufPtr in Y,A table
*--------------------------------------
CORE.LookupInputBuf

View File

@ -690,6 +690,7 @@ hInputBuf .BS 1
bReadMode .BS 1
bBatchMode .BS 1
bFuncMode .BS 1
bEscMode .BS 1
bPause .BS 1

View File

@ -106,6 +106,9 @@ E.FTB .EQ $F5 File Too Big Error
E.OOB .EQ $F4 Out Of Bound
E.INUM .EQ $F3 Invalid Numerical
E.IUSR .EQ $F2 Invalid User
E.NOKEY .EQ $EF Undefined Key
E.DUPKEY .EQ $EE Duplicate Key
*--------------------------------------
* A2osX.SYSCALL Constants
*--------------------------------------

View File

@ -6,10 +6,11 @@ ZPMemMgrSPtr .EQ ZPMEMMGR Pointer To Slot selected
ZPMemMgrTmp1 .EQ ZPMEMMGR+2
ZPMemMgrSize .EQ ZPMEMMGR+4
ZPSListID .EQ ZPMEMMGR+6
ZPSListIBlkPtr .EQ ZPMEMMGR+8
ZPSListDBlkPtr .EQ ZPMEMMGR+10
ZPSListKeyPtr .EQ ZPMEMMGR+12
ZPSListDataPtr .EQ ZPMEMMGR+14
ZPSListKeyPtr .EQ ZPMEMMGR+8
ZPSListDataPtr .EQ ZPMEMMGR+8
ZPSListDataLen .EQ ZPMEMMGR+10
ZPSListIBlkPtr .EQ ZPMEMMGR+12
ZPSListDBlkPtr .EQ ZPMEMMGR+14
*/--------------------------------------
* # GetMem0
* Y,A = Size Requested
@ -353,7 +354,7 @@ K.FreeMem tay
* (X unmodified)
*\--------------------------------------
* Optimized for :
* Mem.Table is page aligned at $1800
* Mem.Table is page aligned at $800
* S.MEM is 8 bytes
*--------------------------------------
.DO Mem.Table=$800
@ -387,8 +388,9 @@ MEM.GetMemByID sta ZPMemMgrSPtr
*/--------------------------------------
* # SListAddData
* ## ASM
* `PUSHB Data`
* `PUSHW DataID`
* `PUSHB DataLen`
* `PUSHB DataPtr`
* `PUSHW KeyID`
* `lda hSList`
* `>SYSCALL SListAddData`
* ## RETURN VALUE
@ -398,23 +400,23 @@ K.SListAddData
*/--------------------------------------
* # SListGetData
* ## ASM
* `PUSHB Data`
* `PUSHW DataID`
* `PUSHB DataLen`
* `PUSHB DataPtr`
* `PUSHW KeyID`
* `lda hSList`
* `>SYSCALL SListGetData`
* ## RETURN VALUE
* Y,A = Next DataID
*\--------------------------------------
K.SListGetData
*/--------------------------------------
* # SListSetData
* ## ASM
* `PUSHB Data`
* `PUSHW DataID`
* `PUSHB DataLen`
* `PUSHB DataPtr`
* `PUSHW KeyID`
* `lda hSList`
* `>SYSCALL SListSetData`
* ## RETURN VALUE
* Y,A = Next DataID
*\--------------------------------------
K.SListSetData pha
>PULLW ZPSListID
@ -441,6 +443,7 @@ K.SListGetByID pha
* `>SYSCALL SListNewKey`
* ## RETURN VALUE
* Y,A = KeyID
* X = KeyLen
*\--------------------------------------
K.SListNewKey
*/--------------------------------------
@ -487,12 +490,12 @@ K.SListFree
* `lda hStkObj`
* `>SYSCALL GetStkObjData`
* ## RETURN VALUE
* Y,A = Property Value
*\--------------------------------------
K.GetStkObjData sta SETREADAUX
jsr K.GetMemPtr
>STYA ZPMemMgrTmp1
>PULLW ZPSListDataLen
>PULLW ZPSListDataPtr
lda (ZPMemMgrTmp1),y

View File

@ -12,8 +12,10 @@ X.SLIST jmp (.1-SYS.SListAddData,x)
.DA SLIST.New
.DA SLIST.Free
*--------------------------------------
SLIST.AddData jsr SLIST.Search
bcc .99 Lookup succeeded...DUP
SLIST.AddData jsr SLIST.Select
bcs .99 Lookup succeeded...DUP
ldy #$ff
@ -55,14 +57,11 @@ SLIST.AddData jsr SLIST.Search
.8 lda #$ff SELF MODIFIED
clc
.HS B0 BCS
.99 sec
ldx ZPSListID
ldy ZPSListID+1
rts
.99 lda #E.NOPKEY
sec
.9 rts
*--------------------------------------
SLIST.GetData
*--------------------------------------
@ -107,9 +106,40 @@ SLIST.GetByID jsr SLIST.Select
ldy SLIST.IndexOfs
rts
*--------------------------------------
SLIST.NewKey
SLIST.NewKey jsr SLIST.Search
bcc .99
>LDYA SLIST.IndexOfs
>STYA ZPSListID
lda SLIST.KeyLen
jsr SLIST.AddBlockByte
bcs .9
ldy #0
.1 lda (ZPSListKeyPtr),y
jsr SLIST.AddBlockByte
bcs .9
iny
cpy SLIST.KeyLen
bne .1
lda #0
jsr SLIST.AddBlockByte
bcs .9
lda #0
jsr SLIST.AddBlockByte
bcs .9
>LDYA ZPSListID
clc
rts
.99 lda #E.DUPKEY
sec
.9 rts
*--------------------------------------
SLIST.UpdateByID
jsr SLIST.Select
@ -137,25 +167,11 @@ SLIST.UpdateByID
rts
*--------------------------------------
SLIST.Lookup jsr SLIST.Search
bcs .9
sty .8+1 Save Key Length
>LDYA ZPSListID
ldx SLIST.KeyLen
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!!!
@ -190,6 +206,8 @@ SLIST.Free sta .8+1
.8 lda #$ff SELF MODIFIED
jmp K.FreeMem
*--------------------------------------
* PRIVATE
*--------------------------------------
SLIST.Select jsr K.GetMemPtr
>STYA ZPSListIBlkPtr
@ -217,47 +235,34 @@ SLIST.Search jsr K.GetMemPtr
stz SLIST.BlockOfs
stz ZPSListID
ldy #$ff
.1 iny
jsr MEM.GetKeyCharY
bcc .1
sty SLIST.KeyLen
jsr SLIST.GetBlockByte
tax
beq .9
.1 ldy #0
.2 jsr MEM.GetKeyCharY
bcs .40
iny
sta .3+1
jsr SLIST.GetNextBlockByte
.3 cmp #$ff SELF MODIFIED
.2 cmp SLIST.KeyLen
bne .4
dex
bne .2
ldy #0
jsr MEM.GetKeyCharY
bcs .8 End of Key....match!!!!
.3 jsr SLIST.GetNextBlockByte
cmp (ZPSListKeyPtr),y
bne .4
jsr SLIST.GetNextBlockByte
bra .41
iny
cpy SLIST.KeyLen
bne .3
.8 jsr SLIST.GetNextBlockByte Advance to DATA LEN
clc Y = Key Length
clc
rts
.40 inx
.4 jsr SLIST.GetNextBlockByte skip remaining key chars
dex
bne .4
.41 tax A=get Data Len
.5 jsr SLIST.GetNextBlockByte skip data bytes
dex
bne .5
.4
jsr SLIST.GetNextBlockByte
ldx SLIST.IndexOfs
@ -265,12 +270,15 @@ SLIST.Search jsr K.GetMemPtr
ldx SLIST.BlockOfs
stx ZPSListID
tax
bne .1
jsr SLIST.GetBlockByte
bne .2
.9 sec
.9 lda #E.NOKEY
sec
rts
*--------------------------------------
SLIST.Skip
*--------------------------------------
SLIST.GetNextBlockByte
phy
ldy SLIST.BlockOfs
@ -354,6 +362,7 @@ SLIST.SetBlockByte
.8 ply
rts
*--------------------------------------
SLIST.KeyLen .BS 1
SLIST.IndexOfs .BS 1
SLIST.BlockOfs .BS 1
*--------------------------------------