From 8d13bd6b180ac6dd652f661b25897b65e948f615 Mon Sep 17 00:00:00 2001 From: Denis-Cosmin NUTIU Date: Sat, 7 Dec 2024 21:43:57 +0200 Subject: [PATCH] update shift instruction to modern behavior --- src/emulator.rs | 6 ++---- src/main.rs | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/emulator.rs b/src/emulator.rs index 0bce48b..ebccee3 100644 --- a/src/emulator.rs +++ b/src/emulator.rs @@ -287,15 +287,13 @@ where ProcessorInstruction::ShiftLeft(vx, vy) => { trace!("ShiftLeft VX={vx:04x} VY={vy:04x}"); // Original chip8 behavior - self.registers[0xF] = (self.registers[vy as usize] & 0x10) >> 4; - self.registers[vx as usize] = self.registers[vy as usize]; + self.registers[0xF] = (self.registers[vx as usize] & 0x10) >> 4; self.registers[vx as usize] <<= 1; } ProcessorInstruction::ShiftRight(vx, vy) => { trace!("ShiftRight VX={vx:04x} VY={vy:04x}"); // Original chip8 behavior - self.registers[0xF] = self.registers[vy as usize] & 0x01; - self.registers[vx as usize] = self.registers[vy as usize]; + self.registers[0xF] = self.registers[vx as usize] & 0x01; self.registers[vx as usize] >>= 1; } ProcessorInstruction::JumpWithOffset(address) => { diff --git a/src/main.rs b/src/main.rs index 11f2dd6..25672e8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -13,7 +13,7 @@ fn main() -> Result<(), anyhow::Error> { let mut emulator = Emulator::new(RatatuiDisplay::new()); - emulator.emulate(String::from("./roms/ibm-logo.ch8"))?; + emulator.emulate(String::from("./roms/3-corax+.ch8"))?; Ok(()) }