A2osX/SYS/KERNEL.S.SLIST.txt

373 lines
6.1 KiB
Plaintext
Raw Normal View History

NEW
2018-11-17 17:17:13 +00:00
PREFIX
AUTO 4,1
*--------------------------------------
2019-01-30 16:23:00 +00:00
X.SLIST jmp (.1-SYS.SListAddData,x)
2019-03-13 16:29:24 +00:00
.1 .DA SLIST.AddData
.DA SLIST.GetData
.DA SLIST.SetData
.DA SLIST.GetByID
2019-03-13 16:29:24 +00:00
.DA SLIST.NewKey
.DA SLIST.Lookup
.DA SLIST.New
2018-06-21 15:12:10 +00:00
.DA SLIST.Free
*--------------------------------------
2019-03-14 16:51:02 +00:00
SLIST.AddData jsr SLIST.Select
bcs .99 Lookup succeeded...DUP
2018-01-22 16:52:04 +00:00
ldy #$ff
2018-01-22 16:52:04 +00:00
.1 iny
jsr MEM.GetKeyCharY
bcc .1
sty .8+1
tya
2018-01-22 16:52:04 +00:00
beq .9 CS
jsr SLIST.AddBlockByte
bcs .9
ldy #0
.2 jsr MEM.GetKeyCharY
bcs .3
jsr SLIST.AddBlockByte
bcs .9
iny
bra .2
.3 jsr MEM.GetDataByte
tax
jsr SLIST.AddBlockByte
bcs .9
.4 jsr MEM.GetDataByte
jsr SLIST.AddBlockByte
bcs .9
dex
bne .4
2018-01-29 16:48:07 +00:00
.8 lda #$ff SELF MODIFIED
clc
2019-03-14 16:51:02 +00:00
rts
2018-01-29 16:48:07 +00:00
2019-03-14 16:51:02 +00:00
.99 lda #E.NOPKEY
sec
2018-01-29 16:48:07 +00:00
.9 rts
2019-03-13 16:29:24 +00:00
*--------------------------------------
SLIST.GetData
*--------------------------------------
SLIST.SetData
clc
rts
*--------------------------------------
SLIST.GetByID jsr SLIST.Select
jsr SLIST.GetBlockByte
tax
beq .9
ldy #0
jsr MEM.SetKeyCharY
.1 jsr SLIST.GetNextBlockByte
iny
jsr MEM.SetKeyCharY
dex
bne .1
jsr SLIST.GetNextBlockByte
2018-01-22 16:52:04 +00:00
tax
2018-01-22 16:52:04 +00:00
jsr MEM.SetDataByte
.2 jsr SLIST.GetNextBlockByte
jsr MEM.SetDataByte
dex
bne .2
jsr SLIST.GetNextBlockByte
clc
2018-01-29 16:48:07 +00:00
.HS B0 BCS
.9 sec
2018-01-29 16:48:07 +00:00
ldx SLIST.BlockOfs
ldy SLIST.IndexOfs
rts
*--------------------------------------
2019-03-14 16:51:02 +00:00
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
2019-03-13 16:29:24 +00:00
clc
rts
2019-03-14 16:51:02 +00:00
.99 lda #E.DUPKEY
sec
.9 rts
2019-03-13 16:29:24 +00:00
*--------------------------------------
SLIST.UpdateByID
jsr SLIST.Select
jsr SLIST.GetBlockByte
tax
.1 jsr SLIST.GetNextBlockByte
dex
bne .1
jsr SLIST.GetNextBlockByte set pos at DATALEN
jsr MEM.GetDataByte
tax
jsr SLIST.SetBlockByte
.4 jsr MEM.GetDataByte
jsr SLIST.SetBlockByte
dex
bne .4
clc
rts
*--------------------------------------
2019-03-13 16:29:24 +00:00
SLIST.Lookup jsr SLIST.Search
bcs .9
2019-03-14 16:51:02 +00:00
>LDYA ZPSListID
ldx SLIST.KeyLen
2019-03-13 16:29:24 +00:00
.9 rts
*--------------------------------------
2018-01-22 07:34:59 +00:00
SLIST.New >LDYAI 160 40k Max before out of memory!!!
2018-06-21 15:12:10 +00:00
jsr K.GetMem0
2018-01-22 07:34:59 +00:00
bcs .9
>STYA ZPSListIBlkPtr
2018-01-22 07:34:59 +00:00
stx .8+1
>LDYAI 256
2018-06-21 15:12:10 +00:00
jsr K.GetMem0
2018-01-22 07:34:59 +00:00
bcs .9
txa
sta (ZPSListIBlkPtr)
2018-01-22 07:34:59 +00:00
.8 lda #$ff SELF MODIFIED
.9 rts
*--------------------------------------
2018-06-21 15:12:10 +00:00
SLIST.Free sta .8+1
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA .1+1
ldx #0
.1 lda $ffff,x SELF MODIFIED
beq .8
2018-06-21 15:12:10 +00:00
jsr K.FreeMem
inx
bra .1
.8 lda #$ff SELF MODIFIED
2018-06-21 15:12:10 +00:00
jmp K.FreeMem
*--------------------------------------
2019-03-14 16:51:02 +00:00
* PRIVATE
*--------------------------------------
2018-06-21 15:12:10 +00:00
SLIST.Select jsr K.GetMemPtr
>STYA ZPSListIBlkPtr
ldy ZPSListID+1
sty SLIST.IndexOfs
lda (ZPSListIBlkPtr),y
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
lda ZPSListID
sta SLIST.BlockOfs
rts
*--------------------------------------
2018-06-21 15:12:10 +00:00
SLIST.Search jsr K.GetMemPtr
>STYA ZPSListIBlkPtr
stz SLIST.IndexOfs
stz ZPSListID+1
lda (ZPSListIBlkPtr)
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
stz SLIST.BlockOfs
stz ZPSListID
2019-03-14 16:51:02 +00:00
ldy #$ff
2019-03-14 16:51:02 +00:00
.1 iny
jsr MEM.GetKeyCharY
2019-03-14 16:51:02 +00:00
bcc .1
2019-03-14 16:51:02 +00:00
sty SLIST.KeyLen
2019-03-14 16:51:02 +00:00
jsr SLIST.GetBlockByte
beq .9
2019-03-14 16:51:02 +00:00
.2 cmp SLIST.KeyLen
bne .4
2019-03-14 16:51:02 +00:00
ldy #0
2019-03-14 16:51:02 +00:00
.3 jsr SLIST.GetNextBlockByte
cmp (ZPSListKeyPtr),y
bne .4
iny
cpy SLIST.KeyLen
bne .3
clc
rts
2019-03-14 16:51:02 +00:00
.4
jsr SLIST.GetNextBlockByte
ldx SLIST.IndexOfs
stx ZPSListID+1
ldx SLIST.BlockOfs
stx ZPSListID
2019-03-14 16:51:02 +00:00
jsr SLIST.GetBlockByte
bne .2
2019-03-14 16:51:02 +00:00
.9 lda #E.NOKEY
sec
rts
*--------------------------------------
2019-03-14 16:51:02 +00:00
SLIST.Skip
*--------------------------------------
SLIST.GetNextBlockByte
phy
ldy SLIST.BlockOfs
iny
beq .1
lda (ZPSListDBlkPtr),y
sty SLIST.BlockOfs
ply
rts
.1 ldy SLIST.IndexOfs
iny
lda (ZPSListIBlkPtr),y
beq .9 Exit with A=0
sty SLIST.IndexOfs
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
stz SLIST.BlockOfs
lda (ZPSListDBlkPtr)
.9 ply
rts
SLIST.GetBlockByte
phy
ldy SLIST.BlockOfs
lda (ZPSListDBlkPtr),y
ply
rts
*--------------------------------------
SLIST.AddBlockByte
phy
ldy SLIST.BlockOfs
sta (ZPSListDBlkPtr),y
inc SLIST.BlockOfs
bne .8
phx
>LDYAI 256
2018-06-21 15:12:10 +00:00
jsr K.GetMem0
bcs .9
>STYA ZPSListDBlkPtr
txa
inc SLIST.IndexOfs
ldy SLIST.IndexOfs
sta (ZPSListIBlkPtr),y
* stz SLIST.BlockOfs
plx
.8 ply
clc
rts
.9 plx
ply
sec
rts
*--------------------------------------
SLIST.SetBlockByte
phy
ldy SLIST.BlockOfs
sta (ZPSListDBlkPtr),y
inc SLIST.BlockOfs
bne .8
inc SLIST.IndexOfs
ldy SLIST.IndexOfs
lda (ZPSListIBlkPtr),y
beq *
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
* stz SLIST.BlockOfs
.8 ply
rts
*--------------------------------------
2019-03-14 16:51:02 +00:00
SLIST.KeyLen .BS 1
SLIST.IndexOfs .BS 1
SLIST.BlockOfs .BS 1
*--------------------------------------
MAN
2018-11-17 17:17:13 +00:00
SAVE USR/SRC/SYS/KERNEL.S.SLIST
LOAD USR/SRC/SYS/KERNEL.S
ASM