This example program will decrement a loop counter held in memory location 2 until that count is 0. It will then load a -1 into the accumulator and loop forever, effectively halting the processor. The code is:

`
`

0 CLR ; Start with 0 in the accumulator.1 ADD ; Load the current loop count into

2 *cnt* ; the accumulator.

3 SUB ; Decrement the loop count by

4 1 ; subtracting 1 from the accumulator.

5 STORE ; Store the count back into

6 2 ; memory location 2.

7 BNZ ; Branch back to the start if

8 0 ; the count is not 0 yet.

9 CLR ; If the count is 0, continue by clearing accumulator.

10 ADD ; Load a -1

11 -1 ; into the accumulator.

12 BNZ ; Loop forever by branching back

13 9 ; to location 9 and repeating.

This program uses negative numbers as data. The eight bit numbers used in Triscuit are all assumed to be 2's complement encoded numbers. This means that the range of numbers that Triscuit can deal with is an astounding -128 to +127. Again, the value of *cnt* is updated by writing the new value back into the instruction.

Sat Nov 29 15:21:21 MST 1997