Code: Select all
Instructions:
ADD 0x?0, 0x??
AND 0x?1, 0x??
CALL 0x?2, 0x??
CMP 0x?3, 0x??
DIV 0x?4, 0x??
JMP 0x?5, 0x??
MOV 0x?6, 0x??
MUL 0x?7, 0x??
OR 0x?8, 0x??
POP 0x?9, 0x??
PUSH 0x?A, 0x??
RET 0x?B, 0x??
SHL 0x?C, 0x??
SHR 0x?D, 0x??
SUB 0x?E, 0x??
XOR 0x?F, 0x??
First octet Second octet
1 A A A X X X X C C C C B B B B
1 = first octet must be [0x80-0xFF]
X = opcode
A = subtype
B = first operand / first part of 8-bit operand
C = second operand / second part of 8-bit operand
MOV - Move
X = 6, A = 0x00 -> MOV R0, imm8
X = 6, A = 0x01 -> MOV R0, imm8 << 8
X = 6, A = 0x02 -> MOV R0, imm8 << 16
X = 6, A = 0x03 -> MOV R0, imm8 << 24
X = 6, A = 0x04 -> MOV reg, reg
X = 6, A = 0x05 -> MOV mem, reg
X = 6, A = 0x06 -> MOV reg, mem
X = 6, A = 0x07 -> MOV mem, mem
Example:
MOV R0, 0x20 -> 0x86, 0x20
MOV R0, (0x21 << 8) -> 0x96, 0x21
MOV R0, (0x22 << 16) -> 0xA6, 0x22
MOV R0, (0x23 << 24) -> 0xB6, 0x23
MOV R15, R1 -> 0xC6, 0x1F
MOV [R15], R1 -> 0xD6, 0x1F
MOV R15, [R1] -> 0xE6, 0x1F
MOV [R15], [R1] -> 0xF6, 0x1F
ADD - Add
X = 0, A = 0x00 -> ADD R0, imm8
X = 0, A = 0x01 -> ADD R0, imm8 << 8
X = 0, A = 0x02 -> ADD R0, imm8 << 16
X = 0, A = 0x03 -> ADD R0, imm8 << 24
ADD R15, R1 -> 0xC0, 0x1F
ADD [R15], R1 -> 0xD0, 0x1F
ADD R15, [R1] -> 0xE0, 0x1F
ADD [R15], [R1] -> 0xF0, 0x1F