Multiple choiceQuestion 1 · Recall
Loading…
By the end you can say what each instruction in the 9618 instruction set does, decode operands written as #12, B0101 or &4A, and follow the contents of ACC and IX through a short program.
Questions in this topic assume a deliberately tiny processor. It has one general purpose register — everything is loaded into it, worked on, and stored back out.
Because ACC is the only working register, almost every instruction reads from or writes to it. ADD 300 does not say "add to what?" — the answer is always ACC.
Operand notation
The #, B and & symbols in front of an operand tell you which number base it is written in:
| Written | Means | Example | Denary value |
|---|---|---|---|
#123 |
denary | LDM #25 |
25 |
B01001010 |
binary | LDM B1011 |
11 |
&4A |
hexadecimal | LDM &4A |
74 |
An operand can also be an absolute address (a plain number such as 200) or a symbolic address (a label such as total). The assembler turns labels into numbers during pass 2.
MOV IX) or directly (LDR #n).Learn these as a table, not as nineteen separate facts. The group names are syllabus wording and they come back in the next lesson.
Data movement — move values between memory and registers:
| Instruction | What it does |
|---|---|
LDM #n |
load the number n into ACC (immediate addressing) |
LDD <address> |
load ACC with the contents of the address (direct) |
LDI <address> |
use the contents of the address as another address, and load ACC from that (indirect) |
LDX <address> |
load ACC from address + contents of IX (indexed) |
LDR #n |
load the number n into IX |
MOV <register> |
move the contents of ACC into the given register, i.e. MOV IX |
STO <address> |
store the contents of ACC at the address |
Input and output:
| Instruction | What it does |
|---|---|
IN |
take a character from the keyboard, store its ASCII value in ACC |
OUT |
output the character whose ASCII value is in ACC |
Arithmetic:
| Instruction | What it does |
|---|---|
ADD <address> |
add the contents of the address to ACC |
SUB <address> |
subtract the contents of the address from ACC |
INC <register> |
add 1 to the register (INC ACC or INC IX) |
DEC <register> |
subtract 1 from the register |
Unconditional and conditional instructions:
| Instruction | What it does |
|---|---|
JMP <address> |
jump to the address, always |
JPE <address> |
jump only if the last compare was true (equal) |
JPN <address> |
jump only if the last compare was false (not equal) |
END |
stop the program |
Compare:
| Instruction | What it does |
|---|---|
CMP <address> |
compare ACC with the contents of the address |
CMP #n |
compare ACC with the number n |
CMI <address> |
compare ACC with the contents at the address stored in the address (indirect) |
Two easy slips: LDR puts its number in IX, not ACC, and MOV copies out of ACC into IX — the two directions are not interchangeable.
Worked example: Following ACC and IX through six instructions
Memory 200 holds 9. What is in ACC and IX after each instruction?
100 LDM #5
101 ADD 200
102 MOV IX
103 LDR #2
104 INC ACC
105 STO 201