.import _malloc, _free
.import searchenv, copyenvptr
.import __environ, __envcount, __envsize
- .import __seterrno, return0
+ .import return0
.import ptr1:zp, ptr2:zp, ptr3:zp, tmp1:zp
.include "errno.inc"
- .macpack cpu
-
.code
;----------------------------------------------------------------------------
; Remember the offset of the equal sign and replace it by a zero.
-.if (.cpu .bitand ::CPU_ISET_65SC02)
- phy
- stz (ptr1),y
-.else
sty tmp1
lda #$00
sta (ptr1),y
-.endif
; Search for the string in the environment. searchenv will set the N flag if
; the string is not found, otherwise X contains the index of the entry, ptr2
; Before doing anything else, restore the old environment string.
-.if (.cpu .bitand ::CPU_ISET_65SC02)
- ply
-.else
ldy tmp1
-.endif
lda #'='
sta (ptr1),y
name: .addr 0 ; Pointer to name
newsize: .byte 0 ; New environment size
+