27.10.2013 Views

5 - Forth Interest Group

5 - Forth Interest Group

5 - Forth Interest Group

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

altered by IMMEDIATE and/or SMUDGE<br />

while still on the stack, before<br />

being compiled by BUILDS> .<br />

DOES ><br />

When a word with a CODE> part ulti-<br />

mately executes, it executes the<br />

code between CODE> and END-CODE,<br />

at a machine code level. Execution<br />

must ultimately be returned to the<br />

address interpreter NEXT .<br />

---<br />

Used in the form:<br />

DOES> . . . . ;<br />

addr mask<br />

to begin the nameless compilation<br />

of a sequence of high-level code.<br />

The address and mask left locate<br />

this sequence for BUILDS> . The<br />

mask contains the precedence and<br />

smudge bits and may be altered by<br />

IMMEDIATE and/or SMUDGE while still<br />

on the stack, before being compiled<br />

by BUILDS> .<br />

When a word with a DOES> part ulti-<br />

mately executes, it executes the<br />

code following DOES> with its own<br />

parameter field address automati-<br />

cally placed on the stack.<br />

IMMEDIATE addr mask --- addr mask<br />

NOW<br />

Set the precedence bit in the mask<br />

to indicate that all words later<br />

defined by the defining word being<br />

defined will always execute when<br />

encountered.<br />

Immediate words are aids to compil-<br />

ation, such as:<br />

IF BEGIN DO ." etc.<br />

A defining word used in the form:<br />

NOW . . . . ;<br />

to define in the fashion of<br />

: , but in the immediate form.<br />

That is, will execute even<br />

when encountered during<br />

compilation.<br />

SMUDGE addr mask --- addr mask<br />

Set the smudge bit in the mask to<br />

indicate that all words defined by<br />

the defining word being defined<br />

will begin in the 'smudged' condi-<br />

tion. This condition prevents a<br />

word from being found in a diction-<br />

ary search until un-smudged at the<br />

completion of correct compilation.<br />

APPENDIX<br />

The example implementation of the<br />

new BUILDS> is written in FORTH-79<br />

running on a 6502 processor. When<br />

system dependencies occur, the fig-<br />

FORTH methods were used regarding<br />

error control and dictionary header<br />

structure. Here is a tabulation of<br />

the pedigree of each word (its origin)<br />

used in this application.<br />

Numbers indicate a standard defin-<br />

ition from FORTH-79, fig indicates the<br />

definition from fig-FORTH. Assembler<br />

words are from a 6502 assembler.<br />

:csp<br />

(<br />

+!<br />

:-<br />

1-<br />

:+<br />

>I<br />

?CSP<br />

1<br />

i05 CCCNI<br />

135 CSP<br />

:16 ClmXuI<br />

196 M<br />

FORTH DIMENSIONS II/5 Page 127

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!