]> git.sur5r.net Git - cc65/commitdiff
Adjust result to user visible size
authorcuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 17 Jul 2004 12:18:51 +0000 (12:18 +0000)
committercuz <cuz@b7a2c559-68d2-44c3-8de9-860c34a00d81>
Sat, 17 Jul 2004 12:18:51 +0000 (12:18 +0000)
git-svn-id: svn://svn.cc65.org/cc65/trunk@3159 b7a2c559-68d2-44c3-8de9-860c34a00d81

libsrc/common/_heapblocksize.s

index 8db62e0b910ee7a3d6d2369d4e92a0e9c9584f4f..0a39f9abc9b233f05a65c3c48af69838a261e05a 100644 (file)
@@ -11,6 +11,9 @@
 
         .include        "_heap.inc"
 
+        .macpack        generic
+        .macpack        cpu
+
 ;-----------------------------------------------------------------------------
 ; Code
 
@@ -18,8 +21,7 @@ __heapblocksize:
 
 ; Decrement the block pointer so it points to the admin data
 
-        sec
-        sbc     #HEAP_ADMIN_SPACE       ; Assume it's less than 256
+        sub     #HEAP_ADMIN_SPACE       ; Assume it's less than 256
         bcs     L1
         dex
 L1:     sta     ptr1
@@ -30,10 +32,20 @@ L1:     sta     ptr1
         ldy     #1
         lda     (ptr1),y
         tax
+.if (.cpu .bitand CPU_ISET_65SC02)
+        lda     (ptr1)
+.else
         dey
         lda     (ptr1),y
+.endif
+
+; Adjust it to the user visible size
+
+        sub     #HEAP_ADMIN_SPACE
+        bcs     L9
+        dex
 
 ; Done
 
-        rts
+L9:     rts