diff options
| author | krolxon <krolyxon@tutanota.com> | 2026-01-05 13:15:01 +0530 |
|---|---|---|
| committer | krolxon <krolyxon@tutanota.com> | 2026-01-05 13:15:01 +0530 |
| commit | 4166b0e5430bd723e31c1198b8d940381aded499 (patch) | |
| tree | 4a919035d0225a7ed752e8692fc03fa8f62c1e25 /src/instructions.rs | |
| parent | 57bbca6cb271f7b5819c02aca9e54e3e3cba8a33 (diff) | |
add cmp instruction, add reg, reg, and reg, imm variations
Diffstat (limited to 'src/instructions.rs')
| -rw-r--r-- | src/instructions.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/instructions.rs b/src/instructions.rs index ac88e94..77de7f4 100644 --- a/src/instructions.rs +++ b/src/instructions.rs @@ -1,23 +1,27 @@ #[repr(u8)] pub enum Instruction { - MOV = 0x01, + MOV_RI = 0x01, + MOV_RR = 0x08, ADD = 0x02, SUB = 0x03, JMP = 0x04, JZ = 0x05, JNZ = 0x06, + CMP_RI = 0x07, + CMP_RR = 0x09, HLT = 0xFF, } impl Instruction { pub fn opcode_name(op: u8) -> &'static str{ match op { - 0x01 => "MOV", + 0x01 | 0x08 => "MOV", 0x02 => "ADD", 0x03 => "SUB", 0x04 => "JMP", 0x05 => "JZ", 0x06 => "JNZ", + 0x07 | 0x09 => "CMP", 0xFF => "HLT", _ => "???", } |
