OpenBoot 2.x Quick Reference

Arithmetic Functions

Table 1-22 Arithmetic Functions

*

( n1 n2 -- n3 ) 

Multiply n1 * n2.

+

( n1 n2 -- n3 ) 

Add n1 + n2.

-

( n1 n2 -- n3 ) 

Subtract n1 - n2

/

( n1 n2 -- quot ) 

Divide n1 / n2; remainder is discarded.

<<

( n1 +n -- n2 ) 

Left-shift n1 by +n bits.

>>

( n1 +n -- n2 ) 

Right-shift n1 by +n bits.

>>a

( n1 +n -- n2 ) 

Arithmetic right-shift n1 by +n bits.

abs

( n -- u ) 

Absolute value. 

and

( n1 n2 -- n3 ) 

Bitwise logical AND.

bounds

( startadr len -- endadr startadr ) 

Convert startadr len to endadr startadr for do loop.

bljoin

( b.low b2 b3 b.hi -- long ) 

Join four bytes to form a 32-bit longword. 

bwjoin

( b.low b.hi -- word ) 

Join two bytes to form a 16-bit word. 

lbsplit

( long -- b.low b2 b3 b.hi ) 

Split a 32-bit longword into four bytes. 

lwsplit

( long -- w.low w.hi ) 

Split a 32-bit longword into two 16-bit words. 

max

( n1 n2 -- n3 ) 

n3 is maximum of n1 and n2.

min

( n1 n2 -- n3 ) 

n3 is minimum of n1 and n2.

mod

( n1 n2 -- rem ) 

Remainder of n1 / n2.

negate

( n1 -- n2 ) 

Change the sign of n1.

not

( n1 -- n2 ) 

Bitwise ones complement. 

or

( n1 n2 -- n3 ) 

Bitwise logical OR.

wbsplit

( word -- b.low b.hi ) 

Split 16-bit word into two bytes. 

wljoin

( w.low w.hi -- long ) 

Join two words to form a longword. 

xor

( n1 n2 -- n3 ) 

Bitwise exclusive OR.