Instruction Set
This section covers the complete set of instructions that are included in the
simulator. Each instruction is identified by an opcode (operation code), a
mnemonic and the type of its parameters. An instruction can have zero, one or
two parameters. Two or more instructions of the same type can have the same
mnemonic (e.g. MOV) but differ in their operation code, depending on the type
of the operands that are involved. Thus, an instruction is always coded in
memory as follows:
opcode |
Operand 1 |
Operand 2 |
mandatory |
optional |
optional |
The size of the operation code is always of 8 bits, while the size of the operands can be 8 or 16 bits, depending on their type.
Operand types
The type of operands or addressing modes supported by the simulator are the following. The table includes the code name of the operand type and the size of the instruction operand in memory.
Operand type |
Description |
Size |
|---|---|---|
BYTE |
8-bits immediate value |
8 bits |
WORD |
16-bits immediate value |
16 bits |
ADDRESS |
16-bits address |
16 bits |
REGISTER_8BITS |
8-bits register |
8 bits |
REGISTER_16BITS |
16-bits register |
8 bits |
REGADDRESS |
Register addressing + offset |
16 bits |
The semantics of the operand types are the following:
8-bits immediate value: an operand of this type will define an unsigned 8-bits wide integer value.
16-bits immediate value: An operand of this type will define an unsigned 16-bits wide integer value.
16-bits address: an operand of this type will define an 16-bits memory address.
8-bits register: this operand will codify the reference number or index of one of the 8-bits registers that are implemented by the CPU. All the index values are expressed in decimal format:
Register Name |
Description |
Index |
|---|---|---|
AH |
MSB of Register A |
9 |
AL |
LSB of Register A |
10 |
BH |
MSB of Register B |
11 |
BL |
LSB of Register B |
12 |
CH |
MSB of Register C |
13 |
CL |
LSB of Register C |
14 |
DH |
MSB of Register D |
15 |
DL |
LSB of Register D |
16 |
16-bits register: this operand will codify the reference number or index of one of the 16-bits registers that are implemented by the CPU. All the index values are expressed in decimal format:
Register Name |
Description |
Index |
|---|---|---|
A |
General Purpose Register A |
0 |
B |
General Purpose Register B |
1 |
C |
General Purpose Register C |
2 |
D |
General Purpose Register D |
3 |
SP |
Stack Pointer Register SP |
4 |
Register addressing + offset: this operand will codify on 1 byte the reference number of one of the 16-bits registers and, on the another byte the offset added to the value stored on the given register. The offset is codified using two’s complement [-128, 127].
Instructions description
The assembler simulator supports the following instructions:
ADD: 16-bits addition
Performs an addition of two 16-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. The integer contained by the register will be added to the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
17 (0x11) |
REGISTER_16BITS |
REGISTER_16BITS |
|
18 (0x12) |
REGISTER_16BITS |
REGADDRESS |
|
19 (0x13) |
REGISTER_16BITS |
ADDRESS |
|
20 (0x14) |
REGISTER_16BITS |
WORD |
|
ADDB: 8-bits addition
Performs an addition of two 8-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. The integer contained by the register will be added to the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
21 (0x15) |
REGISTER_8BITS |
REGISTER_8BITS |
|
22 (0x16) |
REGISTER_8BITS |
REGADDRESS |
|
23 (0x17) |
REGISTER_8BITS |
ADDRESS |
|
24 (0x18) |
REGISTER_8BITS |
BYTE |
|
AND: 16-bits bitwise AND
Performs a bitwise AND of two 16-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. A logic AND will be performed between the contents of the register and the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
88 (0x58) |
REGISTER_16BITS |
REGISTER_16BITS |
|
89 (0x59) |
REGISTER_16BITS |
REGADDRESS |
|
90 (0x5A) |
REGISTER_16BITS |
ADDRESS |
|
91 (0x5B) |
REGISTER_16BITS |
WORD |
|
ANDB: 8-bits bitwise AND
Performs a bitwise AND of two 8-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. A logic AND will be performed between the contents of the register and the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
92 (0x5C) |
REGISTER_8BITS |
REGISTER_8BITS |
|
93 (0x5D) |
REGISTER_8BITS |
REGADDRESS |
|
94 (0x5E) |
REGISTER_8BITS |
ADDRESS |
|
95 (0x5F) |
REGISTER_8BITS |
WORD |
|
CALL: call to subroutine
Jumps to a subroutine that starts at the address referenced by Operand 1. The instruction will push to the stack the return address, i.e. the address of the instruction that follows the call.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
69 (0x45) |
REGADDRESS |
NONE |
|
70 (0x46) |
WORD |
NONE |
|
CLI: clear interrupt mask
Clears the Interrupt Mask Bit of the Status Register. When the register is cleared, the CPU interrupts are masked and, thus, disabled. The instruction has no operands. This is a priviledged instruction that can only be called when in Supervisor mode.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
130 (0x82) |
NONE |
NONE |
|
CMP: 16-bits integer comparison
Compares two 16-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. The comparison will be done by substracting the value referenced by the second operand to the value contained by the register referenced by Operand 1. The result of the substraction will not be stored, but the carry (C) and zero (Z) flags of the Status Register will be modified as follows:
Operand 1 == Operand 2 => C = 0, Z = 1
Operand 1 > Operand 2 => C = 0, Z = 0
Operand 1 < Operand 2 => C = 1, Z = 0
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
37 (0x25) |
REGISTER_16BITS |
REGISTER_16BITS |
|
38 (0x26) |
REGISTER_16BITS |
REGADDRESS |
|
39 (0x27) |
REGISTER_16BITS |
ADDRESS |
|
40 (0x28) |
REGISTER_16BITS |
WORD |
|
CMPB: 8-bits integer comparison
Compares two 8-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. The comparison will be done by substracting the value referenced by the second operand to the value contained by the register referenced by Operand 1. The result of the substraction will not be stored, but the carry (C) and zero (Z) flags of the Status Register will be modified as follows:
Operand 1 == Operand 2 => C = 0, Z = 1
Operand 1 > Operand 2 => C = 0, Z = 0
Operand 1 < Operand 2 => C = 1, Z = 0
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
41 (0x29) |
REGISTER_8BITS |
REGISTER_8BITS |
|
42 (0x2A) |
REGISTER_8BITS |
REGADDRESS |
|
43 (0x2B) |
REGISTER_8BITS |
ADDRESS |
|
44 (0x2C) |
REGISTER_8BITS |
BYTE |
|
DEC: decrement 16-bits register
Decrements the value of a 16-bits register by 1 unit. The result will be stored in the same register. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
35 (0x23) |
REGISTER_16BITS |
NONE |
|
DECB: decrement 8-bits register
Decrements the value of an 8-bits register by 1 unit. The result will be stored in the same register. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
36 (0x24) |
REGISTER_16BITS |
NONE |
|
DIV: 16-bits division
Divides the value stored in Register A by the 16-bits value referred to by Operand 1. The result will be stored into Register A. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register. If the instruction executes a divison-by-zero, an exception will be triggered.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
80 (0x50) |
REGISTER_16BITS |
NONE |
|
81 (0x51) |
REGADDRESS |
NONE |
|
82 (0x52) |
ADDRESS |
NONE |
|
83 (0x53) |
WORD |
NONE |
|
DIVB: 8-bits division
Divides the value stored in Register AL by the 8-bits value referred to by Operand 1. The result will be stored into Register AL. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register. If the instruction executes a divison-by-zero, an exception will be triggered.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
84 (0x54) |
REGISTER_8BITS |
NONE |
|
85 (0x55) |
REGADDRESS |
NONE |
|
86 (0x56) |
ADDRESS |
NONE |
|
87 (0x57) |
BYTE |
NONE |
|
HLT: halt processor
Sets the CPU in halt mode. The halt (H) flag of the Status Register will be set and the processor will be stopped from executing further instructions. Interrupts can occur if they are properly enabled. If an interrupt occurs, the CPU will abandon halt mode (halt flag will be cleared) and the execution will resume from the instruction service routine.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
0 (0x0) |
NONE |
NONE |
|
IN: read input/output register
Reads the value of an input/output register. The address of the register to be read is obtained from the value of Operand 1. The result will be stored into Register A. This is a priviledged instruction that can only be called when in Supervisor mode.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
135 (0x87) |
REGISTER_16BITS |
NONE |
|
136 (0x88) |
REGADDRESS |
NONE |
|
137 (0x89) |
ADDRESS |
NONE |
|
138 (0x8A) |
WORD |
NONE |
|
INC: increment 16-bits register
Increments the value of a 16-bits register by 1 unit. The result will be stored in the same register. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
33 (0x21) |
REGISTER_16BITS |
NONE |
|
INCB: increment 8-bits register
Increments the value of an 8-bits register by 1 unit. The result will be stored in the same register. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
34 (0x22) |
REGISTER_16BITS |
NONE |
|
IRET: return from ISR
Returns from an Interrupt Service Routiner (ISR). The execution of this instruction will recover the Instruction Pointer (IP), the Stack Pointer (SP) and the Status Register stored in the stack and jump to the IP address.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
132 (0x84) |
NONE |
NONE |
|
JA: jump if above
Jumps to a given address if the carry (C) and zero (Z) flags of the
Status Register are zero (see CMP: 16-bits integer comparison). If the condition is met,
the CPU will resume its execution from the address referenced by Operand 1.
Otherwise, it will continue with the next instruction. The instruction has one
mnemonic alias: JNBE.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
55 (0x37) |
REGADDRESS |
NONE |
|
56 (0x38) |
WORD |
NONE |
|
JAE: jump if above or equal
JB: jump if below
JBE: jump if below or equal
JC: jump if carry set
Jumps to a given address if the carry (C) flag of the Status Register is
set (see CMP: 16-bits integer comparison). If the condition is met, the CPU will resume
its execution from the address referenced by Operand 1. Otherwise, it will
continue with the next instruction. The instruction has two mnemonic aliases:
JBE and JNAE.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
47 (0x2F) |
REGADDRESS |
NONE |
|
48 (0x30) |
WORD |
NONE |
|
JE: jump if equal
See JZ: jump if zero.
JMP: jump to address
Inconditionally jumps to a given address. The CPU will resume its execution from the address referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
45 (0x2D) |
REGADDRESS |
NONE |
|
46 (0x2E) |
WORD |
NONE |
|
JNA: jump if not above
Jumps to a given address if the carry (C) or zero (Z) flags of the
Status Register are set (see CMP: 16-bits integer comparison). If the condition is met,
the CPU will resume its execution from the address referenced by Operand 1.
Otherwise, it will continue with the next instruction. The instruction has one
mnemonic alias: JBE.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
57 (0x39) |
REGADDRESS |
NONE |
|
58 (0x3A) |
WORD |
NONE |
|
JNAE: jump if not above or equal
JNB: jump if not below
JNBE: jump if not below or equal
JNC: jump if not carry set
Jumps to a given address if the carry (C) flag of the Status Register is
zero (see CMP: 16-bits integer comparison). If the condition is met, the CPU will resume
its execution from the address referenced by Operand 1. Otherwise, it will
continue with the next instruction. The instruction has two mnemonic aliases:
JNB and JAE.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
49 (0x31) |
REGADDRESS |
NONE |
|
50 (0x32) |
WORD |
NONE |
|
JNE: jump if not equal
JNZ: jump if not zero
Jumps to a given address if the zero (Z) flag of the Status Register is set
(see CMP: 16-bits integer comparison). If the condition is met, the CPU will resume its
execution from the address referenced by Operand 1. Otherwise, it will
continue with the next instruction. The instruction has one mnemonic alias:
JNE.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
53 (0x35) |
REGADDRESS |
NONE |
|
54 (0x36) |
WORD |
NONE |
|
JZ: jump if zero
Jumps to a given address if the zero (Z) flag of the Status Register is zero
(see CMP: 16-bits integer comparison). If the condition is met, the CPU will resume its
execution from the address referenced by Operand 1. Otherwise, it will
continue with the next instruction. The instruction has one mnemonic alias:
JE.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
51 (0x33) |
REGADDRESS |
NONE |
|
52 (0x34) |
WORD |
NONE |
|
MOV: 16-bits copy
Copies a 16-bits value, referenced by Operand 2, to the location referred to by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
1 (0x01) |
REGISTER_16BITS |
REGISTER_16BITS |
|
2 (0x02) |
REGISTER_16BITS |
REGADDRESS |
|
3 (0x03) |
REGISTER_16BITS |
ADDRESS |
|
4 (0x04) |
REGADDRESS |
REGISTER_16BITS |
|
5 (0x05) |
ADDRESS |
REGISTER_16BITS |
|
6 (0x06) |
REGISTER_16BITS |
WORD |
|
7 (0x07) |
REGADDRESS |
WORD |
|
8 (0x08) |
ADDRESS |
WORD |
|
MOVB: 8-bits copy
Copies an 8-bits value, referenced by Operand 2, to the location referred to by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
9 (0x09) |
REGISTER_8BITS |
REGISTER_8BITS |
|
10 (0x0A) |
REGISTER_8BITS |
REGADDRESS |
|
11 (0x0B) |
REGISTER_8BITS |
ADDRESS |
|
12 (0x0C) |
REGADDRESS |
REGISTER_8BITS |
|
13 (0x0D) |
ADDRESS |
REGISTER_8BITS |
|
14 (0x0E) |
REGISTER_8BITS |
BYTE |
|
15 (0x0F) |
REGADDRESS |
BYTE |
|
16 (0x10) |
ADDRESS |
BYTE |
|
MUL: 16-bits multiplication
Multiplies the value stored in Register A by the 16-bits value referred to by Operand 1. The result will be stored into Register A. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
72 (0x48) |
REGISTER_16BITS |
NONE |
|
73 (0x49) |
REGADDRESS |
NONE |
|
74 (0x4A) |
ADDRESS |
NONE |
|
75 (0x4B) |
WORD |
NONE |
|
MULB: 8-bits multiplication
Multiplies the value stored in Register AL by the 8-bits value referred to by Operand 1. The result will be stored into Register AL. The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
76 (0x4C) |
REGISTER_8BITS |
NONE |
|
77 (0x4D) |
REGADDRESS |
NONE |
|
78 (0x4E) |
ADDRESS |
NONE |
|
79 (0x4F) |
BYTE |
NONE |
|
NOT: 16-bits bitwise NOT
Performs a bitwise NOT on the bits of a 16-bits register, referenced by Operand 1. The result of the operation will be stored in the same register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
112 (0x70) |
REGISTER_16BITS |
NONE |
|
NOTB: 8-bits bitwise NOT
Performs a bitwise NOT on the bits of an 8-bits register, referenced by Operand 1. The result of the operation will be stored in the same register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
113 (0x71) |
REGISTER_8BITS |
NONE |
|
OR: 16-bits bitwise OR
Performs a bitwise OR of two 16-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. A logic OR will be performed between the contents of the register and the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
96 (0x60) |
REGISTER_16BITS |
REGISTER_16BITS |
|
97 (0x61) |
REGISTER_16BITS |
REGADDRESS |
|
98 (0x62) |
REGISTER_16BITS |
ADDRESS |
|
99 (0x63) |
REGISTER_16BITS |
WORD |
|
ORB: 8-bits bitwise OR
Performs a bitwise OR of two 8-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. A logic OR will be performed between the contents of the register and the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
100 (0x64) |
REGISTER_8BITS |
REGISTER_8BITS |
|
101 (0x65) |
REGISTER_8BITS |
REGADDRESS |
|
102 (0x66) |
REGISTER_8BITS |
ADDRESS |
|
103 (0x67) |
REGISTER_8BITS |
WORD |
|
OUT: write input/output register
Writes the contents of General Purpose Register A into an input/output register. The address of the register to be written is obtained from the value of Operand 1. This is a priviledged instruction that can only be called when in Supervisor mode.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
139 (0x8B) |
REGISTER_16BITS |
NONE |
|
140 (0x8C) |
REGADDRESS |
NONE |
|
141 (0x8D) |
ADDRESS |
NONE |
|
142 (0x8E) |
WORD |
NONE |
|
POP: pop 16-bits from stack
Pops a 16-bits value from the top of the stack and stores it into the 16-bits register referenced by Operand 1. The instruction will update the Stack Pointer (SP), increasing it by 2 units.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
67 (0x43) |
REGISTER_16BITS |
NONE |
|
POPB: pop 8-bits from stack
Pops an 8-bits value from the top of the stack and stores it into the 8-bits register referenced by Operand 1. The instruction will update the Stack Pointer (SP), increasing it by 1 unit.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
68 (0x44) |
REGISTER_8BITS |
NONE |
|
PUSH: push 16-bits to stack
Pushes a 16-bits value, referenced by Operand 1, to the top of the stack. The instruction will update the Stack Pointer (SP), decreasing it by 2 units.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
59 (0x3B) |
REGISTER_16BITS |
NONE |
|
60 (0x3C) |
REGADDRESS |
NONE |
|
61 (0x3D) |
ADDRESS |
NONE |
|
62 (0x3E) |
WORD |
NONE |
|
PUSHB: push 8-bits to stack
Pushes an 8-bits value, referenced by Operand 1, to the top of the stack. The instruction will update the Stack Pointer (SP), decreasing it by 1 units.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
63 (0x3F) |
REGISTER_16BITS |
NONE |
|
64 (0x40) |
REGADDRESS |
NONE |
|
65 (0x41) |
ADDRESS |
NONE |
|
66 (0x42) |
WORD |
NONE |
|
RET: return from subroutine
Returns from a subroutine. The execution of this instruction will pop the Instruction Pointer (IP) stored in the stack and jump to the IP address. The instruction will update the Stack Pointer (SP).
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
71 (0x47) |
NONE |
NONE |
|
SHL: 16-bits logical left shift
Performs a logical left shift of the value of a 16-bits register. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. Operand 2 will indicate the number of bit positions that the value shall be shifted. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
114 (0x72) |
REGISTER_16BITS |
REGISTER_16BITS |
|
115 (0x73) |
REGISTER_16BITS |
REGADDRESS |
|
116 (0x74) |
REGISTER_16BITS |
ADDRESS |
|
117 (0x75) |
REGISTER_16BITS |
WORD |
|
SHLB: 8-bits logical left shift
Performs a logical left shift of the value of an 8-bits register. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. Operand 2 will indicate the number of bit positions that the value shall be shifted. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
118 (0x76) |
REGISTER_8BITS |
REGISTER_8BITS |
|
119 (0x77) |
REGISTER_8BITS |
REGADDRESS |
|
120 (0x78) |
REGISTER_8BITS |
ADDRESS |
|
121 (0x79) |
REGISTER_8BITS |
WORD |
|
SHR: 16-bits logical right shift
Performs a logical right shift of the value of a 16-bits register. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. Operand 2 will indicate the number of bit positions that the value shall be shifted. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
122 (0x7A) |
REGISTER_16BITS |
REGISTER_16BITS |
|
123 (0x7B) |
REGISTER_16BITS |
REGADDRESS |
|
124 (0x7C) |
REGISTER_16BITS |
ADDRESS |
|
125 (0x7D) |
REGISTER_16BITS |
WORD |
|
SHRB: 8-bits logical right shift
Performs a logical right shift of the value of an 8-bits register. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. Operand 2 will indicate the number of bit positions that the value shall be shifted. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
126 (0x7E) |
REGISTER_8BITS |
REGISTER_8BITS |
|
127 (0x7F) |
REGISTER_8BITS |
REGADDRESS |
|
128 (0x80) |
REGISTER_8BITS |
ADDRESS |
|
129 (0x81) |
REGISTER_8BITS |
WORD |
|
SRET: return from system call
Returns from an System Call (SVC). The execution of this instruction will recover the Instruction Pointer (IP) and the user Stack Pointer (SP) stored in the stack and jump to the IP address. This is a priviledged instruction that can only be called when in Supervisor mode. When executed, the CPU will be switched to User mode.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
134 (0x86) |
NONE |
NONE |
|
STI: set interrupt mask
Set the Interrupt Mask Bit of the Status Register. When the register is cleared, the CPU interrupts are unmasked and, thus, enabled. The instruction has no operands. This is a priviledged instruction that can only be called when in Supervisor mode.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
129 (0x81) |
NONE |
NONE |
|
SUB: 16-bits substraction
Performs a substraction of two 16-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. The integer contained by the register will be substracted from the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
25 (0x19) |
REGISTER_16BITS |
REGISTER_16BITS |
|
26 (0x1A) |
REGISTER_16BITS |
REGADDRESS |
|
27 (0x1B) |
REGISTER_16BITS |
ADDRESS |
|
28 (0x1C) |
REGISTER_16BITS |
WORD |
|
SUBB: 8-bits substraction
Performs a substraction of two 8-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. The integer in the Operand 2 will be substracted from the value in the register specified in the Operand 1. The result will be stored in the register referenced by the Operand 1.
The operation will modify the values of the carry (C) and zero (Z) flags of the Status Register.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
29 (0x1D) |
REGISTER_8BITS |
REGISTER_8BITS |
|
30 (0x1E) |
REGISTER_8BITS |
REGADDRESS |
|
31 (0x1F) |
REGISTER_8BITS |
ADDRESS |
|
32 (0x20) |
REGISTER_8BITS |
WORD |
|
SVC: system call
Performs a System Call (SVC). This instruction can only be executed when the CPU is in User mode. The execution of this instruction will: setup the Supervisor stack; push to it the Instruction Pointer (IP) and the user Stack Pointer (SP); switch the CPU to Supervisor mode; and jump to address 0x0006.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
133 (0x85) |
NONE |
NONE |
|
XOR: 16-bits bitwise XOR
Performs a bitwise XOR of two 16-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to a 16-bits register. A logic XOR will be performed between the contents of the register and the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
104 (0x68) |
REGISTER_16BITS |
REGISTER_16BITS |
|
105 (0x69) |
REGISTER_16BITS |
REGADDRESS |
|
106 (0x6A) |
REGISTER_16BITS |
ADDRESS |
|
107 (0x6B) |
REGISTER_16BITS |
WORD |
|
XORB: 8-bits bitwise XOR
Performs a bitwise XOR of two 8-bits integers. Every form of the instruction will have two operands. Operand 1 will always be a reference to an 8-bits register. A logic XOR will be performed between the contents of the register and the value referenced by Operand 2. The result will be stored in the register referenced by Operand 1.
Opcode |
Operand 1 |
Operand 2 |
Example |
|---|---|---|---|
108 (0x6C) |
REGISTER_8BITS |
REGISTER_8BITS |
|
109 (0x6D) |
REGISTER_8BITS |
REGADDRESS |
|
110 (0x6E) |
REGISTER_8BITS |
ADDRESS |
|
111 (0x6F) |
REGISTER_8BITS |
WORD |
|