 TDS9092 TECHNICAL MANUAL Forth word list 0 to 3 Live website search Enter key words TDS9092 ALPHANUMERIC WORD DEFINITIONS

0

- 0

Used so often that zero is defined as a constant.

0<

n - f

Leave a true flag if the number is less than zero (i.e. negative), otherwise leave a false flag.

0=

n - f

Leave a true flag if the number is equal to zero, otherwise leave a false flag.

0=0=

n - f

Flag f is 1 if n is not zero, and f is 0 if n is zero. The true/false status of the item on the stack is unchanged but 0=0= may be necessary before a logical operation. E.g.

: TEST

01A0 C@ 4 AND 0=0=

01B0 C@ 8 AND 0=0= AND ;

This returns true if both bit 2 of input 01A0 and bit 3 of 01B0 are both logic 1. 0=0= is equivalent to 0= 0= or NOT NOT .

0>

n - f

Leave f=1 if the number n is greater than zero, otherwise f=0.

0AT

-

Used with LCD displays. Clears the user variable AT which determines where the on the LCD the next character will be written. Sets the first position.

0BRANCH

f -

The run-time procedure to conditionally branch. If f is false (zero), the following in-line parameter is added to the interpretative pointer to branch ahead or back. Compiled by IF UNTIL and WHILE .

0TIME

-

Uses free-running 16-bit timer. Use only in a colon definition together with ?TIME to measure execution time of a word in microseconds. Will upset timekeeping of on-board clock. See ?TIME .

1

- 1

Used so often that one is defined as a constant.

1+

n - n+1

Increment n by 1. (faster than 1 + ).

1-

n - n-1

Decrement n by 1. (faster than 1 - ).

2

- 2

Used so often that two is defined as a constant.

2!

2*

n1 - n2

Multiply n1 by 2 to leave n2. Faster than using 2 * .

2+

n - n+2

Add 2 to n. (faster than 2 + ).

2-

n - n-2

Subtract 2 from n. (faster than 2 - ).

2/

n1 - n2

Divide n1 by 2 to leave n2. Faster than using 2 / .

232OFF

-

Turns off the RS232 serial driver and DC-DC converter chip by setting bit 7 of port 2 to logic 1. This can save power when the serial interfaces are not in use.

232ON

-

Turns on the serial RS232 driver and DC-DC converter by setting bit 7 of port 2 to logic 0. It is in this state at power-up but 232OFF can be used to save power when serial ports are not needed.

2>R

n1 n2 -

Puts two single numbers (or one double number) from the stack to the return stack. Must be matched with 2R> . Not the same as >R >R which would put the items the other way round on the return stack. See 2R> and 2R .

2@

2CONSTANT

d -

-         d

-

SYNTAX:

1234567. 2CONSTANT TEST

Defining word to associate a name with a 32-bit constant. When the example word TEST executes it leaves the double number (32-bit) 1234567 on the stack.

2DROP

n1 n2 -

Drops two numbers from the stack. Can also be considered to drop one double number (32 bits).

2DUP

n1 n2 - n1 n2 n1 n2

Duplicates top two numbers on the stack. Can also be considered to duplicate a double number.

2OVER

d1 d2 - d1 d2 d1

Copies second pair of number to top of stack. Can also be considered to perform OVER on two double numbers.

2R

- n1 n2

Copies two numbers (or one double number) from the top of the return stack to the parameter stack.

2R>

- n1 n2

Transfers two numbers (or one double number) from the return stack to the parameter stack. It must be preceded by 2>R . Not the same as R> R> which would take the items the other way round from the return stack. See 2>R and 2R .

2ROT

d1 d2 d3 - d2 d3 d1

Rotates top three double numbers on the stack. The lowest one is brought to the top.

2SWAP

n1 n2 n3 n4 - n3 n4 n1 n2

Swaps two pairs of numbers on the stack. Can also be considered to swap two double numbers (32-bit).

2VARIABLE

d -

SYNTAX: d 2VARIABLE cccc

COMPILING: Creates a dictionary entry for cccc and reserves 32 bits of space, which at compile-time is initialised to d. The position of the two cells is in line with the dictionary so don't use this word in a stand-alone system where it will end up in ROM.

EXECUTING: At run-time the address of the first of 4 reserved bytes is returned. The application is responsible for initialising the contents of the reserved memory.

3

- 3

Used so often that three is defined as a constant. 