]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/strdup.s
Copy TGI drivers into main lib dir
[cc65] / libsrc / common / strdup.s
index fa2d289c4e9e4c91b0395eb34a3e3ea1f81bd2c8..ed49ba485c2ec4532b36c4f8320a642e5e3abaa1 100644 (file)
@@ -18,18 +18,22 @@ _strdup:
 ; Since we need some place to store the intermediate results, allocate a
 ; stack frame. To make this somewhat more efficient, create the stackframe
 ; as needed for the final call to the memcpy function.
-
+               
+       pha                     ; decsp will destroy A (but not X)
        jsr     decsp4          ; Target/source
 
 ; Store the pointer into the source slot
 
-       ldy     #0
-       sta     (sp),y
-       iny
-       pha
+       ldy     #1
        txa
        sta     (sp),y
-       pla
+       pla           
+.ifpc02
+       sta     (sp)
+.else
+               dey
+               sta     (sp),y
+.endif
 
 ; Get length of S (which is still in a/x)