A2osX/SYS/KERNEL.S.SLISTX.txt

467 lines
7.4 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
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLIST.Opt .BS 1
2020-02-18 15:34:56 +00:00
SLIST.KeyLen .BS 1
SLIST.DataLen .BS 2
SLIST.nDataCnt .BS 2
SLIST.nBufCnt .BS 2
2021-05-04 17:31:21 +00:00
SLIST.bStr .BS 1
SLIST.b0 .BS 1
SLIST.KeyID .BS 2
2020-02-18 15:34:56 +00:00
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLISTX.GetData 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-08-18 08:00:26 +00:00
lda ZPSListDataOfs Skip to Offset
2020-02-20 16:54:51 +00:00
ldx ZPSListDataOfs+1
2019-03-18 16:48:16 +00:00
jsr SLIST.SkipDataAX
2021-05-04 17:31:21 +00:00
stz SLIST.b0
2020-08-18 08:00:26 +00:00
2020-02-18 15:34:56 +00:00
lda FORPNT
ora FORPNT+1
2020-08-17 13:03:39 +00:00
bne .12 buffer provided
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
2020-08-18 08:00:26 +00:00
sec
2021-05-04 17:31:21 +00:00
ror SLIST.b0
2020-08-18 08:00:26 +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
2021-05-04 17:31:21 +00:00
.1 ror SLIST.bStr
2019-03-15 16:20:28 +00:00
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-08-17 13:03:39 +00:00
beq .80
2020-01-26 19:36:49 +00:00
2021-05-04 17:31:21 +00:00
.3 bit SLIST.bStr
2020-01-26 19:36:49 +00:00
bmi .4 String mode : until CR
inc SLIST.nBufCnt
2019-03-15 16:20:28 +00:00
bne .4
inc SLIST.nBufCnt+1
2020-08-18 08:00:26 +00:00
beq .80 not string mode : until end of buffer
2020-01-26 19:36:49 +00:00
2021-05-04 17:31:21 +00:00
.4 jsr BLISTX.GetNByte
bit SLIST.bStr
2019-03-15 16:20:28 +00:00
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
2021-05-04 17:31:21 +00:00
.5 jsr SHARED.FORPNTpn
2019-03-15 16:20:28 +00:00
inc ZPSListDataLen
bne .2
2019-03-15 16:20:28 +00:00
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
2021-05-04 17:31:21 +00:00
.80 lda SLIST.bStr
ora SLIST.b0
2020-02-21 13:24:16 +00:00
bpl .82
.81 lda #0
2021-05-04 17:31:21 +00:00
jsr SHARED.FORPNTpn
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
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLISTX.AddData 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
jsr SLISTX.CheckLen
2021-05-04 17:31:21 +00:00
ldy iByte
lda (DBlkPtr),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
2021-05-04 17:31:21 +00:00
sta (DBlkPtr),y
2019-03-27 17:01:01 +00:00
php
2021-05-04 17:31:21 +00:00
jsr BLISTX.2NByte skip LEN lo
2019-03-27 17:01:01 +00:00
plp
2021-05-04 17:31:21 +00:00
ldy iByte
lda (DBlkPtr),y
2019-03-27 17:01:01 +00:00
pha
adc ZPSListDataLen+1
2021-05-04 17:31:21 +00:00
sta (DBlkPtr),y
jsr BLISTX.2NByte skip LEN hi
2019-03-27 17:01:01 +00:00
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
2019-03-15 16:20:28 +00:00
inc ZPSListDataLen+1
beq .8
2020-03-05 16:55:02 +00:00
2021-05-04 17:31:21 +00:00
.2 jsr SHARED.FORPNTgn
2020-03-06 16:20:29 +00:00
bcc .3
2021-05-04 17:31:21 +00:00
jsr BLISTX.SetBlkByte override ending 0, already allocated
2020-03-06 16:20:29 +00:00
clc
bra .1
2021-05-04 17:31:21 +00:00
.3 jsr BLISTX.AddByte
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
2021-05-04 17:31:21 +00:00
jmp BLISTX.AddByte Add an extra 0 to stop Search here
2020-02-18 15:34:56 +00:00
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLISTX.SetData jsr SLIST.Select
2020-02-20 07:41:52 +00:00
2019-03-18 16:48:16 +00:00
jsr SLIST.SkipKey
jsr SLISTX.CheckLen
2019-03-18 16:48:16 +00:00
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
2021-05-04 17:31:21 +00:00
.2 jsr SHARED.FORPNTgn
jsr BLISTX.SetBlkByte
2019-03-18 16:48:16 +00:00
bra .1
.8 clc
rts
2019-03-18 16:48:16 +00:00
.9 lda #E.DATALEN
sec
2019-03-13 16:29:24 +00:00
rts
2020-02-18 15:34:56 +00:00
*--------------------------------------
SLISTX.CheckLen lda ZPSListDataLen
ora ZPSListDataLen+1
bne .8
ldx #0
ldy #0
lda FORPNT+1
pha
.1 jsr SHARED.FORPNTgY
beq .2
iny
bne .1
inx
bra .1
.2 iny add Ending \0
bne .3
inx
.3 sty ZPSListDataLen
stx ZPSListDataLen+1
pla
sta FORPNT+1
.8 rts
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLISTX.GetByID jsr SLIST.Select
2021-05-04 17:31:21 +00:00
jsr BLISTX.GetNByte
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
2021-05-04 17:31:21 +00:00
jsr BLISTX.GetNByte
2019-03-21 07:07:38 +00:00
ply
2020-02-18 15:34:56 +00:00
2021-05-04 17:31:21 +00:00
jsr SHARED.FORPNTpn
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
2021-05-04 17:31:21 +00:00
jsr SHARED.FORPNTpn
2019-03-18 16:48:16 +00:00
jsr SLIST.SkipData
2021-05-04 17:31:21 +00:00
>LDYA 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
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLISTX.NewKey jsr SLIST.Search
2019-03-14 16:51:02 +00:00
bcc .99
2020-02-18 15:34:56 +00:00
2021-05-04 17:31:21 +00:00
>LDYA KeyID
>STYA SLIST.KeyID End of list
2020-03-05 16:55:02 +00:00
2019-03-14 16:51:02 +00:00
lda SLIST.KeyLen
2021-05-04 17:31:21 +00:00
jsr BLISTX.SetBlkByte 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
2021-05-04 17:31:21 +00:00
.1 jsr SHARED.TXTPTRgY
jsr BLISTX.AddByte
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
2021-05-04 17:31:21 +00:00
jsr BLISTX.AddByte
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
2021-05-04 17:31:21 +00:00
jsr BLISTX.AddByte
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
2021-05-04 17:31:21 +00:00
jsr BLISTX.AddByte
2019-03-27 17:01:01 +00:00
bcs .9
2021-05-04 17:31:21 +00:00
>LDYA SLIST.KeyID
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
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLISTX.Lookup 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
*--------------------------------------
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
2021-05-04 17:31:21 +00:00
>STYA IBlkPtr
lda (IBlkPtr)
sta SLIST.Opt
stz iByte
ldy #1
sty iBlk
lda (IBlkPtr),y
2018-06-21 15:12:10 +00:00
jsr K.GetMemPtr
2021-05-04 17:31:21 +00:00
>STYA DBlkPtr
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
2021-05-04 17:31:21 +00:00
jsr SHARED.TXTPTRgY
beq .2
2020-02-20 07:41:52 +00:00
jsr SLIST.IsIDValid
2019-03-14 16:51:02 +00:00
bcc .1
2020-02-18 15:34:56 +00:00
.2 sty SLIST.KeyLen
2020-02-18 15:34:56 +00:00
.3 >LDYA KeyID
2021-05-04 17:31:21 +00:00
>STYA SLIST.KeyID
2020-02-20 16:54:51 +00:00
2021-05-04 17:31:21 +00:00
ldy iByte
lda (DBlkPtr),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
bne .6
2020-02-20 07:41:52 +00:00
2021-05-04 17:31:21 +00:00
jsr BLISTX.GetNByte 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
.4 phy
2021-05-04 17:31:21 +00:00
jsr BLISTX.GetNByte
sta .5+1
2019-03-18 06:53:20 +00:00
ply
2020-02-18 15:34:56 +00:00
2021-05-04 17:31:21 +00:00
jsr SHARED.TXTPTRgY
2020-02-18 15:34:56 +00:00
.5 cmp #$ff SELF MODIFIED
bne .6
2019-03-14 16:51:02 +00:00
iny
cpy SLIST.KeyLen
bne .4
2020-02-18 15:34:56 +00:00
2021-05-04 17:31:21 +00:00
>LDYA SLIST.KeyID
2019-03-14 16:51:02 +00:00
clc
rts
2020-02-18 15:34:56 +00:00
.6 >LDYA SLIST.KeyID
2020-02-20 07:41:52 +00:00
jsr SLIST.Select.I move back...
2019-03-19 07:26:14 +00:00
jsr SLIST.Next
bra .3
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
2021-05-04 17:31:21 +00:00
>STYA IBlkPtr
2019-03-28 16:48:22 +00:00
2020-02-20 07:41:52 +00:00
>LDYA TXTPTR
2021-05-04 17:31:21 +00:00
SLIST.Select.I >STYA KeyID
2020-02-20 07:41:52 +00:00
2021-05-04 17:31:21 +00:00
ldy iBlk
2020-02-18 15:34:56 +00:00
2021-05-04 17:31:21 +00:00
lda (IBlkPtr),y
2019-03-28 16:48:22 +00:00
jsr K.GetMemPtr
2021-05-04 17:31:21 +00:00
>STYA DBlkPtr
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
2021-05-04 17:31:21 +00:00
adc iByte
sta iByte
2019-03-15 16:20:28 +00:00
txa
2021-05-04 17:31:21 +00:00
adc iBlk
sta iBlk
2019-03-18 06:53:20 +00:00
tay
2021-05-04 17:31:21 +00:00
lda (IBlkPtr),y
2019-03-15 16:20:28 +00:00
jsr K.GetMemPtr
2021-05-04 17:31:21 +00:00
>STYA DBlkPtr
2019-03-15 16:20:28 +00:00
rts
2019-03-14 16:51:02 +00:00
*--------------------------------------
2021-05-04 17:31:21 +00:00
SLIST.SkipKey ldy iByte
lda (DBlkPtr),y Get KeyLen
2019-03-15 16:20:28 +00:00
sec
2021-05-04 17:31:21 +00:00
adc iByte
sta iByte
bcc .8
jmp BLISTX.2NBlk
2019-03-15 16:20:28 +00:00
.8 rts
*--------------------------------------
SLIST.GetDataLen
2021-05-04 17:31:21 +00:00
jsr BLISTX.GetNByte Get DataLenLo
2019-03-15 16:20:28 +00:00
sta SLIST.DataLen
2021-05-04 17:31:21 +00:00
jsr BLISTX.GetNByte Get DataLenHI
2019-03-15 16:20:28 +00:00
sta SLIST.DataLen+1
rts
*--------------------------------------
SLIST.IsIDValid bit SLIST.Opt
bpl .2
cmp #'.'
beq .8
.1 bit SLIST.Opt
.2 bvc .3
cmp #'_'
beq .8
.3 jmp SHARED.IsDigitOrL
.8 clc
rts
*--------------------------------------
MAN
2020-12-15 13:23:22 +00:00
SAVE usr/src/sys/kernel.s.slistx
LOAD usr/src/sys/kernel.s
ASM