FORTH - DIARY.ZIP - F83FILE.003

 
Output of file : F83FILE.003 contained in archive : DIARY.ZIP





19





9. USAGE


9.5.3 EMIT

Because of the potential non-transportable action by terminal
devices of control characters, the use of ASCII control
characters is an environmental dependency. Each EMIT deals with
only one ASCII character. The ASCII character occupies the
least-significant 7 bits; the more-significant bits may be
environmentally dependent. Using the more-significant bits when
other than zero is an environmentally dependent usage. EMIT must
display as many bits as can be sent.


9.5.4 TYPE

Because of the potential non-transportable action by terminal
devices of control characters, the use of ASCII control
characters is an environmental dependency.


9.6 Transporting Programs Between Standard Systems

Further usage requirements are expected to be added for
transporting programs between Standard Systems.


9.7 Multiprogramming Impact

In a multiprogrammed system, Device Layer words and those words
which implicitly reference the Device Layer words may relinquish
control of the processor to other tasks. Although there is
insufficient experience to specify a standard for
multiprogramming, historical usage dictates that a programmer be
aware of the potential impact with regard to resources shared
between tasks. The only shared resources specified within the
Standard are block buffers. Therefore the address of a block
buffer returned by BLOCK or BUFFER becomes invalid during and
after the execution of any word marked by the attribute M in the
glossary or any words executing them. A block buffer is valid
only if its address is valid. See: "11.4 Attributes"


9.8 Numbers

Interpreted or compiled numbers are in the range
{-32,768..65,535}. See: "number conversion"


9.9 Control Structures

Control structures are compiled inside colon definitions.
Control structures can be nested but cannot overlap. For
additional limitations see DO .





20





10. ERROR CONDITIONS




10. ERROR CONDITIONS



10.1 Possible Actions on an Error

When an error condition occurs, a Standard System may take one or
more of the following actions:

1. ignore and continue;

2. display a message;

3. execute a particular word;

4. set interpret state and interpret a block;

5. set interpret state and begin interpretation;

6. other system dependent actions.

See: "7.1 Documentation Requirements"


10.2 General Error Conditions

The following error conditions apply in many situations. These
error conditions are listed below, but may occur at various times
and with various words.

1. input stream exhausted before encountering a required
____
or delimiting character;

2. insufficient stack space or insufficient number of stack
entries during text interpretation or compilation;

3. a word not found and not a valid number, during text
interpretation or compilation;

4. compilation of incorrectly nested control structures;

5. execution of words restricted to compilation only, when not
in the compile state and while not compiling a colon
definition;

6. FORGETting within the system to a point that removes a word
required for correct execution;

7. insufficient space remaining in the dictionary;

8. a stack parameter out of range, e.g., a negative number when
a +n was specified in the glossary;



21





10. ERROR CONDITIONS


9. correct mass storage read or write was not possible.
























































22





11. GLOSSARY NOTATION




11. GLOSSARY NOTATION



11.1 Order

The glossary definitions are listed in ASCII alphabetical order.


11.2 Capitalization

Word names are capitalized throughout this Standard.


11.3 Stack Notation

The stack parameters input to and output from a definition are
described using the notation:

before -- after

before stack parameters before execution
after stack parameters after execution

In this notation, the top of the stack is to the right. Words
may also be shown in context when appropriate.

Unless otherwise noted, all stack notation describes exectution
time. If it applies at compile time, the line is followed by:
(compiling) .


11.4 Attributes

Capitalized symbols indicate attributes of the defined words:

C The word may only be used during compilation of a colon
definition.

I Indicates that the word is IMMEDIATE and will execute during
compilation, unless special action is taken.

M This word has a potential multiprogramming impact.
See: "9.7 Multiprogramming Impact"

U A user variable.









23





11. GLOSSARY NOTATION


11.5 Serial Numbers

When a substantive alteration to a word's definition is made or
when a new word is added, the serial number will be the last two
digits of the year of the Standard in which such change was made
(i.e., "83"). When such change is made within a Working Draft,
the number will be suffixed with the character identifying the
draft (i.e., "83A").


11.6 Pronunciation

The natural language pronunciation of word names is given in
double quotes (") where it differs from English pronunciation.


11.7 Stack Parameters

Unless otherwise stated, all references to numbers apply to 16-
bit signed integers. The implied range of values is shown as
{from..to}. The contents of an address is shown by double
braces, particularly for the contents of variables, i.e., BASE
{{2..72}}.

The following are the stack parameter abbreviations and types of
numbers used throughout the glossary. These abbreviations may be
suffixed with a digit to differentiate multiple parameters of the
same type.





























24





11. GLOSSARY NOTATION


Stack Number Range in Minimum
Abbrv. Type Decimal Field

flag boolean 0=false, else=true 16
true boolean -1 (as a result) 16
false boolean 0 0
b bit {0..1} 1
char character {0..127} 7
8b 8 arbitrary bits (byte) not applicable 8
16b 16 arbitrary bits not applicable 16
n number (weighted bits) {-32,768..32,767} 16
+n positive number {0..32,767} 16
u unsigned number {0..65,535} 16
w unspecified weighted number
(n or u) {-32,768..65,535} 16
addr address (same as u) {0..65,535} 16
32b 32 arbitrary bits not applicable 32
d double number {-2,147,483,648..
2,147,483,647} 32
+d positive double number {0..2,147,483,647} 32
ud unsigned double number {0..4,294,967,265} 32
wd unspecified weighted double
number (d or ud) {-2,147,483,648..
4,294,967,295} 32
sys 0, 1, or more system
dependent stack entries not applicable na

Any other symbol refers to an arbitrary signed 16-bit integer in
the range {-32,768..32,767}, unless otherwise noted.

Because of the use of two's complement arithmetic, the signed 16-
bit number (n) -1 has the same bit representation as the unsigned
number (u) 65,535. Both of these numbers are within the set of
unspecified weighted numbers (w). See: "arithmetic, two's
complement" "number" "number types" "stack, data"


11.8 Input Text


____

An arbitrary FORTH word accepted from the input stream.
This notation refers to text from the input stream, not to
values on the data stack. See: "10.2 General Error
Conditions"

ccc
___










25





11. GLOSSARY NOTATION


A sequence of arbitrary characters accepted from the input
stream until the first occurrence of the specified
delimiting character. The delimiter is accepted from the
input stream, but is not one of the characters ccc and is
___
therefore not otherwise processed. This notation refers to
text from the input stream, not to values on the data stack.
Unless noted otherwise, the number of characters accepted
may be from 0 to 255. See: "10.2 General Error Conditions"


11.9 References to other words and definitions

Glossary definitions may refer to other glossary definitions or
to definitions of terms. Such references are made using the
expression "See:". These references provide additional
information which apply as if the information is a portion of the
glossary entry using "See:".








































26





12. REQUIRED WORD SET




12. REQUIRED WORD SET



12.1 The Required Word Set Layers

The words of the Required Word Set are grouped to show like
characteristics. No implementation requirements should be
inferred from this grouping.


Nucleus layer

! * */ */MOD + +! - / /MOD 0< 0= 0> 1+ 1- 2+
2- 2/ < = > >R ?DUP @ ABS AND C! [email protected] CMOVE
CMOVE> COUNT D+ D< DEPTH DNEGATE DROP DUP EXECUTE
EXIT FILL I J MAX MIN MOD NEGATE NOT OR OVER PICK
R> [email protected] ROLL ROT SWAP U< UM* UM/MOD XOR


Device layer

BLOCK BUFFER CR EMIT EXPECT FLUSH KEY SAVE-BUFFERS
SPACE SPACES TYPE UPDATE


Interpreter layer

# #> #S #TIB ' ( -TRAILING . .( <# >BODY >IN
ABORT BASE BLK CONVERT DECIMAL DEFINITIONS FIND
FORGET FORTH FORTH-83 HERE HOLD LOAD PAD QUIT SIGN
SPAN TIB U. WORD


Compiler layer

+LOOP , ." : ; ABORT" ALLOT BEGIN COMPILE CONSTANT
CREATE DO DOES> ELSE IF IMMEDIATE LEAVE LITERAL LOOP
REPEAT STATE THEN UNTIL VARIABLE VOCABULARY WHILE [
['] [COMPILE] ]















27





12. REQUIRED WORD SET





12.2 The Required Word Set Glossary

! 16b addr -- 79 "store"
16b is stored at addr.

# +d1 -- +d2 79 "sharp"
The remainder of +d1 divided by the value of BASE is

converted to an ASCII character and appended to the output
string toward lower memory addresses. +d2 is the quotient
and is maintained for further processing. Typically used
between <# and #> .

#> 32b -- addr +n 79 "sharp-greater"
Pictured numeric output conversion is ended dropping 32b.
addr is the address of the resulting output string. +n is
the number of characters in the output string. addr and +n
together are suitable for TYPE .

#S +d -- 0 0 29 "sharp-s"
+d is converted appending each resultant character into the
pictured numeric output string until the quotient (see: # )
is zero. A single zero is added to the output string if the
number was initially zero. Typically used between <# and
#> .

#TIB -- addr U,83 "number-t-i-b"
The address of a variable containing the number of bytes in
the text input buffer. #TIB is accessed by WORD when BLK is
zero. {{0..capacity of TIB}} See: "input stream"

' -- addr M,83 "tick"
Used in the form:
'
____
addr is the compilation address of . An error
____
condition exists if is not found in the currently
____
active search order.

( -- I,M,83 "paren"
-- (compiling)
Used in the form:
( ccc)
___
The characters ccc, delimited by ) (closing parenthesis),
___
are considered comments. Comments are not otherwise
processed. The blank following ( is not part of ccc. ( may
___
be freely used while interpreting or compiling. The number
of characters in ccc may be zero to the number of characters
___
remaining in the input stream up to the closing parenthesis.

* w1 w2 -- w3 79 "times"
w3 is the least-significant 16 bits of the arithmetic
product of w1 times w2.



28





12. REQUIRED WORD SET


*/ n1 n2 n3 -- n4 83 "times-divide"
n1 is first multiplied by n2 producing an intermediate 32-
bit result. n4 is the floor of the quotient of the
intermediate 32-bit result divided by the divisor n3. The
product of n1 times n2 is maintained as an intermediate 32-
bit result for greater precision than the otherwise
equivalent sequence: n1 n2 * n3 / . An error condition
results if the divisor is zero or if the quotient falls
outside of the range {-32,768..32,767}. See: "division,
floored"

*/MOD n1 n2 n3 -- n4 n5 83 "times-divide-mod"
n1 is first multiplied by n2 producing an intermediate 32-
bit result. n4 is the remainder and n5 is the floor of the
quotient of the intermediate 32-bit result divided by the
divisor n3. A 32-bit intermediate product is used as for
*/ . n4 has the same sign as n3 or is zero. An error
condition results if the divisor is zero or if the quotient
falls outside of the range {-32,768..32,767}. See:
"division, floored"

+ w1 w2 -- w3 79 "plus"
w3 is the arithmetic sum of w1 plus w2.

+! w1 addr -- 79 "plus-store"
w1 is added to the w value at addr using the convention for
+ . This sum replaces the original value at addr.

+LOOP n -- C,I,83 "plus-loop"
sys -- (compiling)
n is added to the loop index. If the new index was
incremented across the boundary between limit-1 and limit
then the loop is terminated and loop control parameters are
discarded. When the loop is not terminated, execution
continues to just after the corresponding DO . sys is
balanced with its corresponding DO . See: DO

, 16b -- 79 "comma"
ALLOT space for 16b then store 16b at HERE 2- .

- w1 w2 -- w3 79 "minus"
w3 is the result of subtracting w2 from w1.

-TRAILING addr +n1 -- addr +n2 79 "dash-trailing"
The character count +n1 of a text string beginning at addr
is adjusted to exclude trailing spaces. If +n1 is zero,
then +n2 is also zero. If the entire string consists of
spaces, then +n2 is zero.

. n -- M,79 "dot"
The absolute value of n is displayed in a free field format
with a leading minus sign if n is negative.





29





12. REQUIRED WORD SET


." -- C,I,83 "dot-quote"
-- (compiling)
Used in the form:
." ccc"
___
Later execution will display the characters ccc up to but
___
not including the delimiting " (close-quote). The blank
following ." is not part of ccc.
___

.( -- I,M,83 "dos-paren"
-- (compiling)
Used in the form:
.( ccc)
___
The characters ccc up to but not including the delimiting )
___
(closing parenthesis) are displayed. The blank following .(
is not part of ccc.
___

/ n1 n2 -- n3 83 "divide"
n3 is the floor of the quotient of n1 divided by the divisor
n2. An error condition results if the divisor is zero or if
the quotient falls outside of the range {-32,768..32,767}.
See: "division, floored"

/MOD n1 n2 -- n3 n4 83 "divide-mod"
n3 is the remainder and n4 the floor of the quotient of n1
divided by the divisor n2. n3 has the same sign as n2 or is
zero. An error condition results if the divisor is zero or
if the quotient falls outside of the range
{-32,768..32,767}. See: "division, floored"

0< n -- flag 83 "zero-less"
flag is true if n is less than zero (negative).

0= w -- flag 83 "zero-equals"
flag is true if w is zero.

0> n -- flag 83 "zero-greater"
flag is true if n is greater than zero.

1+ w1 -- w2 79 "one-plus"
w2 is the result of adding one to w1 according to the
operations of + .

1- w1 -- w2 79 "one-minus"
w2 is the result of subtracting one from w1 according to the
operation of - .

2+ w1 -- w2 79 "two-plus"
w2 is the result of adding two to w1 according to the
operation of + .

2- w1 -- w2 79 "two-minus"
w2 is the result of subtracting two from w1 according to the
operation of - .




30





12. REQUIRED WO