2015-03-14 21:48:35 +00:00
|
|
|
|
PR#3
|
2015-06-03 18:30:57 +00:00
|
|
|
|
PREFIX /A2OSX.SRC
|
2015-03-14 21:48:35 +00:00
|
|
|
|
NEW
|
|
|
|
|
INC 1
|
|
|
|
|
AUTO 6
|
|
|
|
|
.LIST OFF
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #ExpandPStrYA
|
|
|
|
|
* ##In:
|
|
|
|
|
* Y,A = PTR to String to Expand (PSTR)
|
|
|
|
|
* ##Out:
|
|
|
|
|
* X = hMem to Expanded String (PSTR)
|
|
|
|
|
* Y,A = PTR to Expanded String
|
|
|
|
|
*\--------------------------------------
|
|
|
|
|
K.ExpandPStrYA stz K.ExpandPStr.hPStr Reset Intermediate string...
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.11 >STYA ZPPtr2
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
stz KrnBuf256 init Expanded String len=0
|
|
|
|
|
stz K.ExpandPStr.bFound No var found yet
|
|
|
|
|
stz K.ExpandPStr.bNoExp Reset no expand flag
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #0
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.10 stz K.ExpandPStr.Start
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
.1 tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr2) End of PSTR?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .6
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
|
|
|
|
cmp #'''
|
|
|
|
|
bne .21
|
|
|
|
|
|
|
|
|
|
lda K.ExpandPStr.bNoExp
|
|
|
|
|
eor #$ff
|
|
|
|
|
sta K.ExpandPStr.bNoExp toggle flag
|
|
|
|
|
bra .1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.21 bit K.ExpandPStr.bNoExp
|
|
|
|
|
bmi .22
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldx K.ExpandPStr.Start
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .3 already in a var?
|
|
|
|
|
|
|
|
|
|
cmp #'$' no, found one ?
|
|
|
|
|
beq .2
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.22 inc KrnBuf256 no, copy char
|
2016-09-26 06:18:51 +00:00
|
|
|
|
ldx KrnBuf256
|
|
|
|
|
sta KrnBuf256,x
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.2 sec
|
|
|
|
|
ror K.ExpandPStr.bFound Toggle flag
|
|
|
|
|
|
|
|
|
|
sty K.ExpandPStr.Start save var start
|
2016-09-21 15:20:37 +00:00
|
|
|
|
stz K.ExpandPStr.End
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bra .1 skip this char
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.3 cmp #'{' we are in var, "{" after "$"?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .2
|
|
|
|
|
|
|
|
|
|
cmp #'}' end of var?
|
|
|
|
|
beq .5
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
jsr K.ExpandPStr.VC we are in var, is char valid?
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .5 no, end here
|
2016-09-21 15:20:37 +00:00
|
|
|
|
sty K.ExpandPStr.End yes, save end
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bra .1
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.5 lda K.ExpandPStr.End get end
|
2015-11-22 22:30:06 +00:00
|
|
|
|
beq .1 empty {} or $/
|
|
|
|
|
|
|
|
|
|
phy save current index
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.ExpandPStr.AV
|
2015-11-22 22:30:06 +00:00
|
|
|
|
ply restore index in string...
|
|
|
|
|
bra .10 reset start flag and continue
|
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
.6 sty K.ExpandPStr.End end of PSTR
|
|
|
|
|
lda K.ExpandPStr.Start are we in a var?
|
2016-10-29 19:58:21 +00:00
|
|
|
|
beq .8 no...exit...
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.ExpandPStr.AV yes, expand and add to STR
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.8 lda K.ExpandPStr.hPStr working from our temp string ?
|
|
|
|
|
beq .81 no...
|
|
|
|
|
|
|
|
|
|
jsr K.FreeMemA yes, discard....
|
|
|
|
|
|
|
|
|
|
.81 >LDYAI KrnBuf256
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.NewPStrYA
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
stx K.ExpandPStr.hPStr save this as temp string, in case of recurse
|
|
|
|
|
bit K.ExpandPStr.bFound Did we expand something ?
|
2016-12-03 22:16:45 +00:00
|
|
|
|
bpl .82
|
2016-10-29 19:58:21 +00:00
|
|
|
|
jmp .11 Yes, start over with hPStr
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
|
|
|
|
.82
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* or exit with Y,A & X from K.NewPStrYA
|
|
|
|
|
|
|
|
|
|
.9 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.ExpandPStr.AV lda K.ExpandPStr.End
|
2015-11-22 22:30:06 +00:00
|
|
|
|
sec
|
2016-09-21 15:20:37 +00:00
|
|
|
|
sbc K.ExpandPStr.Start compute len of VAR End-Start+1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
ldx KrnBuf256
|
2015-11-22 22:30:06 +00:00
|
|
|
|
inx
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta KrnBuf256,x
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
stx ZPPtr1 Make Ptr1 -> Var NAME
|
2016-09-26 06:18:51 +00:00
|
|
|
|
lda /KrnBuf256
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr1+1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-09-21 15:20:37 +00:00
|
|
|
|
ldy K.ExpandPStr.Start
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
inx
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2),y
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta KrnBuf256,x
|
2016-09-21 15:20:37 +00:00
|
|
|
|
cpy K.ExpandPStr.End
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.CheckSysVarPtr1
|
|
|
|
|
bcc .2 Ptr3=VALUE
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.FindVarPtr1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.NextEnvPtr3 Skip NAME
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda (ZPPtr3)
|
2016-12-03 22:16:45 +00:00
|
|
|
|
beq .9 in case CheckSysVarPtr1 returned a NUL string
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ldy #0
|
2016-09-26 06:18:51 +00:00
|
|
|
|
ldx KrnBuf256
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.3 iny
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
inx
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta KrnBuf256,x
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
|
|
|
|
tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr3) last char?
|
2016-12-03 22:16:45 +00:00
|
|
|
|
bne .3
|
2016-09-26 06:18:51 +00:00
|
|
|
|
stx KrnBuf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2015-11-22 22:30:06 +00:00
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.ExpandPStr.VC cmp #'0'
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'9'+1
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
cmp #'A'
|
|
|
|
|
bcc .9
|
|
|
|
|
cmp #'Z'+1
|
|
|
|
|
bcc .8
|
|
|
|
|
|
|
|
|
|
cmp #'_'
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
.9 sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2016-09-21 15:20:37 +00:00
|
|
|
|
K.ExpandPStr.Start .BS 1
|
|
|
|
|
K.ExpandPStr.End .BS 1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
K.ExpandPStr.bFound .BS 1
|
|
|
|
|
K.ExpandPStr.bNoExp .BS 1
|
|
|
|
|
K.ExpandPStr.hPStr .BS 1
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #PutEnvYA
|
|
|
|
|
* ##In:
|
|
|
|
|
* Y,A = PTR to String NAME=VALUE (PSTR)
|
|
|
|
|
* ##Out:
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.PutEnvYA >STYA ZPPtr1 NAME=VALUE
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta KrnBuf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
tay
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr1),y copy PSTR to KrnBuf256
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sta KrnBuf256,y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
dey
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .1
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldy #0
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.2 iny
|
2016-09-26 06:18:51 +00:00
|
|
|
|
cpy KrnBuf256 last char ?
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9 no "=" found
|
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
lda KrnBuf256,y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'='
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
cpy #1 String like "=value" ?
|
|
|
|
|
beq .9
|
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
cpy KrnBuf256 last char ?
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9 we have "VAR="
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
lda KrnBuf256 get actual string len
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sty KrnBuf256 set length of VAR string
|
|
|
|
|
dec KrnBuf256 ...without "="
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
clc Substract VAR len+1 from whole len to get
|
2016-09-26 06:18:51 +00:00
|
|
|
|
sbc KrnBuf256 VALUE len
|
|
|
|
|
sta KrnBuf256,y save it at "=" POS
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
stz ZPPtr1 #KrnBuf256
|
|
|
|
|
sty ZPPtr2
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2016-09-26 06:18:51 +00:00
|
|
|
|
lda /KrnBuf256
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr1+1
|
|
|
|
|
sta ZPPtr2+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
bra K.SetEnvPtr1Ptr2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #SetEnv
|
|
|
|
|
* ##In:
|
|
|
|
|
* PUSHW = PTR To Value (PSTR)
|
|
|
|
|
* PUSHW = PTR To Name (PSTR)
|
|
|
|
|
* ##Out:
|
|
|
|
|
*\--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
K.SetEnv jsr PullPtr1Ptr2 Ptr1=NAME,Ptr2=VALUE
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
K.SetEnvPtr1Ptr2
|
|
|
|
|
jsr S.UnsetEnvPtr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
jsr ENV.InitEnvPtr3 ZPPtr3 -> Env
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda ZPPtr3 Compute ENV UPPER LIMIT in Ptr4
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
adc #K.ENV.SIZE
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr4
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda ZPPtr3+1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
adc /K.ENV.SIZE
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr4+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
ldy ZPPtr3+1
|
|
|
|
|
lda ZPPtr3 Compute New Env Upper limit in A,Y
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc (ZPPtr1) add NAME len +1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.1 sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc (ZPPtr2) add VALUE len +1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .2
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 cmp ZPPtr4 GE than hMem Upper limit ?
|
2015-03-14 21:48:35 +00:00
|
|
|
|
tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sbc ZPPtr4+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.3 lda (ZPPtr3) Scan until ending 0...
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .4
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .3
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.4 lda (ZPPtr1)
|
|
|
|
|
sta (ZPPtr3)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
tay
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.5 lda (ZPPtr1),y
|
|
|
|
|
sta (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .5
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.NextEnvPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr2)
|
|
|
|
|
sta (ZPPtr3)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
tay
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.6 lda (ZPPtr2),y
|
|
|
|
|
sta (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
dey
|
|
|
|
|
bne .6
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.NextEnvPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.8 lda #0
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta (ZPPtr3)
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
.99 lda #SYSMGR.ERRENVF
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #GetEnvYA
|
|
|
|
|
* ##In:
|
|
|
|
|
* Y,A = PTR to NAME (PSTR)
|
|
|
|
|
* ##Out:
|
|
|
|
|
* CC : Y,A = PTR to VALUE (PSTR)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* CS : not found
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.GetEnvYA >STYA ZPPtr1
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.CheckSysVarPtr1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bcc .8
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.FindVarPtr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.NextEnvPtr3 Skip NAME
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>LDYA ZPPtr3
|
2016-10-06 15:50:20 +00:00
|
|
|
|
clc just in case ADC in NextEnvPtr1 disturb CC
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
|
|
|
|
|
.9 >LDYAI EmptyPSTR
|
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
|
|
|
|
* #UnsetEnvYA
|
|
|
|
|
* ##In:
|
|
|
|
|
* Y,A = PTR To Name (PSTR)
|
|
|
|
|
* ##Out:
|
|
|
|
|
*\--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
K.UnsetEnvYA >STYA ZPPtr1 Store VAR Name
|
2016-12-03 22:16:45 +00:00
|
|
|
|
S.UnsetEnvPtr1 jsr ENV.FindVarPtr1
|
2015-11-22 22:30:06 +00:00
|
|
|
|
bcs .8 not found, quit
|
2015-11-10 21:47:57 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr ENV.DiscardVarPtr3 Ptr3 -> ENVNAME
|
2015-11-10 21:47:57 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* PRIVATE
|
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
* ENV.CheckSysVarPtr1
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ZPPtr1 -> NAME
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* Out:
|
|
|
|
|
* CC: Found
|
|
|
|
|
* YA -> VALUE
|
|
|
|
|
* CS: Not Found
|
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.CheckSysVarPtr1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #1 is name 1 char?
|
|
|
|
|
bne .9
|
|
|
|
|
|
|
|
|
|
ldy #1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-12-03 22:16:45 +00:00
|
|
|
|
cmp #'0'-1 $0...$9 ??
|
|
|
|
|
bcc .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
cmp #'9'+1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bcs .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
and #$0F
|
2016-12-03 22:16:45 +00:00
|
|
|
|
jsr K.GetArgA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr3
|
2016-12-03 22:16:45 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.1 ldx #ENV.SysVarsJmp-ENV.SysVars-1
|
|
|
|
|
|
|
|
|
|
.2 cmp ENV.SysVars,x
|
|
|
|
|
beq .3
|
|
|
|
|
dex
|
|
|
|
|
bpl .2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.3 txa
|
|
|
|
|
asl
|
|
|
|
|
tax
|
|
|
|
|
jmp (ENV.SysVarsJmp,x)
|
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.SysVars .AS "*#?@$!"
|
2016-10-29 19:58:21 +00:00
|
|
|
|
ENV.SysVarsJmp .DA ENV.SysVarsArgs
|
|
|
|
|
.DA ENV.SysVarsArgC
|
|
|
|
|
.DA ENV.SysVarsRC
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.DA ENV.SysVarsPPID
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.DA ENV.SysVarsPID
|
|
|
|
|
.DA ENV.SysVarsCPID
|
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.SysVarsArgs lda #1
|
|
|
|
|
jsr K.GetArgA Trash Ptr1
|
|
|
|
|
|
|
|
|
|
stz KrnOut256
|
|
|
|
|
|
|
|
|
|
ldx #0
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 lda (ZPPtr1)
|
2016-12-03 22:16:45 +00:00
|
|
|
|
beq ENV.SysVarsExit
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.2 iny
|
|
|
|
|
inx
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr1),y
|
2016-12-03 22:16:45 +00:00
|
|
|
|
sta KrnOut256,x
|
|
|
|
|
tya
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr1)
|
2016-12-03 22:16:45 +00:00
|
|
|
|
bne .2
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc ZPPtr1 CS from beq .2
|
|
|
|
|
sta ZPPtr1
|
2016-12-03 22:16:45 +00:00
|
|
|
|
bcc .3
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr1+1
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.3 lda #' '
|
|
|
|
|
inx
|
|
|
|
|
beq ENV.SysVarsExit make sure not overlapping buf 256
|
|
|
|
|
sta KrnOut256,x
|
|
|
|
|
bra .1
|
|
|
|
|
|
|
|
|
|
ENV.SysVarsArgC jsr K.GetArgC Trash Ptr1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bra ENV.SysVarsA
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
ENV.SysVarsRC ldy #S.PS.RC
|
|
|
|
|
.HS 2C
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.SysVarsPPID ldy #S.PS.PPID
|
|
|
|
|
.HS 2C
|
2016-10-29 19:58:21 +00:00
|
|
|
|
ENV.SysVarsPID ldy #S.PS.PID
|
|
|
|
|
.HS 2C
|
|
|
|
|
ENV.SysVarsCPID ldy #S.PS.CPID
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
ENV.SysVarsA sta HEXBUF
|
|
|
|
|
stz HEXBUF+1
|
|
|
|
|
stz HEXBUF+2
|
|
|
|
|
stz HEXBUF+3
|
|
|
|
|
jsr HEX2DEC
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ldy #0
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.1 lda ASCBUF,y
|
2016-10-29 19:58:21 +00:00
|
|
|
|
cmp #'0'
|
|
|
|
|
bne .2
|
2016-12-03 22:16:45 +00:00
|
|
|
|
iny
|
|
|
|
|
cpy #10
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bne .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
sta KrnOut256+1
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ldx #1
|
|
|
|
|
bra ENV.SysVarsExit
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.2 ldx #0
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.3 lda ASCBUF,y
|
2016-10-29 19:58:21 +00:00
|
|
|
|
inx
|
2016-12-03 22:16:45 +00:00
|
|
|
|
sta KrnOut256,x
|
|
|
|
|
iny
|
|
|
|
|
cpy #10
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.SysVarsExit stx KrnOut256
|
2016-10-29 19:58:21 +00:00
|
|
|
|
>LDYAI KrnOut256
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr3
|
2016-10-29 19:58:21 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
* ENV.FindVarPtr1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ZPPtr1 -> NAME
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* Out:
|
|
|
|
|
* CC: Found
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ZPPtr1 -> NAME
|
|
|
|
|
* ZPPtr3 -> ENV.NAME
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* CS: Not Found
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ZPPtr1 -> NAME
|
|
|
|
|
* ZPPtr3 -> PTR to Ending 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.FindVarPtr1 jsr ENV.InitEnvPtr3 Store ENV
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .99
|
2015-03-14 21:48:35 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9 end of ENV
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.1 cmp (ZPPtr1) Same len as NAME?
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
tay
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda (ZPPtr1),y
|
|
|
|
|
cmp (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .3
|
|
|
|
|
dey
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2016-08-17 06:25:58 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
.3 jsr ENV.NextEnvPtr3 Skip NAME
|
|
|
|
|
jsr ENV.NextEnvPtr3 Skip VALUE
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda (ZPPtr3)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .1
|
|
|
|
|
|
|
|
|
|
.9 sec
|
|
|
|
|
.99 rts
|
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
* ENV.DiscardVarPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* In:
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ZPPtr3 -> ENV.NAME to Discard
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.DiscardVarPtr3
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda ZPPtr3 Discard current NAME & VALUE definition
|
|
|
|
|
sec ZPPtr3 -> NAME
|
|
|
|
|
adc (ZPPtr3) add NAME+1 to ZPPtr3
|
|
|
|
|
sta ZPPtr4 store it in ZPPtr4
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda #0
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc ZPPtr3+1
|
|
|
|
|
sta ZPPtr4+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
lda ZPPtr4 add VALUE+1 to ZPPtr4
|
2016-08-17 06:25:58 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc (ZPPtr4)
|
|
|
|
|
sta ZPPtr4
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .1
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr4+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
|
|
|
|
.1 ldy #0
|
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
.2 lda (ZPPtr4),y Move back tail...
|
|
|
|
|
sta (ZPPtr3),y
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .8 ...until we move ending 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .2
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3+1
|
|
|
|
|
inc ZPPtr4+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bra .2
|
|
|
|
|
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2016-12-03 22:16:45 +00:00
|
|
|
|
ENV.InitEnvPtr3 ldy #S.PS.hENV
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda (pPs),y
|
2016-09-21 15:20:37 +00:00
|
|
|
|
jsr K.GetMemPtrA
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr3 Store ENV
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-01-12 17:43:45 +00:00
|
|
|
|
ENV.NextEnvPtr3 lda ZPPtr3
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2017-01-12 17:43:45 +00:00
|
|
|
|
adc (ZPPtr3)
|
|
|
|
|
sta ZPPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .8
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.8 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
|
|
|
|
SAVE SYS/KERNEL.S.ENV
|
|
|
|
|
LOAD SYS/KERNEL.S
|
|
|
|
|
ASM
|