Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Heap help
Heap is uses for string handling yes.
You can manage it using the library alloc.bas (use #include)
There you have memavail (total free memory) and maxavail (maximum chunk available). This memory is fragmented over time (list of free blocks).
So if you have 256bytes and 64 bytes (2 blocks) of free memory, memavail will return 256 + 64 = 320 bytes, and maxavail will return 256.

You can reduce the heap with the --heap compiler flag. Also use --asm and list the asm. There is a HEAP label.
Generating the binary afterwards with: zxbasm yourprog.asm you will get a memory map to detect where is the heap (usually at after your program).
Using a lower org (default 32768, but try 25000), your stack will be reduced, but you will get 5000 bytes extra for heap. The heap (I dont recall at this moment) takes the available space between your code and the UDG zone.

Messages In This Thread

Forum Jump:

Users browsing this thread: 1 Guest(s)