2 ; Ullrich von Bassewitz, 21.7.2000
4 ; Add a block to the heap free list
6 ; void __fastcall__ _heapadd (void* mem, size_t size);
19 ;-----------------------------------------------------------------------------
23 sta ptr1 ; Store size in ptr1
25 jsr popax ; Get the block pointer
27 stx ptr2+1 ; Store block pointer in ptr2
29 ; Check if size is greater or equal than min_size. Otherwise we don't care
30 ; about the block (this may only happen for user supplied blocks, blocks
31 ; from the heap are always large enough to hold a freeblock structure).
33 lda ptr1 ; Load low byte
34 ldx ptr1+1 ; Load/check high byte
36 cmp #HEAP_MIN_BLOCKSIZE
39 rts ; Block not large enough
41 ; The block is large enough. Set the size field in the block.
43 @L1: ldy #freeblock_size
49 ; Call the internal function since variables are now setup correctly