A2osX/SYS/KERNEL.S.ENVX.txt

291 lines
4.7 KiB
Plaintext
Raw Normal View History

2020-01-22 16:31:48 +00:00
NEW
AUTO 3,1
*--------------------------------------
2020-02-02 14:58:01 +00:00
ENVX.hEnv .BS 1
*--------------------------------------
2020-02-06 16:23:59 +00:00
ENVX.PutEnv.9 lda #E.SYN
sec
rts
*--------------------------------------
ENVX.PutEnv tax save hEnv
ldy #$ff
2020-01-22 16:31:48 +00:00
.1 iny
2020-01-29 16:46:51 +00:00
jsr SHARED.TXTPTR.GetY NAME=
2020-02-06 16:23:59 +00:00
beq ENVX.PutEnv.9
2020-01-22 16:31:48 +00:00
cmp #'='
bne .1
tya
sec skip =
adc TXTPTR
sta FORPNT
lda #0
adc TXTPTR+1
sta FORPNT+1
2020-02-06 16:23:59 +00:00
txa get back hEnv
2020-01-22 16:31:48 +00:00
*--------------------------------------
ENVX.SetEnv jsr ENVX.UnsetEnv
2020-02-03 19:41:04 +00:00
.1 jsr ENVX.InitEnvP3
2020-01-22 16:31:48 +00:00
lda #1
sta ZPPtr4
stz ZPPtr4+1 ZPPtr4 = ENVSIZE = 1
.10 lda (ZPPtr3) End of ENV
beq .15
2020-01-29 16:46:51 +00:00
jsr ENVX.GetP3LenY
jsr ENVX.NextEnvP3Y
jsr ENVX.NextEnvP4Y
2020-01-22 16:31:48 +00:00
bra .10
2020-01-29 16:46:51 +00:00
.15 ldy #$ff
2020-01-22 16:31:48 +00:00
.16 iny
2020-01-29 16:46:51 +00:00
jsr SHARED.TXTPTR.GetY
2020-01-22 16:31:48 +00:00
beq .17
jsr SHARED.IsIDValid
bcc .16
2020-01-29 16:46:51 +00:00
.17 jsr ENVX.NextEnvP4Y ZPPtr4 = ENVSIZE + VAR
2020-01-22 16:31:48 +00:00
ldy #$ff
.19 iny
2020-01-29 16:46:51 +00:00
jsr SHARED.FORPNT.getY
2020-01-22 16:31:48 +00:00
bne .19
2020-01-29 16:46:51 +00:00
jsr ENVX.NextEnvP4Y ZPPtr4 = ENVSIZE + VALUE
2020-01-22 16:31:48 +00:00
lda ZPPtr4
beq .20
inc ZPPtr4+1
2020-02-03 15:17:34 +00:00
.20 lda ENVX.hEnv
jsr MEM.GetMemByID
2020-01-22 16:31:48 +00:00
lda ZPPtr4+1
2020-02-03 15:17:34 +00:00
ldy #S.MEM.LEN+1
cmp (ZPMemMgrSPtr),y
bcs .22 env is large enough
sta MEM.NewSize+1
stz MEM.NewSize
jsr K.realloc.I
2020-01-22 16:31:48 +00:00
bcs .9
2020-02-03 15:17:34 +00:00
stx ENVX.hEnv
txa
sta CLRWRITEAUX
2020-01-22 16:31:48 +00:00
ldy #S.PS.hENV
2020-02-28 07:21:46 +00:00
lda (pPS),y
2020-02-03 15:17:34 +00:00
sta SETWRITEAUX
2020-01-22 16:31:48 +00:00
bra .1 Start over
.22 ldy #$ff
2020-01-29 16:46:51 +00:00
2020-01-22 16:31:48 +00:00
.23 iny
2020-01-29 16:46:51 +00:00
jsr SHARED.TXTPTR.GetY
2020-01-22 16:31:48 +00:00
sta (ZPPtr3),y
beq .24
jsr SHARED.IsIDValid
bcc .23
.24 lda #'='
sta (ZPPtr3),y
2020-01-29 16:46:51 +00:00
jsr ENVX.NextEnvP3Y
2020-01-22 16:31:48 +00:00
ldy #$ff
.25 iny
2020-01-29 16:46:51 +00:00
jsr SHARED.FORPNT.getY
2020-01-22 16:31:48 +00:00
sta (ZPPtr3),y
bne .25
iny
sta (ZPPtr3),y don't forget array ending 0
clc
2020-01-29 16:46:51 +00:00
.9 rts
2020-01-22 16:31:48 +00:00
*--------------------------------------
2020-02-04 20:04:33 +00:00
ENVX.GetEnv ldy TXTPTR+1
bne .10
tax hMem for CopyToMain
jsr MEM.GetMemByID
ldy #S.MEM.LEN
lda (ZPMemMgrSPtr),y
pha
iny
lda (ZPMemMgrSPtr),y
ply YA = Len
jmp MEM.CopyToMain
.10 sta ENVX.hEnv
2020-02-03 15:17:34 +00:00
jsr ENVX.FindVar
2020-01-22 16:31:48 +00:00
bcs .9
2020-01-29 16:46:51 +00:00
jsr ENVX.NextEnvP3Y Skip NAME=
2020-01-22 16:31:48 +00:00
lda FORPNT+1
bne .3
ldy #$ff
.1 iny
lda (ZPPtr3),y
bne .1
iny
bne .2
inc
2020-02-03 15:17:34 +00:00
.2 ldx #SYS.GetMem
jsr K.SYSCALL2.MAIN !!! Get a buffer In MAIN Mem !!!
2020-01-29 16:46:51 +00:00
2020-01-22 16:31:48 +00:00
bcs .99
>STYA FORPNT
2020-01-29 16:46:51 +00:00
.3 ldy #$ff
2020-01-22 16:31:48 +00:00
.4 iny
lda (ZPPtr3),y
2020-01-29 16:46:51 +00:00
jsr SHARED.FORPNT.PutY
2020-01-22 16:31:48 +00:00
bne .4
>LDYA FORPNT
clc
rts
.9 >LDYAI 0
2020-02-03 15:17:34 +00:00
2020-01-22 16:31:48 +00:00
* sec
.99 rts
2020-01-29 16:46:51 +00:00
*--------------------------------------
2020-02-03 15:17:34 +00:00
ENVX.UnsetEnv sta ENVX.hEnv
jsr ENVX.FindVar
2020-02-02 14:58:01 +00:00
bcs .8 not found, quit
2020-01-22 16:31:48 +00:00
2020-01-29 16:46:51 +00:00
jsr ENVX.DelVarP3 Ptr3 -> NAME=VALUE
2020-02-02 14:58:01 +00:00
.8 clc
2020-01-22 16:31:48 +00:00
rts
*--------------------------------------
* ENV.FindVar
* In:
* TXTPTR -> NAME
* Out:
* CC: Found
* Y = NAME len
* TXTPTR -> NAME
* ZPPtr3 -> NAME=VALUE
* CS: Not Found
* TXTPTR -> NAME
* ZPPtr3 -> PTR to Ending 0
*--------------------------------------
2020-01-29 16:46:51 +00:00
ENVX.FindVar jsr ENVX.InitEnvP3 Store ENV
2020-01-22 16:31:48 +00:00
.1 lda (ZPPtr3)
beq .9 end of ENV
ldy #$ff
.2 iny
jsr SHARED.TXTPTR.GetY
beq .3
jsr SHARED.IsIDValid
bcs .3
cmp (ZPPtr3),y
beq .2
bra .4
.3 lda (ZPPtr3),y
cmp #'='
bne .4
clc
rts
2020-01-29 16:46:51 +00:00
.4 jsr ENVX.NextEnvP3 Skip NAME=VALUE
2020-01-22 16:31:48 +00:00
bra .1
2020-01-29 16:46:51 +00:00
.9 sec
2020-01-22 16:31:48 +00:00
rts
*--------------------------------------
* ENV.DelVarP3
* In:
* ZPPtr3 -> ENV.NAME to Discard
*--------------------------------------
2020-01-29 16:46:51 +00:00
ENVX.DelVarP3 >LDYA ZPPtr3 save actual Ptr
2020-01-22 16:31:48 +00:00
>STYA ZPPtr4
2020-01-29 16:46:51 +00:00
jsr ENVX.NextEnvP3 Skip NAME=VALUE
2020-01-22 16:31:48 +00:00
.1 ldy #$ff
.2 iny
lda (ZPPtr3),y Move back CSTRs...
sta (ZPPtr4),y
bne .2
tya
beq .8 we moved back ending \0
2020-01-29 16:46:51 +00:00
jsr ENVX.NextEnvP3Y
jsr ENVX.NextEnvP4Y
2020-01-22 16:31:48 +00:00
bra .1
2020-01-29 16:46:51 +00:00
.8 rts
2020-01-22 16:31:48 +00:00
*--------------------------------------
2020-02-02 14:58:01 +00:00
ENVX.InitEnvP3 lda ENVX.hEnv
2020-01-22 16:31:48 +00:00
jsr K.GetMemPtr
>STYA ZPPtr3 Store ENV
rts
*--------------------------------------
2020-01-29 16:46:51 +00:00
ENVX.NextEnvP3 jsr ENVX.GetP3LenY
2020-01-22 16:31:48 +00:00
*--------------------------------------
2020-01-29 16:46:51 +00:00
ENVX.NextEnvP3Y tya
ENVX.NextEnvP3A sec
2020-01-22 16:31:48 +00:00
adc ZPPtr3
sta ZPPtr3
bcc .8
inc ZPPtr3+1
.8 rts
*--------------------------------------
2020-01-29 16:46:51 +00:00
ENVX.GetP3LenY ldy #$ff
2020-01-22 16:31:48 +00:00
.1 iny
lda (ZPPtr3),y
bne .1
rts
*--------------------------------------
2020-01-29 16:46:51 +00:00
ENVX.NextEnvP4Y tya
2020-01-22 16:31:48 +00:00
sec
adc ZPPtr4
sta ZPPtr4
bcc .8
inc ZPPtr4+1
.8 rts
*--------------------------------------
MAN
SAVE USR/SRC/SYS/KERNEL.S.ENVX
LOAD USR/SRC/SYS/KERNEL.S
ASM