6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Mon Apr 29, 2024 5:56 am

All times are UTC




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: Sun Jan 24, 2021 4:41 pm 
Offline

Joined: Mon Jun 24, 2013 8:18 am
Posts: 83
Location: Italy
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 140 times

_________________
http://65xx.unet.bz/ - Hardware & Software 65XX family
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 29 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: