From 7512bad3a0a40e48d0691a93c3cb8f9deba6c2e7 Mon Sep 17 00:00:00 2001 From: Michel Heily Date: Wed, 9 Jun 2021 02:23:16 +0300 Subject: [PATCH] core: debugger: Fix dissassembly Former-commit-id: ec8d6726eb1f599e43b0826e99508cc954454220 Former-commit-id: 3b64d5b60377c303b85be32794df18671002d509 --- core/src/debugger/command.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/core/src/debugger/command.rs b/core/src/debugger/command.rs index 9689085..9fa3895 100644 --- a/core/src/debugger/command.rs +++ b/core/src/debugger/command.rs @@ -184,15 +184,16 @@ impl Debugger { MemWriteCommandSize::Word => gba.sysbus.write_32(addr, val as u32), }, Disass(mode, addr, n) => { - let bytes = gba.sysbus.debug_get_bytes(addr..addr + n); match mode { DisassMode::ModeArm => { + let bytes = gba.sysbus.debug_get_bytes(addr..addr + 4 * n); let disass = Disassembler::::new(addr, &bytes); for (_, line) in disass.take(n as usize) { println!("{}", line) } } DisassMode::ModeThumb => { + let bytes = gba.sysbus.debug_get_bytes(addr..addr + 2 * n); let disass = Disassembler::::new(addr, &bytes); for (_, line) in disass.take(n as usize) { println!("{}", line) @@ -331,7 +332,7 @@ impl Debugger { } 0 => { if let Some(Command::Disass(_mode, addr, n)) = &self.previous_command { - Ok((*addr + (4 * (*n as u32)), 10)) + Ok((*addr + (*n as u32), 10)) } else { Ok((gba.cpu.get_next_pc(), 10)) }