Added register tracking for ORA, TSX and TXS. More testing is required

for these opcodes.

The 'data source' in the debugger CPU area now also shows the SP register,
since it's used for TSX and TXS.

Bumped version # for another test release.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2177 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-11-10 14:01:41 +00:00
parent de67cc34fe
commit 277f034e89
9 changed files with 53 additions and 17 deletions

View File

@ -22,7 +22,7 @@
#include <cstdlib>
#define STELLA_VERSION "3.3_test10"
#define STELLA_VERSION "3.3_test11"
#define STELLA_BUILD atoi("$Rev$" + 6)
#endif

View File

@ -43,6 +43,7 @@ const DebuggerState& CpuDebug::getState()
myState.X = mySystem.m6502().X;
myState.Y = mySystem.m6502().Y;
myState.srcS = mySystem.m6502().lastSrcAddressS();
myState.srcA = mySystem.m6502().lastSrcAddressA();
myState.srcX = mySystem.m6502().lastSrcAddressX();
myState.srcY = mySystem.m6502().lastSrcAddressY();
@ -62,6 +63,7 @@ void CpuDebug::saveOldState()
myOldState.X = mySystem.m6502().X;
myOldState.Y = mySystem.m6502().Y;
myOldState.srcS = mySystem.m6502().lastSrcAddressS();
myOldState.srcA = mySystem.m6502().lastSrcAddressA();
myOldState.srcX = mySystem.m6502().lastSrcAddressX();
myOldState.srcY = mySystem.m6502().lastSrcAddressY();

View File

@ -37,7 +37,7 @@ class CpuState : public DebuggerState
{
public:
int PC, SP, PS, A, X, Y;
int srcA, srcX, srcY;
int srcS, srcA, srcX, srcY;
BoolArray PSbits;
};

View File

@ -82,12 +82,13 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
// 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,
myCpuDataSrcGrid =
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 4, 16, kBASE_16);
myCpuDataSrcGrid->setEditable(false);
new StaticTextWidget(boss, font, xpos-font.getMaxCharWidth(),
ypos+myCpuDataSrcGrid->getHeight() + 4,
font.getStringWidth("Src Addr"), fontHeight, "Src Addr",
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;
@ -291,10 +292,12 @@ void CpuWidget::fillGrid()
alist.push_back(0);
alist.push_back(0);
vlist.push_back(state.srcS);
vlist.push_back(state.srcA);
vlist.push_back(state.srcX);
vlist.push_back(state.srcY);
changed.push_back(state.srcS != oldstate.srcS);
changed.push_back(state.srcA != oldstate.srcA);
changed.push_back(state.srcX != oldstate.srcX);
changed.push_back(state.srcY != oldstate.srcY);

View File

@ -58,6 +58,7 @@ M6502::M6502(uInt32 systemCyclesPerProcessorCycle)
myLastAddress(0),
myLastPeekAddress(0),
myLastPokeAddress(0),
myLastSrcAddressS(0),
myLastSrcAddressA(0),
myLastSrcAddressX(0),
myLastSrcAddressY(0),
@ -122,7 +123,8 @@ void M6502::reset()
myTotalInstructionCount = 0;
myLastAddress = myLastPeekAddress = myLastPokeAddress = 0;
myLastSrcAddressA = myLastSrcAddressX = myLastSrcAddressY = 0;
myLastSrcAddressS = myLastSrcAddressA =
myLastSrcAddressX = myLastSrcAddressY = 0;
myDataAddressForPoke = 0;
}
@ -397,6 +399,7 @@ bool M6502::save(Serializer& out) const
out.putInt(myLastAddress);
out.putInt(myLastPeekAddress);
out.putInt(myLastPokeAddress);
out.putInt(myLastSrcAddressS);
out.putInt(myLastSrcAddressA);
out.putInt(myLastSrcAddressX);
out.putInt(myLastSrcAddressY);
@ -444,6 +447,7 @@ bool M6502::load(Serializer& in)
myLastAddress = (uInt16) in.getInt();
myLastPeekAddress = (uInt16) in.getInt();
myLastPokeAddress = (uInt16) in.getInt();
myLastSrcAddressS = (uInt16) in.getInt();
myLastSrcAddressA = (uInt16) in.getInt();
myLastSrcAddressX = (uInt16) in.getInt();
myLastSrcAddressY = (uInt16) in.getInt();

View File

@ -158,11 +158,12 @@ class M6502 : public Serializable
/**
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
the S/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 lastSrcAddressS() const { return myLastSrcAddressS; }
uInt16 lastSrcAddressA() const { return myLastSrcAddressA; }
uInt16 lastSrcAddressX() const { return myLastSrcAddressX; }
uInt16 lastSrcAddressY() const { return myLastSrcAddressY; }
@ -322,8 +323,9 @@ class M6502 : public Serializable
uInt16 myLastPeekAddress, myLastPokeAddress;
/// Indicates the last address used to access data by a peek command
/// for the CPU registers (A/X/Y)
uInt16 myLastSrcAddressA, myLastSrcAddressX, myLastSrcAddressY;
/// for the CPU registers (S/A/X/Y)
uInt16 myLastSrcAddressS, myLastSrcAddressA,
myLastSrcAddressX, myLastSrcAddressY;
/// Indicates the data address used by the last command that performed
/// a poke (currently, the last address used by STx)

View File

@ -13,6 +13,8 @@
//
// See the file "License.txt" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
//
// $Id: M6502.m4 2175 2010-11-08 22:25:19Z stephena $
//============================================================================
/**
@ -21,7 +23,8 @@
Recompile with the following:
'm4 M6502.m4 > M6502.ins'
@author Bradford W. Mott and Stephen Anthony
@author Bradford W. Mott
@version $Id: M6502.m4 2175 2010-11-08 22:25:19Z stephena $
*/
#ifndef NOTSAMEPAGE
@ -2749,10 +2752,13 @@ case 0xfc:
break;
//////////////////////////////////////////////////
// ORA
case 0x09:
{
operand = peek(PC++, DISASM_CODE);
}
CLEAR_LAST_PEEK(myLastSrcAddressA)
{
A |= operand;
notZ = A;
@ -2765,6 +2771,7 @@ case 0x05:
intermediateAddress = peek(PC++, DISASM_CODE);
operand = peek(intermediateAddress, DISASM_DATA);
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
@ -2779,6 +2786,7 @@ case 0x15:
intermediateAddress += X;
operand = peek(intermediateAddress, DISASM_DATA);
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
@ -2792,6 +2800,7 @@ case 0x0d:
intermediateAddress |= ((uInt16)peek(PC++, DISASM_CODE) << 8);
operand = peek(intermediateAddress, DISASM_DATA);
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
@ -2811,6 +2820,7 @@ case 0x1d:
operand = peek(intermediateAddress, DISASM_DATA);
}
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
@ -2830,6 +2840,7 @@ case 0x19:
operand = peek(intermediateAddress, DISASM_DATA);
}
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
@ -2846,6 +2857,7 @@ case 0x01:
intermediateAddress |= ((uInt16)peek(pointer, DISASM_DATA) << 8);
operand = peek(intermediateAddress, DISASM_DATA);
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
@ -2866,12 +2878,14 @@ case 0x11:
operand = peek(intermediateAddress, DISASM_DATA);
}
}
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
{
A |= operand;
notZ = A;
N = A & 0x80;
}
break;
//////////////////////////////////////////////////
case 0x48:
@ -4590,7 +4604,7 @@ case 0xba:
{
peek(PC, DISASM_NONE);
}
// TODO - add tracking for this opcode
SET_LAST_PEEK(myLastSrcAddressX, myLastSrcAddressS)
{
X = SP;
notZ = X;
@ -4616,7 +4630,7 @@ case 0x9a:
{
peek(PC, DISASM_NONE);
}
// TODO - add tracking for this opcode
SET_LAST_PEEK(myLastSrcAddressS, myLastSrcAddressX)
{
SP = X;
}

View File

@ -1747,45 +1747,56 @@ M6502_NOP
break;
//////////////////////////////////////////////////
// ORA
case 0x09:
M6502_IMMEDIATE_READ
CLEAR_LAST_PEEK(myLastSrcAddressA)
M6502_ORA
break;
case 0x05:
M6502_ZERO_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
case 0x15:
M6502_ZEROX_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
case 0x0d:
M6502_ABSOLUTE_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
case 0x1d:
M6502_ABSOLUTEX_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
case 0x19:
M6502_ABSOLUTEY_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
case 0x01:
M6502_INDIRECTX_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
case 0x11:
M6502_INDIRECTY_READ
SET_LAST_PEEK(myLastSrcAddressA, intermediateAddress)
M6502_ORA
break;
//////////////////////////////////////////////////
case 0x48:
@ -2239,7 +2250,7 @@ break;
case 0xba:
M6502_IMPLIED
// TODO - add tracking for this opcode
SET_LAST_PEEK(myLastSrcAddressX, myLastSrcAddressS)
M6502_TSX
break;
@ -2253,7 +2264,7 @@ break;
case 0x9a:
M6502_IMPLIED
// TODO - add tracking for this opcode
SET_LAST_PEEK(myLastSrcAddressS, myLastSrcAddressX)
M6502_TXS
break;

View File

@ -30,8 +30,8 @@
#include "StateManager.hxx"
#define STATE_HEADER "03030900state"
#define MOVIE_HEADER "03030900movie"
#define STATE_HEADER "03031100state"
#define MOVIE_HEADER "03031100movie"
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
StateManager::StateManager(OSystem* osystem)