]> git.sur5r.net Git - cc65/blobdiff - libsrc/common/_heapadd.s
The spans do now contain the size of a span, no longer the end offset.
[cc65] / libsrc / common / _heapadd.s
index d6703e82069dddd141722a632a0ab79c09dc38cf..547e0478b0c433c42898f5b4826315651ee638c7 100644 (file)
        .importzp       ptr1, ptr2
        .import         popax
        .import         heapadd
-               .export         _heapadd
+               .export         __heapadd
 
-               .macpack        generic
-
-; Offsets into struct freeblock and other constant stuff
-
-size           = 0
-next           = 2
-prev           = 4
-admin_space    = 2
-min_size       = 6
+        .include        "_heap.inc"
 
+               .macpack        generic
 
+;-----------------------------------------------------------------------------
 ; Code
 
-_heapadd:
+__heapadd:
        sta     ptr1            ; Store size in ptr1
        stx     ptr1+1
        jsr     popax           ; Get the block pointer
@@ -39,14 +33,14 @@ _heapadd:
        lda     ptr1            ; Load low byte
        ldx     ptr1+1          ; Load/check high byte
        bne     @L1
-       cmp     #min_size
+       cmp     #HEAP_MIN_BLOCKSIZE
        bcs     @L1
 
        rts                     ; Block not large enough
 
 ; The block is large enough. Set the size field in the block.
 
-@L1:   ldy     #size
+@L1:   ldy     #usedblock::size
        sta     (ptr2),y
        iny
        txa
@@ -56,5 +50,3 @@ _heapadd:
 
        jmp     heapadd
 
-
-