2017-12-22 21:24:30 +00:00
|
|
|
|
NEW
|
2019-05-25 19:24:07 +00:00
|
|
|
|
AUTO 3,1
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2020-01-17 11:23:11 +00:00
|
|
|
|
* # Expand
|
|
|
|
|
* ## C
|
|
|
|
|
* `char *expand(const char *str, char *expanded);`
|
|
|
|
|
* ## ASM
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2020-01-20 07:23:51 +00:00
|
|
|
|
* `>PUSHW str`
|
2020-01-17 11:23:11 +00:00
|
|
|
|
* `>PUSHW expanded`
|
|
|
|
|
* `>SYSCALL expand`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2016-10-29 19:58:21 +00:00
|
|
|
|
* Y,A = PTR to Expanded String
|
2020-01-17 11:23:11 +00:00
|
|
|
|
* X = hMem to Expanded String (C-String)
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2019-01-04 13:17:31 +00:00
|
|
|
|
.DUMMY
|
|
|
|
|
.OR ZPDRV
|
|
|
|
|
ENV.BufLen .BS 1
|
2019-09-09 15:38:37 +00:00
|
|
|
|
ENV.VarEndChar .BS 1
|
2019-01-04 13:17:31 +00:00
|
|
|
|
ENV.bNoExp .BS 1
|
2019-07-22 06:31:01 +00:00
|
|
|
|
ENV.bExp .BS 1
|
2019-01-04 13:17:31 +00:00
|
|
|
|
.ED
|
|
|
|
|
*--------------------------------------
|
2020-01-17 11:23:11 +00:00
|
|
|
|
K.Expand jsr K.strdup
|
2020-01-16 14:55:21 +00:00
|
|
|
|
bcc .1
|
2020-01-17 07:31:00 +00:00
|
|
|
|
|
2020-01-16 14:55:21 +00:00
|
|
|
|
rts
|
|
|
|
|
|
2020-01-18 19:37:32 +00:00
|
|
|
|
.1 phx Save temp string...
|
2020-01-16 14:55:21 +00:00
|
|
|
|
>STYA TXTPTR
|
2019-09-09 15:38:37 +00:00
|
|
|
|
|
2018-04-17 15:25:45 +00:00
|
|
|
|
stz ENV.BufLen init Expanded String len=0
|
2019-07-22 06:31:01 +00:00
|
|
|
|
stz ENV.bExp No var found yet
|
2018-04-17 15:25:45 +00:00
|
|
|
|
stz ENV.bNoExp Reset no expand flag
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2020-01-15 16:43:23 +00:00
|
|
|
|
.10 lda (TXTPTR) End of CSTR?
|
2019-09-09 15:38:37 +00:00
|
|
|
|
beq .80
|
2016-10-29 19:58:21 +00:00
|
|
|
|
|
2020-01-15 16:43:23 +00:00
|
|
|
|
jsr SHARED.TXTPTR.Next
|
|
|
|
|
|
2019-09-10 10:22:57 +00:00
|
|
|
|
.11 cmp #'''
|
2016-10-29 19:58:21 +00:00
|
|
|
|
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
|
2019-09-10 10:22:57 +00:00
|
|
|
|
bra .10
|
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
|
|
|
|
|
2018-05-07 06:13:07 +00:00
|
|
|
|
.22 jsr ENV.AddAToBuf
|
2019-09-10 10:22:57 +00:00
|
|
|
|
bra .10
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2019-09-09 15:38:37 +00:00
|
|
|
|
.23 cmp #'$' no, found one ?
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bne .22 no, store...
|
|
|
|
|
|
2019-07-22 06:31:01 +00:00
|
|
|
|
ror ENV.bExp Toggle Expanded flag
|
2020-01-15 16:43:23 +00:00
|
|
|
|
lda (TXTPTR)
|
2019-09-10 10:22:57 +00:00
|
|
|
|
bne .30
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2019-09-09 15:38:37 +00:00
|
|
|
|
lda #'$' End of string, output $
|
|
|
|
|
bra .22
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2019-09-10 10:22:57 +00:00
|
|
|
|
.30 stz ENV.VarEndChar
|
|
|
|
|
cmp #'{' "${VAR]"?
|
2017-04-01 21:01:28 +00:00
|
|
|
|
bne .31
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2019-09-09 15:38:37 +00:00
|
|
|
|
dec ENV.VarEndChar "}" expected
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2020-01-15 16:43:23 +00:00
|
|
|
|
jsr SHARED.TXTPTR.Next skip "{"
|
2019-09-09 15:38:37 +00:00
|
|
|
|
bra .40
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
.31 jsr ENV.SysVar 0-9 *#?@$!
|
2020-01-17 07:31:00 +00:00
|
|
|
|
bcs .40
|
2015-11-22 22:30:06 +00:00
|
|
|
|
|
2020-01-15 16:43:23 +00:00
|
|
|
|
.35 jsr SHARED.TXTPTR.Next skip $x
|
2019-09-09 15:38:37 +00:00
|
|
|
|
bra .10
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2019-09-10 06:28:08 +00:00
|
|
|
|
.40 jsr ENV.ExpandStrVar
|
2019-09-10 10:22:57 +00:00
|
|
|
|
bcc .70
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
.50 ldy ENV.BufLen
|
|
|
|
|
lda /K.Buf256
|
|
|
|
|
>STYA FORPNT
|
|
|
|
|
|
|
|
|
|
jsr K.GetEnv.I
|
2019-09-10 10:22:57 +00:00
|
|
|
|
bcs .70
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
ldx ENV.BufLen
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
.51 lda K.Buf256,x
|
|
|
|
|
beq .52
|
|
|
|
|
inx
|
|
|
|
|
bra .51
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
.52 stx ENV.BufLen
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2020-01-15 16:43:23 +00:00
|
|
|
|
.70 lda (TXTPTR)
|
2019-09-10 10:22:57 +00:00
|
|
|
|
beq .72
|
2020-01-15 16:43:23 +00:00
|
|
|
|
|
2019-09-10 10:22:57 +00:00
|
|
|
|
jsr SHARED.IsIDValid
|
2020-01-15 16:43:23 +00:00
|
|
|
|
bcs .72
|
|
|
|
|
jsr SHARED.TXTPTR.Next
|
|
|
|
|
bra .70
|
|
|
|
|
|
|
|
|
|
.72 lda ENV.VarEndChar
|
2020-01-22 13:26:40 +00:00
|
|
|
|
bne .35 skip "}" and loop
|
2019-09-10 10:22:57 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
bra .10
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2020-01-16 14:55:21 +00:00
|
|
|
|
.80 ldx ENV.BufLen
|
2017-09-08 14:49:23 +00:00
|
|
|
|
stz K.Buf256,x
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2020-01-18 19:37:32 +00:00
|
|
|
|
pla discard temp string
|
2020-01-16 14:55:21 +00:00
|
|
|
|
jsr K.FreeMem
|
2019-10-12 14:20:09 +00:00
|
|
|
|
|
2020-01-16 14:55:21 +00:00
|
|
|
|
>LDYAI K.Buf256 dup in case of '' processing
|
|
|
|
|
jsr K.strdup
|
|
|
|
|
bcs .9
|
|
|
|
|
|
2019-10-12 14:20:09 +00:00
|
|
|
|
bit ENV.bExp Did we expand something ?
|
2020-01-16 14:55:21 +00:00
|
|
|
|
bpl .9
|
|
|
|
|
jmp .1
|
|
|
|
|
|
|
|
|
|
* clc
|
|
|
|
|
.9 rts
|
2020-01-17 11:23:11 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-22 13:26:40 +00:00
|
|
|
|
ENV.SysVar jsr ZP.IsDigit $0 ... $9 ?
|
|
|
|
|
bcs .1
|
2020-01-16 07:33:14 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
and #$0f
|
|
|
|
|
|
|
|
|
|
jsr K.ArgV
|
|
|
|
|
bcs .8 Arg# is undefined, do not append anything
|
|
|
|
|
|
|
|
|
|
jsr ENV.AddYAToBuf
|
|
|
|
|
|
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.1 ldx #ENV.SysVars.Cnt-1
|
|
|
|
|
|
|
|
|
|
.2 cmp ENV.SysVars,x
|
|
|
|
|
beq .3
|
2018-06-28 15:26:34 +00:00
|
|
|
|
dex
|
2020-01-22 13:26:40 +00:00
|
|
|
|
bpl .2
|
2020-01-16 07:33:14 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
sec
|
|
|
|
|
rts
|
2020-01-16 07:33:14 +00:00
|
|
|
|
|
2020-01-22 13:26:40 +00:00
|
|
|
|
.3 txa
|
2020-01-17 11:23:11 +00:00
|
|
|
|
beq ENV.SysVarsAllArgs
|
2018-06-28 15:26:34 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
ldy ENV.SysVars.PS-1,x
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.SysVarsNum jsr MATH.A2STR10NP
|
|
|
|
|
ldy #0
|
|
|
|
|
.1 lda A2osX.NumStrBuf,y
|
|
|
|
|
beq ENV.SysVarsNum.8
|
|
|
|
|
iny
|
|
|
|
|
jsr ENV.AddAToBuf
|
|
|
|
|
bra .1
|
|
|
|
|
ENV.SysVarsNum.8
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.SysVarsAllArgs
|
|
|
|
|
lda #1
|
|
|
|
|
jsr K.ArgV
|
|
|
|
|
bcs ENV.SysVarsNum.8
|
|
|
|
|
>STYA ZPPtr3
|
2020-01-16 07:33:14 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.1 lda (ZPPtr3)
|
|
|
|
|
beq ENV.SysVarsNum.8
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.2 jsr ENV.AddP3ToBuf
|
|
|
|
|
jsr ENV.NextEnvP3
|
|
|
|
|
lda (ZPPtr3)
|
|
|
|
|
beq ENV.SysVarsNum.8
|
|
|
|
|
lda #C.SPACE
|
|
|
|
|
jsr ENV.AddAToBuf
|
|
|
|
|
bra .2
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.SysVars .AS "*#?@$!"
|
|
|
|
|
ENV.SysVars.Cnt .EQ *-ENV.SysVars
|
|
|
|
|
ENV.SysVars.PS .DA #S.PS.ARGC,#S.PS.RC,#S.PS.PPID,#S.PS.PID,#S.PS.CPID
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.ExpandStrVar
|
|
|
|
|
>LDYAI ENV.StrVars
|
|
|
|
|
>STYA ZPPtr3
|
2020-01-16 14:55:21 +00:00
|
|
|
|
ldx #0
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.1 lda (ZPPtr3)
|
|
|
|
|
beq .9
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
.2 iny
|
|
|
|
|
lda (TXTPTR),y
|
|
|
|
|
beq .3
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
jsr SHARED.IsIDValid
|
|
|
|
|
bcs .3
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
cmp (ZPPtr3),y
|
|
|
|
|
beq .2
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
bra .4
|
2018-06-28 15:26:34 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.3 lda (ZPPtr3),y
|
|
|
|
|
bne .4
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
jmp (ENV.StrVarsJmp,x)
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.4 inx
|
2018-06-28 15:26:34 +00:00
|
|
|
|
inx
|
2020-01-17 11:23:11 +00:00
|
|
|
|
jsr ENV.NextEnvP3
|
|
|
|
|
bra .1
|
2019-12-02 16:47:53 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.9 sec
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.StrVars .AZ "LOGNAME"
|
|
|
|
|
.AZ "GECOS"
|
|
|
|
|
.AZ "HOME"
|
|
|
|
|
.AZ "SHELL"
|
|
|
|
|
.AZ "PWD"
|
|
|
|
|
.AZ "UID"
|
|
|
|
|
.AZ "GID"
|
|
|
|
|
.DA #0
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.StrVarsJmp .DA ENV.StrVarsSession
|
|
|
|
|
.DA ENV.StrVarsSession
|
|
|
|
|
.DA ENV.StrVarsSession
|
|
|
|
|
.DA ENV.StrVarsSession
|
|
|
|
|
.DA ENV.StrVarsPWD
|
|
|
|
|
.DA ENV.StrVarsUID
|
|
|
|
|
.DA ENV.StrVarsGID
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.StrVarsPWD ldy #S.PS.hCWD
|
|
|
|
|
lda (pPS),y
|
|
|
|
|
jsr K.GetMemPtr
|
|
|
|
|
jmp ENV.AddYAToBuf
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.StrVarsUID ldy #S.SESSION.UID
|
|
|
|
|
.HS 2C
|
|
|
|
|
ENV.StrVarsGID ldy #S.SESSION.GID
|
|
|
|
|
lda (pSession),y
|
|
|
|
|
jmp ENV.SysVarsNum
|
|
|
|
|
ENV.StrVarsSession
|
|
|
|
|
lda pSession
|
|
|
|
|
clc
|
|
|
|
|
adc #S.SESSION.NAME
|
|
|
|
|
sta ZPPtr3
|
|
|
|
|
lda pSession+1
|
|
|
|
|
adc /S.SESSION.NAME
|
|
|
|
|
sta ZPPtr3+1
|
2020-01-16 14:55:21 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
.1 dex
|
|
|
|
|
dex
|
2020-01-22 13:26:40 +00:00
|
|
|
|
bmi ENV.AddP3ToBuf
|
2018-06-28 15:26:34 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
bne .2
|
2018-06-28 15:26:34 +00:00
|
|
|
|
|
2020-01-17 11:23:11 +00:00
|
|
|
|
jsr ENV.NextEnvP3Y
|
|
|
|
|
bra .1
|
|
|
|
|
*--------------------------------------
|
2020-01-22 13:26:40 +00:00
|
|
|
|
ENV.AddYAToBuf >STYA ZPPtr3
|
2020-01-17 11:23:11 +00:00
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.AddP3ToBuf ldx ENV.BufLen
|
|
|
|
|
ldy #$ff
|
|
|
|
|
dex
|
|
|
|
|
.1 iny
|
|
|
|
|
inx
|
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
sta K.Buf256,x
|
|
|
|
|
bne .1
|
|
|
|
|
stx ENV.BufLen
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.AddAToBuf ldx ENV.BufLen
|
|
|
|
|
sta K.Buf256,x
|
|
|
|
|
inc ENV.BufLen
|
2018-06-28 15:26:34 +00:00
|
|
|
|
rts
|
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # PutEnv
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* Change or add an environment variable, string is 'NAME=VALUE'
|
|
|
|
|
* ## C
|
|
|
|
|
* `int putenv(char *string);`
|
|
|
|
|
* ## ASM
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2020-01-17 11:23:11 +00:00
|
|
|
|
* `>PUSHW string`
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* `>SYSCALL putenv`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2020-01-17 13:25:59 +00:00
|
|
|
|
K.PutEnv >PULLW TXTPTR NAME=VALUE
|
2016-12-03 22:16:45 +00:00
|
|
|
|
|
2020-01-17 13:25:59 +00:00
|
|
|
|
ldy #$ff
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-17 13:25:59 +00:00
|
|
|
|
.1 iny
|
|
|
|
|
lda (TXTPTR),y NAME=
|
2016-08-17 06:25:58 +00:00
|
|
|
|
beq .9
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2017-08-30 15:26:34 +00:00
|
|
|
|
cmp #'='
|
2020-01-17 13:25:59 +00:00
|
|
|
|
bne .1
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-17 13:25:59 +00:00
|
|
|
|
tya
|
|
|
|
|
sec skip =
|
|
|
|
|
adc TXTPTR
|
|
|
|
|
sta FORPNT
|
2020-01-16 14:55:21 +00:00
|
|
|
|
|
2020-01-17 13:25:59 +00:00
|
|
|
|
lda #0
|
|
|
|
|
adc TXTPTR+1
|
|
|
|
|
sta FORPNT+1
|
|
|
|
|
|
|
|
|
|
bra K.SetEnv.I
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-07-08 15:39:14 +00:00
|
|
|
|
.9 lda #E.SYN
|
|
|
|
|
sec
|
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2017-03-30 16:11:31 +00:00
|
|
|
|
* # SetEnv
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* Change or add an environment variable
|
|
|
|
|
* ## C
|
|
|
|
|
* `int setenv(const char *name, const char *value);`
|
|
|
|
|
* ## ASM
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2020-01-17 07:31:00 +00:00
|
|
|
|
* `>PUSHW name`
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* `>PUSHW value`
|
|
|
|
|
* `>SYSCALL setenv`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2020-01-17 07:31:00 +00:00
|
|
|
|
K.SetEnv >PULLW FORPNT value
|
|
|
|
|
>PULLW TXTPTR name
|
2020-01-15 16:43:23 +00:00
|
|
|
|
|
2017-10-27 14:56:46 +00:00
|
|
|
|
K.SetEnv.I jsr K.UnsetEnv.I
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.1 jsr ENV.InitEnvP3 ZPPtr3 -> Env (SETREADAUX)
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
lda #1
|
|
|
|
|
sta ZPPtr4
|
|
|
|
|
stz ZPPtr4+1 ZPPtr4 = ENVSIZE = 1
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
.10 lda (ZPPtr3) End of ENV
|
|
|
|
|
beq .15
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
jsr ENV.GetP3LenY
|
|
|
|
|
jsr ENV.NextEnvP3Y
|
|
|
|
|
jsr ENV.NextEnvP4Y
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bra .10
|
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.15 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
.FIN
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-23 16:26:48 +00:00
|
|
|
|
.16 iny
|
2020-01-15 16:43:23 +00:00
|
|
|
|
lda (TXTPTR),y
|
2020-01-17 16:12:24 +00:00
|
|
|
|
beq .17
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
jsr SHARED.IsIDValid
|
|
|
|
|
bcc .16
|
|
|
|
|
|
|
|
|
|
.17 jsr ENV.NextEnvP4Y ZPPtr4 = ENVSIZE + VAR
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2018-10-29 08:41:10 +00:00
|
|
|
|
ldy #$ff
|
|
|
|
|
|
|
|
|
|
.19 iny
|
2020-01-16 14:55:21 +00:00
|
|
|
|
lda (FORPNT),y
|
2017-09-11 06:11:57 +00:00
|
|
|
|
bne .19
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
jsr ENV.NextEnvP4Y ZPPtr4 = ENVSIZE + VALUE
|
|
|
|
|
lda ZPPtr4
|
|
|
|
|
beq .20
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2017-09-11 06:11:57 +00:00
|
|
|
|
inc ZPPtr4+1
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
.20 ldy #S.PS.ENVPAGECNT
|
2019-01-22 16:35:42 +00:00
|
|
|
|
lda (pPs),y
|
|
|
|
|
cmp ZPPtr4+1
|
|
|
|
|
bcs .22 env is large enough
|
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
lda ZPPtr4+1
|
|
|
|
|
jsr ENV.Dup.A
|
2019-01-22 16:35:42 +00:00
|
|
|
|
bcs .9
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-22 08:53:07 +00:00
|
|
|
|
phx page count
|
|
|
|
|
pha hENV
|
|
|
|
|
|
2019-01-22 16:35:42 +00:00
|
|
|
|
ldy #S.PS.hENV
|
|
|
|
|
lda (pPs),y
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
ldx #SYS.FreeStkObj
|
|
|
|
|
jsr K.SYSCALL2.AUX
|
|
|
|
|
.ELSE
|
2019-01-22 16:35:42 +00:00
|
|
|
|
jsr K.Freemem
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.FIN
|
|
|
|
|
|
2020-01-22 08:53:07 +00:00
|
|
|
|
pla hEnv
|
2019-01-22 16:35:42 +00:00
|
|
|
|
ldy #S.PS.hENV
|
|
|
|
|
sta (pPs),y
|
2020-01-22 08:53:07 +00:00
|
|
|
|
pla page count
|
2019-01-22 16:35:42 +00:00
|
|
|
|
dey S.PS.ENVPAGECNT
|
|
|
|
|
sta (pPs),y
|
|
|
|
|
bra .1 Start over
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-22 16:35:42 +00:00
|
|
|
|
.22 ldy #$ff
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta SETWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
|
2019-01-22 16:35:42 +00:00
|
|
|
|
.23 iny
|
2020-01-15 16:43:23 +00:00
|
|
|
|
lda (TXTPTR),y
|
2017-09-11 06:11:57 +00:00
|
|
|
|
sta (ZPPtr3),y
|
2020-01-17 13:25:59 +00:00
|
|
|
|
beq .24
|
|
|
|
|
jsr SHARED.IsIDValid
|
|
|
|
|
bcc .23
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-17 13:25:59 +00:00
|
|
|
|
.24 lda #'='
|
2020-01-14 15:26:24 +00:00
|
|
|
|
sta (ZPPtr3),y
|
|
|
|
|
|
2018-10-29 08:41:10 +00:00
|
|
|
|
jsr ENV.NextEnvP3Y
|
|
|
|
|
ldy #$ff
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2020-01-17 13:25:59 +00:00
|
|
|
|
.25 iny
|
2020-01-15 16:43:23 +00:00
|
|
|
|
lda (FORPNT),y
|
2017-09-11 06:11:57 +00:00
|
|
|
|
sta (ZPPtr3),y
|
2020-01-17 13:25:59 +00:00
|
|
|
|
bne .25
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
|
|
|
|
iny
|
|
|
|
|
sta (ZPPtr3),y don't forget array ending 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
clc
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.9 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # GetEnv
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* searches the environment list to find the environment variable name,
|
|
|
|
|
* and returns a pointer to the corresponding value string.
|
|
|
|
|
* ## C
|
2020-01-15 07:10:24 +00:00
|
|
|
|
* `char *getenv(const char *name, char *value);`
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* ## ASM
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2020-01-15 07:10:24 +00:00
|
|
|
|
* `>PUSHW name`
|
|
|
|
|
* `>PUSHW value`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* `>SYSCALL getenv`
|
|
|
|
|
* ## RETURN VALUE
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* CC : Y,A = PTR to VALUE (C-String)
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* CS : not found
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2020-01-15 09:50:04 +00:00
|
|
|
|
K.GetEnv >PULLW FORPNT value
|
2020-01-15 16:43:23 +00:00
|
|
|
|
>PULLW TXTPTR name
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2020-01-21 16:35:11 +00:00
|
|
|
|
K.GetEnv.I lda TXTPTR
|
2020-01-17 16:12:24 +00:00
|
|
|
|
beq K.GetEnvDump
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2020-01-21 16:35:11 +00:00
|
|
|
|
jsr ENV.FindVar
|
2016-08-17 06:25:58 +00:00
|
|
|
|
bcs .9
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-14 15:26:24 +00:00
|
|
|
|
jsr ENV.NextEnvP3Y Skip NAME=
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-15 09:50:04 +00:00
|
|
|
|
lda FORPNT+1
|
2020-01-16 07:33:14 +00:00
|
|
|
|
bne .3
|
|
|
|
|
|
|
|
|
|
ldy #$ff
|
|
|
|
|
|
2020-01-20 11:13:58 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
.FIN
|
|
|
|
|
|
2020-01-16 07:33:14 +00:00
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr3),y
|
2020-01-15 09:50:04 +00:00
|
|
|
|
bne .1
|
2020-01-16 07:33:14 +00:00
|
|
|
|
|
2020-01-20 11:13:58 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
.FIN
|
|
|
|
|
|
2020-01-16 07:33:14 +00:00
|
|
|
|
iny
|
|
|
|
|
bne .2
|
|
|
|
|
inc
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.2 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
|
|
|
|
.FIN
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
jsr K.getmem
|
2020-01-16 07:33:14 +00:00
|
|
|
|
bcs .99
|
|
|
|
|
|
|
|
|
|
>STYA FORPNT
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.3 .DO AUXENV=1
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
.FIN
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
ldy #$ff
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
2020-01-16 07:33:14 +00:00
|
|
|
|
.4 iny
|
2020-01-15 09:50:04 +00:00
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
sta (FORPNT),y
|
2020-01-16 07:33:14 +00:00
|
|
|
|
bne .4
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
|
|
|
|
>LDYA FORPNT
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
.FIN
|
2020-01-15 09:50:04 +00:00
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
.9 >LDYAI 0
|
|
|
|
|
* sec
|
2020-01-16 07:33:14 +00:00
|
|
|
|
.99 rts
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2020-01-18 19:37:32 +00:00
|
|
|
|
K.GetEnvDump ldy #S.PS.ENVPAGECNT
|
|
|
|
|
lda (pPs),y
|
|
|
|
|
sta .1+1
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
jsr K.getmem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA FORPNT
|
|
|
|
|
sty .80+1
|
|
|
|
|
sta .81+1
|
|
|
|
|
stx .82+1
|
|
|
|
|
|
|
|
|
|
jsr ENV.InitEnvP3 SETREADAUX
|
|
|
|
|
|
|
|
|
|
.1 ldx #$ff SELF MODIFIED
|
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
|
|
|
|
|
.2 lda (ZPPtr3),y
|
|
|
|
|
sta (FORPNT),y
|
|
|
|
|
iny
|
|
|
|
|
bne .2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
.80 ldy #$ff SELF MODIFIED
|
|
|
|
|
.81 lda #$ff SELF MODIFIED
|
|
|
|
|
.82 ldx #$ff SELF MODIFIED
|
|
|
|
|
|
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
.FIN
|
|
|
|
|
|
|
|
|
|
clc
|
|
|
|
|
.9 rts
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*/--------------------------------------
|
2018-06-21 15:12:10 +00:00
|
|
|
|
* # UnsetEnv
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* Remove an environment variable
|
|
|
|
|
* ## C
|
|
|
|
|
* `int unsetenv(const char *name);`
|
|
|
|
|
* ## ASM
|
2018-06-14 15:31:36 +00:00
|
|
|
|
* **In:**
|
2020-01-17 11:23:11 +00:00
|
|
|
|
* `>PUSHW name`
|
2018-09-06 15:36:44 +00:00
|
|
|
|
* `>SYSCALL unsetenv`
|
2018-10-11 15:23:06 +00:00
|
|
|
|
* ## RETURN VALUE
|
2016-10-29 19:58:21 +00:00
|
|
|
|
*\--------------------------------------
|
2020-01-17 13:25:59 +00:00
|
|
|
|
K.UnsetEnv >PULLW TXTPTR name
|
|
|
|
|
|
2020-01-21 16:35:11 +00:00
|
|
|
|
K.UnsetEnv.I jsr ENV.FindVar
|
2020-01-22 13:26:40 +00:00
|
|
|
|
bcs .8 not found, quit
|
2015-11-10 21:47:57 +00:00
|
|
|
|
|
2020-01-14 15:26:24 +00:00
|
|
|
|
jsr ENV.DelVarP3 Ptr3 -> NAME=VALUE
|
2020-01-22 13:26:40 +00:00
|
|
|
|
.8 clc
|
|
|
|
|
rts
|
2015-11-10 21:47:57 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-21 16:35:11 +00:00
|
|
|
|
* ENV.FindVar
|
2016-08-17 06:25:58 +00:00
|
|
|
|
* In:
|
2020-01-15 16:43:23 +00:00
|
|
|
|
* TXTPTR -> NAME
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* Out:
|
|
|
|
|
* CC: Found
|
2019-09-09 15:38:37 +00:00
|
|
|
|
* Y = NAME len
|
2020-01-15 16:43:23 +00:00
|
|
|
|
* TXTPTR -> NAME
|
2020-01-14 15:26:24 +00:00
|
|
|
|
* ZPPtr3 -> NAME=VALUE
|
2015-03-14 21:48:35 +00:00
|
|
|
|
* CS: Not Found
|
2020-01-15 16:43:23 +00:00
|
|
|
|
* TXTPTR -> NAME
|
2017-01-12 17:43:45 +00:00
|
|
|
|
* ZPPtr3 -> PTR to Ending 0
|
2015-03-14 21:48:35 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-21 16:35:11 +00:00
|
|
|
|
ENV.FindVar
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
sta SETWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
|
2020-01-15 16:43:23 +00:00
|
|
|
|
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
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2018-10-26 14:46:11 +00:00
|
|
|
|
ldy #$ff
|
2016-08-17 06:25:58 +00:00
|
|
|
|
|
2018-10-26 14:46:11 +00:00
|
|
|
|
.2 iny
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
jsr SHARED.TXTPTR.GetY
|
|
|
|
|
.ELSE
|
2020-01-15 16:43:23 +00:00
|
|
|
|
lda (TXTPTR),y
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.FIN
|
2019-09-09 15:38:37 +00:00
|
|
|
|
beq .3
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2019-09-09 15:38:37 +00:00
|
|
|
|
jsr SHARED.IsIDValid
|
|
|
|
|
bcs .3
|
2020-01-15 16:43:23 +00:00
|
|
|
|
|
2017-01-12 17:43:45 +00:00
|
|
|
|
cmp (ZPPtr3),y
|
2019-09-09 15:38:37 +00:00
|
|
|
|
beq .2
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2019-09-09 15:38:37 +00:00
|
|
|
|
bra .4
|
2020-01-14 15:26:24 +00:00
|
|
|
|
|
2019-09-09 15:38:37 +00:00
|
|
|
|
.3 lda (ZPPtr3),y
|
2020-01-14 15:26:24 +00:00
|
|
|
|
cmp #'='
|
2019-09-09 15:38:37 +00:00
|
|
|
|
bne .4
|
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
|
|
|
|
.FIN
|
2019-07-22 06:31:01 +00:00
|
|
|
|
clc
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2020-01-14 15:26:24 +00:00
|
|
|
|
.4 jsr ENV.NextEnvP3 Skip NAME=VALUE
|
2017-08-30 15:26:34 +00:00
|
|
|
|
bra .1
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.9 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
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
|
|
|
|
*--------------------------------------
|
2020-01-17 16:12:24 +00:00
|
|
|
|
ENV.DelVarP3 .DO AUXENV=1
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
sta SETWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
>LDYA ZPPtr3 save actual Ptr
|
2017-08-30 15:26:34 +00:00
|
|
|
|
>STYA ZPPtr4
|
2020-01-14 15:26:24 +00:00
|
|
|
|
jsr ENV.NextEnvP3 Skip NAME=VALUE
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2018-10-29 08:41:10 +00:00
|
|
|
|
.1 ldy #$ff
|
2017-09-11 06:11:57 +00:00
|
|
|
|
|
2018-10-29 08:41:10 +00:00
|
|
|
|
.2 iny
|
|
|
|
|
lda (ZPPtr3),y Move back CSTRs...
|
2017-09-11 06:11:57 +00:00
|
|
|
|
sta (ZPPtr4),y
|
2018-10-29 08:41:10 +00:00
|
|
|
|
bne .2
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
2018-10-29 08:41:10 +00:00
|
|
|
|
tya
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
beq .8 we moved back ending \0
|
|
|
|
|
|
2018-10-29 08:41:10 +00:00
|
|
|
|
jsr ENV.NextEnvP3Y
|
|
|
|
|
jsr ENV.NextEnvP4Y
|
|
|
|
|
bra .1
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.8 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
rts
|
2016-08-17 06:25:58 +00:00
|
|
|
|
*--------------------------------------
|
2020-01-17 16:12:24 +00:00
|
|
|
|
ENV.InitEnvP3 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
.FIN
|
|
|
|
|
ldy #S.PS.hENV
|
2016-08-17 06:25:58 +00:00
|
|
|
|
lda (pPs),y
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
.FIN
|
2018-06-21 15:12:10 +00:00
|
|
|
|
jsr K.GetMemPtr
|
2017-09-14 15:21:06 +00:00
|
|
|
|
>STYA ZPPtr3 Store ENV
|
2020-01-22 13:26:40 +00:00
|
|
|
|
|
2016-08-17 06:25:58 +00:00
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2019-01-25 15:15:19 +00:00
|
|
|
|
ENV.NextEnvP3 jsr ENV.GetP3LenY
|
2019-01-26 14:01:05 +00:00
|
|
|
|
*--------------------------------------
|
2018-10-29 08:41:10 +00:00
|
|
|
|
ENV.NextEnvP3Y tya
|
2019-07-17 15:49:23 +00:00
|
|
|
|
ENV.NextEnvP3A 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
|
|
|
|
*--------------------------------------
|
2019-01-25 15:15:19 +00:00
|
|
|
|
ENV.GetP3LenY ldy #$ff
|
|
|
|
|
.1 iny
|
|
|
|
|
lda (ZPPtr3),y
|
|
|
|
|
bne .1
|
|
|
|
|
rts
|
|
|
|
|
*--------------------------------------
|
2018-10-29 08:41:10 +00:00
|
|
|
|
ENV.NextEnvP4Y tya
|
|
|
|
|
sec
|
|
|
|
|
adc ZPPtr4
|
|
|
|
|
sta ZPPtr4
|
|
|
|
|
bcc .8
|
|
|
|
|
inc ZPPtr4+1
|
|
|
|
|
.8 rts
|
|
|
|
|
*--------------------------------------
|
2019-01-22 16:35:42 +00:00
|
|
|
|
* ENV.Dup
|
|
|
|
|
* In:
|
|
|
|
|
* A = ENV hMem To Duplicate
|
|
|
|
|
* Out:
|
|
|
|
|
* A = hMem to new ENV
|
|
|
|
|
* X = Page Count
|
|
|
|
|
*--------------------------------------
|
|
|
|
|
ENV.Dup ldy #S.PS.ENVPAGECNT
|
|
|
|
|
lda (pPs),y
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
ENV.Dup.A sta .8+1 Store target page Count
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-25 15:15:19 +00:00
|
|
|
|
ldy #S.PS.ENVPAGECNT get SOURCE page count
|
2019-01-22 16:35:42 +00:00
|
|
|
|
lda (pPs),y
|
2020-01-17 16:12:24 +00:00
|
|
|
|
sta .10+1
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2020-01-17 16:12:24 +00:00
|
|
|
|
ldy #S.PS.hENV
|
2020-01-14 07:40:01 +00:00
|
|
|
|
lda (pPs),y
|
2020-01-17 16:12:24 +00:00
|
|
|
|
.DO AUXENV=1
|
|
|
|
|
sta SETREADAUX
|
|
|
|
|
sta SETWRITEAUX
|
|
|
|
|
.FIN
|
2020-01-14 07:40:01 +00:00
|
|
|
|
jsr K.GetMemPtr
|
|
|
|
|
>STYA .1+1
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
lda .8+1
|
|
|
|
|
jsr K.GetMem
|
|
|
|
|
bcs .9
|
|
|
|
|
|
|
|
|
|
>STYA .2+1 Target Buffer
|
|
|
|
|
phx save hMem
|
|
|
|
|
jsr Mem.SetOwner Set Ownership
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-22 16:35:42 +00:00
|
|
|
|
ldy #0
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.10 ldx #$ff SELF MODIFIED
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-22 16:35:42 +00:00
|
|
|
|
.1 lda $ffff,y SELF MODIFIED
|
|
|
|
|
.2 sta $ffff,y SELF MODIFIED
|
|
|
|
|
iny
|
|
|
|
|
bne .1
|
2020-01-14 07:40:01 +00:00
|
|
|
|
|
2019-01-22 16:35:42 +00:00
|
|
|
|
inc .1+2
|
|
|
|
|
inc .2+2
|
|
|
|
|
dex
|
|
|
|
|
bne .1
|
|
|
|
|
|
2020-01-17 07:31:00 +00:00
|
|
|
|
.8 ldx #$ff SELF MODIFIED Target Page Count
|
2019-01-22 16:35:42 +00:00
|
|
|
|
pla hMem
|
|
|
|
|
clc
|
2020-01-17 16:12:24 +00:00
|
|
|
|
|
|
|
|
|
.9 .DO AUXENV=1
|
|
|
|
|
sta CLRREADAUX
|
|
|
|
|
sta CLRWRITEAUX
|
|
|
|
|
.FIN
|
|
|
|
|
rts
|
2019-01-22 16:35:42 +00:00
|
|
|
|
*--------------------------------------
|
2015-03-14 21:48:35 +00:00
|
|
|
|
MAN
|
2018-11-17 17:17:13 +00:00
|
|
|
|
SAVE USR/SRC/SYS/KERNEL.S.ENV
|
|
|
|
|
LOAD USR/SRC/SYS/KERNEL.S
|
2015-03-14 21:48:35 +00:00
|
|
|
|
ASM
|