The file ARM\MINARM.FTH contains the minimum code definitions required to support Umbilical Forth. If additional definitions are required, they may be copied to a new file from ARM\CODEARM.FTH or COMMON\KERNEL62.FTH.
CODE LEAVE \ --
Remove the current DO..LOOP parameters and jump to the
end of the DO..LOOP structure.
CODE ?LEAVE \ flag --
If flag is non-zero, remove the current DO..LOOP parameters
and jump to the end of the DO..LOOP structure.
CODE (DO) \ limit index --
The run time action of DO compiled on the target.
CODE (?DO) \ limit index --
The run time action of ?DO compiled on the target.
CODE EXECUTE \ xt --
Execute the code described by the XT. This is a Forth equivalent
to an assembler indirect JSR/CALL instruction.
CODE NOOP \ --
A NOOP, null instruction. )
CODE DROP \ x -- ; needed by default interrupt handler
Lose the top data stack item and promote NOS to TOS.
CODE MIN \ n1 n2 -- n1|n2
Given two data stack items preserve only the smaller.
CODE MAX \ n1 n2 -- n1|n2
Given two data stack items preserve only the larger.
CODE WITHIN? \ n1 n2 n3 -- flag
Return TRUE if N1 is within the range N2..N3.
This word uses signed arithmetic.
CODE WITHIN \ n1|u1 n2|u2 n3|u3 -- flag
The ANS version of WITHIN?.
Return TRUE if N1 is within the range N2..N3-1.
This word uses unsigned arithmetic, so that signed compares are
treated as existing on a number circle.
CODE LSHIFT \ x1 u -- x2
Logically shift X1 by U bits left.
CODE RSHIFT \ x1 u -- x2
Logically shift X1 by U bits right.
CODE S>D \ n -- d
Convert a single number to a double one.
CODE UM* \ u1 u2 -- ud
Perform unsigned-multiply between two numbers and return double
result.
CODE * \ n1 n2 -- n3
Standard signed multiply. N3 = n1 * n2.
CODE m* \ n1 n2 -- d
Signed multiply yielding double result.
CODE UM/MOD \ ud un -- urem uquot
Perform unsigned division of double number UD by single number U
and return remainder and quotient.
: MU/MOD \ d n -- rem d#quot
Perform an unsigned divide of a double by a single, returning
a single remainder and a double quotient.
CODE FM/MOD \ d1 n2 -- rem quot ; symmetric division
Perform a signed division of double number D1 by single number N2
and return remainder and quotient using floored division. See the
ANS Forth specification for more details of floored division.
CODE SM/REM \ d1 n2 -- rem quot ; symmetric division
Perform a signed division of double number D1 by single number N2
and return remainder and quotient using symmetric (normal) division.
CODE /MOD \ n1 n2 -- rem quot
Signed division of N1 by N2 single-precision yielding remainder
and quotient.
: / \ n1 n2 -- n3
Standard signed division operator. n3 = n1/n2.
: MOD \ n1 n2 -- n3
Return remainder of division of N1 by N2. n3 = n1 mod n2.
: */MOD \ n1 n2 n3 -- n4 n4
Multiply n1 by n2 to give a double precision result, and then
divide it by n3 returning the remainder and quotient. The point
of this operation is to avoid loss of precision.
: */ \ n1 n2 n3 -- n4
Multiply n1 by n2 to give a double precision result, and then
divide it by n3 returning the quotient. The point
of this operation is to avoid loss of precision.
: M/ \ d n1 -- n2
Signed divide of a double by a single integer.
CODE D+ \ d1 d2 -- d3
Add two double precision integers.
CODE D- \ d1 d2 -- d3
Subtract two double precision integers. D3=D1-D2.
CODE DNEGATE \ d1 -- d2
Negate a double number.
CODE ?NEGATE \ n1 flag -- n1|n2
If flag is negative, then negate n1.
CODE ?DNEGATE \ d1 flag -- d1|d2
If flag is negative, then negate d1.
CODE ABS \ n -- u
If n is negative, return its positive equivalent (absolute value).
CODE DABS \ d -- ud
If d is negative, return its positive equivalent (absolute value).
CODE ROLL \ xu xu-1 .. x0 u -- xu-1 .. x0 xu
Rotate the order of the top N stack items by one place such that
the current top of stack becomes the second item and the Nth item
becomes TOS. See also ROT.
CODE CMOVE \ c-addr1 c-addr2 u --
Copy U bytes of memory forwards from C-ADDR1 to C-ADDR2.
CODE CMOVE> \ c-addr1 c-addr2 u --
As CMOVE but working in the opposite direction,
copying the last character in the string first.
CODE FILL \ c-addr u char -- ; used by multitasker
Fill U bytes of memory starting at C-ADDR with the byte information
specified as CHAR.
: erase \ c-addr u -- ; wipe memory
Set U bytes of memory starting at C-ADDR with zeros.
CODE S= \ c-addr1 c-addr2 u -- flag
Compare two same-length strings/memory blocks, returning TRUE if
they are identical.
CODE (") \ -- a-addr ; return address of string, skip over it
Return the address of a counted string that is inline after the
CALLING word, and adjust the CALLING word's return address to
step over the inline string. See the definition of (.") for
an example.
: (C") \ -- c-addr
The run time action compiled by C".
: (S") \ -- c-addr u
The run time action compiled by S".
here is-action-of constant
The runtime code for a CONSTANT.
here is-action-of variable
The runtime action for a VARIABLE.
here is-action-of value
The runtime action of a VALUE.
here is-action-of user
The runtime action of a USER variable.
: u# \ "<name>"-- u
An INTERPRETER word that returns the index of the
USER variable whose name follows, e.g.
u# S0
: CRASH \ -- ; used as action of DEFER
The default action of a DEFERed word. A NOOP.
here is-action-of DEFER \ Comp: "<spaces>name" -- ; Run: i*x -- j*x
The runtime action of a DEFERred word.
: SPACE \ --
Output a blank space (ASCII 32) character.
: SPACES \ n --
Output 'n' spaces, where 'n' > 0.
If 'n' < 0, no action is taken.
: .nibble \ n --
Convert a nibble to a hex ASCII digit and display it.
: .BYTE \ b --
Display the byte b as a 2 digit hex number.
: .WORD \ w --
Display w as a 4 digit unsigned hexadecimal number.
: .dword \ x --
Display x as an 8 digit unsigned hexadecimal number.
: .lword \ x --
A synonym for .DWORD above.