diff options
Diffstat (limited to 'src/luma/application/decode.rs')
-rw-r--r-- | src/luma/application/decode.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/luma/application/decode.rs b/src/luma/application/decode.rs index feca794..2c18ab1 100644 --- a/src/luma/application/decode.rs +++ b/src/luma/application/decode.rs @@ -1,6 +1,7 @@ // Copyright 2021-2023 Gabriel Jensen. -use crate::luma::application::{Application, TrapKind}; +use crate::luma::application::Application; +use crate::luma::TrapKind; impl Application { pub fn decode(&mut self, opcode: u32) { @@ -20,7 +21,7 @@ impl Application { 0b11000000000000000000000000000 => self.psr & 0b01000000000000000000000000000000 == 0x00 && self.psr & 0b00010000000000000000000000000000 >> 0x1C == self.psr & 0b10000000000000000000000000000000 >> 0x1F, 0b11010000000000000000000000000 => self.psr & 0b01000000000000000000000000000000 != 0x00 || self.psr & 0b00010000000000000000000000000000 >> 0x1C != self.psr & 0b10000000000000000000000000000000 >> 0x1F, 0b11100000000000000000000000000 => true, - _ => { self.trap(TrapKind::InvalidOpcode, Some(self.registers[0xF] - 0x8), Some(opcode), None); unreachable!(); }, + _ => { self.trap(TrapKind::InvalidOpcode, Some(self.registers[0xF] - 0x8), Some(opcode), None); false }, }; if !condition { return }; @@ -28,7 +29,10 @@ impl Application { let off = opcode & 0b00000000111111111111111111111111; // Offset from pc. let inv = !(opcode - 0x1) & 0b00000000111111111111111111111111; // Inverted offset. - if opcode & 0b00000001000000000000000000000000 != 0x0 { self.registers[0xE] = self.registers[0xF] - 0x4; } + if opcode & 0b00000001000000000000000000000000 != 0x0 { + self.registers[0xE] = self.registers[0xF] - 0x4; + eprintln!("link: lr => {}", self.registers[0xE]); + } self.registers[0xF] = match (off & 0b00000000100000000000000000000000) != 0x0 { // If negative... false => self.registers[0xF] + off * 0x4 + 0x8, @@ -40,6 +44,5 @@ impl Application { } self.trap(TrapKind::InvalidOpcode, Some(self.registers[0xF] - 0x8), Some(opcode), None); - unreachable!(); } } |