A2osX/SYS/KERNEL.S.SLISTX.txt

482 lines
8.5 KiB
Plaintext
Raw Normal View History

NEW
2019-04-10 15:51:47 +00:00
AUTO 3,1
*--------------------------------------
2019-03-15 16:20:28 +00:00
X.SLIST jmp (.1-SYS.SListGetData,x)
.1 .DA SLIST.GetData
.DA SLIST.AddData
2019-03-13 16:29:24 +00:00
.DA SLIST.SetData
.DA SLIST.GetByID
2019-03-13 16:29:24 +00:00
.DA SLIST.NewKey
.DA SLIST.Lookup
.DA SLIST.New
2019-03-15 16:20:28 +00:00
.DA SLIST.Free
*--------------------------------------
2019-03-15 16:20:28 +00:00
SLIST.GetData jsr SLIST.Select
jsr SLIST.SkipKey
jsr SLIST.GetDataLen
2019-03-18 06:53:20 +00:00
2019-03-18 16:48:16 +00:00
lda SLIST.DataLen
2019-03-15 16:20:28 +00:00
sec
sbc ZPMemMgrSize
eor #$ff
sta SLIST.nDataCnt
lda SLIST.DataLen+1
2019-04-01 06:07:56 +00:00
sbc ZPMemMgrSize+1
2019-03-15 16:20:28 +00:00
eor #$ff
sta SLIST.nDataCnt+1 Data remaining
2019-03-18 16:48:16 +00:00
bcc .99
.10 lda ZPMemMgrSize
ldx ZPMemMgrSize+1
jsr SLIST.SkipDataAX
lda ZPSListDataPtr
ora ZPSListDataPtr+1
bne .12
2019-03-15 16:20:28 +00:00
2019-03-18 16:48:16 +00:00
>LDYA SLIST.DataLen
jsr MEM.GetMainBuf
bcs .9
stx .82+1
>STYA ZPSListDataPtr
.12 lda ZPSListDataLen
ora ZPSListDataLen+1
2019-03-18 06:53:20 +00:00
sec
2019-03-15 16:20:28 +00:00
beq .1 String Mode
lda ZPSListDataLen
eor #$ff
sta SLIST.nBufCnt
lda ZPSListDataLen+1
eor #$ff
sta SLIST.nBufCnt+1
2019-03-18 06:53:20 +00:00
clc
2019-03-15 16:20:28 +00:00
.1 ror SLIST.bStringMode
stz ZPSListDataLen
stz ZPSListDataLen+1
2019-03-15 16:20:28 +00:00
.2 inc SLIST.nDataCnt
bne .3
inc SLIST.nDataCnt+1
beq .8
2019-03-15 16:20:28 +00:00
.3 inc SLIST.nBufCnt
bne .4
inc SLIST.nBufCnt+1
beq .8
.4 jsr SLIST.GetNextByte
bit SLIST.bStringMode
bpl .5
cmp #C.CR
2019-04-01 06:07:56 +00:00
beq .8
2019-03-15 16:20:28 +00:00
.5 jsr MEM.SetDataByte
inc ZPSListDataLen
bne .2
inc ZPSListDataLen+1
bra .2
2019-03-18 06:53:20 +00:00
2019-05-12 20:45:11 +00:00
.99 lda #E.EMPTYKEY
2019-03-15 16:20:28 +00:00
sec
2019-03-18 16:48:16 +00:00
.9 rts
2019-03-18 06:53:20 +00:00
.8 bit SLIST.bStringMode
bpl .81
lda #0
jsr MEM.SetDataByte
inc ZPSListDataLen
bne .81
inc ZPSListDataLen+1
.81 >LDYA ZPSListDataLen
.82 ldx #$ff SELF MODIFIED
clc
rts
2019-03-15 16:20:28 +00:00
*--------------------------------------
SLIST.AddData jsr SLIST.Select
jsr SLIST.SkipKey
2019-03-18 06:53:20 +00:00
2019-03-15 16:20:28 +00:00
>LDYA SLIST.KeyID Save DataLen location
>STYA ZPSListKeyID to update later
2018-01-29 16:48:07 +00:00
2019-03-27 17:01:01 +00:00
ldy SLIST.BytePtr
lda (ZPSListDBlkPtr),y
2019-03-15 16:20:28 +00:00
pha
2018-01-29 16:48:07 +00:00
clc
2019-03-27 17:01:01 +00:00
adc ZPSListDataLen
sta (ZPSListDBlkPtr),y
php
jsr SLIST.ToNextByte skip LEN lo
plp
ldy SLIST.BytePtr
lda (ZPSListDBlkPtr),y
pha
adc ZPSListDataLen+1
sta (ZPSListDBlkPtr),y
jsr SLIST.ToNextByte skip LEN hi
plx
2019-03-15 16:20:28 +00:00
pla
2019-03-27 17:01:01 +00:00
jsr SLIST.SkipDataAX
lda ZPSListDataLen
2019-03-15 16:20:28 +00:00
eor #$ff
sta ZPSListDataLen
lda ZPSListDataLen+1
eor #$ff
sta ZPSListDataLen+1
.1 inc ZPSListDataLen
bne .2
inc ZPSListDataLen+1
beq .8
.2 jsr MEM.GetDataByte
jsr SLIST.AddBlockByte
2019-03-18 06:53:20 +00:00
bcc .1
2019-03-14 16:51:02 +00:00
rts
2019-03-15 16:20:28 +00:00
2019-03-18 16:48:16 +00:00
.8 lda #0
jsr SLIST.AddBlockByte Make sure 0 follow DATA
2019-03-18 06:53:20 +00:00
2018-01-29 16:48:07 +00:00
.9 rts
2019-03-13 16:29:24 +00:00
*--------------------------------------
2019-03-18 16:48:16 +00:00
SLIST.SetData jsr SLIST.Select
jsr SLIST.SkipKey
jsr SLIST.GetDataLen
lda SLIST.DataLen
cmp ZPSListDataLen
bne .9
ldx SLIST.DataLen+1
cpx ZPSListDataLen+1
bne .9
eor #$ff
sta SLIST.nDataCnt
txa
eor #$ff
sta SLIST.nDataCnt+1
.1 inc SLIST.nDataCnt
bne .2
inc SLIST.nDataCnt+1
beq .8
.2 jsr MEM.GetDataByte
jsr SLIST.SetBlockByte
bra .1
.8 clc
rts
.9 lda #E.DATALEN
sec
2019-03-13 16:29:24 +00:00
rts
*--------------------------------------
SLIST.GetByID jsr SLIST.Select
2019-03-18 16:48:16 +00:00
jsr SLIST.GetNextByte
tax
beq .9
ldy #0
2019-03-21 07:07:38 +00:00
.1 phy
jsr SLIST.GetNextByte
ply
jsr MEM.SetKeyCharY
iny
dex
bne .1
2019-03-18 16:48:16 +00:00
txa lda #0
jsr MEM.SetKeyCharY
jsr SLIST.SkipData
2019-03-15 16:20:28 +00:00
>LDYA SLIST.KeyID
2019-03-18 16:48:16 +00:00
clc
rts
2019-03-15 16:20:28 +00:00
2019-03-18 16:48:16 +00:00
.9 lda #E.NOKEY
sec
rts
*--------------------------------------
2019-03-14 16:51:02 +00:00
SLIST.NewKey jsr SLIST.Search
bcc .99
lda SLIST.KeyLen
jsr SLIST.AddBlockByte
bcs .9
ldy #0
2019-03-15 16:20:28 +00:00
.1 jsr MEM.GetKeyCharY
2019-03-14 16:51:02 +00:00
jsr SLIST.AddBlockByte
bcs .9
iny
cpy SLIST.KeyLen
bne .1
2019-03-27 17:01:01 +00:00
lda #0 Data Len = 0
2019-03-14 16:51:02 +00:00
jsr SLIST.AddBlockByte
bcs .9
lda #0
jsr SLIST.AddBlockByte
bcs .9
2019-03-27 17:01:01 +00:00
lda #0 Next Len = 0
jsr SLIST.AddBlockByte
bcs .9
2019-03-15 16:20:28 +00:00
>LDYA ZPSListKeyID
2019-03-19 16:52:08 +00:00
ldx SLIST.KeyLen
2019-03-13 16:29:24 +00:00
clc
rts
2019-03-14 16:51:02 +00:00
2019-04-09 15:47:33 +00:00
.99 lda #E.DUPKEY
2019-03-14 16:51:02 +00:00
sec
.9 rts
2019-03-13 16:29:24 +00:00
*--------------------------------------
SLIST.Lookup jsr SLIST.Search
bcs .9
2019-03-18 06:53:20 +00:00
>LDYA ZPSListKeyID
2019-03-14 16:51:02 +00:00
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
2019-03-27 17:01:01 +00:00
jsr K.GetMem
2018-01-22 07:34:59 +00:00
bcs .9
2019-03-27 17:01:01 +00:00
>STYA ZPSListDBlkPtr
lda #0
sta (ZPSListDBlkPtr)
2018-01-22 07:34:59 +00:00
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.Search jsr K.GetMemPtr
>STYA ZPSListIBlkPtr
lda (ZPSListIBlkPtr)
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
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-18 16:48:16 +00:00
2019-03-27 17:01:01 +00:00
stz SLIST.BytePtr
stz SLIST.BlockPtr
2019-03-18 06:53:20 +00:00
.2 >LDYA SLIST.KeyID
>STYA ZPSListKeyID
2019-03-18 16:48:16 +00:00
ldy SLIST.BytePtr
2019-03-18 06:53:20 +00:00
lda (ZPSListDBlkPtr),y
2019-03-18 16:48:16 +00:00
beq .9
2019-03-18 06:53:20 +00:00
cmp SLIST.KeyLen
2019-03-15 16:20:28 +00:00
bne .5
2019-03-18 06:53:20 +00:00
jsr SLIST.GetNextByte Skip Len
2019-03-14 16:51:02 +00:00
ldy #0
2019-03-18 06:53:20 +00:00
.3 phy
jsr SLIST.GetNextByte
2019-03-15 16:20:28 +00:00
sta .4+1
2019-03-18 06:53:20 +00:00
ply
2019-03-15 16:20:28 +00:00
jsr MEM.GetKeyCharY
.4 cmp #$ff SELF MODIFIED
bne .5
2019-03-14 16:51:02 +00:00
iny
cpy SLIST.KeyLen
bne .3
clc
rts
2019-03-28 16:48:22 +00:00
.5 jsr SLIST.Select.I move back to ZPSListKeyID
2019-03-19 07:26:14 +00:00
jsr SLIST.Next
2019-03-18 06:53:20 +00:00
bra .2
2019-03-14 16:51:02 +00:00
.9 lda #E.NOKEY
sec
rts
*--------------------------------------
2019-03-28 16:48:22 +00:00
SLIST.Select jsr K.GetMemPtr
>STYA ZPSListIBlkPtr
SLIST.Select.I ldy ZPSListKeyID+1
sty SLIST.BlockPtr
lda (ZPSListIBlkPtr),y
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
lda ZPSListKeyID
sta SLIST.BytePtr
rts
*--------------------------------------
2019-03-15 16:20:28 +00:00
SLIST.Next jsr SLIST.SkipKey
SLIST.SkipData jsr SLIST.GetDataLen
2019-03-27 17:01:01 +00:00
2019-03-15 16:20:28 +00:00
lda SLIST.DataLen
ldx SLIST.DataLen+1
SLIST.SkipDataAX
clc
adc SLIST.BytePtr
sta SLIST.BytePtr
txa
adc SLIST.BlockPtr
sta SLIST.BlockPtr
2019-03-18 06:53:20 +00:00
tay
lda (ZPSListIBlkPtr),y
2019-03-15 16:20:28 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
rts
2019-03-14 16:51:02 +00:00
*--------------------------------------
2019-03-15 16:20:28 +00:00
SLIST.SkipKey ldy SLIST.BytePtr
lda (ZPSListDBlkPtr),y Get KeyLen
sec
adc SLIST.BytePtr
sta SLIST.BytePtr
2019-03-27 21:14:40 +00:00
bcs SLIST.ToNextBlock
2019-03-15 16:20:28 +00:00
.8 rts
*--------------------------------------
SLIST.GetDataLen
jsr SLIST.GetNextByte Get DataLenLo
sta SLIST.DataLen
jsr SLIST.GetNextByte Get DataLenHI
sta SLIST.DataLen+1
rts
*--------------------------------------
SLIST.GetNextByte
ldy SLIST.BytePtr
lda (ZPSListDBlkPtr),y
2019-03-27 21:14:40 +00:00
SLIST.ToNextByte
2019-03-15 16:20:28 +00:00
inc SLIST.BytePtr
bne .8
pha
2019-03-27 21:14:40 +00:00
jsr SLIST.ToNextBlock
2019-03-15 16:20:28 +00:00
pla
.8 rts
*--------------------------------------
SLIST.AddBlockByte
phy
2019-03-15 16:20:28 +00:00
ldy SLIST.BytePtr
sta (ZPSListDBlkPtr),y
2019-03-15 16:20:28 +00:00
inc SLIST.BytePtr
bne .8
phx
>LDYAI 256
2019-03-27 17:01:01 +00:00
jsr K.GetMem
bcs .9
>STYA ZPSListDBlkPtr
txa
2019-03-15 16:20:28 +00:00
inc SLIST.BlockPtr
ldy SLIST.BlockPtr
sta (ZPSListIBlkPtr),y
2019-03-15 16:20:28 +00:00
* stz SLIST.BytePtr
plx
.8 ply
clc
rts
.9 plx
ply
sec
2019-03-27 21:14:40 +00:00
SLIST.AddBlockByte.RTS
rts
*--------------------------------------
SLIST.SetBlockByte
2019-03-18 06:53:20 +00:00
ldy SLIST.BytePtr
sta (ZPSListDBlkPtr),y
2019-03-18 06:53:20 +00:00
inc SLIST.BytePtr
2019-03-27 21:14:40 +00:00
bne SLIST.AddBlockByte.RTS
*--------------------------------------
SLIST.ToNextBlock
inc SLIST.BlockPtr
ldy SLIST.BlockPtr
lda (ZPSListIBlkPtr),y
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
2019-03-27 21:14:40 +00:00
rts
*--------------------------------------
2019-03-14 16:51:02 +00:00
SLIST.KeyLen .BS 1
2019-03-15 16:20:28 +00:00
SLIST.DataLen .BS 2
SLIST.nDataCnt .BS 2
SLIST.nBufCnt .BS 2
SLIST.bStringMode .BS 1
SLIST.KeyID .EQ *
SLIST.BytePtr .BS 1
SLIST.BlockPtr .BS 1
*--------------------------------------
MAN
2019-04-10 15:51:47 +00:00
SAVE USR/SRC/SYS/KERNEL.S.SLISTX
2018-11-17 17:17:13 +00:00
LOAD USR/SRC/SYS/KERNEL.S
ASM