The Structure of figForth words

  Some parts of this page/site are currently incomplete & will be updated asap
  Other parts will change continually so use “Refresh” in your browser !!
  There is extensive use of “Tooltips” text to support learning which do not seem to render on a Smartphone. This site is best viewed via a computer’s HD monitor


Image#1: This is a composite image based upon fragments from the assembler’s *.lst file (Husband, 2022)

(0) - Column#0 Significance

In Column#0 downwards are some green pointers marking the start of fields that have meaning in figForth

NFA denotes the location of the Name Field
LFA denotes the location of the Link Field
CFA denotes the location of the Code Field
PFA denotes the location of the Parameter Field

(1) - Column#1 Significance

These are the addresses (in hex) representing the address of memory in the system that the executable machine code (in Column#2) generated by the assembler source code (in Column#4) is located

(2) - Column#2 Significance

These are the bytes (in hex) representing the executable machine code generated by the assembler source code (in Column#4)

(3) - Column#3 Significance

These are the symbolic names (“assembler labels”) marking the Code Field Addresses of the figForth word being created by the assembler source code (in Column#4)

These names were chosen in the original figForth Model to correspond as closely as possible with the name of the figForth word
  Label “TWOM” is assigned the address of the word called “2-“
  Label “HERE” is assigned the address of the word called “HERE”
  Label “ALLOT” is assigned the address of the word called “ALLOT”

  Label “DOCOL” = the run-time machine code compiled by the word called ”:” (“Colon”)

(4) - Column#4 Significance

This is the Assembler Source Code statement that generates the machine code in Column#2 which is loaded at the address in Column#1 by the Assembler

(5) - Column#5 Significance

The Name Field enables a word to be found in the Dictionary
A detailed discussion of the Name Field

(6) - The Role of the Code Field Address ("CFA")

The Code Field enables machine code to be executed by the Virtual Machine via the Inner Interpreter (address threader)
A detailed discussion of the Code Field

In a Code Definition, the CFA points towards the PFA:

This is achieved in the assembler source code at (a) by using the symbolic expression “DW $+2”
   •  “DW” tells the assembler to generate a 16-bit value
   •  ”$” evaluates to the current value of the assembler’s location counter
   •  Shown as “FA68” at (b) to comply with Z80 Endianness

  (c) -

(7) - The Role of the Parameter Field Address ("PFA")

The Parameter Field enables non-primative figForth Words to be executed by the Virtual Machine via the Inner Interpreter (address threader)
A detailed discussion of the Parameter Field

(8) - The Role of the Link Field Address ("LFA")

The Link Field enables the various nodes of the Dictionary linked-list structure to be “connected” together…

A detailed discussion of the Link Field

  (a) -

  (b) -

  (c) -

(9) - The Role of the Code Field Address ("CFA")

glossary/code-field.html

In a Colon Definition:

  (a) -

  (b) -

  (c) -

  (d) -

  (e) -

(A) - Header Specification

“The header of a dictionary entry is composed of a name field, a link field, and a code field. The parameter field coming after the header is the body of the entry. The name field is of variable length from 2 to 32 bytes, depending on the length of the name from 1 to 31 characters in the figForth model. The first byte in the name field is the length byte. The first and the last bytes in the name field have their most significant bits set as delimiting indicators. Therefore, knowing the address of any of the fields in the header, one can calculate the addresses of all other fields. Different field addresses are used for different purposes. The name field address is used to print out the name, the link field address is used in dictionary searches, the code field address is used by the address interpreter, and the parameter field address is used to access data stored in the parameter field”(Ting 2013, p. 50) (my emphasis)

“To facilitate the conversions between the addresses, a few words are defined as follows:”(Ting 2013, pp. 50-51)

TRAVERSE moves across the name field of a variable length name field”

LFA converts the parameter field address to its link field address

CFA converts the parameter field address to its code field address

NFA converts the parameter field address to its name field address

PFA converts the name field address to its parameter field address

LFA to PFA text above based upon (Ting 2013, p. 51)

Remember this !!

References:

Ting, C. H., 2013. Systems Guide to fig-Forth [online]. 3rd ed. San Mateo, CA 94402, USA: Offete Enterprises, Inc. Available from: http://figforth.org.uk/library/Systems.Guide.to.figForth.pdf.

Ting, C. H., 2012. Inside Forth-83 [online]. 3rd ed. San Mateo, CA 94402, USA: Offete Enterprises, Inc. Available from: http://figforth.org.uk/library/InsideF83.pdf.


Updated: 13th April 2022 by David Husband
© 2021 David Husband, a.k.a. Baremetal Engineer Extraordinaire
All Rights Reserved – All Trademarks & Copyrights Acknowledged
All personal information is subject to the Data Protection Act 2018 & the UK GDPR
“ad auxilium aliis ad auxilium sibi”