Introducing the Instruction Set Part 1
This tutorial focuses primarily on introducing the CP1610's instruction set. The instructions divide up into multiple categories that we will explore briefly below. You can visit the various instruction pages for details on specific instructions.
Primary Instructions
The CP1610 has 7 primary instructions. The primary instructions have the most flexibility in terms of where they draw their inputs from. The 7 primary instructions are:
MVI | "MoVe In": Read a value into a register |
---|---|
MVO | "MoVe Out": Write a value from a register to memory |
ADD | Add two values together |
SUB | Subtract two values |
CMP | Compare two values by subtracting them |
AND | Bitwise logical AND |
XOR | Bitwise logical XOR |
Each instruction takes two operands. The first operand is a source operand. The second is both source and destination, except in the case of CMP, which doesn't write a result. (CMP does, however, set flags.)
The primary instructions are available in 4 forms, each with a different addressing mode. The mnemonics for each form differs slightly from the others:
Register Mode | Direct Mode | Indirect Mode | Immediate Mode |
---|---|---|---|
MOVR | MVI | MVI@ | MVII |
-- | MVO | MVO@ | MVOI |
ADDR | ADD | ADD@ | ADDI |
SUBR | SUB | SUB@ | SUBI |
CMPR | CMP | CMP@ | CMPI |
ANDR | AND | AND@ | ANDI |
XORR | XOR | XOR@ | XORI |