06-25-2017, 10:33 PM
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 --mmap=program.map 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.
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 --mmap=program.map 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.