Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about the Heap
#2
If you dump your code into asm (--asm), you will see the HEAP is defined JUST after your program. Look for:
Code:
ZXBASIC_MEM_HEAP:
    ; Defines DATA END
ZXBASIC_USER_DATA_END EQU ZXBASIC_MEM_HEAP + ZXBASIC_HEAP_SIZE
    ; Defines USER DATA Length in bytes
ZXBASIC_USER_DATA_LEN EQU ZXBASIC_USER_DATA_END - ZXBASIC_USER_DATA
The heap is mainly using for STRINGS (at the moment). If you don't use strings you can page it out, do whatever, and page it in back. Another option is to redefine the heap address (two years ago it was allocated BEFORE the program code, but this scheme seemed to be more suitable for re-running the program).
There are many things that can be done, e.g.:
  1. Hack the MALLOC/FREE routine so they will do something like
    1) Remember the current active page (sort of Push PAGE-NUM)
    2) Set a given page (e.g. 5) into memory
    3) Do whatever with the heap
    4) Page out, setting the previous page in 1)
  2. Set the heap again at 28000, or near there.
  3. Set the heap to "FULL" (this can be done by putting 0000h at a given memory location), so any string op will silently fail.
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)