home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / turbo / turbmem.fix < prev    next >
Encoding:
Text File  |  1993-06-08  |  1.4 KB  |  41 lines

  1. {File TURBMEM.FIX, from "A TURBO Pascal Module" by Jim
  2. Gronek, FOGHORN VI.6, March 1987), 29.}
  3.  
  4. {A module to allow TURBO Pascal programs to automatically
  5. adjust its Stack Pointer, Recursion Pointer and Heap Pointer
  6. to use all available memory in the TPA.
  7.  Note that this routine will require that you compile your
  8. program twice, once without this routine to get the default
  9. code and data block sizes, and once with this module after
  10. adjusting the Heap Pointer address.}
  11.  
  12. {To calculate the correct Heap Pointer address, compile the
  13. program with the deafult address used by TURBO in the .COM
  14. file mode...
  15.  
  16. Code End Address + (Data End Address - Data Start Address) + 200h
  17.  
  18. is rounded up to the next full "page" (multiple of 100h)}
  19.  
  20.  
  21.  
  22. {add this global variable declaration to your list of
  23. variables}
  24.  
  25. Var
  26.   MemTop :Integer Absolute $6;
  27.   {CP/M FDOS address, top of memory}
  28.  
  29. {after the first Begin in your main program,
  30. insert the following lines}
  31.  
  32. (* {<-- remove these after setting HeapPtr address}
  33.  
  34.   StackPtr:= MemTop - $826; {place Stack Pointer under CCP}
  35.   RecurPtr:= StackPtr - $400;{Recursive Stack Pointer 1k lower}
  36.   HeapPtr := $??? ; {16 bytes higher than compiler end add.}
  37.  
  38. {remove these after setting HeapPtr address -->} *)
  39.  
  40. (*That's all there is to it!*)
  41.