From 75b4d5b3628c89fb0240300af64657a04ba855d9 Mon Sep 17 00:00:00 2001 From: Thomas Jentzsch Date: Tue, 3 May 2022 10:18:27 +0200 Subject: [PATCH] fixed saved disassembly for extra RAM --- src/debugger/CartDebug.cxx | 59 ++++++++++++++++++-------------------- src/debugger/CartDebug.hxx | 3 +- 2 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/debugger/CartDebug.cxx b/src/debugger/CartDebug.cxx index 87ee117b5..bef8ce200 100644 --- a/src/debugger/CartDebug.cxx +++ b/src/debugger/CartDebug.cxx @@ -268,18 +268,19 @@ bool CartDebug::disassembleAddr(uInt16 address, bool force) segAddress = address; else segAddress = info.offset; - // disassemble segment + // Disassemble segment const bool newChanged = disassemble(bank, segAddress, disassembly, addrToLineList, force); if(!changed && newChanged) { - // clear lists at first change + // Clear lists at first change + // Note: This is currently either true for all or no segments changed = true; myDisassembly.list.clear(); myAddrToLineList.clear(); } - // add extra empty line between segments + // Add extra empty line between segments if(seg < segCount - 1) { CartDebug::DisassemblyTag tag; @@ -289,7 +290,7 @@ bool CartDebug::disassembleAddr(uInt16 address, bool force) addrToLineList.emplace(0, static_cast(disassembly.list.size() + myDisassembly.list.size()) - 1); } - // aggregate segment disassemblies + // Aggregate segment disassemblies myDisassembly.list.insert(myDisassembly.list.end(), disassembly.list.begin(), disassembly.list.end()); myDisassembly.fieldwidth = std::max(myDisassembly.fieldwidth, disassembly.fieldwidth); @@ -310,11 +311,8 @@ bool CartDebug::disassemblePC(bool force) // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool CartDebug::disassembleBank(int bank) { - BankInfo& info = myBankInfo[bank]; - - info.offset = myConsole.cartridge().bankOrigin(bank); - - return disassemble(bank, info.offset, myDisassembly, myAddrToLineList, true); + // Provide no PC + return disassemble(bank, 0xFFFF, myDisassembly, myAddrToLineList, true); } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1100,25 +1098,6 @@ string CartDebug::saveConfigFile() // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - string CartDebug::saveDisassembly(string path) { - string NTSC_COLOR[16] = { - "BLACK", "YELLOW", "BROWN", "ORANGE", - "RED", "MAUVE", "VIOLET", "PURPLE", - "BLUE", "BLUE_CYAN", "CYAN", "CYAN_GREEN", - "GREEN", "GREEN_YELLOW", "GREEN_BEIGE", "BEIGE" - }; - string PAL_COLOR[16] = { - "BLACK0", "BLACK1", "YELLOW", "GREEN_YELLOW", - "ORANGE", "GREEN", "RED", "CYAN_GREEN", - "MAUVE", "CYAN", "VIOLET", "BLUE_CYAN", - "PURPLE", "BLUE", "BLACKE", "BLACKF" - }; - string SECAM_COLOR[8] = { - "BLACK", "BLUE", "RED", "PURPLE", - "GREEN", "CYAN", "YELLOW", "WHITE" - }; - const bool isNTSC = myConsole.timing() == ConsoleTiming::ntsc; - const bool isPAL = myConsole.timing() == ConsoleTiming::pal; - #define ALIGN(x) setfill(' ') << left << setw(x) // We can't print the header to the disassembly until it's actually @@ -1144,7 +1123,6 @@ string CartDebug::saveDisassembly(string path) const uInt16 oldBank = cart.getBank(); // prepare for switching banks - //cart.unlockHotspots(); uInt32 origin = 0; for(int bank = 0; bank < romBankCount; ++bank) @@ -1281,18 +1259,37 @@ string CartDebug::saveDisassembly(string path) << "; Color constants\n" << ";-----------------------------------------------------------\n\n"; - if(isNTSC) + if(myConsole.timing() == ConsoleTiming::ntsc) { + string NTSC_COLOR[16] = { + "BLACK", "YELLOW", "BROWN", "ORANGE", + "RED", "MAUVE", "VIOLET", "PURPLE", + "BLUE", "BLUE_CYAN", "CYAN", "CYAN_GREEN", + "GREEN", "GREEN_YELLOW", "GREEN_BEIGE", "BEIGE" + }; + for(int i = 0; i < 16; ++i) out << ALIGN(16) << NTSC_COLOR[i] << " = $" << Base::HEX2 << (i << 4) << "\n"; } - else if(isPAL) + else if(myConsole.timing() == ConsoleTiming::pal) { + string PAL_COLOR[16] = { + "BLACK0", "BLACK1", "YELLOW", "GREEN_YELLOW", + "ORANGE", "GREEN", "RED", "CYAN_GREEN", + "MAUVE", "CYAN", "VIOLET", "BLUE_CYAN", + "PURPLE", "BLUE", "BLACKE", "BLACKF" + }; + for(int i = 0; i < 16; ++i) out << ALIGN(16) << PAL_COLOR[i] << " = $" << Base::HEX2 << (i << 4) << "\n"; } else { + string SECAM_COLOR[8] = { + "BLACK", "BLUE", "RED", "PURPLE", + "GREEN", "CYAN", "YELLOW", "WHITE" + }; + for(int i = 0; i < 8; ++i) out << ALIGN(16) << SECAM_COLOR[i] << " = $" << Base::HEX1 << (i << 1) << "\n"; } diff --git a/src/debugger/CartDebug.hxx b/src/debugger/CartDebug.hxx index 6f94f6e66..16ec41e16 100644 --- a/src/debugger/CartDebug.hxx +++ b/src/debugger/CartDebug.hxx @@ -317,7 +317,7 @@ class CartDebug : public DebuggerSystem @return True if disassembly changed from previous call, else false */ - bool disassemble(int bank, uInt16 PC, Disassembly& disassembly, + bool disassemble(int bank, uInt16 PC, Disassembly& disassembly, AddrToLineList& addrToLineList, bool force = false); // Actually call DiStella to fill the DisassemblyList structure @@ -345,6 +345,7 @@ class CartDebug : public DebuggerSystem CartDebugWidget* myDebugWidget{nullptr}; // A complete record of relevant diassembly information for each bank + // (ROM banks, RAM banks, ZP RAM) vector myBankInfo; // Used for the disassembly display, and mapping from addresses