home *** CD-ROM | disk | FTP | other *** search
- Love Forth Technical Note
-
- Love Forth is a Forth-83 standard programming language for the
- IBM PC/XT/AT and compatibles. In order to increase available memory
- space over the standard 64k model, it has been designed to operate over
- five segments. These segments are classified by function: machine code,
- threaded addresses, data, stacks and dictionary heads. This modification
- has been performed without reducing execution speed.
-
- Love Forth uses the usual 8086 'NEXT' instruction sequence:
- LODSW MOV BX, AX JMP [BX]
-
- Since 8086 fetches instructions relative to the CS segment
- register and the LODSW and JMP [BX] work relative to the DS segment
- register, the first logical division was to place threaded addresses
- and code addresses (parameter and code fields) into a separate segment
- from the machine code. This required modification to the assembler and
- some compiler words (like CREATE, DOES>, ;CODE).
-
- The 8086 performs all stack operations (PUSH, POP,
- instructions with [BP]) relative to the SS segment register. The next
- logical division was to assign the SS register a separate segment.
- Love Forth uses SP and BP registers for the parameter and return stacks
- respectfully. This modification was straightforward, the only changes
- required were to some stack operators (PICK, ROLL) and to utilities
- such as: .S .
-
- Separating dictionary heads is a valuable modification to any
- Forth system. Approximately 30% of dictionary space is saved by this
- method. In Love Forth dictionary heads were moved to a segment not
- relative to any specific 8086 segment register. Any words that require
- access to the head segment (WORDS, CREATE) calculate the segment value
- when required.
-
- The last division made to the standard model was to separate
- data. This is commonly done in other Forths to allow programming into
- ROM. In Love Forth this also further reduced the space in the kernel.
- The ES segment register was used to access this segment, requiring
- segment override instructions in some words.
-
- Very few modifications were required to standard Forth source
- code to run under Love Forth. The exception was for compiler words
- that directly stored threaded addresses, machine code or portions of
- the dictionary headers. Special words were added to the kernel for
- this.
-
- There are separate dictionary pointers for code, threads, data
- and head segments. When creating a final application program, the
- segments may be overlapped to the nearest paragraph and the system
- saved without heads.
-