Download FORTH for NOAA/MLML Instruments

Transcript
FORTH for NOAA/MLML Instruments
MLML Tech Pub 93-2
.ABORT
( a -- )
0<
Displays a string to the console. The fIrst byte of
the address must contain a length byte. This is
the default execution for ABORT".
( n -- f )
Test a single-precision nultLber. Returns true if
it's negative, else returns false.
( n -- f )
0=
Related words: ABORT ABORT"
/
Test a single-precision nUltLber. Returns true if
it's equal to zero, else return false.
( n1 n2 -- n3 )
Divides a single-precision number nl by n2. The
result is put on stack as n3. If n2 is zero, an
exception will occur.
Related words:
=
( n -- f )
Test a single-precision nUIrlber. Returns true if
it's positive, else returns false.
/MOD M/ MOD
T/ U/ U/MOD
( u -- )
DO
0>
* */MOD
/LOOP
Format:
Related word:
1
: name ... DO ... /LOOP ... ;
( -- n )
Puts a single-precision one (1) on the stack.
Used only in a colon definition. Increments the
loop index by an unsigned single-precision number
n and then the limit is checked for continuation of
loop. 1 /LOOP is equivalent to LOOP.
1+
( nl -- n2 )
Adds one to the single-precision number on stack.
1-
( nl -- n2 )
Example:
Subtract by one the single-·precision number on
stack.
: DSPNUM 10 0 DO I . 2 /LOOP; ok
DSPNUM 0 2 4 6 8 ok
1.
Related words: DO LEAVE LOOP
+LOOP
Puts a double-precision one (1) on the stack.
This is equivalent to putting single-precision one
and zero on the stack.
( n1 n2 -- n3 n4 )
/MOD
Returns the remainder n3, which has the same
sign as nl, and quotient n4 of nl divided by n2.
If n2 is zero, an exception will occur.
1COM
Example:
DECIMAL 47 II/MOD •• 4 3 ok
HEX IFF lCOM • FF1PFEOO ok
Related words: */MOD / MOD U/MOD
( -- n )
2
( -- d )
Puts a double-precision zero (0) on the stack.
This is equivalent· to putting 2 single-precision
zeros on the stack.
12
( -- n )
Puts a single-precision two (2) on the stack.
Puts a single-precision zero (0) on the stack.
o.
( n1 -- n2 )
Perform a l's complement on the single-precision
number on stack.
Example:
o
( -- d )
2!
. (d a -- )
Stores a double-precision number d to the
memory address a. The Ingher longword goes to
the lower memory address.
July 1993 (Rev. January 1994)