Category : Forth Source Code
Archive   : FIFTH.ZIP
Filename : BLD.FIV

 
Output of file : BLD.FIV contained in archive : FIFTH.ZIP
CREATE BUILD
CREATE FILENAME
EDIT
\ This is the name of the help file.
: filename " fifth.hlp" 1+ ;
~UP
CREATE X
CREATE DEFINE
CREATE SKIP
EDIT
\ Creates the module, and skips all text.
: skip create
>in @
begin
dup c@@
while
1+
repeat
>in !
;
~UP
EDIT
\ Normally x will simply skip the text for the given module.
: define
create ['] skip ,
does>
@ execute
;
~UP
EDIT
\ The execution of X will create an entry in the help file.
\ Use x by following it with the module name that will contain
\ the entry. This module name is really unimportant; it is only a
\ place holder. Next is the name of the help entry, followed by
\ the definition or help for the entry, followed by a quote. For
\ example, a help entry for a word HELLO might be define like:
\
\ x greeting
\
\ HELLO
\ ( -> ) This word prints a friendly and warm greeting."
\
define x
~UP
CREATE DICTIONARY
CREATE ARITHMETIC
CREATE F->I
EDIT
x F->I

F->I
(32b1 -> 32b2) Converts floating point to integer, numerical overflow if
32b1 cannot be represented as an integer."
~UP
CREATE I->F
EDIT
x I->F

I->F
(32b1 -> 32b2 ) Convert integer to floating point."
~UP
CREATE ABS
EDIT
x ABS

ABS
(32b -> u32b) Signed 32b is replaced by it's absolute value."
~UP
CREATE -
EDIT
x -

-
(32b1 32b2 -> 32b3) Subtract 32b2 from 32b1 yielding 32b3."
~UP
CREATE SHL
EDIT
x SHL

SHL
(32b1 32b2 -> 32b3) 32b1 is shifted left 32b2 places, zeros are shifted in on
the right. The result is 32b3."
~UP
CREATE SHR
EDIT
x SHR

SHR
(32b1 32b2 -> 32b3) 32b1 is shifted right 32b2 places, zeros are shifted in on
the left. The result is 32b3."
~UP
CREATE MOD
EDIT
x MOD

MOD
(32b1 32b2 -> 32b3) Divide 32b1 by 32b2 yielding remainder 32b3. 32b3 has
same sign as 32b2, forces an error if 32b2 is zero or quotient out of range."
~UP
CREATE NEGATE
EDIT
x NEGATE

NEGATE
(32b1 -> 32b2) Two's complement 32b1 yielding 32b2."
~UP
CREATE 2/
EDIT
x 2/

2/
(32b1 -> 32b2) Arithmetically shift 32b1 right 1 yielding 32b2."
~UP
CREATE 2-
EDIT
x 2-

2-
(32b1 -> 32b2) Subtract 2 from 32b1 yielding 32b2."
~UP
CREATE 2+
EDIT
x 2+

2+
(32b1 -> 32b2) Add 2 to 32b1 yielding 32b2."
~UP
CREATE 1-
EDIT
x 1-

1-
(32b1 -> 32b2) Decrement 32b1 yielding 32b2."
~UP
CREATE 1+
EDIT
x 1+

1+
(32b1 -> 32b2) Increment 32b1 yielding 32b2."
~UP
CREATE *
EDIT
x *

*
(32b1 32b2 -> 32b3) Signed multiply of 32b1 times 32b2 yielding 32b3."
~UP
CREATE +
EDIT
x +

+
(32b1 32b2 -> 32b3) Add 32b1 to 32b2 yielding 32b3."
~UP
CREATE /MOD
EDIT
x /MOD

/MOD
(32b1 32b2 -> 32b3 32b4) Divide 32b1 by 32b2, leaving quotient 32b4 and
remainder 32b3. 32b3 has same sign as 32b2 Numerical overflow if 32b2 is zero
or 32b4 out of range."
~UP
CREATE /
EDIT
x /

/
(32b1 32b2 -> 32b3) Divide 32b1 by 32b2, leaving quotient 32b3. Numerical
overflow if 32b2 is zero or 32b3 out of range."
~UP
CREATE F/
EDIT
x F/

F/
(32b1 32b2 -> 32b3 ) Divides two floating point numbers."
~UP
CREATE F*
EDIT
x F*

F*
(32b1 32b2 -> 32b3 ) Multiplies two floating point numbers."
~UP
CREATE F-
EDIT
x F-

F-
(32b1 32b2 -> 32b3 ) Subtracts two floating point numbers."
~UP
CREATE F+
EDIT
x F+

F+
(32b1 32b2 -> 32b3 ) Adds two floating point numbers."
~UP
CREATE FEXP
EDIT
x FEXP

FEXP
(32b1 -> 32b2) Returns e^X on floating point number 32b1."
~UP
CREATE FLOG
EDIT
x FLOG

FLOG
(32b1 -> 32b2) Returns the natural log of 32b1."
~UP
EDIT
create arithmetic
~UP
CREATE I/O
CREATE F->EM
EDIT
x F->EM

F->EM
(32b1 -> 32b2 32b3) Converts the floating point 32b1 to exponent 32b2 and
mantissa 32b3. Mantissa is adjusted by RADIX to the 6th power, to allow six #'s
to be used on it within a formatted string command sequence."
~UP
CREATE WRITE
EDIT
x WRITE

WRITE
(addr 32b1 32b2 -> 32b3 -1) or (addr 32b1 32b2 -> 32b3 0) Write buffer at
address. Buffer length written is 32b1 bytes. File handle is 32b2. 32b3 is
the number of bytes written followed by -1, or 32b3 is an error number followed
by 0."
~UP
CREATE SPAN
EDIT
x SPAN

SPAN
( -> addr) Addr is the address of the length of the last data read with
EXPECT."
~UP
CREATE SIGN
EDIT
x SIGN

SIGN
(32b -> ) Place a sign '-' character in the formatted string buffer if 32b is
less than zero."
~UP
CREATE F.
EDIT
x F.

F.
(32b -> ) Prints the floating point number."
~UP
CREATE GOTOXY
EDIT
x GOTOXY

GOTOXY
( 32b1 32b2 -> ) Moves the cursor to column 32b1, row 32b2."
~UP
CREATE COUNT
EDIT
x COUNT

COUNT
(addr1 -> addr2 8b) The string whose length byte is pointed to by address #1
has it's length byte pushed onto the stack, address #1 is incremented yielding
address #2."
~UP
CREATE CONVERT
EDIT
x CONVERT

CONVERT
(addr1 -> addr2 32b) The string whose length byte is pointed to by address #1
is converted to 32b. Address #2 points to the first non-convertible character.
DPL is a -1 for a integer, and >= 0 for a floating point number."
~UP
CREATE KEY
EDIT
x KEY

KEY
( -> 8b) Wait for a character from the keyboard, do not echo it."
~UP
CREATE U.
EDIT
x U.

U.
(u32b -> ) The unsigned integer u32b is printed."
~UP
CREATE TYPE
EDIT
x TYPE

TYPE
(addr +n -> ) +n characters from the string at address are echoed to the
terminal."
~UP
CREATE TIB
EDIT
x TIB

TIB
( -> addr) Leaves the address the start of the terminal input buffer on the
stack."
~UP
CREATE SPACES
EDIT
x SPACES

SPACES
(32b -> ) Output 32b spaces to the terminal."
~UP
CREATE SPACE
EDIT
x SPACE

SPACE
( -> ) Output a space to the terminal."
~UP
CREATE SEEK
EDIT
x SEEK

SEEK
(32b1 8b 32b2 -> 32b3 -1) or (32b1 8b 32b2 -> 32b4 0) Moves file pointer 32b1
bytes from offset specified in 8b, in file with handle 32b2. Returns new file
pointer position 32b3 and a true flag, or error code 32b4 and a false flag. If
8b = 0 then offset is from file beginning, if 8b = 1 then offset is from the
current position, if 8b = 2 then offset is from end of file."
~UP
CREATE SCREEN
EDIT
x SCREEN

SCREEN
( -> 32b) Returns the indirect address of the current video text screen.
SCREEN is compatible with such primitives as FILL and MOVE. On the IBM, SCREEN
keeps track of the correct screen for both black & white and color screens."
~UP
CREATE RENAME
EDIT
x RENAME

RENAME
(addr1 addr2 -> -1) or (addr1 addr2 -> 32b1 0) File with name at addr1 is
renamed to name at addr2. Returns a true flag, or error code 32b1 and false
flag."
~UP
CREATE READ
EDIT
x READ

READ
(addr 32b1 32b2 -> 32b3 -1) or (addr 32b1 32b2 -> 32b3 0) The buffer at
address is filled with 32b1 bytes from file with handle 32b2. 32b3 is the
number of bytes actually read, unless an error occurred. Then 32b3 is the
error code."
~UP
CREATE QUERY
EDIT
x QUERY

QUERY
( -> ) Causes the input buffer to be flushed and read."
~UP
CREATE PAD
EDIT
x PAD

PAD
( -> addr) Leaves the address of the start of the formatted string buffer on
the stack."
~UP
CREATE OUT
EDIT
x OUT

OUT
(8b 32b -> ) The 8b value is outputted thru port number 32b."
~UP
CREATE OPEN
EDIT
x OPEN

OPEN
(addr 8b -> 32b1 -1) or (addr 8b -> 32b2 0) Opens existing file with name at
address. 8b is 0 for read, 1 for write, 2 for read and write. Returns 32b1 as
file handle and true flag, or 32b2 as error code and false flag. The 32b1
handle will be used in all I/O with the file."
~UP
CREATE IN
EDIT
x IN

IN
(32b -> 8b) Input 8b from port number 32b."
~UP
CREATE EXPECT
EDIT
x EXPECT

EXPECT
(addr 8b1 -> addr 8b2) Read 8b1 characters at addr or until a CR, with
backspace editing. 8b2 is the number of characters read."
~UP
CREATE EMIT
EDIT
x EMIT

EMIT
(8b -> ) The 8b value is sent to the terminal."
~UP
CREATE DPL
EDIT
x DPL

DPL
( -> addr ) The address of the number of trailing digits in the last double
precision number, or a -1 if integer, is left on the stack."
~UP
CREATE DELETE
EDIT
x DELETE

DELETE
(addr -> -1) or (addr -> 32b1 0) Deletes file with name at address. Returns
a true flag, or error code 32b1 and a false flag."
~UP
CREATE CREATEFILE
EDIT
x CREATEFILE

CREATEFILE
(addr 32b1 -> 32b2 -1) or (addr 32b1 -> 32b2 0) Create file with name at
address and attributes 32b1. 32b1 is 1 = read only, 2 = hidden, 4 = system, 20h
= archive. Sum bits for multiple attributes. 32b2 is the file handle, unless an
error occurred, then 32b2 is the error code."
~UP
CREATE CR
EDIT
x CR

CR
( -> ) Sends a carriage-return line-feed pair to the terminal."
~UP
CREATE CLS
EDIT
x CLS

CLS
( -> ) Clear the screen and home the cursor."
~UP
CREATE CLOSE
EDIT
x CLOSE

CLOSE
(32b1 -> -1) or (32b1 -> 32b2 0) Close file with handle 32b1. Returns true
flag if no error. Returns false flag and error code 32b2 if error."
~UP
CREATE ABORT"
EDIT
x ABORT"

ABORT"
( flag -> ) If the flag is true, the following message is printed, and ABORT
is called."
~UP
CREATE ?TERM
EDIT
x ?TERM

?TERM
( -> flag) Leave a true flag if a character is available at the keyboard,
otherwise leave a false flag."
~UP
CREATE <#
EDIT
x <#

<#
( -> ) Reset the formatted string length and pointer."
~UP
CREATE .S
EDIT
x .S

.S
(32b1 32b2 ... -> ) Print all values on stack as signed integer values."
~UP
CREATE .(
EDIT
x .(

.(
( -> ) Following string is immediately displayed, until the terminating
parenthesis."
~UP
CREATE .
EDIT
x .

.
(32b -> ) Signed integer number is printed in the current radix with a
trailing blank."
~UP
CREATE ."
EDIT
x ."

."
( -> ) Following string is compiled inline for later display. String is
terminated by a quote."
~UP
CREATE -TRAILING
EDIT
x -TRAILING

-TRAILING
(addr +8b1 -> addr +8b2) All trailing blanks from string at address are
removed, the new length is left on the stack."
~UP
CREATE #TIB
EDIT
x #TIB

#TIB
( -> addr) Leaves address of terminal input buffer, first byte is length,
next is buffer. Use C@ or COUNT to get the length."
~UP
CREATE #S
EDIT
x #S

#S
(+32b -> 0 ) All remaining digits of 32b are placed in the formatted string
buffer."
~UP
CREATE #>
EDIT
x #>

#>
(32b -> addr +n ) Number on stack is replaced by the address and
length of the formatted string buffer."
~UP
CREATE #
EDIT
x #

#
(+32b1 -> +32b2 ) Positive number +32b1 is divided by the current radix. The
remainder is converted to a digit and stuffed into the formatted string buffer.
The quotient is left on the stack."
~UP
EDIT
create i/o
~UP
CREATE GRAPHICS
CREATE VMODE
EDIT
x VMODE

VMODE
( 32b1 -> ) On the IBM, the 32b1 is the screen mode, both black & white and
color screens are supported. On the TI, 32b1 is ignored, and the screen palette
is reset."
~UP
CREATE PALETTE
EDIT
x PALETTE

PALETTE
( 32b1 32b2 -> ) On the IBM, 32b1 is the background color, and 32b2 is either
0 or 1. On the TI 32b1 is pixel value (0-7) and 32b2 is the color it is being
mapped to (0-7)."
~UP
CREATE POINT
EDIT
x POINT

POINT
( x1 y2 -> color ) Returns the color of a point."
~UP
CREATE PSET
EDIT
x PSET

PSET
( color x1 y1 -> ) Set a point."
~UP
CREATE PAINT
EDIT
x PAINT

PAINT
( x1 y1 color1 color2 -> ) Starting at x1,y1, fill the screen with color1,
stopping on both color boundaries."
~UP
CREATE LINE
EDIT
x LINE

LINE
( color x1 y1 x2 y2 -> color x2 y2) Draws a line. Repeated calls to LINE are
easy to use, as the last call leaves to endpoint for the next call."
~UP
CREATE FILLBOX
EDIT
x FILLBOX

FILLBOX
( color x1 y1 x2 y2 -> ) Fills a box."
~UP
CREATE BOX
EDIT
x BOX

BOX
( color x1 y1 x2 y2 -> ) Draws a box."
~UP
EDIT
create graphics
~UP
CREATE CONDITIONAL.COMPILATION
CREATE }REPEAT
EDIT
x }REPEAT

}REPEAT
( -> ) The text pointer is reset to just after an enclosing BEGIN{.
NOTE: }REPEAT is immediate."
~UP
CREATE }WHILE{
EDIT
x }WHILE{

}WHILE{
( flag -> ) If the flag is true, execution proceeds. If false, the return stack
is popped, and execution proceeds after the enclosing }REPEAT.
NOTE: }WHILE{ is immediate."
~UP
CREATE }UNTIL
EDIT
x }UNTIL

}UNTIL
( flag -> ) If the flag is true, the return stack is popped and execution
continues. If false, the text pointer is reset to just after an enclosing
BEGIN{. NOTE }UNTIL is immediate."
~UP
CREATE BEGIN{
EDIT
x BEGIN{

BEGIN{
( -> ) Saves the text pointer on the return stack, used with }UNTIL or }WHILE{
}REPEAT. NOTE BEGIN{ is immediate."
~UP
CREATE }LOOP
EDIT
x }LOOP

}LOOP
( -> ) Bumps the index provided by DO{, and checks it versus the terminator. If
index equals the terminator, processing continues. If not, the text pointer is
reset to just after the DO{. Use R@ to get the index. NOTE: }LOOP is immediate.
"
~UP
CREATE DO{
EDIT
x DO{

DO{
( 32b1 32b2 -> ) The index is set to 32b2, and increments to 32b1. Text upto
the enclosing }LOOP is repeated (reparsed). The value of the index, terminator
and loop address is kept on the return stack. NOTE: DO{ is immediate."
~UP
CREATE }ENDIF
EDIT
x }ENDIF

}ENDIF
( -> ) Place marker for IF{ and }ELSE{ modules. This module does nothing."
~UP
CREATE }ELSE{
EDIT
x }ELSE{

}ELSE{
( -> ) Skips text to the next }ENDIF. NOTE: }ELSE{ is immediate."
~UP
CREATE IF{
EDIT
x IF{

IF{
( flag -> ) If the flag is true, execution proceeds. If the flag is false, text
is skipped till the next }ELSE{ or }ENDIF. NOTE: IF{ is immediate."
~UP
EDIT
create conditional.compilation
~UP
CREATE STRUCTURES
CREATE @
EDIT
x @

@
(addr -> 32b) The 32b value at the address is fetched."
~UP
CREATE C@
EDIT
x C@

C@
(addr -> 8b) 8b value is fetched from the address, the high bytes are set to
zero and placed on the stack as a 32b value."
~UP
CREATE C@@
EDIT
x C@@

C@@
(32b -> 8b) The 8b value at the direct hardware address 32b is fetched."
~UP
CREATE C!!
EDIT
x C!!

C!!
( 8b 32b -> ) Store the 8b value at the 32b direct hardware address."
~UP
CREATE C!
EDIT
x C!

C!
(8b addr -> ) 8b value is stored at address."
~UP
CREATE 2@
EDIT
x 2@

2@
(addr -> 64b ) Fetch the 64b value stored at the address."
~UP
CREATE 2!
EDIT
x 2!

2!
(64b addr -> ) Store the 64b value into the address."
~UP
CREATE +!
EDIT
x +!

+!
(32b addr -> ) Add 32b to the value at the address."
~UP
CREATE !
EDIT
x !

!
( 32b addr -> ) Store the 32b value at the address."
~UP
CREATE I->D
EDIT
x I->D

I->D
(addr -> 32b) Convert indirect address to a direct hardware 32b address."
~UP
CREATE IF
EDIT
x IF

IF
(flag -> ) Used in a test IF true-body ENDIF or test IF true-body ELSE false-
body ENDIF construct. Branches according to whether the flag is zero or non-
zero."
~UP
CREATE ELSE
EDIT
x ELSE

ELSE
( -> ) Used in a test IF true-body ELSE false-body ENDIF construct."
~UP
CREATE ENDIF
EDIT
x ENDIF

ENDIF
( -> ) Used inside a test IF true-body ENDIF or test IF true-body ELSE false-
body ENDIF construct."
~UP
CREATE BEGIN
EDIT
x BEGIN

BEGIN
( -> ) Marks the beginning of a BEGIN body test UNTIL loop or a BEGIN test
WHILE body REPEAT loop."
~UP
CREATE WHILE
EDIT
x WHILE

WHILE
(flag -> ) Used to test for loop termination in a BEGIN test WHILE body
REPEAT loop. If the flag is false the loop is exited past the REPEAT."
~UP
CREATE UNTIL
EDIT
x UNTIL

UNTIL
(flag -> ) Loops to enclosing BEGIN if flag is false, otherwise the loop
terminates. Used in BEGIN body test UNTIL loops."
~UP
CREATE REPEAT
EDIT
x REPEAT

REPEAT
( -> ) Causes a loop to an enclosing BEGIN in a BEGIN test WHILE body REPEAT
construct."
~UP
CREATE VARIABLE
EDIT
x VARIABLE

VARIABLE
( -> ) The next module in the input stream is CREATE'd, and 4 bytes reserved
for it's use."
~UP
CREATE CONSTANT
EDIT
x CONSTANT

CONSTANT
(32b -> ) Next module in the input stream is compiled into the dictionary.
Later execution of this name leaves 32b on the stack."
~UP
CREATE NEW
EDIT
x NEW

NEW
( -> addr) Creates a module, exactly as CREATE does, except the name is always
a 'þ' a special character). Returns addr as the parameter area. Used for
dynamic storage allocation to the HEAP."
~UP
CREATE DISPOSE
EDIT
x DISPOSE

DISPOSE
(addr -> ) Deletes module with parameter area address, and all sub-modules and
related text. Does not mark following modules as 'Not Compiled' , therefore it
should not be used to delete code modules. Usually used to remove modules
created by NEW."
~UP
CREATE SCAN
EDIT
x SCAN

SCAN
( addr 32b1 8b -> 32b2 ) Scan 32b1 bytes at addr for 8b. Return 32b2 as offset
+ 1 of first occurance of byte 8b in addr. Return 0 if byte not found in 32b1
characters. If byte is first character, 32b2 is 1."
~UP
CREATE DO
EDIT
x DO

DO
(32b1 32b2 -> ) Move 32b1 and 32b2 to the return stack. 32b2 is the initial
value and 32b1 is the limit. All code between the DO and the LOOP or +LOOP is
repeat until the index crosses the (limit-1) to (limit) boundary."
~UP
CREATE I
EDIT
x I

I
( -> 32b) Leaves the value of the innermost DO index on the stack."
~UP
CREATE J
EDIT
x J

J
( -> 32b) Leaves the value of the second innermost DO index on the stack."
~UP
CREATE LEAVE
EDIT
x LEAVE

LEAVE
( -> ) Causes the innermost DO body LOOP construct to be exited immediately."
~UP
CREATE LOOP
EDIT
x LOOP

LOOP
( -> ) Increments the loop index by one, in a DO body LOOP construct. If the
index crosses the (limit-1) to (limit) boundary, then the index and limit are
removed from the return stack and the loop is terminated, otherwise loops to
the DO."
~UP
CREATE +LOOP
EDIT
x +LOOP

+LOOP
(n -> ) Add the value n to the loop index, if the index crossed the (limit -
1) to (limit) boundary terminate, otherwise loop to the enclosing DO. The index
and limit values are on the return stack."
~UP
CREATE EXIT
EDIT
x EXIT

EXIT
( -> ) Exits the current module, >R and R> modules must be balanced, but
DO/LOOP's do not."
~UP
CREATE HERE
EDIT
x HERE

HERE
( -> addr ) Leaves the address of the current top of dictionary."
~UP
CREATE DOES>
EDIT
x DOES>

DOES>
( -> ) Causes the address of the code following the DOES> to be placed in the
current module's indirect parameter address. UP is called, to restore the local
module from a previous CREATE. Later execution of a module CREATE'd with this
module
will execute the code following the DOES>. The current module's compilation is
completed without executing this code. "
~UP
CREATE CMOVE>
EDIT
x CMOVE>

CMOVE>
(addr1 addr2 32b -> ) Move 32b bytes starting at (addr1 + 32b - 1) to (addr2
+ 32b - 1) and proceeding toward low memory."
~UP
CREATE CMOVE
EDIT
x CMOVE

CMOVE
(addr1 addr2 32b -> ) 32b characters from address #1 are moved to address
#2."
~UP
CREATE ERASE
EDIT
x ERASE

ERASE
(addr 32b -> ) Zeros 32b bytes at addr."
~UP
CREATE FILL
EDIT
x FILL

FILL
(addr 32b 8b -> ) From address, 32b bytes are filled with 8b."
~UP
CREATE BLANK
EDIT
x BLANK

BLANK
(addr 32b -> ) Fills 32b bytes at addr with blanks."
~UP
CREATE MOVE
EDIT
x MOVE

MOVE
(addr1 addr2 n -> ) Copy n words (32b values) from address #1 to address #2.
Do nothing if n is less than or equal to zero."
~UP
CREATE >BODY
EDIT
x >BODY

>BODY
(addr1 -> addr2) Convert the execution address addr1 to a parameter field
address addr2."
~UP
CREATE "
EDIT
x "

"
( -> addr ) Compiles a string literal inline, up to the terminating quote.
Returns the address of the length byte of the literal."
~UP
EDIT
create structures
~UP
CREATE COMPILING
CREATE WORD
EDIT
x WORD

WORD
(8b -> addr) Parses the next module in the input stream delimited by 8b, tabs,
blanks, carriage-returns, line-feeds or nulls. Leading whitespace and
delimiters are skipped, the word is left at address+1, with a count at
address. The count is zero if the input stream is empty."
~UP
CREATE [
EDIT
x [

[
( -> ) The compiler is turned off."
~UP
CREATE ]
EDIT
x ]

]
( -> ) The compiler is turned on."
~UP
CREATE [COMPILE]
EDIT
x [COMPILE]

[COMPILE]
( -> ) Causes a call to the next module in the input stream to be generated
when the module containing [COMPILE] is run."
~UP
CREATE [']
EDIT
x [']

[']
( -> ) Compiles the execution address of next module in input stream as a
literal, later execution of code leaves the address on the stack."
~UP
CREATE TRACE
EDIT
x TRACE

TRACE
( -> ) TRACE moves the cursor to the screen top, and prints the stack and the
module about to be executed. If a space bar is hit, execution proceeds
normally, if ESC is hit ABORT is called. Other keys are ignored. If Trace is
set on from the DIR command, TRACE is called before each module in the module
being traced."
~UP
CREATE TEXT
EDIT
x TEXT

TEXT
( 8b -> ) Clears the PAD buffer, then reads from the input stream to the PAD
buffer until the 8b delimiter is found."
~UP
CREATE STATE
EDIT
x STATE

STATE
( -> addr ) Leaves the address of the compiler state. 0 is off, anything else
is on. This value must NOT be modified."
~UP
CREATE FIND
EDIT
x FIND

FIND
(addr1 -> addr2 n) For a string with count byte at address #1, search for
matching module name in dictionary. If found addr2 is the indirect execution
address, n is 1 if immediate, -1 otherwise. If not found but the string is an
integer, then addr2 is the 32b value, and n is 2. If string is a floating point
number, addr2 is the value, and n is 3. If none of the above, then
addr2 = addr1 and n=0."
~UP
CREATE LITERAL
EDIT
x LITERAL

LITERAL
(32b -> ) Causes the top-of-stack value to be compiled just as if it where an
inline number."
~UP
CREATE EXECUTE
EDIT
x EXECUTE

EXECUTE
(addr -> ) The code at the address is executed."
~UP
CREATE CHILD
EDIT
x CHILD

CHILD
(addr1 -> addr2) Returns the address addr2 of the first child of module
addr1."
~UP
CREATE NEXT
EDIT
x NEXT

NEXT
(addr1 -> addr2) Returns the address addr2 of the next module after module
addr1."
~UP
CREATE COMP
EDIT
x COMP

COMP
( addr -> ) Compiles the module with execution address addr."
~UP
CREATE ABORT
EDIT
x ABORT

ABORT
( -> ) All stacks are reset, all buffers are cleared, all files are closed,
the radix is set to 10, input is from keyboard, the screen mode is reset and
the compiler turned off."
~UP
CREATE QUIT
EDIT
x QUIT
QUIT
( -> ) Does a full reset like ABORT except the data stack is left untouched."
~UP
CREATE >IN
EDIT
x >IN

>IN
( -> addr ) Leaves the address of the hardware pointer in the text input
buffer. Use @ and ! to get this hardware pointer, but C@@ to read the buffer."
~UP
CREATE '
EDIT
x '

'
( -> 32b ) The input stream is parsed, a number's value is placed on the
stack, a known module's execution address pointer is placed on the stack, an
unknown module generates an error."
~UP
CREATE IMMEDIATE
EDIT
x IMMEDIATE

IMMEDIATE
( -> ) Causes the local module to become immediate, it executes even if the
compiler is turned on."
~UP
CREATE .CREATE
EDIT
x .CREATE

CREATE
( -> ) The next module in the input stream has a dictionary entry and a code
segment created for it. In the code segment the name and code to push the
indirect address after the code (the new parameter area) is generated, followed
by a return. When the new module is executed, the parameter area indirect
address will be left on the data stack.

The module is created at the end of the local dictionary, unless the module is
the same as the name of the local dictionary. In that case, the module is
(re)created. None of the pointers are lost, but the code is reset as above. The
F$CRH bit is also set on a re-creation."
~UP
CREATE ,
EDIT
x ,

,
(32b -> ) The 32b value is placed at the end of the local dictionary."
~UP
CREATE C,
EDIT
x C,

C,
(8b -> ) 8b value is compiled into the top-of-dictionary."
~UP
CREATE ALLOT
EDIT
x ALLOT

ALLOT
(32b -> ) Top-of-dictionary pointer is advanced by 32b."
~UP
CREATE :
EDIT
x :

:
( -> ) CREATE is called to (re)create a header for the following module. The
compiler is turned on."
~UP
CREATE ;
EDIT
x ;

;
( -> ) A return is compiled, then the compiler is turned off. Nesting of
control structures is also checked."
~UP
CREATE (
EDIT
x (

(
( -> ) All characters up to the closing ')' paren are ignored. This is the
comment module."
~UP
CREATE \
EDIT
x \

\
( -> ) Skip comments to the end of the line."
~UP
EDIT
create compiling
~UP
CREATE COMPARISON
CREATE XOR
EDIT
x XOR

XOR
(32b1 32b2 -> 32b3) Exclusive or 32b1 to 32b2 yielding 32b3."
~UP
CREATE U<
EDIT
x U<

U<
(u32b1 u32b2 -> flag) Leave a true flag if unsigned integer u32b1 is less
than u32b2."
~UP
CREATE F<
EDIT
x F<

F<
(32b1 32b2 -> flag ) Compares two floating point numbers."
~UP
CREATE OR
EDIT
x OR

OR
(32b1 32b2 -> 32b3) Bitwise or 32b1 to 32b2 yielding 32b3."
~UP
CREATE NOT
EDIT
x NOT

NOT
(32b1 -> 32b2) One's complement 32b1 yielding 32b2."
~UP
CREATE AND
EDIT
x AND

AND
(32b1 32b2 -> 32b3) 32b1 is bit-wise anded with 32b2 yielding 32b3."
~UP
CREATE >
EDIT
x >

>
(32b1 32b2 -> flag) A true flag is left if 32b1 is greater than 32b2,
otherwise a zero."
~UP
CREATE =
EDIT
x =

=
(32b1 32b2 -> flag) A true flag is left if 32b1 equals 32b2, otherwise a
zero."
~UP
CREATE <
EDIT
x <

<
(32b1 32b2 -> flag) A true flag is left if 32b1 is less than 32b2, otherwise
a zero."
~UP
CREATE 0>
EDIT
x 0>

0>
(32b -> flag) Replace 32b with a true flag (-1) if 32b is greater than zero,
otherwise replace 32b with a false flag (0)."
~UP
CREATE 0=
EDIT
x 0=

0=
(32b -> flag) Replace 32b with a true flag (-1) if 32b is equal to zero,
otherwise replace 32b with a false flag (0)."
~UP
CREATE 0<
EDIT
x 0<

0<
(32b -> flag) Replace 32b with a true flag (-1) if n is less than zero,
otherwise replace 32b with a false flag (0)."
~UP
EDIT
create comparison
~UP
CREATE STACK
CREATE ?DUP
EDIT
x ?DUP

?DUP
(32b -> 32b 32b) or (0 -> 0) If the top-of-stack value is zero, nothing
occurs, otherwise it is duplicated."
~UP
CREATE SWAP
EDIT
x SWAP

SWAP
(32b1 32b2 -> 32b2 32b1) Top two stack elements are swapped."
~UP
CREATE OVER
EDIT
x OVER

OVER
(32b1 32b2 -> 32b1 32b2 32b1) Stack is modified according to stack diagram."
~UP
CREATE HOLD
EDIT
x HOLD

HOLD
(8b -> ) Pushes the 8b character into the formatted string buffer."
~UP
CREATE DEPTH
EDIT
x DEPTH

DEPTH
( -> n) Return the depth of the stack, not counting n."
~UP
CREATE ROT
EDIT
x ROT

ROT
(32b1 32b2 32b3 -> 32b2 32b3 32b1) Roll 32b1 to the top-of-stack, alter other
values according to stack diagram."
~UP
CREATE ROLL
EDIT
x ROLL

ROLL
(+32b -> ) Roll the +32b-th (not counting the position of +32b) stack
location's contents to the top-of-stack. Move all intervening values down one.
+32b is zero based, thus ROT is 2 ROLL, SWAP is 1 ROLL and 0 ROLL does nothing.
"
~UP
CREATE PICK
EDIT
x PICK

PICK
(+n -> 32b) Leave a copy of the nth stack location over +n. +n is zero based
so DUP is the same as 0 PICK and OVER the same as 1 PICK."
~UP
CREATE MIN
EDIT
x MIN

MIN
(32b1 32b2 -> 32b3) Leave the lesser of 32b1 and 32b2 on the stack as 32b3."
~UP
CREATE MAX
EDIT
x MAX

MAX
(32b1 32b2 -> 32b3) Leave the larger of 32b1 and 32b2 on the stack as 32b3."
~UP
CREATE DUP
EDIT
x DUP

DUP
(32b -> 32b 32b) Duplicate the top-of-stack element."
~UP
CREATE DROP
EDIT
x DROP

DROP
(32b -> ) A 32b is dropped from the stack."
~UP
CREATE ?STACK
EDIT
x ?STACK

?STACK
( -> flag) Returns a true flag if the stack has underflowed."
~UP
CREATE 2SWAP
EDIT
x 2SWAP

2SWAP
(64b1 64b2 -> 64b2 64b1) Swap top two 64b stack elements."
~UP
CREATE 2DUP
EDIT
x 2DUP

2DUP
(64b -> 64b 64b) Duplicate 64b value."
~UP
CREATE 2DROP
EDIT
x 2DROP

2DROP
(64b -> ) Drop 64b from the stack."
~UP
EDIT
create stack
~UP
CREATE MISC
CREATE HELP
EDIT
x HELP

HELP
( -> ) Used as 'HELP xxx' where xxx is a system primitive. It reads the file
'FIFTH.HLP' and returns information on the primitive."
~UP
CREATE .UP
EDIT
x .UP

UP
( -> ) Raises the environment level, does nothing if at ROOT level."
~UP
CREATE SAVE
EDIT
x SAVE

SAVE
( -> ) Saves the current Fifth environment to a disk file under the ROOT
name, with a .EXE extension. To re-load the environment, type it's name to
MSDOS. If a .EXE file already exists when saving, it is renamed to .BAK ."
~UP
CREATE R@
EDIT
x R@

R@
( -> 32b) Copies a value from the return stack and places it on the data
stack."
~UP
CREATE R>
EDIT
x R>

R>
( -> 32b) Pulls a value from the return stack and places it on the data
stack."
~UP
CREATE MEMORY
EDIT
x MEMORY

MEMORY
( -> 32b) Returns the size of the largest HEAP block. Saving and reloading
Fifth will compress the HEAP."
~UP
CREATE INT
EDIT
x INT

INT
(Registers Int -> Registers Flags) The registers are 8 16b values in this
order: ES DS SI DI DX CX BX AX . Stack them as 4 32b values. Push all registers
on the stack prior to using INT. The registers are loaded and the interrupt is
called. The registers are pushed back on the stack with the flags."
~UP
CREATE .EDIT
EDIT
x .EDIT

EDIT
( -> ) Edits the text of a single module. (Edits the local module.) Use DIR to
edit program structure. See the Text Editor section of the Fifth manual."
~UP
CREATE .DIR
EDIT
x .DIR

DIR
( -> ) Invokes the dictionary editor. This is the word that is used to edit
the structure of Fifth programs. DIR is invoked by typing `DIR' in the
interactive environment. Use the arrow keys to move around in your program.
See the full description in the Dictionary Editor section in the manual."
~UP
CREATE DECIMAL
EDIT
x DECIMAL

DECIMAL
( -> ) Force the radix to base 10."
~UP
CREATE BYE
EDIT
x BYE

BYE
( -> ) Exits to calling procedure. (MSDOS)"
~UP
CREATE BASE
EDIT
x BASE

BASE
( -> addr) Leaves the address of the radix. Valid radix are in the range 2
to 72."
~UP
CREATE >R
EDIT
x >R

>R
(32b -> ) 32b value is pushed onto the return stack."
~UP
EDIT
create misc
~UP
EDIT
create dictionary
~UP
CREATE COMPILE-DICTIONARY
CREATE TABLE.LENGTH
EDIT
\ Used to keep track of the table length.
variable table.length
~UP
CREATE BUFFER
EDIT
\ The definition of a word is limited to 32K.
create buffer 1024 32 * allot
~UP
CREATE LEN
EDIT
\ Used to keep track of offsets into the definitions.
variable len
~UP
CREATE HN
EDIT
variable hn
~UP
CREATE HT
EDIT
variable ht
~UP
CREATE OPENFILES
EDIT
\ Open the files.
: openfiles
filename delete ?dup 2drop \ Delete old hlp files.
" text.hlp " 1+ delete ?dup 2drop

filename 32 createfile \ Open files.
if else
." Cannot open help file." abort
endif
hn !
" text.hlp " 1+ 34 createfile
if else
." Cannot open text.hlp" abort
endif
ht !
0 table.length ! \ Reset table.length to zero.
" hold" 1+ 4 hn @ write 2drop \ Save a place for table length.
" " 1+ 16 hn @ write 2drop \ First entry null.
table.length 4 hn @ write 2drop \ Save a zero length for first entry.
20 table.length !
;
~UP
CREATE WRITE.OUT
CREATE DEF
EDIT
\ Writes out a word definition to the text file.
: def
buffer
begin
>in @ c@@ dup 34 = not
1 >in +!
while
over c!
1+
repeat
drop
buffer swap over -
ht @ write if
len +!
len 4 hn @ write 2drop
else
." Write error to text file (def)" abort
endif
;
~UP
EDIT
\ write.out - Writes out the name and definition to FILENAME
: write.out
create
20 table.length +!
0 word dup c@ 1+ dup 16 > if drop 16 endif
hn @ write if
16 swap -
" " 1+ swap hn @ write 2drop
else
." Write error to name file. (x)" abort
endif
def
;
~UP
CREATE R.COMP
EDIT
\ ( execution.addr -> )
\ A recursive compilation routine. compiles all children and brothers
\ of the execution address on the stack.
: r.comp
?dup if else exit endif
dup comp
dup child r.comp
next r.comp
;
~UP
CREATE CLEANUP
EDIT
\ Merges files, deletes intermediate files, fixes up table length, etc.
: cleanup
0 0 ht @ seek
if drop else ." Seek error (build)" abort endif
buffer 1024 32 * ht @ read drop
buffer swap hn @ write
if else
." Write error! (build)" abort
endif
drop
0 0 hn @ seek
if drop else ." Seek error (build)" abort endif
table.length 4 hn @ write 2drop
" text.hlp" 1+ delete ?dup 2drop
hn @ close ?dup 2drop
ht @ close ?dup 2drop
;
~UP
EDIT
\ Execution of this word will create the help file. X is made to write out
\ the entries to a file in the proper format for the word HELP to read.
\
: compile-dictionary
0 len !
openfiles
['] x comp \ Insure x is compiled.
['] write.out ['] x >body ! \ Set up for creation of `fifth.hlp'
['] dictionary comp \ Compile the dictionary,
['] dictionary child r.comp \ and all its children
['] x comp \ Reset x to do nothing.
cleanup \ Close files and stuff.
;
~UP
EDIT
\ Executing BUILD will build a new help file.
\ Modify program for help file.
: build
compile-dictionary
;
~UP
ABORT


  3 Responses to “Category : Forth Source Code
Archive   : FIFTH.ZIP
Filename : BLD.FIV

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/