Fixed debugger 'runto' command; it was case sensitive, so it never

matched anything most of the time.  Also, as this operation can take
a somewhat long time on slower systems, a progress bar is now shown.

Fixed handling of bit 6 in VBLANK TIA register, which is related to
how INPT4 and INPT5 are handled.  This fixes at least one ROM that
should have failed in Stella, but didn't.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2096 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-08-12 16:55:47 +00:00
parent 259e3091f0
commit 764e598536
5 changed files with 59 additions and 12 deletions

View File

@ -34,16 +34,22 @@
now works exactly like an axis in UI mode (holding down a direction now works exactly like an axis in UI mode (holding down a direction
continues that direction until the hat is released/centered). continues that direction until the hat is released/centered).
* Several improvements to the debugger. User labels are now supported * Several improvements to the debugger:
again, the debugger window can be resized between ROM loads - user labels are now supported again
(previously, the app had to be restarted), and a vertical line - the debugger window can be resized between ROM loads (previously,
separates the disassembly from the raw bytes. the app had to be restarted)
- a vertical line separates the disassembly from the raw bytes
- 'runto' debugger command is now case-insensitive, and shows a
progressbar while searching through the disassembly
* Fixed behaviour of SWCHB and SWBCNT; pins set to output now remember * Fixed behaviour of SWCHB and SWBCNT; pins set to output now remember
the values previously written. Some ROMs use this functionality for the values previously written. Some ROMs use this functionality for
extra storage. Special thanks to Omegamatrix of AtariAge for advice extra storage. Special thanks to Omegamatrix of AtariAge for advice
and test ROMs in this area. and test ROMs in this area.
* Fixed bug in handling INPT4/INPT5 latches from VBLANK; a least one
ROM was working in Stella when it didn't on real hardware.
* Added 'finishing touches' to some of the UI descriptions, giving a * Added 'finishing touches' to some of the UI descriptions, giving a
better explanation of the functions. Related to this, certain better explanation of the functions. Related to this, certain
options now show a message box explaining the option in further options now show a message box explaining the option in further

View File

@ -63,6 +63,7 @@
// The following code should provide access to the standard C++ objects and // The following code should provide access to the standard C++ objects and
// types: cout, cerr, string, ostream, istream, etc. // types: cout, cerr, string, ostream, istream, etc.
#include <algorithm>
#include <iostream> #include <iostream>
#include <iomanip> #include <iomanip>
#include <string> #include <string>
@ -122,6 +123,17 @@ inline bool BSPF_equalsIgnoreCase(const char* s1, const char* s2)
return BSPF_strcasecmp(s1, s2) == 0; return BSPF_strcasecmp(s1, s2) == 0;
} }
static bool BSPF_equalsIgnoreCaseChar(char ch1, char ch2)
{
return toupper((unsigned char)ch1) == toupper((unsigned char)ch2);
}
inline size_t BSPF_findIgnoreCase(const string& s1, const string& s2)
{
string::const_iterator pos = std::search(s1.begin(), s1.end(),
s2.begin(), s2.end(), BSPF_equalsIgnoreCaseChar);
return pos == s1.end() ? string::npos : pos - s1.begin();
}
static const string EmptyString(""); static const string EmptyString("");
#ifdef _WIN32_WCE #ifdef _WIN32_WCE

View File

@ -32,6 +32,7 @@
#include "Expression.hxx" #include "Expression.hxx"
#include "FSNode.hxx" #include "FSNode.hxx"
#include "RomWidget.hxx" #include "RomWidget.hxx"
#include "ProgressDialog.hxx"
#ifdef CHEATCODE_SUPPORT #ifdef CHEATCODE_SUPPORT
#include "CheatManager.hxx" #include "CheatManager.hxx"
@ -1115,7 +1116,16 @@ void DebuggerParser::executeRunTo()
const CartDebug& cartdbg = debugger->cartDebug(); const CartDebug& cartdbg = debugger->cartDebug();
const CartDebug::DisassemblyList& list = cartdbg.disassembly().list; const CartDebug::DisassemblyList& list = cartdbg.disassembly().list;
uInt32 count = 0; uInt32 count = 0, max_iterations = list.size();
// Create a progress dialog box to show the progress searching through the
// disassembly, since this may be a time-consuming operation
ostringstream buf;
buf << "RunTo searching through " << max_iterations << " disassembled instructions";
ProgressDialog progress(debugger->myBaseDialog,
debugger->getOSystem()->consoleFont(), buf.str());
progress.setRange(0, max_iterations, 5);
bool done = false; bool done = false;
do { do {
debugger->step(); debugger->step();
@ -1125,10 +1135,13 @@ void DebuggerParser::executeRunTo()
if(pcline >= 0) if(pcline >= 0)
{ {
const string& next = list[pcline].disasm; const string& next = list[pcline].disasm;
done = (next.find(argStrings[0]) != string::npos); done = (BSPF_findIgnoreCase(next, argStrings[0]) != string::npos);
} }
++count; // Update the progress bar
} while(!done && count < list.size()); progress.setProgress(count);
} while(!done && ++count < max_iterations);
progress.close();
if(done) if(done)
commandResult commandResult

View File

@ -169,6 +169,7 @@ void TIA::reset()
myDumpEnabled = false; myDumpEnabled = false;
myDumpDisabledCycle = 0; myDumpDisabledCycle = 0;
myINPT4 = myINPT5 = 0x80;
// Should undriven pins be randomly driven high or low? // Should undriven pins be randomly driven high or low?
myTIAPinsDriven = mySettings.getBool("tiadriven"); myTIAPinsDriven = mySettings.getBool("tiadriven");
@ -1241,14 +1242,22 @@ uInt8 TIA::peek(uInt16 addr)
break; break;
case INPT4: case INPT4:
value = (value & 0x7F) | {
(myConsole.controller(Controller::Left).read(Controller::Six) ? 0x80 : 0x00); uInt8 button = (myConsole.controller(Controller::Left).read(Controller::Six) ? 0x80 : 0x00);
myINPT4 = (myVBLANK & 0x40) ? (myINPT4 & button) : button;
value = (value & 0x7F) | myINPT4;
break; break;
}
case INPT5: case INPT5:
value = (value & 0x7F) | {
(myConsole.controller(Controller::Right).read(Controller::Six) ? 0x80 : 0x00); uInt8 button = (myConsole.controller(Controller::Right).read(Controller::Six) ? 0x80 : 0x00);
myINPT5 = (myVBLANK & 0x40) ? (myINPT5 & button) : button;
value = (value & 0x7F) | myINPT5;
break; break;
}
default: default:
break; break;
@ -1321,6 +1330,10 @@ bool TIA::poke(uInt16 addr, uInt8 value)
myDumpDisabledCycle = mySystem->cycles(); myDumpDisabledCycle = mySystem->cycles();
} }
// Are the latches for I4 and I5 being set?
if (!(myVBLANK & 0x40))
myINPT4 = myINPT5 = 0x80;
#if 0 // TODO - this isn't yet complete #if 0 // TODO - this isn't yet complete
// Check for the first scanline at which VBLANK is disabled. // Check for the first scanline at which VBLANK is disabled.
// Usually, this will be the first scanline to start drawing. // Usually, this will be the first scanline to start drawing.

View File

@ -558,6 +558,9 @@ class TIA : public Device
// Indicates if the dump is current enabled for the paddles // Indicates if the dump is current enabled for the paddles
bool myDumpEnabled; bool myDumpEnabled;
// Latches for INPT4 and INPT5
uInt8 myINPT4, myINPT5;
// Indicates if HMOVE blanks are currently or previously enabled, // Indicates if HMOVE blanks are currently or previously enabled,
// and at which horizontal position the HMOVE was initiated // and at which horizontal position the HMOVE was initiated
Int32 myCurrentHMOVEPos; Int32 myCurrentHMOVEPos;