From 3c36e71c04a4af387f18a64ecad80664fc02ac52 Mon Sep 17 00:00:00 2001 From: nick-less Date: Mon, 17 Dec 2018 14:32:04 +0100 Subject: [PATCH] add getter for stack, adjusted disply of vector for page direct with x/y --- src/Addressing.cpp | 3 +++ src/Cpu65816.cpp | 4 ++++ src/Cpu65816Debugger.cpp | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/Addressing.cpp b/src/Addressing.cpp index a65ce54..c788e37 100644 --- a/src/Addressing.cpp +++ b/src/Addressing.cpp @@ -183,6 +183,9 @@ Address Cpu65816::getAddressOfOpCodeData(OpCode &opCode) { break; case AddressingMode::DirectPageIndirectIndexedWithY: { + + Log::vrb(LOG_TAG).str("DirectPageIndirectIndexedWithY").hex( mSystemBus.readByte(mProgramAddress.newWithOffset(1))).show(); + Address firstStageAddress(0x00, mD + mSystemBus.readByte(mProgramAddress.newWithOffset(1))); uint16_t secondStageOffset = mSystemBus.readTwoBytes(firstStageAddress); Address thirdStageAddress(mDB, secondStageOffset); diff --git a/src/Cpu65816.cpp b/src/Cpu65816.cpp index 8dea231..1972ab4 100644 --- a/src/Cpu65816.cpp +++ b/src/Cpu65816.cpp @@ -59,6 +59,10 @@ Address Cpu65816::getProgramAddress() { return mProgramAddress; } +Stack *Cpu65816::getStack() { + return &mStack; +} + /** * Resets the cpu to its initial state. diff --git a/src/Cpu65816Debugger.cpp b/src/Cpu65816Debugger.cpp index 9872d73..cadb5f3 100644 --- a/src/Cpu65816Debugger.cpp +++ b/src/Cpu65816Debugger.cpp @@ -157,11 +157,11 @@ void Cpu65816Debugger::logOpCode(OpCode &opCode) const { log.str(" [Direct Page Indirect Long]"); break; case AddressingMode::DirectPageIndexedIndirectWithX: - log.str("(").hex(mCpu.mSystemBus.readByte(mCpu.getAddressOfOpCodeData(opCode)), 2).str(", X)").sp(); + log.str("(").hex(mCpu.mSystemBus.readByte(mCpu.mProgramAddress.newWithOffset(1)), 2).str(", X)").sp(); log.str(" [Direct Page Indexed Indirect, X]"); break; case AddressingMode::DirectPageIndirectIndexedWithY: - log.str("(").hex(mCpu.mSystemBus.readByte(mCpu.getAddressOfOpCodeData(opCode)), 2).str("), Y").sp(); + log.str("(").hex(mCpu.mSystemBus.readByte(mCpu.mProgramAddress.newWithOffset(1)), 2).str("), Y").sp(); log.str(" [Direct Page Indirect Indexed, Y]"); break; case AddressingMode::DirectPageIndirectLongIndexedWithY: