ABCDEFGHIJ
1
2
StatusInsopcode
(first 6 bits)
1 bit9 bitsDescriptionExampleSyntax
3
0okINP0x0register selectorinput channelinput - input channel 2 - ascii keyboard<#LABELNAME> COMMAND <Rx/y>,< Rx/y> / 8-bit number
4
0okOUT0x1register selectorinput channeloutput - output channel 2 - numeric console, 3 - binary console, 4 - ascii console!!! ONLY SPACES AND NO TABS OR \n
after labelname
5
0okLDR0x02register selector1st 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
0okSTR0x03register selector1st 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
0okHLT0x04--stop
8
0okJMS0x05if 0, use register from lsb from the 9 bits, otherwise use 8 bit immediate address valueimmediate value if used / register selectorjumpJMS R0
000101 0 0000 0000 0
JMS 255
000101 1 01111 1111
JMS #LABEL
9
0okPSH0x06register selector-stack push
10
0okPOP0x07register selector-stack pop
11
0okRET0x08--suboutine return
12
0okCMP0x09register selector1st 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
0okBRA0x0A-8 bit mem address (msb unused)branch always
14
0okBEQ0x0B-8 bit mem address (msb unused)br equal
when Z=1, C=1
15
0okBRZ0x0C-8 bit mem address (msb unused)branch if accumulator is zero

16
0okBMI0x0D-8 bit mem address (msb unused)Branch if minus
(when N == 1)
17
0okBPL0x0E-8 bit mem address (msb unused)branch plus
18
0okBGT0x0F-8 bit mem address (msb unused)branch >
19
0okBLT0x10-8 bit mem address (msb unused)branch <
20
0okADD0x11register destination1st 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
additionADD 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
0okSUB0x12register destinationsubtraction
22
0okMUL0x13register destinationmultiplication
23
0okDIV0x14register destinationdivision
24
0okMOD0x15register destinationmodulus
25
0AND0x16register destinationbitwise and
26
0okOR0x17register destinationbitwise orXOR 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
0XOR0x18register destinationbitwise xor
28
0>>0x19register destinationshift right
29
0<<0x1Aregister destinationshift left
30
0NOT0x19register destination-bitwise not
31
0okMOV0x1Cregister destination8-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