Simple Heap Manager for 65C816

Programming the 6502 microprocessor and its relatives in assembly and other languages.
Post Reply
granati
Posts: 83
Joined: 24 Jun 2013
Location: Italy

Simple Heap Manager for 65C816

Post by granati »

Developing a native pascal/c compiler for 65c816 one problem is implement new()/dispose() procedures and malloc()/free() functions that take advantage of large memory addressable by cpu.
In attached file an attempt of a possible implementation of 2 routines:
- GetMem: allocate a block of memory from heap (max size of one block = $fff6 bytes)
- FreeMem: free memory previously allocated with GetMem

Allocated block can span banks, and global heap size is limited only by available ram. Pointers to allocated blocks are long pointer (24 bit).
Heap require a simple initialitation of some dp variables, especially hStart and hTop (24 bit pointers extended to 32 bit) that define heap size.

Marco
Attachments
HEAP.ASM.TXT
(8.11 KiB) Downloaded 194 times
http://65xx.unet.bz/ - Hardware & Software 65XX family
Post Reply