advertisement
DB006 G144A12 polyFORTH Supplement
The assignment of letters for stack effect comments has been changed to reflect the coexistence of cell and byte addressing:
c
a
b now denotes any octet sized value... a byte, or a character that may fit into a byte. now denotes a 16-bit cell address. now denotes a 16-bit byte address.
See Source Code Management below for the consolidated and updated tools provided with this system.
3.2 Chapter 2: Basic Forth Vocabulary
This implementation uses 16-bit cells, twos complement arithmetic, and by default all addressing is in cell units.
Double cells are stored with most significant cell first in memory. Big-endian byte addressing is simulated as described later. Enhancements are documented later on.
3.2.1 Stack Operations
Parameter stack operations are conventional; note that 'S returns a cell address so offsets into the stack are half what the examples show. PICK and ROLL are deprecated since both are apocryphal and ROLL is abysmally inefficient.
Memory operations are conventional except for the cell addressing and the hierarchy of available memory, as described later. Half-cells do not exist so the half-cell vocabulary does not exist.
Return stack operators are conventional except that R@ is apocryphal and is deprecated.
Conveniences are conventional except that ' (tick) yields an interpretable execution token (executable versions for primitives) and that the execution token is not a parameter field address.
3.2.2 Arithmetic and Logical Operations
Some operations may be available only in compiling forms and may not be interpreted.
Deprecated functions: M-
The division operators will be changed soon. Not all have been tested for full range. Relationals such as < MAX MIN are implemented using the circular model, so are not full range; for full range use U< or WITHIN .
Truth values are conventional for late polyFORTH systems. Any word that consumes a flag will interpret zero as false and any nonzero value as true. Any word that produces a flag will produce "clean" values (0 for false, -1 for true) unless the word is documented to produce a "dirty" value (any nonzero for true.) NOT is equivalent to 0= and therefore will invert the interpretation of any flag, dirty or clean.
3.2.3 Character and String Operations
In general character oriented words produce and consume byte addresses and counts in the manner most natural for their intended uses. For example, WORD places counted strings at HERE 1+ and returns a cell address. COUNT takes a cell address, returning a byte address and byte count. Those words dealing in byte addresses and/or counts are listed in later sections. " is not presently implemented.
3.2.4 Program Structures
FORTH, Inc. systems have always supported flexible program structuring. During compilation, the parameter stack holds cell addresses and is what ANS Forth calls the "control flow stack." These addresses may be manipulated freely to build useful structures, such as multi-exit loops, that are more efficient of code and of execution time than the less flexible alternatives. Please see ANS Forth for examples of what may be accomplished.
18
Copyright© 2010-2011 GreenArrays, Inc. 9/23/12
advertisement
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Related manuals
advertisement
Table of contents
- 5 Introduction
- 5 Related Publications
- 6 Getting Started (Quick Setup)
- 6 Documentation Conventions
- 6 Numbers
- 6 Node coordinates
- 6 Bit Numbering
- 7 Key Properties
- 7 Compliance with Standards
- 8 The Virtual Machine
- 9 Memory Model
- 9 Execution Model
- 9 Pseudo-registers
- 9 Pseudo-Instructions
- 10 Implementation
- 10 Interaction with RAM control
- 10 Interactions among VM nodes
- 11 Bitsy Node (105)
- 12 Bitsy Down Node (005)
- 12 Bitsy Up Node (205)
- 13 Stack Node (106)
- 14 Stack Down Node (006)
- 14 Stack Up Node (206)
- 16 polyFORTH Model Differences
- 16 Chapter 1: Introduction
- 16 Forth Language Features
- 16 polyFORTH Operating System Features
- 17 The polyFORTH Assembler
- 17 System Configuration and Electives
- 17 Documentation and Source Management Facilities
- 18 Chapter 2: Basic Forth Vocabulary
- 18 Stack Operations
- 18 Arithmetic and Logical Operations
- 18 Character and String Operations
- 18 Program Structures
- 19 Interpreter and Compiler Details
- 19 Chapter 3: System Functions
- 19 Vectored Routines
- 19 Disk Driver
- 19 Loading Source Blocks
- 19 Vocabularies
- 19 Calendar Support
- 19 Clock Support
- 19 Terminal Driver
- 19 Forth Bootstrap
- 19 Chapter 4: Multitasking
- 20 Chapter 5: Utility Functions
- 20 The Editor
- 20 Program Listing Utility
- 20 DISKING Utility
- 20 Other Utilities
- 20 The Assembler
- 20 Target Compilation
- 20 Data Base Support
- 21 System Features
- 21 Addresses, Data and Arithmetic
- 21 Using Memory
- 22 Using High Memory
- 22 Using Extended Memory
- 23 Character Operations
- 24 Using the Active Compiler
- 24 Dictionary Structure
- 25 Vocabularies
- 25 Program Structure
- 26 Compiler Internals
- 26 Missing Interpretables
- 27 Using the Multiprogrammer
- 27 The USER Area
- 27 Creating and Managing BACKGROUND tasks
- 27 Creating and Managing TERMINAL tasks
- 28 Additional Entitlements
- 28 Basic Forth Vocabulary
- 29 Exception Handling
- 30 Source Code Management
- 30 Source Code Organization
- 31 Editor
- 31 DISKING Utility
- 33 Mass storage
- 34 Terminal I/O
- 34 The Snorkel and Ganglia
- 35 Clock and Calendar
- 35 Serial Clock
- 36 FTDI Clock
- 36 10 MHz Clock
- 37 More Optional Entitlements
- 37 String Arrays
- 37 Exception Handling
- 38 Unix Time Stamps
- 39 Operation and Maintenance
- 39 Basic Operation
- 39 Installation Procedures
- 39 Customizing the VM using arrayForth
- 40 Loading or Installing polyFORTH
- 41 RESET Boot Procedure from SPI Flash
- 41 Tethered Operation
- 41 Stand-Alone Operation
- 44 Maintaining the Virtual Machine
- 44 Walk-through
- 44 Extending the Virtual Machine
- 44 Maintaining the polyFORTH Nucleus
- 44 Target Compilation Tools
- 45 Terminal Emulator
- 47 Application Extensions
- 49 Data Book Revision History