2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2017-03-29 15:48:15 +00:00
|
|
|
|
PREFIX /A2OSX.BUILD
|
2017-12-22 21:24:30 +00:00
|
|
|
|
AUTO 4,1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-08-28 15:35:10 +00:00
|
|
|
|
* # ExpandStr.YA
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-08-28 15:35:10 +00:00
|
|
|
|
* Y,A = PTR to String to Expand (C-String)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2017-08-28 15:35:10 +00:00
|
|
|
|
* X = hMem to Expanded String (C-String)
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* Y,A = PTR to Expanded String
|
|
|
|
|
*\--------------------------------------
|
2018-04-17 15:25:45 +00:00
|
|
|
|
K.ExpandStr.YA stz ENV.hStr Reset Intermediate string...
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-04-01 21:01:28 +00:00
|
|
|
|
.1 >STYA ZPPtr2
|
2018-04-17 15:25:45 +00:00
|
|
|
|
stz ENV.BufLen init Expanded String len=0
|
|
|
|
|
stz ENV.bFound No var found yet
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
stz ENV.bNoExp Reset no expand flag
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ldy #0
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.10 stz ENV.VarLen
|
|
|
|
|
stz ENV.bInVar
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
|
|
|
|
.11 lda (ZPPtr2),y End of CSTR?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
beq .8
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
|
|
|
|
cmp #'''
|
|
|
|
|
bne .21
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
lda ENV.bNoExp
|
2016-10-29 19:58:21 +00:00
|
|
|
|
eor #$ff
|
2018-04-17 15:25:45 +00:00
|
|
|
|
sta ENV.bNoExp toggle flag
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bra .11
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.21 bit ENV.bNoExp
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bpl .23
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.22 ldx ENV.BufLen
|
2017-08-24 12:46:48 +00:00
|
|
|
|
sta K.Buf256,x
|
2017-08-28 15:35:10 +00:00
|
|
|
|
inx
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.BufLen
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bra .11
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
.23 ldx ENV.bInVar already in a var?
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bne .3 yes...
|
|
|
|
|
|
2017-04-01 21:01:28 +00:00
|
|
|
|
cmp #'$' no, found one ?
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bne .22 no, store...
|
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
sta ENV.bFound Toggle flag
|
2017-10-27 14:56:46 +00:00
|
|
|
|
sta ENV.bInVar
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bra .11 skip this char
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2016-10-29 19:58:21 +00:00
|
|
|
|
.3 cmp #'{' we are in var, "{" after "$"?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bne .31
|
2018-04-17 15:25:45 +00:00
|
|
|
|
ldx ENV.VarLen No char in var yet ?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
beq .11 normal, "${" syntax is ok,skip
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bne .5 not allowed char in varname, end of var
|
|
|
|
|
|
|
|
|
|
.31 cmp #'}' end of var?
|
|
|
|
|
beq .50
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
jsr MEM.IsIDValid _,.,a-z,A-Z,0-9 ?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bcc .32 yes, add to varname
|
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ldx ENV.VarLen
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bne .5 varname has already chars...end of var
|
|
|
|
|
|
|
|
|
|
inx must be a $? or ?x.....go expand
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.VarLen
|
|
|
|
|
sta ENV.VarName
|
2017-07-06 15:30:40 +00:00
|
|
|
|
bra .51 go Expand....
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.32 ldx ENV.VarLen
|
2017-04-01 21:01:28 +00:00
|
|
|
|
cpx #16
|
|
|
|
|
beq .11 varname longer than 15....ignore
|
2017-10-27 14:56:46 +00:00
|
|
|
|
sta ENV.VarName,x
|
2017-08-30 15:26:34 +00:00
|
|
|
|
inx
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.VarLen
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bra .11
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-04-01 21:01:28 +00:00
|
|
|
|
.5 dey last char was invalid...move back
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.50 ldx ENV.VarLen
|
2017-07-06 15:30:40 +00:00
|
|
|
|
beq .52 var name is empty...start over
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.51 stz ENV.VarName,x
|
2017-08-30 15:26:34 +00:00
|
|
|
|
phy save current index
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.GetValue
|
2015-11-22 22:30:06 +00:00
|
|
|
|
ply restore index in string...
|
2017-07-06 15:30:40 +00:00
|
|
|
|
.52 jmp .10 reset start flag and continue
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
.8 ldx ENV.VarLen end of STR,are we in a var?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
beq .80 no...exit...
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stz ENV.VarName,x
|
2018-04-17 15:25:45 +00:00
|
|
|
|
jsr ENV.GetValue yes, expand and add to STR
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
.80 lda ENV.hStr working from our temp string ?
|
2016-10-29 19:58:21 +00:00
|
|
|
|
beq .81 no...
|
|
|
|
|
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.FreeMem.A yes, discard....
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.81 ldx ENV.BufLen
|
2017-09-08 14:49:23 +00:00
|
|
|
|
stz K.Buf256,x
|
|
|
|
|
|
|
|
|
|
>LDYAI K.Buf256
|
|
|
|
|
jsr K.NewStr.YA
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bcs .9
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.hStr save this as temp string, in case of recurse
|
|
|
|
|
ldx ENV.bFound Did we expand something ?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
beq .82
|
|
|
|
|
jmp .1 Yes, start over with hPStr
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.82 ldx ENV.hStr
|
2017-09-08 14:49:23 +00:00
|
|
|
|
* or exit with Y,A from K.NewStrYA
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
2015-11-22 22:30:06 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.GetValue jsr ENV.ExpandSysVar
|
2017-08-23 15:05:29 +00:00
|
|
|
|
bcc .9
|
2017-09-11 15:29:08 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
>LDYAI ENV.VarName
|
2017-08-24 12:46:48 +00:00
|
|
|
|
jsr K.GetEnv.YA
|
2017-08-23 15:05:29 +00:00
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA ZPPtr3
|
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.AddP3ToBuf
|
2017-08-23 15:05:29 +00:00
|
|
|
|
|
|
|
|
|
.9 rts
|
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.BufLen .BS 1
|
|
|
|
|
ENV.bNoExp .BS 1
|
|
|
|
|
ENV.bInVar .BS 1
|
|
|
|
|
ENV.bFound .BS 1
|
|
|
|
|
ENV.hStr .BS 1
|
|
|
|
|
ENV.VarLen .BS 1
|
|
|
|
|
ENV.VarName .BS 16
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-08-24 12:46:48 +00:00
|
|
|
|
* # PutEnv.YA
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2017-08-30 15:26:34 +00:00
|
|
|
|
* Y,A = PTR to String NAME=VALUE (C-String)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2017-08-24 12:46:48 +00:00
|
|
|
|
K.PutEnv.YA >STYA ZPPtr1 NAME=VALUE
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
ldy #0
|
2016-06-07 06:10:18 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.1 lda (ZPPtr1),y copy STR to K.Buf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9
|
2017-08-30 15:26:34 +00:00
|
|
|
|
cmp #'='
|
|
|
|
|
beq .2
|
|
|
|
|
sta K.Buf256,y
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.2 lda #0
|
|
|
|
|
sta K.Buf256,y
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
tya
|
2017-09-11 06:11:57 +00:00
|
|
|
|
sec
|
2017-08-30 15:26:34 +00:00
|
|
|
|
adc ZPPtr1
|
|
|
|
|
sta ZPPtr2
|
2017-08-30 20:39:43 +00:00
|
|
|
|
lda ZPPtr1+1
|
2017-08-30 15:26:34 +00:00
|
|
|
|
adc #0
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr2+1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
>LDYAI K.Buf256
|
|
|
|
|
>STYA ZPPtr1
|
2017-10-27 14:56:46 +00:00
|
|
|
|
bra K.SetEnv.I
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SetEnv
|
|
|
|
|
* ## In:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* PUSHW = PTR To Value (PSTR)
|
|
|
|
|
* PUSHW = PTR To Name (PSTR)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
K.SetEnv jsr PullP1P2 Ptr1=NAME,Ptr2=VALUE
|
|
|
|
|
K.SetEnv.I jsr K.UnsetEnv.I
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.InitEnvP3 ZPPtr3 -> Env
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
ldx #0
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.10 lda (ZPPtr3) End of ENV
|
|
|
|
|
beq .15
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.11 iny Compute ENV size in X,Y
|
|
|
|
|
bne .12
|
|
|
|
|
inx
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.12 inc ZPPtr3
|
|
|
|
|
bne .13
|
|
|
|
|
inc ZPPtr3+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.13 lda (ZPPtr3) End of string
|
|
|
|
|
bne .11
|
|
|
|
|
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bne .14
|
|
|
|
|
inx
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.14 inc ZPPtr3
|
|
|
|
|
bne .10
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3+1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bra .10
|
|
|
|
|
|
|
|
|
|
.15 sty ZPPtr4
|
|
|
|
|
stx ZPPtr4+1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.16 lda (ZPPtr1),y
|
|
|
|
|
beq .17
|
|
|
|
|
iny
|
|
|
|
|
bne .16
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.17 tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr4
|
|
|
|
|
sta ZPPtr4
|
|
|
|
|
bcc .18
|
|
|
|
|
inc ZPPtr4+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.18 ldy #0
|
|
|
|
|
|
|
|
|
|
.19 lda (ZPPtr2),y
|
|
|
|
|
beq .20
|
|
|
|
|
iny
|
|
|
|
|
bne .19
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.20 tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr4
|
|
|
|
|
tax
|
|
|
|
|
bcc .21
|
|
|
|
|
inc ZPPtr4+1
|
|
|
|
|
|
|
|
|
|
.21 cpx #K.ENV.SIZE
|
|
|
|
|
lda ZPPtr4+1
|
|
|
|
|
sbc /K.ENV.SIZE
|
|
|
|
|
bcs .99
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
ldy #$ff
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.22 iny
|
|
|
|
|
lda (ZPPtr1),y
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
bne .22
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr3
|
|
|
|
|
sta ZPPtr3
|
|
|
|
|
bcc .23
|
|
|
|
|
inc ZPPtr3+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.23 ldy #$ff
|
|
|
|
|
|
|
|
|
|
.24 iny
|
|
|
|
|
lda (ZPPtr2),y
|
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
bne .24
|
|
|
|
|
|
|
|
|
|
iny
|
2017-09-11 15:29:08 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
sta (ZPPtr3),y don't forget array ending 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-10-26 16:01:54 +00:00
|
|
|
|
.99 lda #K.E.ENVF
|
2017-09-11 06:11:57 +00:00
|
|
|
|
* sec
|
2015-03-14 21:48:35 +00:00
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-08-24 12:46:48 +00:00
|
|
|
|
* # GetEnv.YA
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* Y,A = PTR to NAME (PSTR)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* 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-08-24 12:46:48 +00:00
|
|
|
|
K.GetEnv.YA >STYA ZPPtr1
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.FindVarP1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.NextEnvP3 Skip NAME
|
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
|
|
|
|
|
2017-09-11 15:29:08 +00:00
|
|
|
|
.9 >LDYA ZPPtr3
|
2016-10-29 19:58:21 +00:00
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2017-08-24 12:46:48 +00:00
|
|
|
|
* # UnsetEnv.YA
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## In:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* Y,A = PTR To Name (PSTR)
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* ## Out:
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
K.UnsetEnv.YA >STYA ZPPtr1 Store VAR Name
|
|
|
|
|
K.UnsetEnv.I jsr ENV.FindVarP1
|
2018-04-17 15:25:45 +00:00
|
|
|
|
bcs K.UnsetEnv.I.8 not found, quit
|
2015-11-10 21:47:57 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.DelVarP3 Ptr3 -> ENVNAME
|
2015-11-10 21:47:57 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
K.UnsetEnv.I.8 clc
|
2015-11-10 21:47:57 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* PRIVATE
|
|
|
|
|
*--------------------------------------
|
2017-04-01 21:01:28 +00:00
|
|
|
|
* ENV.ExpandSysVar
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* In:
|
2017-10-27 14:56:46 +00:00
|
|
|
|
* ENV.VarLen,ENV.VarName
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* Out:
|
|
|
|
|
* CC: Found
|
2017-08-24 12:46:48 +00:00
|
|
|
|
* Append VALUE to K.Buf256
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* CS: Not Found
|
|
|
|
|
*--------------------------------------
|
2017-04-01 21:01:28 +00:00
|
|
|
|
ENV.ExpandSysVar
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ldx ENV.VarLen
|
2017-04-01 21:01:28 +00:00
|
|
|
|
cpx #1 is name 1 char?
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bne .9
|
2017-07-06 15:30:40 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
lda ENV.VarName
|
2018-04-17 15:25:45 +00:00
|
|
|
|
jsr MEM.IsDigit $0...$9 ??
|
2016-10-29 19:58:21 +00:00
|
|
|
|
bcs .1
|
2018-04-17 15:25:45 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
and #$0F
|
2017-09-25 15:50:33 +00:00
|
|
|
|
|
2017-08-24 12:46:48 +00:00
|
|
|
|
jsr K.GetArg.A
|
2018-04-17 15:25:45 +00:00
|
|
|
|
bcs K.UnsetEnv.I.8 Arg# is undefined, do not append anything
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
>STYA ZPPtr3
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jmp ENV.AddP3ToBuf
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
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
|
2017-04-04 13:07:58 +00:00
|
|
|
|
.99 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)
|
2017-03-28 15:46:12 +00:00
|
|
|
|
|
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
|
|
|
|
|
*--------------------------------------
|
2017-04-03 06:01:52 +00:00
|
|
|
|
ENV.SysVarsArgs lda #1
|
2017-08-24 12:46:48 +00:00
|
|
|
|
jsr K.GetArg.A
|
2017-09-19 15:34:01 +00:00
|
|
|
|
bcs .8
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2017-04-03 06:01:52 +00:00
|
|
|
|
>STYA ZPPtr3
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2017-04-03 06:01:52 +00:00
|
|
|
|
.1 lda (ZPPtr3)
|
2017-09-19 15:34:01 +00:00
|
|
|
|
beq .8
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.AddP3ToBuf
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.2 jsr ENV.NextEnvP3
|
2017-04-03 06:01:52 +00:00
|
|
|
|
lda (ZPPtr3)
|
2017-09-19 15:34:01 +00:00
|
|
|
|
beq .8
|
2017-04-03 06:01:52 +00:00
|
|
|
|
|
2016-12-03 22:16:45 +00:00
|
|
|
|
inx
|
2017-09-19 15:34:01 +00:00
|
|
|
|
beq .8 make sure not overlapping buf 256
|
2017-04-03 06:01:52 +00:00
|
|
|
|
lda #' '
|
2017-08-24 12:46:48 +00:00
|
|
|
|
sta K.Buf256,x
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.BufLen
|
2017-04-04 13:07:58 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.AddP3ToBuf
|
2017-04-03 06:01:52 +00:00
|
|
|
|
bra .2
|
2017-09-19 15:34:01 +00:00
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2017-04-03 06:01:52 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.AddP3ToBuf ldx ENV.BufLen
|
2017-09-11 15:29:08 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
dex
|
|
|
|
|
|
|
|
|
|
.1 iny
|
|
|
|
|
inx
|
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
sta K.Buf256,x
|
|
|
|
|
bne .1
|
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.BufLen
|
2017-09-11 15:29:08 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-09-19 15:34:01 +00:00
|
|
|
|
ENV.SysVarsArgC ldy #S.PS.ARGC
|
|
|
|
|
.HS 2C
|
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
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
stz .2+1
|
|
|
|
|
stz .3+1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
ldx #8
|
|
|
|
|
sed
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
.1 asl
|
|
|
|
|
pha
|
|
|
|
|
.2 lda #$ff Self Modified
|
|
|
|
|
adc .2+1
|
|
|
|
|
sta .2+1
|
|
|
|
|
|
|
|
|
|
.3 lda #$ff Self Modified
|
|
|
|
|
adc .3+1
|
|
|
|
|
sta .3+1
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
pla
|
|
|
|
|
dex
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bne .1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
cld
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ldx ENV.BufLen
|
2017-09-19 15:34:01 +00:00
|
|
|
|
lda .3+1
|
|
|
|
|
beq .4
|
|
|
|
|
sta K.Buf256,x
|
|
|
|
|
inx
|
|
|
|
|
|
|
|
|
|
.4 lda .2+1
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
lsr
|
|
|
|
|
beq .5
|
2017-03-28 15:46:12 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
ora #$30
|
2017-08-24 12:46:48 +00:00
|
|
|
|
sta K.Buf256,x
|
2017-09-19 15:34:01 +00:00
|
|
|
|
inx
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2017-09-19 15:34:01 +00:00
|
|
|
|
.5 lda .2+1
|
|
|
|
|
and #$0f
|
|
|
|
|
ora #$30
|
|
|
|
|
sta K.Buf256,x
|
|
|
|
|
inx
|
2017-04-01 21:01:28 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
stx ENV.BufLen
|
2016-10-29 19:58:21 +00:00
|
|
|
|
clc
|
|
|
|
|
rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
* ENV.FindVarP1
|
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
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.FindVarP1 jsr ENV.InitEnvP3 Store ENV
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.1 lda (ZPPtr3)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9 end of ENV
|
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
ldy #0
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
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
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
ora #0
|
|
|
|
|
beq .8
|
|
|
|
|
|
|
|
|
|
iny
|
2015-03-14 21:48:35 +00:00
|
|
|
|
bne .2
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.8 clc
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
.3 jsr ENV.NextEnvP3 Skip NAME
|
|
|
|
|
jsr ENV.NextEnvP3 Skip VALUE
|
2017-08-30 15:26:34 +00:00
|
|
|
|
bra .1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.9 sec
|
2017-09-14 15:21:06 +00:00
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
* ENV.DelVarP3
|
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
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.DelVarP3 >LDYA ZPPtr3 save actual Ptr
|
2017-08-30 15:26:34 +00:00
|
|
|
|
>STYA ZPPtr4
|
2017-10-27 14:56:46 +00:00
|
|
|
|
jsr ENV.NextEnvP3 Skip current NAME....
|
|
|
|
|
jsr ENV.NextEnvP3 Skip current VALUE....
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
ldy #0
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.1 lda (ZPPtr3),y Move back CSTRs...
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.2 sta (ZPPtr4),y
|
2017-09-11 06:11:57 +00:00
|
|
|
|
beq .3 0 ended....
|
2015-03-14 21:48:35 +00:00
|
|
|
|
iny
|
2017-08-30 15:26:34 +00:00
|
|
|
|
bne .1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
inc ZPPtr3+1
|
|
|
|
|
inc ZPPtr4+1
|
2017-08-30 15:26:34 +00:00
|
|
|
|
bra .1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.3 iny
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
|
|
|
|
inc ZPPtr3+1
|
|
|
|
|
inc ZPPtr4+1
|
|
|
|
|
|
|
|
|
|
.4 lda (ZPPtr3),y
|
|
|
|
|
bne .2 Until array ending 0
|
|
|
|
|
sta (ZPPtr4),y
|
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.InitEnvP3 ldy #S.PS.hENV
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda (pPs),y
|
2017-08-25 06:37:21 +00:00
|
|
|
|
jsr K.GetMemPtr.A
|
2017-09-14 15:21:06 +00:00
|
|
|
|
>STYA ZPPtr3 Store ENV
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2017-10-27 14:56:46 +00:00
|
|
|
|
ENV.NextEnvP3 ldy #0
|
2017-08-30 15:26:34 +00:00
|
|
|
|
|
|
|
|
|
.1 lda (ZPPtr3),y
|
|
|
|
|
beq .2
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
.2 tya
|
2015-03-14 21:48:35 +00:00
|
|
|
|
sec
|
2017-08-30 15:26:34 +00:00
|
|
|
|
adc ZPPtr3
|
2017-01-12 17:43:45 +00:00
|
|
|
|
sta ZPPtr3
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcc .8
|
2017-01-12 17:43:45 +00:00
|
|
|
|
inc ZPPtr3+1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.8 rts
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
MAN
|
2017-03-29 15:48:15 +00:00
|
|
|
|
SAVE /A2OSX.SRC/SYS/KERNEL.S.ENV
|
|
|
|
|
LOAD /A2OSX.SRC/SYS/KERNEL.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|