From c2dba25b915edd76b5c90487a5b4c4e7a0745152 Mon Sep 17 00:00:00 2001 From: scawful Date: Tue, 5 Dec 2023 03:46:08 -0500 Subject: [PATCH] Immediate addressing sized based on register used --- src/app/emu/cpu/addressing.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/emu/cpu/addressing.cc b/src/app/emu/cpu/addressing.cc index c0aad3b7..ebf77d0b 100644 --- a/src/app/emu/cpu/addressing.cc +++ b/src/app/emu/cpu/addressing.cc @@ -98,8 +98,9 @@ uint32_t CPU::DirectPageIndirectLongIndexedY() { return effective_address; } -uint16_t CPU::Immediate() { - if (GetAccumulatorSize()) { +uint16_t CPU::Immediate(bool index_size) { + bool bit_mode = index_size ? GetIndexSize() : GetAccumulatorSize(); + if (bit_mode) { return memory.ReadByte((PB << 16) | PC + 1); } else { return memory.ReadWord((PB << 16) | PC + 1);