Move _heap.h to the compiler include dir.
Create heap.inc and use that from the assembler code. Rename heap related _h... variables to _heap... Add _heapmaxavail and _heapmemavail functions. git-svn-id: svn://svn.cc65.org/cc65/trunk@1912 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
@@ -10,22 +10,16 @@
|
||||
.importzp ptr1, ptr2
|
||||
.import popax
|
||||
.import heapadd
|
||||
.export _heapadd
|
||||
.export __heapadd
|
||||
|
||||
.include "_heap.inc"
|
||||
|
||||
.macpack generic
|
||||
|
||||
; Offsets into struct freeblock and other constant stuff
|
||||
|
||||
size = 0
|
||||
next = 2
|
||||
prev = 4
|
||||
admin_space = 2
|
||||
min_size = 6
|
||||
|
||||
|
||||
;-----------------------------------------------------------------------------
|
||||
; 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 #freeblock_size
|
||||
sta (ptr2),y
|
||||
iny
|
||||
txa
|
||||
@@ -56,5 +50,3 @@ _heapadd:
|
||||
|
||||
jmp heapadd
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user