A2osX/SYS/KERNEL.S.SLISTX.txt

503 lines
8.8 KiB
Plaintext
Raw Normal View History

NEW
2019-04-10 15:51:47 +00:00
AUTO 3,1
*--------------------------------------
2020-02-20 16:54:51 +00:00
ZPSListDataOfs .EQ ZPMEMMGR+8
2019-07-29 15:38:55 +00:00
ZPSListDataLen .EQ ZPMEMMGR+10
ZPSListIBlkPtr .EQ ZPMEMMGR+12
ZPSListDBlkPtr .EQ ZPMEMMGR+14
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLIST.KeyLen .BS 1
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
2020-02-20 07:41:52 +00:00
SLIST.KeyID.Save .BS 2
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListGetData
2019-07-29 15:38:55 +00:00
jsr SLIST.Select
2020-02-20 07:41:52 +00:00
2019-03-15 16:20:28 +00:00
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
2020-02-20 16:54:51 +00:00
sbc ZPSListDataOfs Offset
2019-03-15 16:20:28 +00:00
eor #$ff
sta SLIST.nDataCnt
2020-01-26 19:36:49 +00:00
2019-03-15 16:20:28 +00:00
lda SLIST.DataLen+1
2020-02-20 16:54:51 +00:00
sbc ZPSListDataOfs+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
2019-08-12 07:40:16 +00:00
bcc .99 Offset Beyond DataLen
2019-03-18 16:48:16 +00:00
2020-02-20 16:54:51 +00:00
.10 lda ZPSListDataOfs Skip to Offset
ldx ZPSListDataOfs+1
2019-03-18 16:48:16 +00:00
jsr SLIST.SkipDataAX
2020-02-18 15:34:56 +00:00
lda FORPNT
ora FORPNT+1
2019-03-18 16:48:16 +00:00
bne .12
2020-01-26 19:36:49 +00:00
2019-03-18 16:48:16 +00:00
>LDYA SLIST.DataLen
2020-01-26 19:36:49 +00:00
2019-08-12 07:40:16 +00:00
iny
bne .11
inc +1 for ending 0
2020-01-26 19:36:49 +00:00
2019-08-12 07:40:16 +00:00
.11 ldx #SYS.GetMem
2019-08-05 13:30:58 +00:00
jsr K.SYSCALL2.MAIN !!! Get a buffer In MAIN Mem !!!
2019-03-18 16:48:16 +00:00
bcs .9
2020-02-21 13:24:16 +00:00
stx .88+1
2020-02-18 15:34:56 +00:00
>STYA FORPNT
2019-03-18 16:48:16 +00:00
.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
2020-01-26 19:36:49 +00:00
2019-03-15 16:20:28 +00:00
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
2020-01-26 19:36:49 +00:00
2019-03-15 16:20:28 +00:00
.1 ror SLIST.bStringMode
stz ZPSListDataLen
stz ZPSListDataLen+1
2020-01-26 19:36:49 +00:00
2019-03-15 16:20:28 +00:00
.2 inc SLIST.nDataCnt
bne .3
inc SLIST.nDataCnt+1
2020-02-21 13:24:16 +00:00
beq .80
2020-01-26 19:36:49 +00:00
.3 bit SLIST.bStringMode
bmi .4 String mode : until CR
inc SLIST.nBufCnt
2019-03-15 16:20:28 +00:00
bne .4
inc SLIST.nBufCnt+1
2020-02-21 13:24:16 +00:00
beq .82 not string mode : end of buffer, no extra \0
2020-01-26 19:36:49 +00:00
2019-03-15 16:20:28 +00:00
.4 jsr SLIST.GetNextByte
bit SLIST.bStringMode
bpl .5
2020-02-21 13:24:16 +00:00
2019-03-15 16:20:28 +00:00
cmp #C.CR
2020-02-21 13:24:16 +00:00
beq .81
2020-02-18 15:34:56 +00:00
.5 jsr SHARED.FORPNT.PutNext
2019-03-15 16:20:28 +00:00
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
2020-02-21 13:24:16 +00:00
.80 bit SLIST.bStringMode
bpl .82
.81 lda #0
2020-02-18 15:34:56 +00:00
jsr SHARED.FORPNT.PutNext
2020-02-21 13:24:16 +00:00
.82 >LDYA ZPSListDataLen
.88 ldx #$ff SELF MODIFIED
2019-03-18 06:53:20 +00:00
clc
rts
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListAddData
2019-07-29 15:38:55 +00:00
jsr SLIST.Select
2020-02-20 07:41:52 +00:00
2019-03-15 16:20:28 +00:00
jsr SLIST.SkipKey
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
2020-03-06 16:20:29 +00:00
sec
2019-03-15 16:20:28 +00:00
.1 inc ZPSListDataLen
bne .2
inc ZPSListDataLen+1
beq .8
2020-03-05 16:55:02 +00:00
2020-02-18 15:34:56 +00:00
.2 jsr SHARED.FORPNT.GetNext
2020-03-06 16:20:29 +00:00
bcc .3
jsr SLIST.SetBlockByte override ending 0, already allocated
clc
bra .1
.3 jsr SLIST.AddDataByte
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
2020-03-05 16:55:02 +00:00
jmp SLIST.AddDataByte Add an extra 0 to stop Search here
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListSetData
2019-07-29 15:38:55 +00:00
jsr SLIST.Select
2020-02-20 07:41:52 +00:00
2019-03-18 16:48:16 +00:00
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
2020-03-06 16:20:29 +00:00
2019-03-18 16:48:16 +00:00
.1 inc SLIST.nDataCnt
bne .2
2020-03-06 16:20:29 +00:00
2019-03-18 16:48:16 +00:00
inc SLIST.nDataCnt+1
beq .8
2020-03-06 16:20:29 +00:00
2020-02-18 15:34:56 +00:00
.2 jsr SHARED.FORPNT.GetNext
2019-03-18 16:48:16 +00:00
jsr SLIST.SetBlockByte
bra .1
.8 clc
rts
.9 lda #E.DATALEN
sec
2019-03-13 16:29:24 +00:00
rts
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListGetByID
2019-07-29 15:38:55 +00:00
jsr SLIST.Select
2019-03-18 16:48:16 +00:00
jsr SLIST.GetNextByte
tax
beq .9
2020-02-18 15:34:56 +00:00
ldy #0
2020-02-18 15:34:56 +00:00
2019-03-21 07:07:38 +00:00
.1 phy
jsr SLIST.GetNextByte
ply
2020-02-18 15:34:56 +00:00
2020-02-24 13:33:28 +00:00
jsr SHARED.FORPNT.PutNext
2020-02-18 15:34:56 +00:00
iny
dex
bne .1
2020-02-18 15:34:56 +00:00
2019-03-18 16:48:16 +00:00
txa lda #0
2020-02-18 15:34:56 +00:00
2020-02-24 13:33:28 +00:00
jsr SHARED.FORPNT.PutNext
2019-03-18 16:48:16 +00:00
jsr SLIST.SkipData
2019-03-15 16:20:28 +00:00
>LDYA SLIST.KeyID
2019-03-18 16:48:16 +00:00
clc
rts
2020-02-18 15:34:56 +00:00
2019-03-18 16:48:16 +00:00
.9 lda #E.NOKEY
sec
rts
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListNewKey
2019-07-29 15:38:55 +00:00
jsr SLIST.Search
2019-03-14 16:51:02 +00:00
bcc .99
2020-02-18 15:34:56 +00:00
2020-03-05 16:55:02 +00:00
>LDYA SLIST.KeyID
>STYA SLIST.KeyID.Save End of list
2019-03-14 16:51:02 +00:00
lda SLIST.KeyLen
2020-03-06 16:20:29 +00:00
jsr SLIST.SetBlockByte override ending 0, already allocated
2020-02-18 15:34:56 +00:00
2019-03-14 16:51:02 +00:00
ldy #0
2020-02-18 15:34:56 +00:00
.1 jsr SHARED.TXTPTR.GetY
2020-03-05 16:55:02 +00:00
jsr SLIST.AddDataByte
2019-03-14 16:51:02 +00:00
bcs .9
2020-02-18 15:34:56 +00:00
2019-03-14 16:51:02 +00:00
iny
cpy SLIST.KeyLen
bne .1
2020-02-18 15:34:56 +00:00
2020-03-06 16:20:29 +00:00
lda #0 Data Len lo = 0
2020-03-05 16:55:02 +00:00
jsr SLIST.AddDataByte
2019-03-14 16:51:02 +00:00
bcs .9
2020-02-18 15:34:56 +00:00
2020-03-06 16:20:29 +00:00
lda #0 Data Len hi = 0
2020-03-05 16:55:02 +00:00
jsr SLIST.AddDataByte
2019-03-14 16:51:02 +00:00
bcs .9
2020-02-18 15:34:56 +00:00
2020-03-06 16:20:29 +00:00
lda #0 Ending Len = 0
2020-03-05 16:55:02 +00:00
jsr SLIST.AddDataByte
2019-03-27 17:01:01 +00:00
bcs .9
2020-02-20 16:54:51 +00:00
>LDYA SLIST.KeyID.Save
2019-03-19 16:52:08 +00:00
ldx SLIST.KeyLen
2020-02-18 15:34:56 +00:00
* clc
2019-03-13 16:29:24 +00:00
rts
2020-02-18 15:34:56 +00:00
2019-04-09 15:47:33 +00:00
.99 lda #E.DUPKEY
2019-03-14 16:51:02 +00:00
sec
2019-10-03 06:25:27 +00:00
.9 rts
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListLookup
2019-07-29 15:38:55 +00:00
jsr SLIST.Search
2019-03-13 16:29:24 +00:00
bcs .9
2019-03-14 16:51:02 +00:00
ldx SLIST.KeyLen
2019-03-13 16:29:24 +00:00
.9 rts
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.SListFree
2020-03-03 16:44:52 +00:00
pha
2020-02-18 15:34:56 +00:00
jsr K.GetMemPtr
>STYA .1+1
ldx #0
.1 lda $ffff,x SELF MODIFIED
beq .8
jsr K.FreeMem
inx
bra .1
2020-03-03 16:44:52 +00:00
.8 pla
2020-02-18 15:34:56 +00:00
jmp K.FreeMem
*--------------------------------------
2020-02-20 07:41:52 +00:00
SLISTX.SListNew >LDYAI 128 32k Max before out of memory!!!
2020-03-06 06:56:36 +00:00
ldx #S.MEM.F.INIT0+8 index
jsr MEM.GetMem.YAX
2018-01-22 07:34:59 +00:00
bcs .9
2020-02-20 07:41:52 +00:00
>STYA ZPSListIBlkPtr
2018-01-22 07:34:59 +00:00
stx .8+1
2020-02-20 07:41:52 +00:00
2018-01-22 07:34:59 +00:00
>LDYAI 256
2020-03-06 06:56:36 +00:00
ldx #4 data
jsr MEM.GetMem.YAX
2018-01-22 07:34:59 +00:00
bcs .9
2020-02-20 07:41:52 +00:00
2019-03-27 17:01:01 +00:00
>STYA ZPSListDBlkPtr
2020-02-20 07:41:52 +00:00
2019-03-27 17:01:01 +00:00
lda #0
sta (ZPSListDBlkPtr)
2018-01-22 07:34:59 +00:00
txa
sta (ZPSListIBlkPtr)
2020-02-20 07:41:52 +00:00
2019-10-03 06:25:27 +00:00
.8 lda #$ff SELF MODIFIED
2018-01-22 07:34:59 +00:00
.9 rts
*--------------------------------------
2019-03-14 16:51:02 +00:00
* PRIVATE
2019-07-29 15:38:55 +00:00
*--------------------------------------
2020-02-20 16:54:51 +00:00
SLIST.Search jsr K.GetMemPtr
>STYA ZPSListIBlkPtr
lda (ZPSListIBlkPtr)
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
2020-02-18 15:34:56 +00:00
2019-03-14 16:51:02 +00:00
ldy #$ff
2019-03-14 16:51:02 +00:00
.1 iny
2020-02-18 15:34:56 +00:00
jsr SHARED.TXTPTR.GetY
beq .11
2020-02-20 07:41:52 +00:00
2020-02-18 15:34:56 +00:00
jsr SHARED.IsIDValid
2019-03-14 16:51:02 +00:00
bcc .1
2020-02-18 15:34:56 +00:00
.11 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
2020-02-18 15:34:56 +00:00
2020-02-20 16:54:51 +00:00
.2 >LDYA SLIST.KeyID
>STYA SLIST.KeyID.Save
ldy SLIST.BytePtr
2019-03-18 06:53:20 +00:00
lda (ZPSListDBlkPtr),y
2019-03-18 16:48:16 +00:00
beq .9
2020-02-18 15:34:56 +00:00
2019-03-18 06:53:20 +00:00
cmp SLIST.KeyLen
2019-03-15 16:20:28 +00:00
bne .5
2020-02-20 07:41:52 +00:00
2019-03-18 06:53:20 +00:00
jsr SLIST.GetNextByte Skip Len
2020-02-18 15:34:56 +00:00
2019-03-14 16:51:02 +00:00
ldy #0
2020-02-18 15:34:56 +00:00
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
2020-02-18 15:34:56 +00:00
jsr SHARED.TXTPTR.GetY
2019-10-03 06:25:27 +00:00
.4 cmp #$ff SELF MODIFIED
2019-03-15 16:20:28 +00:00
bne .5
2019-03-14 16:51:02 +00:00
iny
cpy SLIST.KeyLen
bne .3
2020-02-18 15:34:56 +00:00
2020-02-20 07:41:52 +00:00
>LDYA SLIST.KeyID.Save
2019-03-14 16:51:02 +00:00
clc
rts
2020-02-18 15:34:56 +00:00
2020-02-20 07:41:52 +00:00
.5 >LDYA SLIST.KeyID.Save
jsr SLIST.Select.I move back...
2019-03-19 07:26:14 +00:00
jsr SLIST.Next
2019-03-18 06:53:20 +00:00
bra .2
2020-02-18 15:34:56 +00:00
2019-03-14 16:51:02 +00:00
.9 lda #E.NOKEY
sec
rts
*--------------------------------------
2020-02-20 16:54:51 +00:00
SLIST.Select jsr K.GetMemPtr
2019-03-28 16:48:22 +00:00
>STYA ZPSListIBlkPtr
2020-02-20 07:41:52 +00:00
>LDYA TXTPTR
SLIST.Select.I >STYA SLIST.KeyID
ldy SLIST.BlockPtr
2020-02-18 15:34:56 +00:00
2019-10-03 06:25:27 +00:00
lda (ZPSListIBlkPtr),y
2019-03-28 16:48:22 +00:00
jsr K.GetMemPtr
>STYA ZPSListDBlkPtr
2020-02-18 15:34:56 +00:00
2019-03-28 16:48:22 +00:00
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
2019-10-03 06:25:27 +00:00
SLIST.SkipDataAX
2019-03-15 16:20:28 +00:00
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
2019-10-03 06:25:27 +00:00
.8 rts
*--------------------------------------
2020-03-05 16:55:02 +00:00
SLIST.AddDataByte
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
2020-03-04 16:38:32 +00:00
phx
>LDYAI 256
2020-03-06 06:56:36 +00:00
ldx #4
jsr MEM.GetMem.YAX
bcs .9
2020-03-04 16:38:32 +00:00
>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
2020-03-04 16:38:32 +00:00
.8 ply
clc
rts
.9 plx
ply
2019-10-03 06:25:27 +00:00
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-08-12 07:40:16 +00:00
bne SLIST.ToNextBlock.RTS
2019-03-27 21:14:40 +00:00
*--------------------------------------
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-10-03 06:25:27 +00:00
SLIST.ToNextBlock.RTS
2019-03-27 21:14:40 +00:00
rts
*--------------------------------------
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