(Hover to enlarge image) |
Mnemonic, mode | Hex | Binary | Instruction | ||
---|---|---|---|---|---|
Load/store instructions | |||||
LDA,i | C0 | 110b r000 | Load into AC from immediate | ||
LDA,d | C1 | 110b r001 | Load into AC from memory address | ||
[ILLEGAL INSTRUCTION] | |||||
STA,d | E1 | 111b r001 | Store from AC into memory | ||
If "b" bit is 1, one byte only.
If "r" bit is 1, use X (index) register; else (accumulator) else instruction memory address of the data. | |||||
Arithmetic instructions | |||||
ADDA,i | 70 | 0111 r000 | Add AC + immediate (into AC) | ||
ADDA,d | 71 | 0111 0001 | Add AC + memory (into AC) | ||
SUBA,i | 80 | 1000 r000 | Subtract AC - immediate (into AC) | ||
SUBA,d | 81 | 1000 r001 | Subtract AC - memory (into AC) | ||
Logical instructions | |||||
ANDA,i | 90 | 1001 r000 | AND AC + immediate (into AC) | ||
ANDA,d | 91 | 1001 r001 | AND AC + memory (into AC) | ||
ORA,i | A0 | 1010 r000 | OR AC + immediate (into AC) | ||
ORA,d | A1 | 1010 r001 | OR AC + memory (into AC) | ||
CPA,i | B0 | 1011 r000 | Compare AC with immediate | ||
CPA,d | B1 | 1011 r001 | Compare AC with memory | ||
NOTA | 18 | 0001 100r | Invert every bit (1-s complement) | ||
NEGA | 1A | 0001 101r | Negate the value (2-s complement) | ||
ASLA | 1C | 0001 110r | Arithmetic shift left (with sign ext.) | ||
ASRA | 1E | 0001 111r | Arithmetic shift right (end-off). | ||
ROLA | 20 | 0010 000r | Rotate left | ||
RORA | 22 | 0010 001r | Rotate right | ||
I/O instructions | |||||
CHARI,d | 49 | 0100 1001 | Character input to memory | ||
CHARO,i | 50 | 0100 1000 | Character output from immediate | ||
CHARO,d | 51 | 0101 1001 | Character output from memory | ||
DECI,d | 31 | 0011 0001 | Read a decimal number into memory. | ||
DECO,i | 38 | 0011 1000 | Write a decimal number from immediate. | ||
DECO,d | 39 | 0011 1001 | Write a decimal number from memory. | ||
STRO | 40 | 0100 0000 | String output trap | ||
Branch instructions | |||||
STOP | 00 | 0000 0000 | Stop the computer! | ||
BR | 04 | 0000 010x | Branch to specified address | ||
BRLE | 06 | 0000 011x | Branch if less-than-or-equal | ||
BRLT | 08 | 0000 100x | Branch if less-than | ||
BREQ | 0A | 0000 101x | Branch if equal | ||
BRNE | 0C | 0000 110x | Branch if not equal | ||
BRGE | 0E | 0000 111x | Branch if greater-or-equal | ||
BRGT | 00 | 0000 000x | Branch if greater | ||
BRV | 02 | 0000 001x | Branch if overflow | ||
BRC | 04 | 0000 010x | Branch if carry | ||
CALL | 06 | 0000 011x | Call subroutine | ||
RETn | 58 | 0101 1nnn | Return from subroutine (with n bytes) | ||
If "x" bit is 1, use X (index) register; else immediate. | |||||
Stack and other instructions | |||||
ADDSP | 60 | 0110 0000 | Add to stack pointer | ||
SUBSP | 61 | 0110 0001 | Subtract from stack pointer | ||
MOVSPA | 02 | 0000 0010 | Move stack pointer to A | ||
MOVFLGA | 03 | 0000 0011 | Move flags (NZVC) to A | ||
RETTR | 01 | 0000 0001 | Return from trap | ||
NOP | 2n | 0010 nnnn | Unary and non-unary no-op trap |
; op-code bits: 31 01 00 DECI,d A ; 0011 0001 31 01 04 DECI,d B ; 0011 0001 C1 01 00 LDA,d A ; 1100 0001 71 01 04 ADDA,d B ; 0111 0001 E1 01 08 STA,d C ; 1110 0001 39 01 08 DECI,d A ; 0011 1001 00 00 00 STOP ; 0000 0000 |
Useful Instructions (immediate and direct forms; register specifier 0 means A): C0 (Load into A Immediate) C1 (Load into A from Address) 00 (Stop) E1 (Store A into Address) 70 (Add to A Immediate) 71 (Add contents of Address to A) 80 (Subtract from A Immediate) 81 (Subtract Address contents from A) 50 (Character Output Immediate) 51 (Character Output from Address) 38 (Decimal Output Immediate) 39 (Decimal Output from Address) 49 (Character Input to Address) 31 (Decimal Input to Address)