Fixed bug in ROM disassembler in the debugger. Apparently, mixing C strings and C++ strings causes issues in the Visual Studio compiler, but not for Linux. The ROM listing no longer shows squares (which represented null/out of bounds pointers to strings.

Updated Visual Studio files with latest AtariVox class.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1455 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-04-02 01:54:31 +00:00
parent 27dc5a60e2
commit cfe52adc62
8 changed files with 190 additions and 134 deletions

View File

@ -13,9 +13,11 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CpuDebug.cxx,v 1.9 2008-02-06 13:45:19 stephena Exp $ // $Id: CpuDebug.cxx,v 1.10 2008-04-02 01:54:31 stephena Exp $
//============================================================================ //============================================================================
#include <sstream>
#include "Array.hxx" #include "Array.hxx"
#include "EquateList.hxx" #include "EquateList.hxx"
#include "M6502.hxx" #include "M6502.hxx"
@ -72,91 +74,106 @@ void CpuDebug::saveOldState()
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CpuDebug::disassemble(int address, char* buffer, EquateList* equateList) int CpuDebug::disassemble(int address, string& result, EquateList* equateList)
{ {
// equateList->dumpAll(); ostringstream buf;
int count = 0;
int opcode = mySystem->peek(address); int opcode = mySystem->peek(address);
switch(M6502::ourAddressingModeTable[opcode]) switch(M6502::ourAddressingModeTable[opcode])
{ {
case M6502::Absolute: case M6502::Absolute:
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(dpeek(mySystem, address + 1), 4), << equateList->getFormatted(dpeek(mySystem, address + 1), 4) << " ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 3; count = 3;
break;
case M6502::AbsoluteX: case M6502::AbsoluteX:
sprintf(buffer, "%s %s,x ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(dpeek(mySystem, address + 1), 4), << equateList->getFormatted(dpeek(mySystem, address + 1), 4) << ",x ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 3; count = 3;
break;
case M6502::AbsoluteY: case M6502::AbsoluteY:
sprintf(buffer, "%s %s,y ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(dpeek(mySystem, address + 1), 4), << equateList->getFormatted(dpeek(mySystem, address + 1), 4) << ",y ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 3; count = 3;
break;
case M6502::Immediate: case M6502::Immediate:
sprintf(buffer, "%s #$%02X ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " #$"
mySystem->peek(address + 1), << hex << setw(2) << setfill('0') << (int) mySystem->peek(address + 1) << " ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << dec << M6502::ourInstructionProcessorCycleTable[opcode];
return 2; count = 2;
break;
case M6502::Implied: case M6502::Implied:
sprintf(buffer, "%s ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 1; count = 1;
break;
case M6502::Indirect: case M6502::Indirect:
sprintf(buffer, "%s (%s) ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " ("
equateList->getFormatted(dpeek(mySystem, address + 1), 4), << equateList->getFormatted(dpeek(mySystem, address + 1), 4) << ") ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 3; count = 3;
break;
case M6502::IndirectX: case M6502::IndirectX:
sprintf(buffer, "%s (%s,x) ; %d", buf << M6502::ourInstructionMnemonicTable[opcode] << " ("
M6502::ourInstructionMnemonicTable[opcode], << equateList->getFormatted(mySystem->peek(address + 1), 2) << ",x) ; "
equateList->getFormatted(mySystem->peek(address + 1), 2), << M6502::ourInstructionProcessorCycleTable[opcode];
M6502::ourInstructionProcessorCycleTable[opcode]); count = 2;
return 2; break;
case M6502::IndirectY: case M6502::IndirectY:
sprintf(buffer, "%s (%s),y ; %d", buf << M6502::ourInstructionMnemonicTable[opcode] << " ("
M6502::ourInstructionMnemonicTable[opcode], << equateList->getFormatted(mySystem->peek(address + 1), 2) << "),y ; "
equateList->getFormatted(mySystem->peek(address + 1), 2), << M6502::ourInstructionProcessorCycleTable[opcode];
M6502::ourInstructionProcessorCycleTable[opcode]); count = 2;
return 2; break;
case M6502::Relative: case M6502::Relative:
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)), 4), << equateList->getFormatted(address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)), 4)
M6502::ourInstructionProcessorCycleTable[opcode]); << " ; " << M6502::ourInstructionProcessorCycleTable[opcode];
return 2; count = 2;
break;
case M6502::Zero: case M6502::Zero:
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(mySystem->peek(address + 1), 2), << equateList->getFormatted(mySystem->peek(address + 1), 2) << " ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 2; count = 2;
break;
case M6502::ZeroX: case M6502::ZeroX:
sprintf(buffer, "%s %s,x ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(mySystem->peek(address + 1), 2), << equateList->getFormatted(mySystem->peek(address + 1), 2) << ",x ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 2; count = 2;
break;
case M6502::ZeroY: case M6502::ZeroY:
sprintf(buffer, "%s %s,y ; %d", M6502::ourInstructionMnemonicTable[opcode], buf << M6502::ourInstructionMnemonicTable[opcode] << " "
equateList->getFormatted(mySystem->peek(address + 1), 2), << equateList->getFormatted(mySystem->peek(address + 1), 2) << ",y ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << M6502::ourInstructionProcessorCycleTable[opcode];
return 2; count = 2;
break;
default: default:
sprintf(buffer, "dc $%02X ; %d", opcode, buf << "dc $" << hex << setw(2) << setfill('0') << (int) opcode << " ; "
M6502::ourInstructionProcessorCycleTable[opcode]); << dec << M6502::ourInstructionProcessorCycleTable[opcode];
return 1; count = 1;
break;
} }
result = buf.str();
return count;
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: CpuDebug.hxx,v 1.11 2008-02-06 13:45:19 stephena Exp $ // $Id: CpuDebug.hxx,v 1.12 2008-04-02 01:54:31 stephena Exp $
//============================================================================ //============================================================================
#ifndef CPU_DEBUG_HXX #ifndef CPU_DEBUG_HXX
@ -51,7 +51,7 @@ class CpuDebug : public DebuggerSystem
// I know, we ain't supposed to do this... // I know, we ain't supposed to do this...
M6502 &m6502() { return mySystem->m6502(); } M6502 &m6502() { return mySystem->m6502(); }
int disassemble(int address, char* buffer, EquateList* equateList); int disassemble(int address, string& result, EquateList* equateList);
int dPeek(int address); int dPeek(int address);
int getBank(); int getBank();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: Debugger.cxx,v 1.121 2008-03-28 23:29:13 stephena Exp $ // $Id: Debugger.cxx,v 1.122 2008-04-02 01:54:31 stephena Exp $
//============================================================================ //============================================================================
#include "bspf.hxx" #include "bspf.hxx"
@ -776,31 +776,24 @@ int Debugger::cycles()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& Debugger::disassemble(int start, int lines) const string& Debugger::disassemble(int start, int lines)
{ {
char buf[255], bbuf[255];
static string result; static string result;
ostringstream buffer;
string cpubuf;
result = "";
do { do {
const char *label = myEquateList->getFormatted(start, 4); buffer << myEquateList->getFormatted(start, 4) << ": ";
result += label; int count = myCpuDebug->disassemble(start, cpubuf, myEquateList);
result += ": "; for(int i = 0; i < count; i++)
buffer << hex << setw(2) << setfill('0') << peek(start++) << dec;
int count = myCpuDebug->disassemble(start, buf, myEquateList); if(count < 3) buffer << " ";
if(count < 2) buffer << " ";
for(int i=0; i<count; i++) { buffer << " " << cpubuf << "\n";
sprintf(bbuf, "%02x ", peek(start++));
result += bbuf;
}
if(count < 3) result += " ";
if(count < 2) result += " ";
result += " ";
result += buf;
result += "\n";
} while(--lines > 0 && start <= 0xffff); } while(--lines > 0 && start <= 0xffff);
result = buffer.str();
return result; return result;
} }
@ -809,25 +802,25 @@ void Debugger::disassemble(IntArray& addr, StringList& addrLabel,
StringList& bytes, StringList& data, StringList& bytes, StringList& data,
int start, int lines) int start, int lines)
{ {
char buf[255], bbuf[255]; string cpubuf, tmp;
string tmp; char buf[255];
do do
{ {
tmp = myEquateList->getFormatted(start, 4); addrLabel.push_back(myEquateList->getFormatted(start, 4) + ":");
addrLabel.push_back(tmp + ":");
addr.push_back(start); addr.push_back(start);
int count = myCpuDebug->disassemble(start, buf, myEquateList); cpubuf = "";
int count = myCpuDebug->disassemble(start, cpubuf, myEquateList);
tmp = ""; tmp = "";
for(int i=0; i<count; i++) { for(int i=0; i<count; i++) {
sprintf(bbuf, "%02x ", peek(start++)); sprintf(buf, "%02x ", peek(start++));
tmp += bbuf; tmp += buf;
} }
bytes.push_back(tmp); bytes.push_back(tmp);
data.push_back(buf); data.push_back(cpubuf);
} }
while(--lines > 0 && start <= 0xffff); while(--lines > 0 && start <= 0xffff);
} }

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EquateList.cxx,v 1.27 2008-02-24 16:51:52 stephena Exp $ // $Id: EquateList.cxx,v 1.28 2008-04-02 01:54:31 stephena Exp $
//============================================================================ //============================================================================
#include <fstream> #include <fstream>
@ -252,7 +252,7 @@ const string& EquateList::getLabel(int addr, int flags)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// DEPRECATED // DEPRECATED
const char *EquateList::getFormatted(int addr, int places) string EquateList::getFormatted(int addr, int places)
{ {
return getFormatted(addr, places, EQF_ANY); return getFormatted(addr, places, EQF_ANY);
} }
@ -260,15 +260,15 @@ const char *EquateList::getFormatted(int addr, int places)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// returns either the label, or a formatted hex string // returns either the label, or a formatted hex string
// if no label found. // if no label found.
const char *EquateList::getFormatted(int addr, int places, int flags) string EquateList::getFormatted(int addr, int places, int flags)
{ {
static char fmt[10], buf[255]; char fmt[10], buf[255];
string res = getLabel(addr, flags); const string& label = getLabel(addr, flags);
if(res != "")
return res.c_str(); if(label != "")
return label;
sprintf(fmt, "$%%0%dx", places); sprintf(fmt, "$%%0%dx", places);
//cerr << addr << ", " << fmt << ", " << places << endl;
sprintf(buf, fmt, addr); sprintf(buf, fmt, addr);
return buf; return buf;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: EquateList.hxx,v 1.17 2008-02-24 16:51:52 stephena Exp $ // $Id: EquateList.hxx,v 1.18 2008-04-02 01:54:31 stephena Exp $
//============================================================================ //============================================================================
#ifndef EQUATELIST_HXX #ifndef EQUATELIST_HXX
@ -33,8 +33,8 @@ class EquateList
const string& getLabel(int addr); const string& getLabel(int addr);
const string& getLabel(int addr, int flags); const string& getLabel(int addr, int flags);
const char *getFormatted(int addr, int places); string getFormatted(int addr, int places);
const char *getFormatted(int addr, int places, int flags); string getFormatted(int addr, int places, int flags);
int getAddress(const string& label); int getAddress(const string& label);
int getAddress(const string& label, const int flags); int getAddress(const string& label, const int flags);
void addEquate(const string& label, int address); void addEquate(const string& label, int address);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of // See the file "license" for information on usage and redistribution of
// this file, and for a DISCLAIMER OF ALL WARRANTIES. // this file, and for a DISCLAIMER OF ALL WARRANTIES.
// //
// $Id: AtariVox.cxx,v 1.8 2008-03-31 00:59:30 stephena Exp $ // $Id: AtariVox.cxx,v 1.9 2008-04-02 01:54:31 stephena Exp $
//============================================================================ //============================================================================
#ifdef SPEAKJET_EMULATION #ifdef SPEAKJET_EMULATION
@ -113,7 +113,7 @@ void AtariVox::update()
void AtariVox::clockDataIn(bool value) void AtariVox::clockDataIn(bool value)
{ {
// bool oldValue = myPinState & 0x01; // bool oldValue = myPinState & 0x01;
myPinState = (myPinState & 0xfe) | value; myPinState = (myPinState & 0xfe) | (int)value;
uInt32 cycle = mySystem->cycles(); uInt32 cycle = mySystem->cycles();
if(DEBUG_ATARIVOX) if(DEBUG_ATARIVOX)

View File

@ -208,6 +208,7 @@
Name="VCCLCompilerTool" Name="VCCLCompilerTool"
AdditionalOptions="/MP" AdditionalOptions="/MP"
OmitFramePointers="true" OmitFramePointers="true"
WholeProgramOptimization="false"
AdditionalIncludeDirectories="..\yacc;..\emucore\m6502\src\bspf\src;..\emucore\m6502\src;..\emucore;..\common;..\gui;..\debugger\gui;..\debugger;..\win32;..\cheat" AdditionalIncludeDirectories="..\yacc;..\emucore\m6502\src\bspf\src;..\emucore\m6502\src;..\emucore;..\common;..\gui;..\debugger\gui;..\debugger;..\win32;..\cheat"
PreprocessorDefinitions="BSPF_WIN32;WIN32;ZLIB_WINAPI;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;DISPLAY_OPENGL;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT" PreprocessorDefinitions="BSPF_WIN32;WIN32;ZLIB_WINAPI;NDEBUG;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;DISPLAY_OPENGL;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT"
RuntimeLibrary="0" RuntimeLibrary="0"
@ -400,6 +401,10 @@
<Filter <Filter
Name="emucore" Name="emucore"
> >
<File
RelativePath="..\emucore\AtariVox.cxx"
>
</File>
<File <File
RelativePath="..\emucore\Booster.cxx" RelativePath="..\emucore\Booster.cxx"
> >
@ -966,6 +971,10 @@
<Filter <Filter
Name="emucore" Name="emucore"
> >
<File
RelativePath="..\emucore\AtariVox.hxx"
>
</File>
<File <File
RelativePath="..\emucore\Booster.hxx" RelativePath="..\emucore\Booster.hxx"
> >

View File

@ -1,37 +1,74 @@
; Script generated by the Inno Setup Script Wizard. ; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES! ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup] [Setup]
AppName=Stella AppName=Stella
AppVerName=Stella 2.5 AppVerName=Stella 2.5
AppPublisher=Bradford W. Mott and the Stella team AppPublisher=Bradford W. Mott and the Stella team
AppPublisherURL=http://stella.sourceforge.net AppPublisherURL=http://stella.sourceforge.net
AppSupportURL=http://stella.sourceforge.net AppSupportURL=http://stella.sourceforge.net
AppUpdatesURL=http://stella.sourceforge.net AppUpdatesURL=http://stella.sourceforge.net
DefaultDirName={pf}\Stella DefaultDirName={pf}\Stella
DefaultGroupName=Stella DefaultGroupName=Stella
OutputBaseFilename=stella-2.5-win32 OutputBaseFilename=stella-2.5-win32
Compression=lzma Compression=lzma
SolidCompression=yes SolidCompression=yes
[Languages] [Languages]
Name: "eng"; MessagesFile: "compiler:Default.isl" Name: "eng"; MessagesFile: "compiler:Default.isl"
[Tasks] [Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files] [Files]
Source: "H:\windows\src\stella\stella-2.5\stella.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "H:\windows\src\stella\stella-2.5\zlib1.dll"; DestDir: "{app}"; Flags: ignoreversion Source: "C:\Users\stephena\src\stella\stella-2.5\Stella.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "H:\windows\src\stella\stella-2.5\SDL.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "H:\windows\src\stella\stella-2.5\docs\*"; DestDir: "{app}\docs"; Flags: ignoreversion recursesubdirs createallsubdirs Source: "C:\Users\stephena\src\stella\stella-2.5\zlibwapi.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\stephena\src\stella\stella-2.5\SDL.dll"; DestDir: "{app}"; Flags: ignoreversion
Source: "C:\Users\stephena\src\stella\stella-2.5\docs\*"; DestDir: "{app}\docs"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files ; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons] [Icons]
Name: "{group}\Stella"; Filename: "{app}\stella.exe"; WorkingDir: "{app}" Name: "{group}\Stella"; Filename: "{app}\stella.exe"; WorkingDir: "{app}"
Name: "{userdesktop}\Stella"; Filename: "{app}\stella.exe"; WorkingDir: "{app}"; Tasks: desktopicon Name: "{userdesktop}\Stella"; Filename: "{app}\stella.exe"; WorkingDir: "{app}"; Tasks: desktopicon
Name: "{group}\Documentation"; Filename: "{app}\docs\index.html" Name: "{group}\Documentation"; Filename: "{app}\docs\index.html"
Name: "{group}\Uninstall Stella"; Filename: "{uninstallexe}" Name: "{group}\Uninstall Stella"; Filename: "{uninstallexe}"
;[Run] ;[Run]
;Filename: "{app}\stella.exe"; Description: "{cm:LaunchProgram,Stella}"; Flags: nowait postinstall skipifsilent ;Filename: "{app}\stella.exe"; Description: "{cm:LaunchProgram,Stella}"; Flags: nowait postinstall skipifsilent