summaryrefslogtreecommitdiff
path: root/src/core.rs
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2019-11-19 03:01:07 +0300
committerOxore <oxore@protonmail.com>2019-11-19 03:01:07 +0300
commit6bea1622ee07de01098aba586740625c88ad8eeb (patch)
tree1aae651cd03d8990023774807888cb4865bf7e53 /src/core.rs
parent4ec9b0780e0813e0acd9cfa8e9cb4ca6e9884c5e (diff)
Sort opcode constants and OP_LUT array
Diffstat (limited to 'src/core.rs')
-rw-r--r--src/core.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/core.rs b/src/core.rs
index 4c3202b..dbe26f0 100644
--- a/src/core.rs
+++ b/src/core.rs
@@ -98,7 +98,9 @@ const OPCODE_MOV_DIRECT_DATA: u8 = 0x75;
const OPCODE_SJMP: u8 = 0x80;
const OPCODE_AJMP_P4: u8 = 0x81;
const OPCODE_AJMP_P5: u8 = 0xA1;
+const OPCODE_PUSH: u8 = 0xC0;
const OPCODE_AJMP_P6: u8 = 0xC1;
+const OPCODE_POP: u8 = 0xD0;
const OPCODE_AJMP_P7: u8 = 0xE1;
const OPCODE_MOV_A_DIRECT: u8 = 0xE5;
const OPCODE_MOV_A_INDIRECT_R0: u8 = 0xE6;
@@ -111,8 +113,6 @@ const OPCODE_MOV_A_R4: u8 = 0xEC;
const OPCODE_MOV_A_R5: u8 = 0xED;
const OPCODE_MOV_A_R6: u8 = 0xEE;
const OPCODE_MOV_A_R7: u8 = 0xEF;
-const OPCODE_PUSH: u8 = 0xC0;
-const OPCODE_POP: u8 = 0xD0;
const OP_LUT: [IncompleteOp; u8::max_value() as usize + 1] = {
let mut lut = [IncompleteOp {
@@ -193,12 +193,24 @@ const OP_LUT: [IncompleteOp; u8::max_value() as usize + 1] = {
operand1: Some(IncompleteOperand::Addr11(5)),
operand2: None,
};
+ lut[OPCODE_PUSH as usize] = IncompleteOp {
+ opname: Opname::Push,
+ size: 2,
+ operand1: Some(IncompleteOperand::Direct),
+ operand2: None,
+ };
lut[OPCODE_AJMP_P6 as usize] = IncompleteOp {
opname: Opname::Ajmp,
size: 2,
operand1: Some(IncompleteOperand::Addr11(6)),
operand2: None,
};
+ lut[OPCODE_POP as usize] = IncompleteOp {
+ opname: Opname::Pop,
+ size: 2,
+ operand1: Some(IncompleteOperand::Direct),
+ operand2: None,
+ };
lut[OPCODE_AJMP_P7 as usize] = IncompleteOp {
opname: Opname::Ajmp,
size: 2,
@@ -271,18 +283,6 @@ const OP_LUT: [IncompleteOp; u8::max_value() as usize + 1] = {
operand1: Some(IncompleteOperand::Acc),
operand2: Some(IncompleteOperand::Register(Register::R7)),
};
- lut[OPCODE_PUSH as usize] = IncompleteOp {
- opname: Opname::Push,
- size: 2,
- operand1: Some(IncompleteOperand::Direct),
- operand2: None,
- };
- lut[OPCODE_POP as usize] = IncompleteOp {
- opname: Opname::Pop,
- size: 2,
- operand1: Some(IncompleteOperand::Direct),
- operand2: None,
- };
lut
};