]> git.sur5r.net Git - cc65/commitdiff
Fixed an error in calloc reported by Marc 'BlackJack' Rintsch.
authoruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 12 Nov 2012 23:07:02 +0000 (23:07 +0000)
committeruz <uz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Mon, 12 Nov 2012 23:07:02 +0000 (23:07 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@5932 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/calloc.s

index 16d217553dd064ad118f4b5d2a4b83e991dd6ed1..2a66a7d1bab5f75c5903687a76ed90e252064349 100644 (file)
@@ -7,8 +7,8 @@
 ;
 
        .export _calloc
-       .import _malloc, _memset
-       .import tosumulax, pushax, push0
+       .import _malloc, __bzero
+       .import tosumulax, pushax
 
 
 ; -------------------------------------------------------------------------
        cpx     #0
        bne     ClearBlock
        cmp     #0
-       beq     ClearBlock
+               bne     ClearBlock
 
 ; We have a NULL pointer, bail out
 
        rts
 
-; No NULL pointer, clear the block. memset will return a pointer to the
+; No NULL pointer, clear the block. _bzero will return a pointer to the
 ; block which is exactly what we want.
 
 ClearBlock:
         jsr    pushax                  ; ptr
-       jsr     push0                   ; #0
        lda     Size
-       ldx     Size+1                  ; Size
-       jmp     _memset
+       ldx     Size+1                  ; Size
+       jmp     __bzero
 
 .endproc