Skip to content

Commit

Permalink
Merge pull request #15 from parasyte/fix/disassembler-tracing-ld
Browse files Browse the repository at this point in the history
Fix disassembler tracing early exits with some LD instructions
  • Loading branch information
Rodrigodd authored Dec 24, 2024
2 parents de6258f + 0cace6a commit 35c2798
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions core/src/disassembler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -360,18 +360,14 @@ impl Trace {
return;
}

let cursors = &std::cell::RefCell::new(cursors);

let (step, jump) = compute_step(len, cursor, &op, &rom.cartridge);
cursors.borrow_mut().extend(step);
cursors.extend(step);

let Some(jump) = jump else {
return
};
let Some(jump) = jump else { return };

if let Some(to) = Address::from_cursor(&jump) {
self.add_jump(address, to);
cursors.borrow_mut().push(jump);
cursors.push(jump);
}
}

Expand Down Expand Up @@ -527,7 +523,15 @@ pub fn compute_step(
None,
)
}
(None, 0x0000..=0x7FFF) => (None, None),
(None, 0x0000..=0x7FFF) => (
Some(Cursor {
bank0,
bank,
pc: pc.wrapping_add(len as u16),
reg_a: None,
}),
None,
),
_ => (
Some(Cursor {
bank0,
Expand Down

0 comments on commit 35c2798

Please sign in to comment.