]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/putenv.s
The spans do now contain the size of a span, no longer the end offset.
[cc65] / libsrc / common / putenv.s
index aec6d1b343cba75a687ff4054142132b8adc0d00..6f7982fcd01bb8d7cd29408f332cadd7bff4001c 100644 (file)
         .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
 
@@ -180,7 +169,7 @@ addentry:
 ; Error entries
 
 nomem:  lda     #ENOMEM
-error: jsr     seterrno
+error: jsr     __seterrno
        lda     #$FF                    ; Return -1
        tax
        rts
@@ -196,3 +185,4 @@ error:      jsr     seterrno
 name:           .addr   0               ; Pointer to name
 newsize:        .byte   0               ; New environment size
 
+