This page (revision-7) was last changed on 03-Feb-2023 15:21 by Carsten Strotmann 

This page was created on 25-Apr-2010 09:19 by Carsten Strotmann

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
7 03-Feb-2023 15:21 8 KB Carsten Strotmann to previous
6 25-Apr-2010 17:29 6 KB Carsten Strotmann to previous | to last
5 25-Apr-2010 17:20 4 KB Carsten Strotmann to previous | to last
4 25-Apr-2010 16:54 3 KB Carsten Strotmann to previous | to last
3 25-Apr-2010 16:45 1 KB Carsten Strotmann to previous | to last
2 25-Apr-2010 09:22 416 bytes Carsten Strotmann to previous | to last
1 25-Apr-2010 09:19 379 bytes Carsten Strotmann to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 5 added 2 lines
[{TableOfContents }] \\
At line 23 added one line
!! OVERVIEW
At line 25 added 25 lines
Forth is provided with a machine language assembler to create execution procedures that would be time inefficient, if written as colon-definitions. It is intended that "code" be written similarly to high level, for clarity of expression. Functions may be written first in high-level, tested, and then re-coded into assembly, with a minimum of restructuring.
!! THE ASSEMBLY PROCESS
Code assembly just consists of interpreting with the ASSEMBLER vocabulary as CONTEXT. Thus, each word in the input stream will be matched according the Forth practice of searching CONTEXT first then CURRENT:
{{{
ASSEMBER (now CONTEXT)
FORTH (chained to ASSEMBLER)
user's (CURRENT if one exists)
FORTH (chained to the user's vocab)
try for literal number
else, do error abort
}}}
The above sequence is the usual action of Forth's text interpreter, which remains in control during assembly.
During assembly of CODE definitions, Forth continues interpretation of each word encountered in the input stream (not in the compile mode). These assembler words specify operands, address modes, and opcodes. At the conclusion of the CODE definition a final error check verifies correct completion by "unsmudging" the definition's name, to make it available for dictionary searches.
!! RUN-TIME, ASSEMBLY-TIME
One must be careful to understand at what time a particular word definition executes. During assembly, each assembler word interpreted executes. Its function at that instant is called 'assembling' or 'assembly-time'. This function may involve op-code generation, address calculation, mode selection, etc.
The later execution of the generated code is called 'run-time'. This distinction is particularly important with the conditionals. At assembly time each such word (i.e., IF,UNTIL, BEGIN, etc.) itself 'runs' to produce machine code which will later execute at what is labeled 'run-time' when its named code definition is used.