mirror of
https://github.com/A2osX/A2osX.git
synced 2024-11-25 05:32:20 +00:00
491 lines
7.8 KiB
Plaintext
491 lines
7.8 KiB
Plaintext
NEW
|
||
AUTO 3,1
|
||
*--------------------------------------
|
||
ZPSListDataOfs .EQ ZPMEMMGR+8
|
||
ZPSListDataLen .EQ ZPMEMMGR+10
|
||
*--------------------------------------
|
||
SLISTX.Opt .BS 1
|
||
SLISTX.KeyLen .BS 1
|
||
SLISTX.DataLen .BS 2
|
||
SLISTX.nDataCnt .BS 2
|
||
SLISTX.nBufCnt .BS 2
|
||
SLISTX.bStr .BS 1
|
||
SLISTX.b0 .BS 1
|
||
SLISTX.KeyID .BS 2
|
||
*--------------------------------------
|
||
SLISTX.GetData jsr SLISTX.Select
|
||
|
||
jsr SLISTX.SkipKey
|
||
|
||
jsr SLISTX.GetDataLen
|
||
|
||
lda SLISTX.DataLen
|
||
sec
|
||
sbc ZPSListDataOfs Offset
|
||
eor #$ff
|
||
sta SLISTX.nDataCnt
|
||
|
||
lda SLISTX.DataLen+1
|
||
sbc ZPSListDataOfs+1
|
||
eor #$ff
|
||
sta SLISTX.nDataCnt+1 Data remaining
|
||
|
||
bcc .99 Offset Beyond DataLen
|
||
|
||
lda ZPSListDataOfs Skip to Offset
|
||
ldx ZPSListDataOfs+1
|
||
jsr SLISTX.SkipDataAX
|
||
|
||
stz SLISTX.b0
|
||
|
||
lda FORPNT
|
||
ora FORPNT+1
|
||
bne .12 buffer provided
|
||
|
||
>LDYA SLISTX.DataLen
|
||
|
||
iny
|
||
bne .11
|
||
|
||
inc +1 for ending 0
|
||
|
||
sec
|
||
ror SLISTX.b0
|
||
|
||
.11 ldx #SYS.GetMem
|
||
jsr JMP.M !!! Get a buffer In MAIN Mem !!!
|
||
bcs .9
|
||
|
||
stx .88+1
|
||
>STYA FORPNT
|
||
|
||
.12 lda ZPSListDataLen
|
||
ora ZPSListDataLen+1
|
||
sec
|
||
beq .1 String Mode
|
||
|
||
lda ZPSListDataLen
|
||
eor #$ff
|
||
sta SLISTX.nBufCnt
|
||
lda ZPSListDataLen+1
|
||
eor #$ff
|
||
sta SLISTX.nBufCnt+1
|
||
clc
|
||
|
||
.1 ror SLISTX.bStr
|
||
|
||
stz ZPSListDataLen
|
||
stz ZPSListDataLen+1
|
||
|
||
.2 inc SLISTX.nDataCnt
|
||
bne .3
|
||
inc SLISTX.nDataCnt+1
|
||
beq .80
|
||
|
||
.3 bit SLISTX.bStr
|
||
bmi .4 String mode : until CR
|
||
|
||
inc SLISTX.nBufCnt
|
||
bne .4
|
||
|
||
inc SLISTX.nBufCnt+1
|
||
beq .80 not string mode : until end of buffer
|
||
|
||
.4 jsr BLISTX.GetNByte
|
||
bit SLISTX.bStr
|
||
bpl .5
|
||
|
||
cmp #C.CR
|
||
beq .81
|
||
|
||
.5 jsr SHARED.FORPNTpn
|
||
inc ZPSListDataLen
|
||
bne .2
|
||
|
||
inc ZPSListDataLen+1
|
||
bra .2
|
||
|
||
.99 lda #E.EMPTYKEY
|
||
sec
|
||
.9 rts
|
||
|
||
.80 lda SLISTX.bStr
|
||
ora SLISTX.b0
|
||
bpl .82
|
||
|
||
.81 lda #0
|
||
jsr SHARED.FORPNTpn
|
||
|
||
.82 >LDYA ZPSListDataLen
|
||
.88 ldx #$ff SELF MODIFIED
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.AddData jsr SLISTX.Select
|
||
|
||
jsr SLISTX.SkipKey
|
||
|
||
jsr SLISTX.CheckLen
|
||
|
||
ldy iByte
|
||
lda (DBlkPtr),y
|
||
pha
|
||
clc
|
||
adc ZPSListDataLen
|
||
sta (DBlkPtr),y
|
||
php
|
||
jsr BLISTX.2NByte skip LEN lo
|
||
|
||
plp
|
||
ldy iByte
|
||
lda (DBlkPtr),y
|
||
pha
|
||
adc ZPSListDataLen+1
|
||
sta (DBlkPtr),y
|
||
jsr BLISTX.2NByte skip LEN hi
|
||
|
||
plx
|
||
pla
|
||
jsr SLISTX.SkipDataAX
|
||
lda ZPSListDataLen
|
||
eor #$ff
|
||
sta ZPSListDataLen
|
||
|
||
lda ZPSListDataLen+1
|
||
eor #$ff
|
||
sta ZPSListDataLen+1
|
||
|
||
sec
|
||
|
||
.1 inc ZPSListDataLen
|
||
bne .2
|
||
|
||
inc ZPSListDataLen+1
|
||
beq .8
|
||
|
||
.2 jsr SHARED.FORPNTgn
|
||
bcc .3
|
||
|
||
jsr BLISTX.SetBlkByte override ending 0, already allocated
|
||
clc
|
||
bra .1
|
||
|
||
.3 jsr BLISTX.AddByte
|
||
bcc .1
|
||
rts
|
||
|
||
.8 lda #0
|
||
jmp BLISTX.AddByte Add an extra 0 to stop Search here
|
||
*--------------------------------------
|
||
SLISTX.SetData jsr SLISTX.Select
|
||
|
||
jsr SLISTX.SkipKey
|
||
|
||
jsr SLISTX.CheckLen
|
||
|
||
jsr SLISTX.GetDataLen
|
||
|
||
lda SLISTX.DataLen
|
||
cmp ZPSListDataLen
|
||
bne .9
|
||
|
||
ldx SLISTX.DataLen+1
|
||
cpx ZPSListDataLen+1
|
||
bne .9
|
||
|
||
eor #$ff
|
||
sta SLISTX.nDataCnt
|
||
txa
|
||
eor #$ff
|
||
sta SLISTX.nDataCnt+1
|
||
|
||
.1 inc SLISTX.nDataCnt
|
||
bne .2
|
||
|
||
inc SLISTX.nDataCnt+1
|
||
beq .8
|
||
|
||
.2 jsr SHARED.FORPNTgn
|
||
jsr BLISTX.SetBlkByte
|
||
bra .1
|
||
|
||
.8 clc
|
||
rts
|
||
|
||
.9 lda #E.DATALEN
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.CheckLen lda ZPSListDataLen
|
||
ora ZPSListDataLen+1
|
||
bne .8
|
||
|
||
tax ldx #0
|
||
tay ldy #0
|
||
|
||
lda FORPNT+1
|
||
pha
|
||
|
||
.1 jsr SHARED.FORPNTgY
|
||
beq .2
|
||
|
||
iny
|
||
bne .1
|
||
|
||
inc FORPNT+1
|
||
|
||
inx
|
||
bra .1
|
||
|
||
.2 iny add Ending \0
|
||
bne .3
|
||
|
||
inx
|
||
|
||
.3 sty ZPSListDataLen
|
||
stx ZPSListDataLen+1
|
||
|
||
pla
|
||
sta FORPNT+1
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
SLISTX.GetByID jsr SLISTX.Select
|
||
|
||
jsr BLISTX.GetNByte
|
||
tax
|
||
beq .9
|
||
|
||
ldy #0
|
||
|
||
.1 phy
|
||
jsr BLISTX.GetNByte
|
||
ply
|
||
|
||
jsr SHARED.FORPNTpn
|
||
|
||
iny
|
||
dex
|
||
bne .1
|
||
|
||
txa lda #0
|
||
|
||
jsr SHARED.FORPNTpn ending \0
|
||
|
||
jsr BLISTX.GetNByte ScopeID lo
|
||
jsr SHARED.FORPNTpn
|
||
|
||
jsr BLISTX.GetNByte ScopeID hi
|
||
jsr SHARED.FORPNTpn
|
||
|
||
jsr SLISTX.SkipData
|
||
>LDYA KeyID
|
||
clc
|
||
rts
|
||
|
||
.9 lda #E.NOKEY
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.NewKey jsr SLISTX.Lookup
|
||
bcc .99
|
||
|
||
>LDYA KeyID
|
||
>STYA SLISTX.KeyID End of list
|
||
|
||
lda SLISTX.KeyLen
|
||
jsr BLISTX.SetBlkByte override ending 0, already allocated
|
||
|
||
ldy #0
|
||
|
||
.1 jsr SHARED.TXTPTRgY
|
||
jsr BLISTX.AddByte
|
||
bcs .9
|
||
|
||
iny
|
||
cpy SLISTX.KeyLen
|
||
bne .1
|
||
|
||
lda FORPNT
|
||
jsr BLISTX.AddByte ScopeID lo
|
||
bcs .9
|
||
|
||
lda FORPNT+1 ScopeID hi
|
||
jsr BLISTX.AddByte
|
||
bcs .9
|
||
|
||
lda #0 Data Len lo = 0
|
||
jsr BLISTX.AddByte
|
||
bcs .9
|
||
|
||
lda #0 Data Len hi = 0
|
||
jsr BLISTX.AddByte
|
||
bcs .9
|
||
|
||
lda #0 Ending Len = 0
|
||
jsr BLISTX.AddByte
|
||
bcc SLISTX.8
|
||
|
||
rts
|
||
|
||
.99 lda #E.DUPKEY
|
||
sec
|
||
.9 rts
|
||
*--------------------------------------
|
||
SLISTX.8 >LDYA SLISTX.KeyID
|
||
ldx SLISTX.KeyLen
|
||
clc
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.Lookup jsr K.GetMemPtr
|
||
>STYA IBlkPtr
|
||
|
||
lda (IBlkPtr)
|
||
sta SLISTX.Opt
|
||
|
||
stz iByte
|
||
|
||
ldy #1
|
||
sty iBlk
|
||
|
||
lda (IBlkPtr),y
|
||
jsr K.GetMemPtr
|
||
>STYA DBlkPtr
|
||
|
||
ldy #$ff
|
||
|
||
.1 iny
|
||
jsr SHARED.TXTPTRgY
|
||
beq .2
|
||
|
||
jsr SLISTX.IsIDValid
|
||
bcc .1
|
||
|
||
.2 sty SLISTX.KeyLen
|
||
|
||
.3 >LDYA KeyID
|
||
>STYA SLISTX.KeyID
|
||
|
||
ldy iByte
|
||
lda (DBlkPtr),y
|
||
beq .9
|
||
|
||
cmp SLISTX.KeyLen
|
||
bne .6
|
||
|
||
jsr BLISTX.GetNByte Skip Len
|
||
|
||
ldy #0
|
||
|
||
.4 phy
|
||
jsr BLISTX.GetNByte
|
||
sta .5+1
|
||
ply
|
||
|
||
jsr SHARED.TXTPTRgY
|
||
|
||
.5 cmp #$ff SELF MODIFIED
|
||
bne .6
|
||
|
||
iny
|
||
cpy SLISTX.KeyLen
|
||
bne .4
|
||
|
||
jsr SLISTX.GetDataLen Get Scope
|
||
cmp FORPNT+1
|
||
bne .6
|
||
|
||
lda FORPNT
|
||
cmp SLISTX.DataLen
|
||
beq SLISTX.8
|
||
|
||
.6 >LDYA SLISTX.KeyID
|
||
|
||
jsr SLISTX.Select.I move back...
|
||
jsr SLISTX.SkipKey
|
||
jsr SLISTX.SkipData
|
||
bra .3
|
||
|
||
.9 lda #E.NOKEY
|
||
sec
|
||
rts
|
||
*--------------------------------------
|
||
* PRIVATE
|
||
*--------------------------------------
|
||
SLISTX.Select jsr K.GetMemPtr
|
||
>STYA IBlkPtr
|
||
|
||
>LDYA TXTPTR
|
||
|
||
SLISTX.Select.I >STYA KeyID
|
||
|
||
ldy iBlk
|
||
|
||
lda (IBlkPtr),y
|
||
jsr K.GetMemPtr
|
||
>STYA DBlkPtr
|
||
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.SkipKey ldy iByte
|
||
lda (DBlkPtr),y Get KeyLen
|
||
sec len
|
||
inc
|
||
inc Skip ScopeID
|
||
adc iByte
|
||
sta iByte
|
||
bcc .8
|
||
|
||
jmp BLISTX.2NBlk
|
||
|
||
.8 rts
|
||
*--------------------------------------
|
||
SLISTX.SkipData jsr SLISTX.GetDataLen
|
||
|
||
lda SLISTX.DataLen
|
||
ldx SLISTX.DataLen+1
|
||
SLISTX.SkipDataAX
|
||
clc
|
||
adc iByte
|
||
sta iByte
|
||
txa
|
||
adc iBlk
|
||
sta iBlk
|
||
tay
|
||
lda (IBlkPtr),y
|
||
jsr K.GetMemPtr
|
||
>STYA DBlkPtr
|
||
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.GetDataLen
|
||
jsr BLISTX.GetNByte Get DataLenLo
|
||
sta SLISTX.DataLen
|
||
jsr BLISTX.GetNByte Get DataLenHI
|
||
sta SLISTX.DataLen+1
|
||
rts
|
||
*--------------------------------------
|
||
SLISTX.IsIDValid
|
||
bit SLISTX.Opt SL..
|
||
bpl .2
|
||
|
||
cmp #'.'
|
||
beq .8
|
||
|
||
.1 bit SLISTX.Opt SL._
|
||
|
||
.2 bvc .3
|
||
|
||
cmp #'_'
|
||
beq .8
|
||
|
||
.3 jmp SHARED.IsDigitOrL
|
||
|
||
.8 clc
|
||
rts
|
||
*--------------------------------------
|
||
MAN
|
||
SAVE usr/src/sys/kernel.s.slistx
|
||
LOAD usr/src/sys/kernel.s
|
||
ASM
|