From 8cb6a83512c80ce29ce31b2f2b86e00e008edb96 Mon Sep 17 00:00:00 2001 From: stephena Date: Thu, 21 Oct 2010 21:01:00 +0000 Subject: [PATCH] Reworked M6502 detection of debugger GFX sections, by moving the actual detection and marking of those areas into the TIA class itself, specifically at the location of the write. In other words, there's no longer an IF statement executed for every STx opcode; the marking is done directly within the write to GRPx or PFx, so extra code is only executed when actually storing to those locations. Fixed several cases of opcodes marking an area as CODE when it should have been DATA. Added output to the CPU area of the debugger for displaying the source address for loading data into the A/X/Y registers. Note that these are only modified when actual addresses are used, so immediate and zero-page mode will show addresses as zero (meaning that no address was involved in retrieving the data). Tweaked console font to better diffentiate the disassembly output between graphics for players and graphics for the playfield. Bumped state file format because of changes to M6502. This means old state files will be broken. Bumped version # for next test release. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2157 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba --- src/common/Version.hxx | 2 +- src/debugger/CpuDebug.cxx | 8 +++ src/debugger/CpuDebug.hxx | 1 + src/debugger/gui/CpuWidget.cxx | 24 +++++++ src/debugger/gui/CpuWidget.hxx | 1 + src/emucore/M6502.cxx | 29 +++++--- src/emucore/M6502.hxx | 30 +++++++- src/emucore/M6502.ins | 124 ++++++++++++++++----------------- src/emucore/M6502.m4 | 70 +++++++++---------- src/emucore/StateManager.cxx | 4 +- src/emucore/TIA.cxx | 29 ++++++++ src/gui/ConsoleFont.hxx | 12 ++-- 12 files changed, 214 insertions(+), 120 deletions(-) diff --git a/src/common/Version.hxx b/src/common/Version.hxx index 103ea7935..361ef53a8 100644 --- a/src/common/Version.hxx +++ b/src/common/Version.hxx @@ -22,7 +22,7 @@ #include -#define STELLA_VERSION "3.3_test8" +#define STELLA_VERSION "3.3_test9" #define STELLA_BUILD atoi("$Rev$" + 6) #endif diff --git a/src/debugger/CpuDebug.cxx b/src/debugger/CpuDebug.cxx index e88519d53..a8d30ba24 100644 --- a/src/debugger/CpuDebug.cxx +++ b/src/debugger/CpuDebug.cxx @@ -43,6 +43,10 @@ const DebuggerState& CpuDebug::getState() myState.X = mySystem.m6502().X; myState.Y = mySystem.m6502().Y; + myState.srcA = mySystem.m6502().lastSrcAddressA(); + myState.srcX = mySystem.m6502().lastSrcAddressX(); + myState.srcY = mySystem.m6502().lastSrcAddressY(); + Debugger::set_bits(myState.PS, myState.PSbits); return myState; @@ -58,6 +62,10 @@ void CpuDebug::saveOldState() myOldState.X = mySystem.m6502().X; myOldState.Y = mySystem.m6502().Y; + myOldState.srcA = mySystem.m6502().lastSrcAddressA(); + myOldState.srcX = mySystem.m6502().lastSrcAddressX(); + myOldState.srcY = mySystem.m6502().lastSrcAddressY(); + Debugger::set_bits(myOldState.PS, myOldState.PSbits); } diff --git a/src/debugger/CpuDebug.hxx b/src/debugger/CpuDebug.hxx index 0881c029e..693188ff8 100644 --- a/src/debugger/CpuDebug.hxx +++ b/src/debugger/CpuDebug.hxx @@ -37,6 +37,7 @@ class CpuState : public DebuggerState { public: int PC, SP, PS, A, X, Y; + int srcA, srcX, srcY; BoolArray PSbits; }; diff --git a/src/debugger/gui/CpuWidget.cxx b/src/debugger/gui/CpuWidget.cxx index 62e1b1443..9e7fa1ae6 100644 --- a/src/debugger/gui/CpuWidget.cxx +++ b/src/debugger/gui/CpuWidget.cxx @@ -80,6 +80,15 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y) new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 8, kBASE_2); myCpuGridBinValue->setEditable(false); + // Create a label and 1x3 grid showing the source of data for A/X/Y registers + xpos += myCpuGridBinValue->getWidth() + 20; + new StaticTextWidget(boss, font, xpos-font.getMaxCharWidth(), ypos+1, + font.getStringWidth("Data Src"), fontHeight, "Data Src", + kTextAlignLeft); + myCpuDataSrcGrid = + new DataGridWidget(boss, font, xpos, ypos+lineHeight, 1, 3, 4, 16, kBASE_16); + myCpuDataSrcGrid->setEditable(false); + // Add labels for other CPU registers xpos = x; string labels[4] = { "SP:", "A:", "X:", "Y:" }; @@ -276,6 +285,21 @@ void CpuWidget::fillGrid() myCpuGridDecValue->setList(alist, vlist, changed); myCpuGridBinValue->setList(alist, vlist, changed); + // Update the data sources for the A/X/Y registers + alist.clear(); vlist.clear(); changed.clear(); + alist.push_back(0); + alist.push_back(0); + alist.push_back(0); + + vlist.push_back(state.srcA); + vlist.push_back(state.srcX); + vlist.push_back(state.srcY); + + changed.push_back(state.srcA != oldstate.srcA); + changed.push_back(state.srcX != oldstate.srcX); + changed.push_back(state.srcY != oldstate.srcY); + myCpuDataSrcGrid->setList(alist, vlist, changed); + // Update the PS register booleans changed.clear(); for(unsigned int i = 0; i < state.PSbits.size(); ++i) diff --git a/src/debugger/gui/CpuWidget.hxx b/src/debugger/gui/CpuWidget.hxx index 7ab183e31..e5ab43dd1 100644 --- a/src/debugger/gui/CpuWidget.hxx +++ b/src/debugger/gui/CpuWidget.hxx @@ -77,6 +77,7 @@ class CpuWidget : public Widget, public CommandSender DataGridWidget* myCpuGrid; DataGridWidget* myCpuGridDecValue; DataGridWidget* myCpuGridBinValue; + DataGridWidget* myCpuDataSrcGrid; ToggleBitWidget* myPSRegister; EditTextWidget* myPCLabel; }; diff --git a/src/emucore/M6502.cxx b/src/emucore/M6502.cxx index 085d70e64..83a6320c1 100644 --- a/src/emucore/M6502.cxx +++ b/src/emucore/M6502.cxx @@ -58,9 +58,10 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle) myLastAddress(0), myLastPeekAddress(0), myLastPokeAddress(0), - myLastPeekAddressA(0), - myLastPeekAddressX(0), - myLastPeekAddressY(0) + myLastSrcAddressA(0), + myLastSrcAddressX(0), + myLastSrcAddressY(0), + myDataAddressForPoke(0) { #ifdef DEBUGGER_SUPPORT myDebugger = NULL; @@ -121,7 +122,8 @@ void M6502::reset() myTotalInstructionCount = 0; myLastAddress = myLastPeekAddress = myLastPokeAddress = 0; - myLastPeekAddressA = myLastPeekAddressX = myLastPeekAddressY = 0; + myLastSrcAddressA = myLastSrcAddressX = myLastSrcAddressY = 0; + myDataAddressForPoke = 0; } // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -268,7 +270,7 @@ bool M6502::execute(uInt32 number) uInt8 operand = 0; // Reset the peek/poke address pointers - myLastPeekAddress = myLastPokeAddress = 0; + myLastPeekAddress = myLastPokeAddress = myDataAddressForPoke = 0; // Fetch instruction at the program counter IR = peek(PC++, DISASM_CODE); // This address represents a code section @@ -390,9 +392,14 @@ bool M6502::save(Serializer& out) const // Indicates the number of distinct memory accesses out.putInt(myNumberOfDistinctAccesses); - // Indicates the last address which was accessed + // Indicates the last address(es) which was accessed out.putInt(myLastAddress); - + out.putInt(myLastPeekAddress); + out.putInt(myLastPokeAddress); + out.putInt(myLastSrcAddressA); + out.putInt(myLastSrcAddressX); + out.putInt(myLastSrcAddressY); + out.putInt(myDataAddressForPoke); } catch(const char* msg) { @@ -432,8 +439,14 @@ bool M6502::load(Serializer& in) // Indicates the number of distinct memory accesses myNumberOfDistinctAccesses = (uInt32) in.getInt(); - // Indicates the last address which was accessed + // Indicates the last address(es) which was accessed myLastAddress = (uInt16) in.getInt(); + myLastPeekAddress = (uInt16) in.getInt(); + myLastPokeAddress = (uInt16) in.getInt(); + myLastSrcAddressA = (uInt16) in.getInt(); + myLastSrcAddressX = (uInt16) in.getInt(); + myLastSrcAddressY = (uInt16) in.getInt(); + myDataAddressForPoke = (uInt16) in.getInt(); } catch(const char* msg) { diff --git a/src/emucore/M6502.hxx b/src/emucore/M6502.hxx index 95b550506..bf47e6bf3 100644 --- a/src/emucore/M6502.hxx +++ b/src/emucore/M6502.hxx @@ -147,6 +147,26 @@ class M6502 : public Serializable myLastPeekAddress; } + /** + Return the source of the address that was used for a write/poke. + Note that this isn't the same as the address that is poked, but + is instead the address of the *data* that is poked (if any). + + @return The address of the data used in the last poke, else 0 + */ + uInt16 lastDataAddressForPoke() const { return myDataAddressForPoke; } + + /** + Return the last data address used as part of a peek operation for + the A/X/Y registers. Note that if an address wasn't used (as in + immediate mode), then the address is zero. + + @return The address of the data used in the last peek, else 0 + */ + uInt16 lastSrcAddressA() const { return myLastSrcAddressA; } + uInt16 lastSrcAddressX() const { return myLastSrcAddressX; } + uInt16 lastSrcAddressY() const { return myLastSrcAddressY; } + /** Get the total number of instructions executed so far. @@ -301,9 +321,15 @@ class M6502 : public Serializable /// by a peek or poke command uInt16 myLastPeekAddress, myLastPokeAddress; - /// Indicates the last address which was accessed by a peek command + /// Indicates the last address used to access data by a peek command /// for the CPU registers (A/X/Y) - uInt16 myLastPeekAddressA, myLastPeekAddressX, myLastPeekAddressY; + uInt16 myLastSrcAddressA, myLastSrcAddressX, myLastSrcAddressY; + + /// Indicates the data address used by the last command that performed + /// a poke (currently, the last address used by STx) + /// If an address wasn't used (ie, as in immediate mode), the address + /// is set to zero + uInt16 myDataAddressForPoke; #ifdef DEBUGGER_SUPPORT /// Pointer to the debugger for this processor or the null pointer diff --git a/src/emucore/M6502.ins b/src/emucore/M6502.ins index 2b71c7b96..19c1d7c01 100644 --- a/src/emucore/M6502.ins +++ b/src/emucore/M6502.ins @@ -14,7 +14,7 @@ // See the file "License.txt" for information on usage and redistribution of // this file, and for a DISCLAIMER OF ALL WARRANTIES. // -// $Id: M6502.m4 2153 2010-10-11 23:32:37Z stephena $ +// $Id: M6502.m4 2156 2010-10-21 17:46:23Z stephena $ //============================================================================ /** @@ -24,7 +24,7 @@ 'm4 M6502.m4 > M6502.ins' @author Bradford W. Mott - @version $Id: M6502.m4 2153 2010-10-11 23:32:37Z stephena $ + @version $Id: M6502.m4 2156 2010-10-21 17:46:23Z stephena $ */ #ifndef NOTSAMEPAGE @@ -47,15 +47,11 @@ #endif #endif -#ifndef CHECK_GFX_WRITE +#ifndef SET_LAST_POKE #ifdef DEBUGGER_SUPPORT - #define CHECK_GFX_WRITE(_addr) \ - if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \ - mySystem->setAddressDisasmType(_addr, DISASM_GFX); \ - else if((operandAddress == 0x0D || operandAddress == 0x0E || operandAddress == 0x0F) && _addr) \ - mySystem->setAddressDisasmType(_addr, DISASM_PGFX); + #define SET_LAST_POKE(_addr) myDataAddressForPoke = _addr; #else - #define CHECK_GFX_WRITE(_addr) + #define SET_LAST_POKE(_addr) #endif #endif @@ -277,7 +273,7 @@ case 0x69: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(!D) @@ -601,7 +597,7 @@ break; case 0x4b: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { A &= operand; @@ -620,7 +616,7 @@ break; case 0x0b: case 0x2b: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { A &= operand; @@ -633,7 +629,7 @@ break; case 0x29: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { A &= operand; @@ -757,7 +753,7 @@ break; case 0x8b: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { // NOTE: The implementation of this instruction is based on @@ -772,7 +768,7 @@ break; case 0x6b: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { // NOTE: The implementation of this instruction is based on @@ -913,12 +909,12 @@ break; case 0x90: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(!C) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -930,12 +926,12 @@ break; case 0xb0: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(C) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -947,12 +943,12 @@ break; case 0xf0: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(!notZ) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -989,12 +985,12 @@ break; case 0x30: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(N) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -1006,12 +1002,12 @@ break; case 0xD0: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(notZ) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -1023,12 +1019,12 @@ break; case 0x10: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(!N) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -1058,12 +1054,12 @@ break; case 0x50: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(!V) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -1075,12 +1071,12 @@ break; case 0x70: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { if(V) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -1132,7 +1128,7 @@ break; case 0xc9: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { uInt16 value = (uInt16)A - (uInt16)operand; @@ -1272,7 +1268,7 @@ break; case 0xe0: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { uInt16 value = (uInt16)X - (uInt16)operand; @@ -1314,7 +1310,7 @@ break; case 0xc0: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { uInt16 value = (uInt16)Y - (uInt16)operand; @@ -1586,7 +1582,7 @@ break; case 0x49: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { A ^= operand; @@ -2250,9 +2246,9 @@ break; // LDA case 0xa9: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } -CLEAR_LAST_PEEK(myLastPeekAddressA) +CLEAR_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2264,7 +2260,7 @@ case 0xa5: { operand = peek(peek(PC++, DISASM_CODE), DISASM_DATA); } -CLEAR_LAST_PEEK(myLastPeekAddressA) +CLEAR_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2279,7 +2275,7 @@ case 0xb5: address += X; operand = peek(address, DISASM_DATA); } -CLEAR_LAST_PEEK(myLastPeekAddressA) +CLEAR_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2293,7 +2289,7 @@ case 0xad: intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); operand = peek(intermediateAddress, DISASM_DATA); } -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2313,7 +2309,7 @@ case 0xbd: operand = peek(intermediateAddress, DISASM_DATA); } } -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2333,7 +2329,7 @@ case 0xb9: operand = peek(intermediateAddress, DISASM_DATA); } } -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2350,7 +2346,7 @@ case 0xa1: intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8); operand = peek(intermediateAddress, DISASM_DATA); } -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2371,7 +2367,7 @@ case 0xb1: operand = peek(intermediateAddress, DISASM_DATA); } } -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) { A = operand; notZ = A; @@ -2385,9 +2381,9 @@ break; // LDX case 0xa2: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } -CLEAR_LAST_PEEK(myLastPeekAddressX) +CLEAR_LAST_PEEK(myLastSrcAddressX) { X = operand; notZ = X; @@ -2399,7 +2395,7 @@ case 0xa6: { operand = peek(peek(PC++, DISASM_CODE), DISASM_DATA); } -CLEAR_LAST_PEEK(myLastPeekAddressX) +CLEAR_LAST_PEEK(myLastSrcAddressX) { X = operand; notZ = X; @@ -2414,7 +2410,7 @@ case 0xb6: address += Y; operand = peek(address, DISASM_DATA); } -CLEAR_LAST_PEEK(myLastPeekAddressX) +CLEAR_LAST_PEEK(myLastSrcAddressX) { X = operand; notZ = X; @@ -2428,7 +2424,7 @@ case 0xae: intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); operand = peek(intermediateAddress, DISASM_DATA); } -SET_LAST_PEEK(myLastPeekAddressX) +SET_LAST_PEEK(myLastSrcAddressX) { X = operand; notZ = X; @@ -2448,7 +2444,7 @@ case 0xbe: operand = peek(intermediateAddress, DISASM_DATA); } } -SET_LAST_PEEK(myLastPeekAddressX) +SET_LAST_PEEK(myLastSrcAddressX) { X = operand; notZ = X; @@ -2462,9 +2458,9 @@ break; // LDY case 0xa0: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } -CLEAR_LAST_PEEK(myLastPeekAddressY) +CLEAR_LAST_PEEK(myLastSrcAddressY) { Y = operand; notZ = Y; @@ -2476,7 +2472,7 @@ case 0xa4: { operand = peek(peek(PC++, DISASM_CODE), DISASM_DATA); } -CLEAR_LAST_PEEK(myLastPeekAddressY) +CLEAR_LAST_PEEK(myLastSrcAddressY) { Y = operand; notZ = Y; @@ -2491,7 +2487,7 @@ case 0xb4: address += X; operand = peek(address, DISASM_DATA); } -CLEAR_LAST_PEEK(myLastPeekAddressY) +CLEAR_LAST_PEEK(myLastSrcAddressY) { Y = operand; notZ = Y; @@ -2505,7 +2501,7 @@ case 0xac: intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8); operand = peek(intermediateAddress, DISASM_DATA); } -SET_LAST_PEEK(myLastPeekAddressY) +SET_LAST_PEEK(myLastSrcAddressY) { Y = operand; notZ = Y; @@ -2525,7 +2521,7 @@ case 0xbc: operand = peek(intermediateAddress, DISASM_DATA); } } -SET_LAST_PEEK(myLastPeekAddressY) +SET_LAST_PEEK(myLastSrcAddressY) { Y = operand; notZ = Y; @@ -2632,7 +2628,7 @@ break; case 0xab: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { // NOTE: The implementation of this instruction is based on @@ -2665,7 +2661,7 @@ case 0x89: case 0xc2: case 0xe2: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { } @@ -2731,7 +2727,7 @@ break; case 0x09: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { A |= operand; @@ -3656,7 +3652,7 @@ break; case 0xe9: case 0xeb: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { // N, V, Z, C flags are the same in either mode (C calculated at the end) @@ -3956,7 +3952,7 @@ break; case 0xcb: { - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); } { uInt16 value = (uInt16)(X & A) - (uInt16)operand; @@ -4383,7 +4379,7 @@ case 0x85: { operandAddress = peek(PC++, DISASM_CODE); } -CHECK_GFX_WRITE(myLastPeekAddressA) +SET_LAST_POKE(myLastSrcAddressA) { poke(operandAddress, A); } @@ -4468,7 +4464,7 @@ case 0x86: { operandAddress = peek(PC++, DISASM_CODE); } -CHECK_GFX_WRITE(myLastPeekAddressX) +SET_LAST_POKE(myLastSrcAddressX) { poke(operandAddress, X); } @@ -4503,7 +4499,7 @@ case 0x84: { operandAddress = peek(PC++, DISASM_CODE); } -CHECK_GFX_WRITE(myLastPeekAddressY) +SET_LAST_POKE(myLastSrcAddressY) { poke(operandAddress, Y); } diff --git a/src/emucore/M6502.m4 b/src/emucore/M6502.m4 index 805688776..d39ed6387 100644 --- a/src/emucore/M6502.m4 +++ b/src/emucore/M6502.m4 @@ -47,15 +47,11 @@ #endif #endif -#ifndef CHECK_GFX_WRITE +#ifndef SET_LAST_POKE #ifdef DEBUGGER_SUPPORT - #define CHECK_GFX_WRITE(_addr) \ - if((operandAddress == 0x1B || operandAddress == 0x1C) && _addr) \ - mySystem->setAddressDisasmType(_addr, DISASM_GFX); \ - else if((operandAddress == 0x0D || operandAddress == 0x0E || operandAddress == 0x0F) && _addr) \ - mySystem->setAddressDisasmType(_addr, DISASM_PGFX); + #define SET_LAST_POKE(_addr) myDataAddressForPoke = _addr; #else - #define CHECK_GFX_WRITE(_addr) + #define SET_LAST_POKE(_addr) #endif #endif @@ -65,7 +61,7 @@ define(M6502_IMPLIED, `{ }') define(M6502_IMMEDIATE_READ, `{ - operand = peek(PC++, DISASM_DATA); + operand = peek(PC++, DISASM_CODE); }') define(M6502_ABSOLUTE_READ, `{ @@ -271,7 +267,7 @@ define(M6502_INDIRECTY_READMODIFYWRITE, `{ define(M6502_BCC, `{ if(!C) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -282,7 +278,7 @@ define(M6502_BCC, `{ define(M6502_BCS, `{ if(C) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -293,7 +289,7 @@ define(M6502_BCS, `{ define(M6502_BEQ, `{ if(!notZ) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -304,7 +300,7 @@ define(M6502_BEQ, `{ define(M6502_BMI, `{ if(N) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -315,7 +311,7 @@ define(M6502_BMI, `{ define(M6502_BNE, `{ if(notZ) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -326,7 +322,7 @@ define(M6502_BNE, `{ define(M6502_BPL, `{ if(!N) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -337,7 +333,7 @@ define(M6502_BPL, `{ define(M6502_BVC, `{ if(!V) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -348,7 +344,7 @@ define(M6502_BVC, `{ define(M6502_BVS, `{ if(V) { - peek(PC, DISASM_CODE); + peek(PC, DISASM_DATA); uInt16 address = PC + (Int8)operand; if(NOTSAMEPAGE(PC, address)) peek((PC & 0xFF00) | (address & 0x00FF), DISASM_DATA); @@ -1533,49 +1529,49 @@ break; // LDA case 0xa9: M6502_IMMEDIATE_READ -CLEAR_LAST_PEEK(myLastPeekAddressA) +CLEAR_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xa5: M6502_ZERO_READ -CLEAR_LAST_PEEK(myLastPeekAddressA) +CLEAR_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xb5: M6502_ZEROX_READ -CLEAR_LAST_PEEK(myLastPeekAddressA) +CLEAR_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xad: M6502_ABSOLUTE_READ -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xbd: M6502_ABSOLUTEX_READ -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xb9: M6502_ABSOLUTEY_READ -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xa1: M6502_INDIRECTX_READ -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; case 0xb1: M6502_INDIRECTY_READ -SET_LAST_PEEK(myLastPeekAddressA) +SET_LAST_PEEK(myLastSrcAddressA) M6502_LDA break; ////////////////////////////////////////////////// @@ -1585,31 +1581,31 @@ break; // LDX case 0xa2: M6502_IMMEDIATE_READ -CLEAR_LAST_PEEK(myLastPeekAddressX) +CLEAR_LAST_PEEK(myLastSrcAddressX) M6502_LDX break; case 0xa6: M6502_ZERO_READ -CLEAR_LAST_PEEK(myLastPeekAddressX) +CLEAR_LAST_PEEK(myLastSrcAddressX) M6502_LDX break; case 0xb6: M6502_ZEROY_READ -CLEAR_LAST_PEEK(myLastPeekAddressX) +CLEAR_LAST_PEEK(myLastSrcAddressX) M6502_LDX break; case 0xae: M6502_ABSOLUTE_READ -SET_LAST_PEEK(myLastPeekAddressX) +SET_LAST_PEEK(myLastSrcAddressX) M6502_LDX break; case 0xbe: M6502_ABSOLUTEY_READ -SET_LAST_PEEK(myLastPeekAddressX) +SET_LAST_PEEK(myLastSrcAddressX) M6502_LDX break; ////////////////////////////////////////////////// @@ -1619,31 +1615,31 @@ break; // LDY case 0xa0: M6502_IMMEDIATE_READ -CLEAR_LAST_PEEK(myLastPeekAddressY) +CLEAR_LAST_PEEK(myLastSrcAddressY) M6502_LDY break; case 0xa4: M6502_ZERO_READ -CLEAR_LAST_PEEK(myLastPeekAddressY) +CLEAR_LAST_PEEK(myLastSrcAddressY) M6502_LDY break; case 0xb4: M6502_ZEROX_READ -CLEAR_LAST_PEEK(myLastPeekAddressY) +CLEAR_LAST_PEEK(myLastSrcAddressY) M6502_LDY break; case 0xac: M6502_ABSOLUTE_READ -SET_LAST_PEEK(myLastPeekAddressY) +SET_LAST_PEEK(myLastSrcAddressY) M6502_LDY break; case 0xbc: M6502_ABSOLUTEX_READ -SET_LAST_PEEK(myLastPeekAddressY) +SET_LAST_PEEK(myLastSrcAddressY) M6502_LDY break; ////////////////////////////////////////////////// @@ -2129,7 +2125,7 @@ break; // STA case 0x85: M6502_ZERO_WRITE -CHECK_GFX_WRITE(myLastPeekAddressA) +SET_LAST_POKE(myLastSrcAddressA) M6502_STA break; @@ -2169,7 +2165,7 @@ break; // STX case 0x86: M6502_ZERO_WRITE -CHECK_GFX_WRITE(myLastPeekAddressX) +SET_LAST_POKE(myLastSrcAddressX) M6502_STX break; @@ -2189,7 +2185,7 @@ break; // STY case 0x84: M6502_ZERO_WRITE -CHECK_GFX_WRITE(myLastPeekAddressY) +SET_LAST_POKE(myLastSrcAddressY) M6502_STY break; diff --git a/src/emucore/StateManager.cxx b/src/emucore/StateManager.cxx index 4956ce2ec..67f1bd90b 100644 --- a/src/emucore/StateManager.cxx +++ b/src/emucore/StateManager.cxx @@ -30,8 +30,8 @@ #include "StateManager.hxx" -#define STATE_HEADER "03020000state" -#define MOVIE_HEADER "03020000movie" +#define STATE_HEADER "03030900state" +#define MOVIE_HEADER "03030900movie" // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - StateManager::StateManager(OSystem* osystem) diff --git a/src/emucore/TIA.cxx b/src/emucore/TIA.cxx index 78efeb369..e4e47e581 100644 --- a/src/emucore/TIA.cxx +++ b/src/emucore/TIA.cxx @@ -23,6 +23,10 @@ #include "bspf.hxx" +#ifdef DEBUGGER_SUPPORT + #include "CartDebug.hxx" +#endif + #include "Console.hxx" #include "Control.hxx" #include "Device.hxx" @@ -1468,6 +1472,11 @@ bool TIA::poke(uInt16 addr, uInt8 value) else myEnabledObjects |= PFBit; + #ifdef DEBUGGER_SUPPORT + uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); + if(dataAddr) + mySystem->setAddressDisasmType(dataAddr, CartDebug::PGFX); + #endif break; } @@ -1480,6 +1489,11 @@ bool TIA::poke(uInt16 addr, uInt8 value) else myEnabledObjects |= PFBit; + #ifdef DEBUGGER_SUPPORT + uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); + if(dataAddr) + mySystem->setAddressDisasmType(dataAddr, CartDebug::PGFX); + #endif break; } @@ -1492,6 +1506,11 @@ bool TIA::poke(uInt16 addr, uInt8 value) else myEnabledObjects |= PFBit; + #ifdef DEBUGGER_SUPPORT + uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); + if(dataAddr) + mySystem->setAddressDisasmType(dataAddr, CartDebug::PGFX); + #endif break; } @@ -1727,6 +1746,11 @@ bool TIA::poke(uInt16 addr, uInt8 value) else myEnabledObjects &= ~P1Bit; + #ifdef DEBUGGER_SUPPORT + uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); + if(dataAddr) + mySystem->setAddressDisasmType(dataAddr, CartDebug::GFX); + #endif break; } @@ -1765,6 +1789,11 @@ bool TIA::poke(uInt16 addr, uInt8 value) else myEnabledObjects &= ~BLBit; + #ifdef DEBUGGER_SUPPORT + uInt16 dataAddr = mySystem->m6502().lastDataAddressForPoke(); + if(dataAddr) + mySystem->setAddressDisasmType(dataAddr, CartDebug::GFX); + #endif break; } diff --git a/src/gui/ConsoleFont.hxx b/src/gui/ConsoleFont.hxx index f37a8f0f7..ccb747268 100644 --- a/src/gui/ConsoleFont.hxx +++ b/src/gui/ConsoleFont.hxx @@ -3120,32 +3120,32 @@ static const uInt16 _console_font_bits[] = { +--------+ | | | | + | | | **** | | ****** | | ****** | | ****** | | ****** | | ****** | - | ****** | - | ****** | | **** | | | | | + | | +--------+ */ 0x0000, 0x0000, +0x0000, 0x3c00, 0x7e00, 0x7e00, 0x7e00, 0x7e00, 0x7e00, -0x7e00, -0x7e00, 0x3c00, 0x0000, 0x0000, +0x0000, /* Character 128 (0x80): large centered circle width 8 @@ -3154,10 +3154,10 @@ static const uInt16 _console_font_bits[] = { | | | | | | + | | | **** | | ****** | | ****** | - | ****** | | **** | | | | | @@ -3169,10 +3169,10 @@ static const uInt16 _console_font_bits[] = { 0x0000, 0x0000, 0x0000, +0x0000, 0x3c00, 0x7e00, 0x7e00, -0x7e00, 0x3c00, 0x0000, 0x0000,