OP Code | Format | Example Effect |
---|---|---|
ADD | ADD REG REG(or NUM) | add a b : a <= (a) + (b) |
SUB | SUB REG REG(or NUM) | sub a b : a <= (a) - (b) |
MUL | MUL REG REG(or NUM) | mul a b : a <= (a) * (b) |
DIV | DIV REG REG(or NUM) | div a b : a <= (a) / (b) |
IN | IN REG | in a : a <= one value of input stream |
OUT | OUT REG | out a : output value of register <= (a) |
LD | LD REG MEM |
(1) ld a 10 : a <= (mem(10))
(2) ld c 8(b) : c <= (mem(8+(b))) |
ST | ST MEM REG |
(1) st 10 a : mem(10) <= (a)
(2) st 5(d) 10 : mem(5+(d)) <= 10 |
JMP | JMP NUM | jmp 10 : jump to line 10 |
BCK | BCK | bck : return from the subroutine |
CMP | CMP REG REG(or NUM) | cmp a 10 : register SW <= ((a) ? 10) |
JEQ | JEQ NUM | jeq 10 : if ((SW) == '='), jump to line 10 |
JGT | JGT NUM | jgt 10 : if ((SW) == '>'), jump to line 10 |
JLT | JLT NUM | jlt 10 : if ((SW) == '<'), jump to line 10 |
MOV | MOV REG REG(or NUM) | mov a b : a <= (b) |
END | END | Indicate the end of the program |
PC | SW | A | B | C | D |
0 |
X |
0 |
0 |
0 |
0 |
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 |