A2osX/SYS/KERNEL.S.SLIST.txt

351 lines
5.8 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)
.1 .DA SLIST.Add
.DA SLIST.Lookup
.DA SLIST.GetByID
.DA SLIST.UpdateByID
.DA SLIST.New
2018-06-21 15:12:10 +00:00
.DA SLIST.Free
*--------------------------------------
SLIST.Add jsr SLIST.Search
bcc .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
.HS B0 BCS
.99 sec
ldx ZPSListID
ldy ZPSListID+1
2018-01-29 16:48:07 +00:00
.9 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.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
*--------------------------------------
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
*--------------------------------------
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
*--------------------------------------
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
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
bne .4
dex
bne .2
jsr MEM.GetKeyCharY
bcs .8 End of Key....match!!!!
jsr SLIST.GetNextBlockByte
bra .41
.8 jsr SLIST.GetNextBlockByte Advance to DATA LEN
clc Y = Key Length
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
jsr SLIST.GetNextBlockByte
ldx SLIST.IndexOfs
stx ZPSListID+1
ldx SLIST.BlockOfs
stx ZPSListID
tax
bne .1
.9 sec
rts
*--------------------------------------
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
*--------------------------------------
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