2 ; Ullrich von Bassewitz, 21.7.2000
4 ; Add a block to the heap free list
6 ; void __fastcall__ _hadd (void* mem, size_t size);
17 ; Offsets into struct freeblock and other constant stuff
28 _hadd: sta ptr1 ; Store size in ptr1
30 jsr popax ; Get the block pointer
32 stx ptr2+1 ; Store block pointer in ptr2
34 ; Check if size is greater or equal than min_size. Otherwise we don't care
35 ; about the block (this may only happen for user supplied blocks, blocks
36 ; from the heap are always large enough to hold a freeblock structure).
38 lda ptr1 ; Load low byte
39 ldx ptr1+1 ; Load/check high byte
44 rts ; Block not large enough
46 ; The block is large enough. Set the size field in the block.
54 ; Call the internal function since variables are now setup correctly