home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
forth
/
compiler
/
love
/
chap07.doc
< prev
next >
Wrap
Text File
|
1993-04-11
|
4KB
|
94 lines
Chapter7 L_O_V_E FORTH
7.0 Saving the forth system
-----------------------
To save an interactive forth system, simply type:
SAVE" filename.EXE"
SAVE" is in the TOOLBOX vocabulary (set by DEVELOP). It will
overwrite any file existing of the same name.
The word APPLICATION" is used to save final applications.
They are saved without heads or vocabulary stack. When re-started in
memory, the program has all the remaining segments (code, threads, data,
stack) compressed to the nearest paragraph. Note that this word
automatically returns the user to DOS.
Usage:
ALSO UTILITIES
APPLICATION" filename.EXE" wordname
The Forth word QUIT (top level word) is redefined to execute
'wordname' followed by BYE . In this way a single forth word becomes
the application. See also startup conditions below. For example:
APPLICATION" MYPROG.EXE" PROG-START-WORD
C> (dos prompt)
7.1 Allocating additional memory
----------------------------
When an exe file is loaded, DOS allocates enough memory for the
program and any additional that is requested in the exe header. This is
done in two stages. DOS looks at the minimum amount requested (MINALLOC).
If insufficient memory is available in the system to satisfy this, DOS
aborts with an error message. If the request is satisfied, DOS allots up
to the maximum amount requested ( MAXALLOC ). If this is a very large
number, DOS allots all the available memory.
For interactive forth (saved with SAVE" ) normally just enough
additional memory is allocated to leave room for the expansion of the
segments. For final applications, additional memory is allocated for the
stacks alone.
This can be increased by the programmer by storing the number of
requested paragraphs into the variables MINHEAP and MAXHEAP . These
are normally set to 0. Note that the actual starting segment for this is;
that if MINHEAP exceeds MAXHEAP , MAXHEAP is set to the value of
MINHEAP.
7.2 Conditions on startup
---------------------
Both target applications and interactive forth:
- BASE set to DECIMAL
- S0 set to address of stack in SS:
- variable ATTRIBUTE set to 7
- DISPLAYADAPT sets variables CRTSEG and CRTPORT
for current video card
- a minimum of MINHEAP paragraphs (spec'd on previous save)
available above GET:HEAP
- zero divide vector ( INT 0 ) pointing to execute ZERO-DIV
- control-break vector pointing to execute BRK-RETN
- if BLOCK words are installed, they are initialized
- source code loading handle stack is initialized
- printer flag is set to 0 (PR-OFF)
- variable WIDTH is set to 31
- variable WARNING is set to true
- the forth system 10 millisecond timer is set for
the speed of the present CPU
- executes word ONBOOT
- executes ABORT
Interactive forth only:
- clears display and prints logo
- sets vocabularies context: DEVELOP current: FORTH
- clears V-BODY to ensure no virtual vocabulary
- FIRST returns an address in high memory (VS:), LIMIT
returns an address
404 hex * #BUFF above FIRST
- array TOPS contains highest usable addresses in each segment.
Target application only:
- all segments are packed together to the nearest greater segment,
based on their respective dictionary pointers
- no head segment is present
( HS:HERE GET:HS return undefined values)
- FIRST returns address 50 hex above PAD. LIMIT returns an address
404 hex * #BUFF above FIRST.
- array TOPS (highest addresses in each segment) is undefined.