fix JSR absolute indexed indirect

This commit is contained in:
2024-03-16 19:18:20 -05:00
parent d32aa96825
commit a5425f98f6
2 changed files with 2 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ impl CPUInstruction for JSR {
let (bytes, cycles) = cycles::increment_cycles_jsr(self.addressing_mode);
registers.increment_pc(bytes - 1); registers.cycles += cycles;
let value = registers.get_pc_address();
if is_long {
if matches!(self.addressing_mode, AddressingMode::AbsoluteLong) {
push_common::do_push(registers, bus, &[
(value >> 16) as u8,
(value >> 8) as u8,

View File

@@ -150,7 +150,7 @@ pub fn map_opcode_to_instruction(opcode: u8) -> Box<dyn CPUInstruction> {
0xDC => Box::new(JMP{addressing_mode: A::AbsoluteIndirectLong}),
// JSR
0x20 => Box::new(JSR{addressing_mode: A::Absolute}),
0xFC => Box::new(JSR{addressing_mode: A::AbsoluteIndexedIndirect(I::X)}), // TODO: Broken
0xFC => Box::new(JSR{addressing_mode: A::AbsoluteIndexedIndirect(I::X)}),
0x22 => Box::new(JSR{addressing_mode: A::AbsoluteLong}), // same as JSL
// LDA
0xA9 => Box::new(LDA{addressing_mode: A::Immediate}),