A | B | C | D | E | F | G | H | I | J | |
---|---|---|---|---|---|---|---|---|---|---|
1 | ||||||||||
2 | Status | Ins | opcode (first 6 bits) | 1 bit | 9 bits | Description | Example | Syntax | ||
3 | 0 | ok | INP | 0x0 | register selector | input channel | input - input channel 2 - ascii keyboard | <#LABELNAME> COMMAND <Rx/y>,< Rx/y> / 8-bit number | ||
4 | 0 | ok | OUT | 0x1 | register selector | input channel | output - output channel 2 - numeric console, 3 - binary console, 4 - ascii console | !!! ONLY SPACES AND NO TABS OR \n after labelname | ||
5 | 0 | ok | LDR | 0x02 | register selector | 1st bit - whether load is done with adress from another register / immediate value last 8 bits : memory address if immediate value is used / lsb register selector | load reg ( in memory) | LDR R0,R1 LDR R1,255 000010 0 0 000 0000 1 000010 1 1 1111 1111 | no whitespaces between , | |
6 | 0 | ok | STR | 0x03 | register selector | 1st bit - whether store is done with adress from another register / immediate value last 8 bits : memory address if immediate value is used / lsb register selector | store reg (in memory) | STR R0, R1 STR R0,128 | ||
7 | 0 | ok | HLT | 0x04 | - | - | stop | |||
8 | 0 | ok | JMS | 0x05 | if 0, use register from lsb from the 9 bits, otherwise use 8 bit immediate address value | immediate value if used / register selector | jump | JMS R0 000101 0 0000 0000 0 JMS 255 000101 1 01111 1111 JMS #LABEL | ||
9 | 0 | ok | PSH | 0x06 | register selector | - | stack push | |||
10 | 0 | ok | POP | 0x07 | register selector | - | stack pop | |||
11 | 0 | ok | RET | 0x08 | - | - | suboutine return | |||
12 | 0 | ok | CMP | 0x09 | register selector | 1st bit - whether comparison is done with another register / immediate value immediate comparison : next 8 bits are the value with which the register is compared register comparison : lsb indicates the register used for comparison | compare CMP A,B // NZCV A == B // 0110 A < B // 1000 A > B // 0010 | CMP R0,255 command bits look like : opcode(first 6) - 0(register selector) - 1 (first bit indicates immediate comparison is done) 1111 1111(255, imediate value) so : <opcode>0 1 1111 1111 CMP R1,R0 command bits look like : opcode(first 6) - 1(register selector) - 0 (first bit indicates register comparison is done) 0000 0000(0, because register 0 is used) so : <opcode>0 0 0000 0000 | ||
13 | 0 | ok | BRA | 0x0A | - | 8 bit mem address (msb unused) | branch always | |||
14 | 0 | ok | BEQ | 0x0B | - | 8 bit mem address (msb unused) | br equal when Z=1, C=1 | |||
15 | 0 | ok | BRZ | 0x0C | - | 8 bit mem address (msb unused) | branch if accumulator is zero | |||
16 | 0 | ok | BMI | 0x0D | - | 8 bit mem address (msb unused) | Branch if minus (when N == 1) | |||
17 | 0 | ok | BPL | 0x0E | - | 8 bit mem address (msb unused) | branch plus | |||
18 | 0 | ok | BGT | 0x0F | - | 8 bit mem address (msb unused) | branch > | |||
19 | 0 | ok | BLT | 0x10 | - | 8 bit mem address (msb unused) | branch < | |||
20 | 0 | ok | ADD | 0x11 | register destination | 1st bit - whether operation is done with another register / immediate value register operation : lsb indicates the register used for operation immediate operation : next 8 bits are the value with which the register does the operation | addition | ADD R0, R1 command bits : opcode(first 6),0(register 0 used), 0(first bit in the 9 bits indicates register is used as second operand), 0000 0001 (register 1 used) so : <opcode>0 0 0000 0001 | ||
21 | 0 | ok | SUB | 0x12 | register destination | subtraction | ||||
22 | 0 | ok | MUL | 0x13 | register destination | multiplication | ||||
23 | 0 | ok | DIV | 0x14 | register destination | division | ||||
24 | 0 | ok | MOD | 0x15 | register destination | modulus | ||||
25 | 0 | AND | 0x16 | register destination | bitwise and | |||||
26 | 0 | ok | OR | 0x17 | register destination | bitwise or | XOR R0, 128 command bits : opcode(first 6),1(register 1 used), 1(first bit in the 9 bits indicates immediate value is used as second operand), 1000 0000 (128) so : <opcode>1 1 1000 0000 | |||
27 | 0 | XOR | 0x18 | register destination | bitwise xor | |||||
28 | 0 | >> | 0x19 | register destination | shift right | |||||
29 | 0 | << | 0x1A | register destination | shift left | |||||
30 | 0 | NOT | 0x19 | register destination | - | bitwise not | ||||
31 | 0 | ok | MOV | 0x1C | register destination | 8-bit immediate value (msb unused) | move imeediate value into register | |||
32 | ||||||||||
33 | ||||||||||
34 | ||||||||||
35 | ||||||||||
36 | ||||||||||
37 | ||||||||||
38 | ||||||||||
39 | ||||||||||
40 | ||||||||||
41 | ||||||||||
42 | ||||||||||
43 | ||||||||||
44 | ||||||||||
45 | ||||||||||
46 | ||||||||||
47 | ||||||||||
48 | ||||||||||
49 |