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
// 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 "EquateList.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);
switch(M6502::ourAddressingModeTable[opcode])
{
case M6502::Absolute:
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(dpeek(mySystem, address + 1), 4),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 3;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(dpeek(mySystem, address + 1), 4) << " ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 3;
break;
case M6502::AbsoluteX:
sprintf(buffer, "%s %s,x ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(dpeek(mySystem, address + 1), 4),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 3;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(dpeek(mySystem, address + 1), 4) << ",x ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 3;
break;
case M6502::AbsoluteY:
sprintf(buffer, "%s %s,y ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(dpeek(mySystem, address + 1), 4),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 3;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(dpeek(mySystem, address + 1), 4) << ",y ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 3;
break;
case M6502::Immediate:
sprintf(buffer, "%s #$%02X ; %d", M6502::ourInstructionMnemonicTable[opcode],
mySystem->peek(address + 1),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " #$"
<< hex << setw(2) << setfill('0') << (int) mySystem->peek(address + 1) << " ; "
<< dec << M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
case M6502::Implied:
sprintf(buffer, "%s ; %d", M6502::ourInstructionMnemonicTable[opcode],
M6502::ourInstructionProcessorCycleTable[opcode]);
return 1;
buf << M6502::ourInstructionMnemonicTable[opcode] << " ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 1;
break;
case M6502::Indirect:
sprintf(buffer, "%s (%s) ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(dpeek(mySystem, address + 1), 4),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 3;
buf << M6502::ourInstructionMnemonicTable[opcode] << " ("
<< equateList->getFormatted(dpeek(mySystem, address + 1), 4) << ") ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 3;
break;
case M6502::IndirectX:
sprintf(buffer, "%s (%s,x) ; %d",
M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(mySystem->peek(address + 1), 2),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " ("
<< equateList->getFormatted(mySystem->peek(address + 1), 2) << ",x) ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
case M6502::IndirectY:
sprintf(buffer, "%s (%s),y ; %d",
M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(mySystem->peek(address + 1), 2),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " ("
<< equateList->getFormatted(mySystem->peek(address + 1), 2) << "),y ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
case M6502::Relative:
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)), 4),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(address + 2 + ((Int16)(Int8)mySystem->peek(address + 1)), 4)
<< " ; " << M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
case M6502::Zero:
sprintf(buffer, "%s %s ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(mySystem->peek(address + 1), 2),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(mySystem->peek(address + 1), 2) << " ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
case M6502::ZeroX:
sprintf(buffer, "%s %s,x ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(mySystem->peek(address + 1), 2),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(mySystem->peek(address + 1), 2) << ",x ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
case M6502::ZeroY:
sprintf(buffer, "%s %s,y ; %d", M6502::ourInstructionMnemonicTable[opcode],
equateList->getFormatted(mySystem->peek(address + 1), 2),
M6502::ourInstructionProcessorCycleTable[opcode]);
return 2;
buf << M6502::ourInstructionMnemonicTable[opcode] << " "
<< equateList->getFormatted(mySystem->peek(address + 1), 2) << ",y ; "
<< M6502::ourInstructionProcessorCycleTable[opcode];
count = 2;
break;
default:
sprintf(buffer, "dc $%02X ; %d", opcode,
M6502::ourInstructionProcessorCycleTable[opcode]);
return 1;
buf << "dc $" << hex << setw(2) << setfill('0') << (int) opcode << " ; "
<< dec << M6502::ourInstructionProcessorCycleTable[opcode];
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
// 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
@ -51,7 +51,7 @@ class CpuDebug : public DebuggerSystem
// I know, we ain't supposed to do this...
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 getBank();

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// 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"
@ -776,31 +776,24 @@ int Debugger::cycles()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& Debugger::disassemble(int start, int lines)
{
char buf[255], bbuf[255];
static string result;
ostringstream buffer;
string cpubuf;
result = "";
do {
const char *label = myEquateList->getFormatted(start, 4);
buffer << myEquateList->getFormatted(start, 4) << ": ";
result += label;
result += ": ";
int count = myCpuDebug->disassemble(start, cpubuf, myEquateList);
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++) {
sprintf(bbuf, "%02x ", peek(start++));
result += bbuf;
}
if(count < 3) result += " ";
if(count < 2) result += " ";
result += " ";
result += buf;
result += "\n";
buffer << " " << cpubuf << "\n";
} while(--lines > 0 && start <= 0xffff);
result = buffer.str();
return result;
}
@ -809,25 +802,25 @@ void Debugger::disassemble(IntArray& addr, StringList& addrLabel,
StringList& bytes, StringList& data,
int start, int lines)
{
char buf[255], bbuf[255];
string tmp;
string cpubuf, tmp;
char buf[255];
do
{
tmp = myEquateList->getFormatted(start, 4);
addrLabel.push_back(tmp + ":");
addrLabel.push_back(myEquateList->getFormatted(start, 4) + ":");
addr.push_back(start);
int count = myCpuDebug->disassemble(start, buf, myEquateList);
cpubuf = "";
int count = myCpuDebug->disassemble(start, cpubuf, myEquateList);
tmp = "";
for(int i=0; i<count; i++) {
sprintf(bbuf, "%02x ", peek(start++));
tmp += bbuf;
sprintf(buf, "%02x ", peek(start++));
tmp += buf;
}
bytes.push_back(tmp);
data.push_back(buf);
data.push_back(cpubuf);
}
while(--lines > 0 && start <= 0xffff);
}

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// 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>
@ -252,7 +252,7 @@ const string& EquateList::getLabel(int addr, int flags)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// DEPRECATED
const char *EquateList::getFormatted(int addr, int places)
string EquateList::getFormatted(int addr, int places)
{
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
// 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];
string res = getLabel(addr, flags);
if(res != "")
return res.c_str();
char fmt[10], buf[255];
const string& label = getLabel(addr, flags);
if(label != "")
return label;
sprintf(fmt, "$%%0%dx", places);
//cerr << addr << ", " << fmt << ", " << places << endl;
sprintf(buf, fmt, addr);
return buf;

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// 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
@ -33,8 +33,8 @@ class EquateList
const string& getLabel(int addr);
const string& getLabel(int addr, int flags);
const char *getFormatted(int addr, int places);
const char *getFormatted(int addr, int places, int flags);
string getFormatted(int addr, int places);
string getFormatted(int addr, int places, int flags);
int getAddress(const string& label);
int getAddress(const string& label, const int flags);
void addEquate(const string& label, int address);

View File

@ -13,7 +13,7 @@
// See the file "license" for information on usage and redistribution of
// 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
@ -113,7 +113,7 @@ void AtariVox::update()
void AtariVox::clockDataIn(bool value)
{
// bool oldValue = myPinState & 0x01;
myPinState = (myPinState & 0xfe) | value;
myPinState = (myPinState & 0xfe) | (int)value;
uInt32 cycle = mySystem->cycles();
if(DEBUG_ATARIVOX)

View File

@ -208,6 +208,7 @@
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
OmitFramePointers="true"
WholeProgramOptimization="false"
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"
RuntimeLibrary="0"
@ -400,6 +401,10 @@
<Filter
Name="emucore"
>
<File
RelativePath="..\emucore\AtariVox.cxx"
>
</File>
<File
RelativePath="..\emucore\Booster.cxx"
>
@ -966,6 +971,10 @@
<Filter
Name="emucore"
>
<File
RelativePath="..\emucore\AtariVox.hxx"
>
</File>
<File
RelativePath="..\emucore\Booster.hxx"
>

View File

@ -1,37 +1,74 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[Setup]
AppName=Stella
AppVerName=Stella 2.5
AppPublisher=Bradford W. Mott and the Stella team
AppPublisherURL=http://stella.sourceforge.net
AppSupportURL=http://stella.sourceforge.net
AppUpdatesURL=http://stella.sourceforge.net
DefaultDirName={pf}\Stella
DefaultGroupName=Stella
OutputBaseFilename=stella-2.5-win32
Compression=lzma
SolidCompression=yes
[Languages]
Name: "eng"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[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: "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\Stella.exe"; DestDir: "{app}"; Flags: ignoreversion
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
[Icons]
Name: "{group}\Stella"; Filename: "{app}\stella.exe"; WorkingDir: "{app}"
Name: "{userdesktop}\Stella"; Filename: "{app}\stella.exe"; WorkingDir: "{app}"; Tasks: desktopicon
Name: "{group}\Documentation"; Filename: "{app}\docs\index.html"
Name: "{group}\Uninstall Stella"; Filename: "{uninstallexe}"
;[Run]
;Filename: "{app}\stella.exe"; Description: "{cm:LaunchProgram,Stella}"; Flags: nowait postinstall skipifsilent