next up previous
Next: Execution Model Up: No Title Previous: Working With a Partner

Triscuit's Instruction Set

Because Triscuit is a tiny processor, it has an equally tiny instruction set. It includes only 5 instructions. There is also only a single addressing mode. All addressing is immediate. Triscuit is an accumulator machine. That is, the instructions all reference the accumulator, and all operations take place in the accumulator. Except for the CLR instruction, all instructions consist of two eight-bit words. Remember that Triscuit is an eight bit processor, so when you get a word from memory (more on ``memory'' later), you get an eight bit word. In Triscuit code, the first eight bit word is the opcode and the second eight bit word is the data to operate on.

The instructions are:

ADD A
-- Add A to the value of the accumulator. Store the result back in the accumulator.
(Acc tex2html_wrap_inline521 Acc + A)

SUB A
-- Subtract A from the value in the accumulator. Store the result back in the accumulator.
(Acc tex2html_wrap_inline521 Acc - A)

CLR
-- Clear the accumulator to 0. This instruction does not have any data and so it occupies only a single four-bit word in memory. (Acc tex2html_wrap_inline521 0)

STORE A
-- Store the value of the accumulator to memory location A. (Mem[A] tex2html_wrap_inline521 Acc)

BNZ A
-- Branch-non-zero to location A. If the value of the accumulator is anything but zero, jump to location A (load the program counter (PC) with the value of A) and start executing instructions from there. If the accumulator is zero, continue to the next sequential instruction. (If Acc tex2html_wrap_inline529 0, PC tex2html_wrap_inline521 A)

Notice that these instructions all use immediate data. That is, the data word is used directly as data for the program. This means that programs are a little cumbersome to write. Because the program counter (PC) is also only eight bits wide, this means that Triscuit can only address 256 memory locations! Programs written for this machine will have to be pretty compact!




next up previous
Next: Execution Model Up: No Title Previous: Working With a Partner

Erik Brunvand
Sat Nov 29 15:21:21 MST 1997