home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / forth / compiler / love / chap07.doc < prev    next >
Text File  |  1993-04-11  |  4KB  |  94 lines

  1. Chapter7                L_O_V_E FORTH
  2.  
  3.  
  4.  
  5. 7.0  Saving the forth system
  6.      -----------------------
  7.  
  8.     To save an interactive forth system, simply type:
  9.         SAVE" filename.EXE"
  10.  
  11.     SAVE"  is in the   TOOLBOX   vocabulary (set by DEVELOP).  It will
  12. overwrite any file existing of the same name.
  13.  
  14.     The word    APPLICATION"   is used to save final applications.
  15. They are saved without heads or vocabulary stack. When re-started in
  16. memory, the program has all the remaining segments (code, threads, data,
  17. stack) compressed to the nearest paragraph.  Note that this word
  18. automatically returns the user to DOS.
  19.  
  20.     Usage:
  21.              ALSO UTILITIES
  22.              APPLICATION" filename.EXE"  wordname
  23.  
  24.     The Forth word QUIT (top level word) is redefined to execute
  25. 'wordname' followed by   BYE  .   In this way a single forth word becomes
  26. the application.  See also startup conditions below.  For example:
  27.  
  28.         APPLICATION" MYPROG.EXE"  PROG-START-WORD
  29.         C>                                      (dos prompt)
  30.  
  31.  
  32. 7.1  Allocating additional memory
  33.      ----------------------------
  34.  
  35.     When an exe file is loaded, DOS allocates enough memory for the
  36. program and any additional that is requested in the exe header.  This is
  37. done in two stages.  DOS looks at the minimum amount requested (MINALLOC).
  38. If insufficient memory is available in the system to satisfy this, DOS
  39. aborts with an error message.  If the request is satisfied, DOS allots up
  40. to the maximum amount requested ( MAXALLOC ).  If this is a very large
  41. number, DOS allots all the available memory.
  42.  
  43.     For interactive forth (saved with   SAVE"  ) normally just enough
  44. additional memory is allocated to leave room for the expansion of the
  45. segments.  For final applications, additional memory is allocated for the
  46. stacks alone.
  47.  
  48.     This can be increased by the programmer by storing the number of
  49. requested paragraphs into the variables   MINHEAP   and   MAXHEAP .  These
  50. are normally set to 0.  Note that the actual starting segment for this is;
  51. that if   MINHEAP   exceeds   MAXHEAP ,   MAXHEAP   is set to the value of
  52. MINHEAP.
  53.  
  54.  
  55. 7.2  Conditions on startup
  56.      ---------------------
  57.  
  58.      Both target applications and interactive forth:
  59.      - BASE set to   DECIMAL
  60.      - S0 set to address of stack in SS:
  61.      - variable   ATTRIBUTE   set to 7
  62.      - DISPLAYADAPT    sets variables   CRTSEG   and   CRTPORT
  63.        for current video card
  64.      - a minimum of   MINHEAP   paragraphs (spec'd on previous save)
  65.        available above GET:HEAP
  66.      - zero divide vector ( INT 0 ) pointing to execute   ZERO-DIV
  67.      - control-break vector pointing to execute BRK-RETN
  68.      - if   BLOCK   words are installed, they are initialized
  69.      - source code loading handle stack is initialized
  70.      - printer flag is set to 0 (PR-OFF)
  71.      - variable   WIDTH   is set to 31
  72.      - variable   WARNING  is set to true
  73.      - the forth system 10 millisecond timer is set for
  74.     the speed of the present   CPU
  75.      - executes word   ONBOOT
  76.      - executes   ABORT
  77.  
  78.      Interactive forth only:
  79.      - clears display and prints logo
  80.      - sets vocabularies context:   DEVELOP    current: FORTH
  81.      - clears   V-BODY   to ensure no virtual vocabulary
  82.      - FIRST   returns an address in high memory (VS:),   LIMIT
  83.        returns an address
  84.   404 hex * #BUFF above   FIRST
  85.      - array TOPS contains highest usable addresses in each segment.
  86.  
  87.      Target application only:
  88.      - all segments are packed together to the nearest greater segment,
  89.      based on their respective dictionary pointers
  90.      - no head segment is present
  91.      ( HS:HERE GET:HS return undefined values)
  92.      - FIRST returns address 50 hex above PAD.  LIMIT  returns an address
  93.      404 hex * #BUFF above   FIRST.
  94.      - array   TOPS   (highest addresses in each segment) is undefined.