OpenBoot 3.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.

lshift

( n1 +n -- n2 )

Left-shift n1 by +n bits.

rshift

( 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

( n cnt -- n+cnt n )

Prepare arguments for  

do or ?do loop.

bljoin

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

Join four bytes to form a 32-bit value. 

bwjoin

( b.low b.hi -- word )

Join two bytes to form a 16-bit value. 

lbsplit

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

Split a 32-bit value into four bytes. 

lwsplit

( long -- w.low w.hi )

Split a 32-bit value 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.

invert

( n1 -- n2 )

Bitwise ones complement. 

or

( n1 n2 -- n3 )

Bitwise logical OR.

wbsplit

( word -- b.low b.hi )

Split 16-bit value into two bytes. 

wljoin

( w.low w.hi -- long )

Join two 16-bit values to form a 32-bit value. 

xor

( n1 n2 -- n3 )

Bitwise exclusive OR.