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);
17 ; Offsets into struct freeblock and other constant stuff
29 sta ptr1 ; Store size in ptr1
31 jsr popax ; Get the block pointer
33 stx ptr2+1 ; Store block pointer in ptr2
35 ; Check if size is greater or equal than min_size. Otherwise we don't care
36 ; about the block (this may only happen for user supplied blocks, blocks
37 ; from the heap are always large enough to hold a freeblock structure).
39 lda ptr1 ; Load low byte
40 ldx ptr1+1 ; Load/check high byte
45 rts ; Block not large enough
47 ; The block is large enough. Set the size field in the block.
55 ; Call the internal function since variables are now setup correctly