mirror of https://github.com/stella-emu/stella.git
Consolidated the code for converting integers to strings in various
bases into a Common::Base class. Previously, this functionality was spread across several classes, and used different approaches to formatting. While the code still mixes C++ streams and C-style sprintf's, at least it will now be easier to modify it all in one place. Related to the above, added ability to use upper or lower case characters for HEX output in the debugger. This is toggled by the new debugger prompt command 'uhex', which is also tied to a new commandline argument, 'dbg.uhex'. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2770 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
33bcec92be
commit
95fe213f3a
|
@ -35,7 +35,11 @@
|
||||||
|
|
||||||
- Added 'cpurandom' commandline argument, and associated UI item
|
- Added 'cpurandom' commandline argument, and associated UI item
|
||||||
to the 'I/O' tab. This works similar to 'ramrandom', and
|
to the 'I/O' tab. This works similar to 'ramrandom', and
|
||||||
randomizes the contents on the CPU registers on ROM startup.
|
randomizes the contents of the CPU registers on ROM startup.
|
||||||
|
|
||||||
|
- Added 'uhex' debugger prompt command, which toggles all
|
||||||
|
hexadecimal display between upper/lower case. This setting is
|
||||||
|
also saved in the settings file as argument 'dbg.uhex'.
|
||||||
|
|
||||||
* For the Linux/UNIX port:
|
* For the Linux/UNIX port:
|
||||||
- Fixed bug whereby a maximize button was always present in the
|
- Fixed bug whereby a maximize button was always present in the
|
||||||
|
|
|
@ -0,0 +1,115 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
void Base::setHexUppercase(bool enable)
|
||||||
|
{
|
||||||
|
if(enable)
|
||||||
|
{
|
||||||
|
myHexflags |= std::ios_base::uppercase;
|
||||||
|
myFmt = Base::myUpperFmt;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
myHexflags &= ~std::ios_base::uppercase;
|
||||||
|
myFmt = Base::myLowerFmt;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
string Base::toString(int value, Common::Base::Format outputBase)
|
||||||
|
{
|
||||||
|
static char vToS_buf[32];
|
||||||
|
|
||||||
|
if(outputBase == Base::F_DEFAULT)
|
||||||
|
outputBase = myDefaultBase;
|
||||||
|
|
||||||
|
switch(outputBase)
|
||||||
|
{
|
||||||
|
case Base::F_2: // base 2: 8 or 16 bits (depending on value)
|
||||||
|
case Base::F_2_8: // base 2: 1 byte (8 bits) wide
|
||||||
|
case Base::F_2_16: // base 2: 2 bytes (16 bits) wide
|
||||||
|
{
|
||||||
|
int places = (outputBase == Base::F_2_8 ||
|
||||||
|
(outputBase == Base::F_2 && value < 0x100)) ? 8 : 16;
|
||||||
|
vToS_buf[places] = '\0';
|
||||||
|
int bit = 1;
|
||||||
|
while(--places >= 0) {
|
||||||
|
if(value & bit) vToS_buf[places] = '1';
|
||||||
|
else vToS_buf[places] = '0';
|
||||||
|
bit <<= 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case Base::F_10: // base 10: 3 or 5 bytes (depending on value)
|
||||||
|
if(value < 0x100)
|
||||||
|
BSPF_snprintf(vToS_buf, 4, "%3d", value);
|
||||||
|
else
|
||||||
|
BSPF_snprintf(vToS_buf, 6, "%5d", value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Base::F_16_1: // base 16: 1 byte wide
|
||||||
|
BSPF_snprintf(vToS_buf, 2, myFmt[0], value);
|
||||||
|
break;
|
||||||
|
case Base::F_16_2: // base 16: 2 bytes wide
|
||||||
|
BSPF_snprintf(vToS_buf, 3, myFmt[1], value);
|
||||||
|
break;
|
||||||
|
case Base::F_16_4: // base 16: 4 bytes wide
|
||||||
|
BSPF_snprintf(vToS_buf, 5, myFmt[2], value);
|
||||||
|
break;
|
||||||
|
case Base::F_16_8: // base 16: 8 bytes wide
|
||||||
|
BSPF_snprintf(vToS_buf, 9, myFmt[3], value);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case Base::F_16: // base 16: 2, 4, 8 bytes (depending on value)
|
||||||
|
default:
|
||||||
|
if(value < 0x100)
|
||||||
|
BSPF_snprintf(vToS_buf, 3, myFmt[1], value);
|
||||||
|
else if(value < 0x10000)
|
||||||
|
BSPF_snprintf(vToS_buf, 5, myFmt[2], value);
|
||||||
|
else
|
||||||
|
BSPF_snprintf(vToS_buf, 9, myFmt[3], value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return string(vToS_buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
Base::Format Base::myDefaultBase = Base::F_16;
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
std::ios_base::fmtflags Base::myHexflags =
|
||||||
|
std::ios_base::hex | std::ios_base::left;
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
const char* Base::myLowerFmt[4] = {
|
||||||
|
"%1x", "%02x", "%04x", "%08x"
|
||||||
|
};
|
||||||
|
const char* Base::myUpperFmt[4] = {
|
||||||
|
"%1X", "%02X", "%04X", "%08X"
|
||||||
|
};
|
||||||
|
const char** Base::myFmt = Base::myLowerFmt;
|
||||||
|
|
||||||
|
} // Namespace Common
|
|
@ -0,0 +1,102 @@
|
||||||
|
//============================================================================
|
||||||
|
//
|
||||||
|
// SSSS tt lll lll
|
||||||
|
// SS SS tt ll ll
|
||||||
|
// SS tttttt eeee ll ll aaaa
|
||||||
|
// SSSS tt ee ee ll ll aa
|
||||||
|
// SS tt eeeeee ll ll aaaaa -- "An Atari 2600 VCS Emulator"
|
||||||
|
// SS SS tt ee ll ll aa aa
|
||||||
|
// SSSS ttt eeeee llll llll aaaaa
|
||||||
|
//
|
||||||
|
// Copyright (c) 1995-2013 by Bradford W. Mott, Stephen Anthony
|
||||||
|
// and the Stella Team
|
||||||
|
//
|
||||||
|
// See the file "License.txt" for information on usage and redistribution of
|
||||||
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||||
|
//
|
||||||
|
// $Id$
|
||||||
|
//============================================================================
|
||||||
|
|
||||||
|
#ifndef BASE_HXX
|
||||||
|
#define BASE_HXX
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <iomanip>
|
||||||
|
|
||||||
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
namespace Common {
|
||||||
|
|
||||||
|
/**
|
||||||
|
This class implements several functions for converting integer data
|
||||||
|
into strings in multiple bases, with different formats (# of characters,
|
||||||
|
upper/lower-case, etc).
|
||||||
|
|
||||||
|
@author Stephen Anthony
|
||||||
|
*/
|
||||||
|
class Base
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
// The base to use for conversion from integers to strings
|
||||||
|
// Note that the actual number of places will be determined by
|
||||||
|
// the magnitude of the value itself in the general case
|
||||||
|
enum Format {
|
||||||
|
F_16, // base 16: 2, 4, 8 bytes (depending on value)
|
||||||
|
F_16_1, // base 16: 1 byte wide
|
||||||
|
F_16_2, // base 16: 2 bytes wide
|
||||||
|
F_16_4, // base 16: 4 bytes wide
|
||||||
|
F_16_8, // base 16: 8 bytes wide
|
||||||
|
F_10, // base 10: 3 or 5 bytes (depending on value)
|
||||||
|
F_2, // base 2: 8 or 16 bits (depending on value)
|
||||||
|
F_2_8, // base 2: 1 byte (8 bits) wide
|
||||||
|
F_2_16, // base 2: 2 bytes (16 bits) wide
|
||||||
|
F_DEFAULT
|
||||||
|
};
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Get/set the number base when parsing numeric values */
|
||||||
|
static void setFormat(Base::Format base) { myDefaultBase = base; }
|
||||||
|
static Base::Format format() { return myDefaultBase; }
|
||||||
|
|
||||||
|
/** Get/set HEX output to be upper/lower case */
|
||||||
|
static void setHexUppercase(bool enable);
|
||||||
|
static bool hexUppercase() { return myHexflags & std::ios_base::uppercase; }
|
||||||
|
|
||||||
|
/** Output HEX digits in 1/2/4 byte format */
|
||||||
|
static inline std::ostream& HEX2(std::ostream& os) {
|
||||||
|
os.flags(myHexflags);
|
||||||
|
return os << std::setw(2) << std::setfill('0');
|
||||||
|
}
|
||||||
|
static inline std::ostream& HEX4(std::ostream& os) {
|
||||||
|
os.flags(myHexflags);
|
||||||
|
return os << std::setw(4) << std::setfill('0');
|
||||||
|
}
|
||||||
|
static inline std::ostream& HEX8(std::ostream& os) {
|
||||||
|
os.flags(myHexflags);
|
||||||
|
return os << std::setw(8) << std::setfill('0');
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Convert integer to a string in the given base format */
|
||||||
|
static string toString(int value,
|
||||||
|
Common::Base::Format outputBase = Common::Base::F_DEFAULT);
|
||||||
|
|
||||||
|
private: // Make sure this class is never instantiated
|
||||||
|
Base() { }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// Default format to use when none is specified
|
||||||
|
static Format myDefaultBase;
|
||||||
|
|
||||||
|
// Upper or lower case for HEX digits
|
||||||
|
static std::ios_base::fmtflags myHexflags;
|
||||||
|
|
||||||
|
// Format specifiers to use for sprintf (eventually we may convert
|
||||||
|
// to C++ streams
|
||||||
|
static const char* myLowerFmt[4];
|
||||||
|
static const char* myUpperFmt[4];
|
||||||
|
static const char** myFmt;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // Namespace Common
|
||||||
|
|
||||||
|
#endif
|
|
@ -70,6 +70,7 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
|
#include <cstdio>
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
// Defines to help with path handling
|
// Defines to help with path handling
|
||||||
|
@ -112,11 +113,6 @@ using namespace std;
|
||||||
#define BSPF_ARCH "NOARCH"
|
#define BSPF_ARCH "NOARCH"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Used for stringstreams
|
|
||||||
#define HEX8 uppercase << hex << setw(8) << setfill('0')
|
|
||||||
#define HEX4 uppercase << hex << setw(4) << setfill('0')
|
|
||||||
#define HEX2 uppercase << hex << setw(2) << setfill('0')
|
|
||||||
|
|
||||||
// Some convenience functions
|
// Some convenience functions
|
||||||
template<typename T> inline void BSPF_swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
template<typename T> inline void BSPF_swap(T& a, T& b) { T tmp = a; a = b; b = tmp; }
|
||||||
template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; }
|
template<typename T> inline T BSPF_abs (T x) { return (x>=0) ? x : -x; }
|
||||||
|
|
|
@ -2,6 +2,7 @@ MODULE := src/common
|
||||||
|
|
||||||
MODULE_OBJS := \
|
MODULE_OBJS := \
|
||||||
src/common/mainSDL.o \
|
src/common/mainSDL.o \
|
||||||
|
src/common/Base.o \
|
||||||
src/common/SoundSDL.o \
|
src/common/SoundSDL.o \
|
||||||
src/common/FrameBufferSoft.o \
|
src/common/FrameBufferSoft.o \
|
||||||
src/common/FrameBufferGL.o \
|
src/common/FrameBufferGL.o \
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#include "Version.hxx"
|
#include "Version.hxx"
|
||||||
#include "CartDebug.hxx"
|
#include "CartDebug.hxx"
|
||||||
#include "CartDebugWidget.hxx"
|
#include "CartDebugWidget.hxx"
|
||||||
|
using namespace Common;
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
|
CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
|
||||||
|
@ -97,7 +98,7 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
|
||||||
|
|
||||||
// Add settings for Distella
|
// Add settings for Distella
|
||||||
DiStella::settings.gfx_format =
|
DiStella::settings.gfx_format =
|
||||||
myOSystem.settings().getInt("dis.gfxformat") == 16 ? kBASE_16 : kBASE_2;
|
myOSystem.settings().getInt("dis.gfxformat") == 16 ? Base::F_16 : Base::F_2;
|
||||||
DiStella::settings.resolve_code =
|
DiStella::settings.resolve_code =
|
||||||
myOSystem.settings().getBool("dis.resolve");
|
myOSystem.settings().getBool("dis.resolve");
|
||||||
DiStella::settings.show_addresses =
|
DiStella::settings.show_addresses =
|
||||||
|
@ -201,18 +202,18 @@ string CartDebug::toString()
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
uInt32 bytesPerLine;
|
uInt32 bytesPerLine;
|
||||||
|
|
||||||
switch(myDebugger.parser().base())
|
switch(Base::format())
|
||||||
{
|
{
|
||||||
case kBASE_16:
|
case Base::F_16:
|
||||||
case kBASE_10:
|
case Base::F_10:
|
||||||
bytesPerLine = 0x10;
|
bytesPerLine = 0x10;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_2:
|
case Base::F_2:
|
||||||
bytesPerLine = 0x04;
|
bytesPerLine = 0x04;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_DEFAULT:
|
case Base::F_DEFAULT:
|
||||||
default:
|
default:
|
||||||
return DebuggerParser::red("invalid base, this is a BUG");
|
return DebuggerParser::red("invalid base, this is a BUG");
|
||||||
}
|
}
|
||||||
|
@ -236,7 +237,7 @@ string CartDebug::toString()
|
||||||
bytesSoFar = 0;
|
bytesSoFar = 0;
|
||||||
}
|
}
|
||||||
curraddr = state.rport[i];
|
curraddr = state.rport[i];
|
||||||
buf << HEX2 << (curraddr & 0x00ff) << ": ";
|
buf << Base::HEX2 << (curraddr & 0x00ff) << ": ";
|
||||||
|
|
||||||
for(uInt8 j = 0; j < bytesPerLine; ++j)
|
for(uInt8 j = 0; j < bytesPerLine; ++j)
|
||||||
{
|
{
|
||||||
|
@ -611,10 +612,10 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
{
|
{
|
||||||
buf << ourTIAMnemonicR[a];
|
buf << ourTIAMnemonicR[a];
|
||||||
if(offset > 0)
|
if(offset > 0)
|
||||||
buf << "|$" << HEX2 << offset;
|
buf << "|$" << Base::HEX2 << offset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buf << "$" << HEX2 << addr;
|
buf << "$" << Base::HEX2 << addr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -623,10 +624,10 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
{
|
{
|
||||||
buf << ourTIAMnemonicW[a];
|
buf << ourTIAMnemonicW[a];
|
||||||
if(offset > 0)
|
if(offset > 0)
|
||||||
buf << "|$" << HEX2 << offset;
|
buf << "|$" << Base::HEX2 << offset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buf << "$" << HEX2 << addr;
|
buf << "$" << Base::HEX2 << addr;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -640,13 +641,13 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
{
|
{
|
||||||
buf << ourIOMnemonic[a - 0x80];
|
buf << ourIOMnemonic[a - 0x80];
|
||||||
if(offset > 0)
|
if(offset > 0)
|
||||||
buf << "|$" << HEX2 << offset;
|
buf << "|$" << Base::HEX2 << offset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buf << "$" << HEX2 << addr;
|
buf << "$" << Base::HEX2 << addr;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
buf << "$" << HEX2 << addr;
|
buf << "$" << Base::HEX2 << addr;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -668,7 +669,7 @@ bool CartDebug::getLabel(ostream& buf, uInt16 addr, bool isRead, int places) con
|
||||||
else
|
else
|
||||||
buf << ourZPMnemonic[a - 0x80];
|
buf << ourZPMnemonic[a - 0x80];
|
||||||
if(offset > 0)
|
if(offset > 0)
|
||||||
buf << "|$" << HEX2 << offset;
|
buf << "|$" << Base::HEX2 << offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -977,7 +978,7 @@ string CartDebug::saveDisassembly()
|
||||||
myDisLabels, myDisDirectives, myReserved);
|
myDisLabels, myDisDirectives, myReserved);
|
||||||
|
|
||||||
buf << " SEG CODE\n"
|
buf << " SEG CODE\n"
|
||||||
<< " ORG $" << HEX4 << info.offset << "\n\n";
|
<< " ORG $" << Base::HEX4 << info.offset << "\n\n";
|
||||||
|
|
||||||
// Format in 'distella' style
|
// Format in 'distella' style
|
||||||
for(uInt32 i = 0; i < disasm.list.size(); ++i)
|
for(uInt32 i = 0; i < disasm.list.size(); ++i)
|
||||||
|
@ -1008,25 +1009,25 @@ string CartDebug::saveDisassembly()
|
||||||
}
|
}
|
||||||
case CartDebug::GFX:
|
case CartDebug::GFX:
|
||||||
{
|
{
|
||||||
buf << ".byte " << (settings.gfx_format == kBASE_2 ? "%" : "$")
|
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
|
||||||
<< tag.bytes << " ; |";
|
<< tag.bytes << " ; |";
|
||||||
for(int i = 12; i < 20; ++i)
|
for(int i = 12; i < 20; ++i)
|
||||||
buf << ((tag.disasm[i] == '\x1e') ? "#" : " ");
|
buf << ((tag.disasm[i] == '\x1e') ? "#" : " ");
|
||||||
buf << "| $" << HEX4 << tag.address << " (G)\n";
|
buf << "| $" << Base::HEX4 << tag.address << " (G)\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CartDebug::PGFX:
|
case CartDebug::PGFX:
|
||||||
{
|
{
|
||||||
buf << ".byte " << (settings.gfx_format == kBASE_2 ? "%" : "$")
|
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
|
||||||
<< tag.bytes << " ; |";
|
<< tag.bytes << " ; |";
|
||||||
for(int i = 12; i < 20; ++i)
|
for(int i = 12; i < 20; ++i)
|
||||||
buf << ((tag.disasm[i] == '\x1f') ? "*" : " ");
|
buf << ((tag.disasm[i] == '\x1f') ? "*" : " ");
|
||||||
buf << "| $" << HEX4 << tag.address << " (P)\n";
|
buf << "| $" << Base::HEX4 << tag.address << " (P)\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CartDebug::DATA:
|
case CartDebug::DATA:
|
||||||
{
|
{
|
||||||
buf << tag.disasm.substr(0, 9) << " ; $" << HEX4 << tag.address << " (D)\n";
|
buf << tag.disasm.substr(0, 9) << " ; $" << Base::HEX4 << tag.address << " (D)\n";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -1068,15 +1069,15 @@ string CartDebug::saveDisassembly()
|
||||||
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
||||||
if(myReserved.TIARead[addr] && ourTIAMnemonicR[addr])
|
if(myReserved.TIARead[addr] && ourTIAMnemonicR[addr])
|
||||||
out << ALIGN(6) << ourTIAMnemonicR[addr] << " = $"
|
out << ALIGN(6) << ourTIAMnemonicR[addr] << " = $"
|
||||||
<< HEX2 << right << addr << " ; (R)\n";
|
<< Base::HEX2 << right << addr << " ; (R)\n";
|
||||||
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
|
||||||
if(myReserved.TIAWrite[addr] && ourTIAMnemonicW[addr])
|
if(myReserved.TIAWrite[addr] && ourTIAMnemonicW[addr])
|
||||||
out << ALIGN(6) << ourTIAMnemonicW[addr] << " = $"
|
out << ALIGN(6) << ourTIAMnemonicW[addr] << " = $"
|
||||||
<< HEX2 << right << addr << " ; (W)\n";
|
<< Base::HEX2 << right << addr << " ; (W)\n";
|
||||||
for(uInt16 addr = 0x00; addr <= 0x17; ++addr)
|
for(uInt16 addr = 0x00; addr <= 0x17; ++addr)
|
||||||
if(myReserved.IOReadWrite[addr] && ourIOMnemonic[addr])
|
if(myReserved.IOReadWrite[addr] && ourIOMnemonic[addr])
|
||||||
out << ALIGN(6) << ourIOMnemonic[addr] << " = $"
|
out << ALIGN(6) << ourIOMnemonic[addr] << " = $"
|
||||||
<< HEX4 << right << (addr+0x280) << "\n";
|
<< Base::HEX4 << right << (addr+0x280) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
addrUsed = false;
|
addrUsed = false;
|
||||||
|
@ -1093,7 +1094,7 @@ string CartDebug::saveDisassembly()
|
||||||
myUserLabels.find(addr) == myUserLabels.end())
|
myUserLabels.find(addr) == myUserLabels.end())
|
||||||
{
|
{
|
||||||
out << ALIGN(6) << ourZPMnemonic[addr-0x80] << " = $"
|
out << ALIGN(6) << ourZPMnemonic[addr-0x80] << " = $"
|
||||||
<< HEX2 << right << (addr) << "\n";
|
<< Base::HEX2 << right << (addr) << "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1168,7 +1169,7 @@ string CartDebug::listConfig(int bank)
|
||||||
{
|
{
|
||||||
buf << "(*) ";
|
buf << "(*) ";
|
||||||
disasmTypeAsString(buf, i->type);
|
disasmTypeAsString(buf, i->type);
|
||||||
buf << " " << HEX4 << i->start << " " << HEX4 << i->end << endl;
|
buf << " " << Base::HEX4 << i->start << " " << Base::HEX4 << i->end << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
getBankDirectives(buf, info);
|
getBankDirectives(buf, info);
|
||||||
|
@ -1260,7 +1261,7 @@ CartDebug::AddrType CartDebug::addressType(uInt16 addr) const
|
||||||
void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
|
void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
|
||||||
{
|
{
|
||||||
// Start with the offset for this bank
|
// Start with the offset for this bank
|
||||||
buf << "ORG " << HEX4 << info.offset << endl;
|
buf << "ORG " << Base::HEX4 << info.offset << endl;
|
||||||
|
|
||||||
// Now consider each byte
|
// Now consider each byte
|
||||||
uInt32 prev = info.offset, addr = prev + 1;
|
uInt32 prev = info.offset, addr = prev + 1;
|
||||||
|
@ -1273,7 +1274,7 @@ void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
|
||||||
if(currType != prevType)
|
if(currType != prevType)
|
||||||
{
|
{
|
||||||
disasmTypeAsString(buf, prevType);
|
disasmTypeAsString(buf, prevType);
|
||||||
buf << " " << HEX4 << prev << " " << HEX4 << (addr-1) << endl;
|
buf << " " << Base::HEX4 << prev << " " << Base::HEX4 << (addr-1) << endl;
|
||||||
|
|
||||||
prev = addr;
|
prev = addr;
|
||||||
prevType = currType;
|
prevType = currType;
|
||||||
|
@ -1284,7 +1285,7 @@ void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
|
||||||
if(prev != addr)
|
if(prev != addr)
|
||||||
{
|
{
|
||||||
disasmTypeAsString(buf, prevType);
|
disasmTypeAsString(buf, prevType);
|
||||||
buf << " " << HEX4 << prev << " " << HEX4 << (addr-1) << endl;
|
buf << " " << Base::HEX4 << prev << " " << Base::HEX4 << (addr-1) << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1301,11 +1302,11 @@ void CartDebug::addressTypeAsString(ostream& buf, uInt16 addr) const
|
||||||
debugger = myDebugger.getAccessFlags(addr) & 0xFC,
|
debugger = myDebugger.getAccessFlags(addr) & 0xFC,
|
||||||
label = myDisLabels[addr & 0xFFF];
|
label = myDisLabels[addr & 0xFFF];
|
||||||
|
|
||||||
buf << endl << "directive: " << myDebugger.valueToString(directive, kBASE_2_8) << " ";
|
buf << endl << "directive: " << Base::toString(directive, Base::F_2_8) << " ";
|
||||||
disasmTypeAsString(buf, directive);
|
disasmTypeAsString(buf, directive);
|
||||||
buf << endl << "emulation: " << myDebugger.valueToString(debugger, kBASE_2_8) << " ";
|
buf << endl << "emulation: " << Base::toString(debugger, Base::F_2_8) << " ";
|
||||||
disasmTypeAsString(buf, debugger);
|
disasmTypeAsString(buf, debugger);
|
||||||
buf << endl << "tentative: " << myDebugger.valueToString(label, kBASE_2_8) << " ";
|
buf << endl << "tentative: " << Base::toString(label, Base::F_2_8) << " ";
|
||||||
disasmTypeAsString(buf, label);
|
disasmTypeAsString(buf, label);
|
||||||
buf << endl;
|
buf << endl;
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,7 +127,7 @@ Debugger::Debugger(OSystem& osystem, Console& console)
|
||||||
myRewindManager(NULL)
|
myRewindManager(NULL)
|
||||||
{
|
{
|
||||||
// Init parser
|
// Init parser
|
||||||
myParser = new DebuggerParser(*this);
|
myParser = new DebuggerParser(*this, osystem.settings());
|
||||||
|
|
||||||
// Create debugger subsystems
|
// Create debugger subsystems
|
||||||
myCpuDebug = new CpuDebug(*this, myConsole);
|
myCpuDebug = new CpuDebug(*this, myConsole);
|
||||||
|
@ -203,7 +203,7 @@ bool Debugger::start(const string& message, int address)
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << message;
|
buf << message;
|
||||||
if(address > -1)
|
if(address > -1)
|
||||||
buf << valueToString(address);
|
buf << Common::Base::HEX4 << address;
|
||||||
|
|
||||||
myDialog->message().setText(buf.str());
|
myDialog->message().setText(buf.str());
|
||||||
return true;
|
return true;
|
||||||
|
@ -265,66 +265,6 @@ const string Debugger::run(const string& command)
|
||||||
return myParser->run(command);
|
return myParser->run(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
||||||
string Debugger::valueToString(int value, BaseFormat outputBase) const
|
|
||||||
{
|
|
||||||
static char vToS_buf[32];
|
|
||||||
|
|
||||||
if(outputBase == kBASE_DEFAULT)
|
|
||||||
outputBase = myParser->base();
|
|
||||||
|
|
||||||
switch(outputBase)
|
|
||||||
{
|
|
||||||
case kBASE_2: // base 2: 8 or 16 bits (depending on value)
|
|
||||||
case kBASE_2_8: // base 2: 1 byte (8 bits) wide
|
|
||||||
case kBASE_2_16: // base 2: 2 bytes (16 bits) wide
|
|
||||||
{
|
|
||||||
int places = (outputBase == kBASE_2_8 ||
|
|
||||||
(outputBase == kBASE_2 && value < 0x100)) ? 8 : 16;
|
|
||||||
vToS_buf[places] = '\0';
|
|
||||||
int bit = 1;
|
|
||||||
while(--places >= 0) {
|
|
||||||
if(value & bit) vToS_buf[places] = '1';
|
|
||||||
else vToS_buf[places] = '0';
|
|
||||||
bit <<= 1;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case kBASE_10: // base 10: 3 or 5 bytes (depending on value)
|
|
||||||
if(value < 0x100)
|
|
||||||
BSPF_snprintf(vToS_buf, 4, "%3d", value);
|
|
||||||
else
|
|
||||||
BSPF_snprintf(vToS_buf, 6, "%5d", value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kBASE_16_1: // base 16: 1 byte wide
|
|
||||||
BSPF_snprintf(vToS_buf, 2, "%1X", value);
|
|
||||||
break;
|
|
||||||
case kBASE_16_2: // base 16: 2 bytes wide
|
|
||||||
BSPF_snprintf(vToS_buf, 3, "%02X", value);
|
|
||||||
break;
|
|
||||||
case kBASE_16_4: // base 16: 4 bytes wide
|
|
||||||
BSPF_snprintf(vToS_buf, 5, "%04X", value);
|
|
||||||
break;
|
|
||||||
case kBASE_16_8: // base 16: 8 bytes wide
|
|
||||||
BSPF_snprintf(vToS_buf, 9, "%08X", value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case kBASE_16: // base 16: 2, 4, 8 bytes (depending on value)
|
|
||||||
default:
|
|
||||||
if(value < 0x100)
|
|
||||||
BSPF_snprintf(vToS_buf, 3, "%02X", value);
|
|
||||||
else if(value < 0x10000)
|
|
||||||
BSPF_snprintf(vToS_buf, 5, "%04X", value);
|
|
||||||
else
|
|
||||||
BSPF_snprintf(vToS_buf, 9, "%08X", value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return string(vToS_buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
const string Debugger::invIfChanged(int reg, int oldReg)
|
const string Debugger::invIfChanged(int reg, int oldReg)
|
||||||
{
|
{
|
||||||
|
@ -332,7 +272,7 @@ const string Debugger::invIfChanged(int reg, int oldReg)
|
||||||
|
|
||||||
bool changed = reg != oldReg;
|
bool changed = reg != oldReg;
|
||||||
if(changed) ret += "\177";
|
if(changed) ret += "\177";
|
||||||
ret += valueToString(reg);
|
ret += Common::Base::toString(reg, Common::Base::F_16_2);
|
||||||
if(changed) ret += "\177";
|
if(changed) ret += "\177";
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -41,6 +41,7 @@ class ButtonWidget;
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
|
#include "Base.hxx"
|
||||||
#include "DialogContainer.hxx"
|
#include "DialogContainer.hxx"
|
||||||
#include "DebuggerDialog.hxx"
|
#include "DebuggerDialog.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
#include "DebuggerParser.hxx"
|
||||||
|
@ -183,7 +184,6 @@ class Debugger : public DialogContainer
|
||||||
*/
|
*/
|
||||||
int stringToValue(const string& stringval)
|
int stringToValue(const string& stringval)
|
||||||
{ return myParser->decipher_arg(stringval); }
|
{ return myParser->decipher_arg(stringval); }
|
||||||
string valueToString(int value, BaseFormat outputBase = kBASE_DEFAULT) const;
|
|
||||||
|
|
||||||
/* Convenience methods to get/set bit(s) in an 8-bit register */
|
/* Convenience methods to get/set bit(s) in an 8-bit register */
|
||||||
static uInt8 set_bit(uInt8 input, uInt8 bit, bool on)
|
static uInt8 set_bit(uInt8 input, uInt8 bit, bool on)
|
||||||
|
|
|
@ -36,6 +36,9 @@
|
||||||
#include "ProgressDialog.hxx"
|
#include "ProgressDialog.hxx"
|
||||||
#include "PackedBitArray.hxx"
|
#include "PackedBitArray.hxx"
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
|
using namespace Common;
|
||||||
|
|
||||||
#ifdef CHEATCODE_SUPPORT
|
#ifdef CHEATCODE_SUPPORT
|
||||||
#include "Cheat.hxx"
|
#include "Cheat.hxx"
|
||||||
#include "CheatManager.hxx"
|
#include "CheatManager.hxx"
|
||||||
|
@ -50,9 +53,9 @@
|
||||||
// TODO - use C++ streams instead of nasty C-strings and pointers
|
// TODO - use C++ streams instead of nasty C-strings and pointers
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DebuggerParser::DebuggerParser(Debugger& d)
|
DebuggerParser::DebuggerParser(Debugger& d, Settings& s)
|
||||||
: debugger(d),
|
: debugger(d),
|
||||||
defaultBase(kBASE_16)
|
settings(s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,7 +151,7 @@ string DebuggerParser::exec(const FilesystemNode& file)
|
||||||
run(command);
|
run(command);
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
buf << "Executed " << debugger.valueToString(count) << " commands from \""
|
buf << "Executed " << count << " commands from \""
|
||||||
<< file.getShortPath() << "\"";
|
<< file.getShortPath() << "\"";
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
|
@ -181,9 +184,11 @@ int DebuggerParser::decipher_arg(const string& str)
|
||||||
int result;
|
int result;
|
||||||
string arg = str;
|
string arg = str;
|
||||||
|
|
||||||
if(defaultBase == kBASE_2) {
|
Base::Format defaultBase = Base::format();
|
||||||
|
|
||||||
|
if(defaultBase == Base::F_2) {
|
||||||
bin=true; dec=false;
|
bin=true; dec=false;
|
||||||
} else if(defaultBase == kBASE_10) {
|
} else if(defaultBase == Base::F_10) {
|
||||||
bin=false; dec=true;
|
bin=false; dec=true;
|
||||||
} else {
|
} else {
|
||||||
bin=false; dec=false;
|
bin=false; dec=false;
|
||||||
|
@ -543,11 +548,11 @@ string DebuggerParser::eval()
|
||||||
buf << wlabel << "(W): ";
|
buf << wlabel << "(W): ";
|
||||||
|
|
||||||
if(args[i] < 0x100)
|
if(args[i] < 0x100)
|
||||||
buf << "$" << debugger.valueToString(args[i], kBASE_16_2)
|
buf << "$" << Base::toString(args[i], Base::F_16_2)
|
||||||
<< " %" << debugger.valueToString(args[i], kBASE_2_8);
|
<< " %" << Base::toString(args[i], Base::F_2_8);
|
||||||
else
|
else
|
||||||
buf << "$" << debugger.valueToString(args[i], kBASE_16_4)
|
buf << "$" << Base::toString(args[i], Base::F_16_4)
|
||||||
<< " %" << debugger.valueToString(args[i], kBASE_2_16);
|
<< " %" << Base::toString(args[i], Base::F_2_16);
|
||||||
|
|
||||||
buf << " #" << (int) args[i];
|
buf << " #" << (int) args[i];
|
||||||
if(i != argCount - 1)
|
if(i != argCount - 1)
|
||||||
|
@ -561,7 +566,7 @@ string DebuggerParser::eval()
|
||||||
string DebuggerParser::trapStatus(int addr)
|
string DebuggerParser::trapStatus(int addr)
|
||||||
{
|
{
|
||||||
string result;
|
string result;
|
||||||
result += debugger.valueToString(addr);
|
result += Base::toString(addr);
|
||||||
result += ": ";
|
result += ": ";
|
||||||
bool r = debugger.readTrap(addr);
|
bool r = debugger.readTrap(addr);
|
||||||
bool w = debugger.writeTrap(addr);
|
bool w = debugger.writeTrap(addr);
|
||||||
|
@ -649,8 +654,8 @@ void DebuggerParser::executeBank()
|
||||||
commandResult << red("bankswitching not supported by this cartridge");
|
commandResult << red("bankswitching not supported by this cartridge");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
commandResult << "current = " << debugger.valueToString(debugger.cartDebug().getBank())
|
commandResult << "current = " << debugger.cartDebug().getBank()
|
||||||
<< " out of " << debugger.valueToString(banks) << " banks";
|
<< " out of " << banks << " banks";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -659,7 +664,7 @@ void DebuggerParser::executeBank()
|
||||||
commandResult << red("bankswitching not supported by this cartridge");
|
commandResult << red("bankswitching not supported by this cartridge");
|
||||||
else if(args[0] >= banks)
|
else if(args[0] >= banks)
|
||||||
commandResult << red("invalid bank number (must be 0 to ")
|
commandResult << red("invalid bank number (must be 0 to ")
|
||||||
<< debugger.valueToString(banks - 1) << ")";
|
<< (banks - 1) << ")";
|
||||||
else if(debugger.setBank(args[0]))
|
else if(debugger.setBank(args[0]))
|
||||||
commandResult << "switched bank OK";
|
commandResult << "switched bank OK";
|
||||||
else
|
else
|
||||||
|
@ -672,23 +677,23 @@ void DebuggerParser::executeBank()
|
||||||
void DebuggerParser::executeBase()
|
void DebuggerParser::executeBase()
|
||||||
{
|
{
|
||||||
if(args[0] == 2 || argStrings[0] == "bin")
|
if(args[0] == 2 || argStrings[0] == "bin")
|
||||||
setBase(kBASE_2);
|
Base::setFormat(Base::F_2);
|
||||||
else if(args[0] == 10 || argStrings[0] == "dec")
|
else if(args[0] == 10 || argStrings[0] == "dec")
|
||||||
setBase(kBASE_10);
|
Base::setFormat(Base::F_10);
|
||||||
else if(args[0] == 16 || argStrings[0] == "hex")
|
else if(args[0] == 16 || argStrings[0] == "hex")
|
||||||
setBase(kBASE_16);
|
Base::setFormat(Base::F_16);
|
||||||
|
|
||||||
commandResult << "default base set to ";
|
commandResult << "default base set to ";
|
||||||
switch(defaultBase) {
|
switch(Base::format()) {
|
||||||
case kBASE_2:
|
case Base::F_2:
|
||||||
commandResult << "#2/bin";
|
commandResult << "#2/bin";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_10:
|
case Base::F_10:
|
||||||
commandResult << "#10/dec";
|
commandResult << "#10/dec";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kBASE_16:
|
case Base::F_16:
|
||||||
commandResult << "#16/hex";
|
commandResult << "#16/hex";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -715,7 +720,7 @@ void DebuggerParser::executeBreak()
|
||||||
else
|
else
|
||||||
commandResult << "Cleared";
|
commandResult << "Cleared";
|
||||||
|
|
||||||
commandResult << " breakpoint at " << debugger.valueToString(bp);
|
commandResult << " breakpoint at " << Base::toString(bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -727,7 +732,7 @@ void DebuggerParser::executeBreakif()
|
||||||
{
|
{
|
||||||
uInt32 ret = debugger.cpuDebug().m6502().addCondBreak(
|
uInt32 ret = debugger.cpuDebug().m6502().addCondBreak(
|
||||||
YaccParser::getResult(), argStrings[0] );
|
YaccParser::getResult(), argStrings[0] );
|
||||||
commandResult << "Added breakif " << debugger.valueToString(ret);
|
commandResult << "Added breakif " << Base::toString(ret);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
commandResult << red("invalid expression");
|
commandResult << red("invalid expression");
|
||||||
|
@ -943,10 +948,10 @@ void DebuggerParser::executeDump()
|
||||||
for(int i=0; i<8; i++)
|
for(int i=0; i<8; i++)
|
||||||
{
|
{
|
||||||
int start = args[0] + i*16;
|
int start = args[0] + i*16;
|
||||||
commandResult << debugger.valueToString(start) << ": ";
|
commandResult << Base::toString(start) << ": ";
|
||||||
for(int j = 0; j < 16; j++)
|
for(int j = 0; j < 16; j++)
|
||||||
{
|
{
|
||||||
commandResult << debugger.valueToString(debugger.peek(start+j)) << " ";
|
commandResult << Base::toString(debugger.peek(start+j)) << " ";
|
||||||
if(j == 7) commandResult << "- ";
|
if(j == 7) commandResult << "- ";
|
||||||
}
|
}
|
||||||
if(i != 7) commandResult << endl;
|
if(i != 7) commandResult << endl;
|
||||||
|
@ -975,8 +980,7 @@ void DebuggerParser::executeFrame()
|
||||||
int count = 1;
|
int count = 1;
|
||||||
if(argCount != 0) count = args[0];
|
if(argCount != 0) count = args[0];
|
||||||
debugger.nextFrame(count);
|
debugger.nextFrame(count);
|
||||||
commandResult << "advanced " << debugger.valueToString(count) << " frame";
|
commandResult << "advanced " << dec << count << " frame(s)";
|
||||||
if(count != 1) commandResult << "s";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1057,10 +1061,10 @@ void DebuggerParser::executeJump()
|
||||||
if(line >= 0 && address >= 0)
|
if(line >= 0 && address >= 0)
|
||||||
{
|
{
|
||||||
debugger.rom().scrollTo(line);
|
debugger.rom().scrollTo(line);
|
||||||
commandResult << "disassembly scrolled to address $" << HEX4 << address;
|
commandResult << "disassembly scrolled to address $" << Base::HEX4 << address;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
commandResult << "address $" << HEX4 << args[0] << " doesn't exist";
|
commandResult << "address $" << Base::HEX4 << args[0] << " doesn't exist";
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1094,7 +1098,7 @@ void DebuggerParser::executeListbreaks()
|
||||||
commandResult << "\nbreakifs:\n";
|
commandResult << "\nbreakifs:\n";
|
||||||
for(unsigned int i = 0; i < conds.size(); i++)
|
for(unsigned int i = 0; i < conds.size(); i++)
|
||||||
{
|
{
|
||||||
commandResult << debugger.valueToString(i) << ": " << conds[i];
|
commandResult << i << ": " << conds[i];
|
||||||
if(i != (conds.size() - 1)) commandResult << endl;
|
if(i != (conds.size() - 1)) commandResult << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1278,8 +1282,7 @@ void DebuggerParser::executeRom()
|
||||||
// method ...
|
// method ...
|
||||||
debugger.rom().invalidate();
|
debugger.rom().invalidate();
|
||||||
|
|
||||||
commandResult << "changed " << debugger.valueToString( args.size() - 1 )
|
commandResult << "changed " << (args.size() - 1) << " location(s)";
|
||||||
<< " location(s)";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1349,13 +1352,11 @@ void DebuggerParser::executeRunTo()
|
||||||
|
|
||||||
if(done)
|
if(done)
|
||||||
commandResult
|
commandResult
|
||||||
<< "found " << argStrings[0] << " in "
|
<< "found " << argStrings[0] << " in " << dec << count
|
||||||
<< debugger.valueToString(count, kBASE_10)
|
|
||||||
<< " disassembled instructions";
|
<< " disassembled instructions";
|
||||||
else
|
else
|
||||||
commandResult
|
commandResult
|
||||||
<< argStrings[0] << " not found in "
|
<< argStrings[0] << " not found in " << dec << count
|
||||||
<< debugger.valueToString(count, kBASE_10)
|
|
||||||
<< " disassembled instructions";
|
<< " disassembled instructions";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1379,14 +1380,12 @@ void DebuggerParser::executeRunToPc()
|
||||||
|
|
||||||
if(done)
|
if(done)
|
||||||
commandResult
|
commandResult
|
||||||
<< "set PC to " << hex << args[0] << " in "
|
<< "set PC to " << Base::HEX4 << args[0] << " in "
|
||||||
<< debugger.valueToString(count, kBASE_10)
|
<< dec << count << " disassembled instructions";
|
||||||
<< " disassembled instructions";
|
|
||||||
else
|
else
|
||||||
commandResult
|
commandResult
|
||||||
<< "PC " << hex << args[0] << " not reached or found in "
|
<< "PC " << Base::HEX4 << args[0] << " not reached or found in "
|
||||||
<< debugger.valueToString(count, kBASE_10)
|
<< dec << count << " disassembled instructions";
|
||||||
<< " disassembled instructions";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1454,8 +1453,7 @@ void DebuggerParser::executeScanline()
|
||||||
int count = 1;
|
int count = 1;
|
||||||
if(argCount != 0) count = args[0];
|
if(argCount != 0) count = args[0];
|
||||||
debugger.nextScanline(count);
|
debugger.nextScanline(count);
|
||||||
commandResult << "advanced " << debugger.valueToString(count) << " scanline";
|
commandResult << "advanced " << dec << count << " scanline(s)";
|
||||||
if(count != 1) commandResult << "s";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1463,7 +1461,7 @@ void DebuggerParser::executeScanline()
|
||||||
void DebuggerParser::executeStep()
|
void DebuggerParser::executeStep()
|
||||||
{
|
{
|
||||||
commandResult
|
commandResult
|
||||||
<< "executed " << debugger.valueToString(debugger.step()) << " cycles";
|
<< "executed " << dec << debugger.step() << " cycles";
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1477,8 +1475,7 @@ void DebuggerParser::executeTia()
|
||||||
// "trace"
|
// "trace"
|
||||||
void DebuggerParser::executeTrace()
|
void DebuggerParser::executeTrace()
|
||||||
{
|
{
|
||||||
commandResult
|
commandResult << "executed " << dec << debugger.trace() << " cycles";
|
||||||
<< "executed " << debugger.valueToString(debugger.trace()) << " cycles";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1537,12 +1534,24 @@ void DebuggerParser::executeType()
|
||||||
|
|
||||||
for(uInt32 i = beg; i <= end; ++i)
|
for(uInt32 i = beg; i <= end; ++i)
|
||||||
{
|
{
|
||||||
commandResult << HEX4 << i << ": ";
|
commandResult << Base::HEX4 << i << ": ";
|
||||||
debugger.cartDebug().addressTypeAsString(commandResult, i);
|
debugger.cartDebug().addressTypeAsString(commandResult, i);
|
||||||
commandResult << endl;
|
commandResult << endl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
// "uhex"
|
||||||
|
void DebuggerParser::executeUHex()
|
||||||
|
{
|
||||||
|
bool enable = !Base::hexUppercase();
|
||||||
|
Base::setHexUppercase(enable);
|
||||||
|
|
||||||
|
settings.setValue("dbg.uhex", enable);
|
||||||
|
|
||||||
|
commandResult << "uppercase HEX " << (enable ? "enabled" : "disabled");
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
// "undef"
|
// "undef"
|
||||||
void DebuggerParser::executeUndef()
|
void DebuggerParser::executeUndef()
|
||||||
|
@ -2178,6 +2187,14 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
||||||
&DebuggerParser::executeType
|
&DebuggerParser::executeType
|
||||||
},
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"uhex",
|
||||||
|
"Toggle upper/lowercase HEX display",
|
||||||
|
false,
|
||||||
|
true,
|
||||||
|
{ kARG_END_ARGS },
|
||||||
|
&DebuggerParser::executeUHex
|
||||||
|
},
|
||||||
|
|
||||||
{
|
{
|
||||||
"undef",
|
"undef",
|
||||||
|
|
|
@ -29,27 +29,12 @@ struct Command;
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
|
#include "Settings.hxx"
|
||||||
// The base to use for conversion from integers to strings
|
|
||||||
// Note that the actual number of places will be determined by
|
|
||||||
// the magnitude of the value itself in the general case
|
|
||||||
typedef enum {
|
|
||||||
kBASE_16, // base 16: 2, 4, 8 bytes (depending on value)
|
|
||||||
kBASE_16_1, // base 16: 1 byte wide
|
|
||||||
kBASE_16_2, // base 16: 2 bytes wide
|
|
||||||
kBASE_16_4, // base 16: 4 bytes wide
|
|
||||||
kBASE_16_8, // base 16: 8 bytes wide
|
|
||||||
kBASE_10, // base 10: 3 or 5 bytes (depending on value)
|
|
||||||
kBASE_2, // base 2: 8 or 16 bits (depending on value)
|
|
||||||
kBASE_2_8, // base 2: 1 byte (8 bits) wide
|
|
||||||
kBASE_2_16, // base 2: 2 bytes (16 bits) wide
|
|
||||||
kBASE_DEFAULT
|
|
||||||
} BaseFormat;
|
|
||||||
|
|
||||||
class DebuggerParser
|
class DebuggerParser
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DebuggerParser(Debugger& debugger);
|
DebuggerParser(Debugger& debugger, Settings& settings);
|
||||||
~DebuggerParser();
|
~DebuggerParser();
|
||||||
|
|
||||||
/** Run the given command, and return the result */
|
/** Run the given command, and return the result */
|
||||||
|
@ -68,10 +53,6 @@ class DebuggerParser
|
||||||
/** String representation of all watches currently defined */
|
/** String representation of all watches currently defined */
|
||||||
string showWatches();
|
string showWatches();
|
||||||
|
|
||||||
/** Get/set the number base when parsing numeric values */
|
|
||||||
void setBase(BaseFormat base) { defaultBase = base; }
|
|
||||||
BaseFormat base() const { return defaultBase; }
|
|
||||||
|
|
||||||
static inline string red(const string& msg = "")
|
static inline string red(const string& msg = "")
|
||||||
{
|
{
|
||||||
return char(kDbgChangedColor) + msg;
|
return char(kDbgChangedColor) + msg;
|
||||||
|
@ -91,7 +72,7 @@ class DebuggerParser
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum {
|
enum {
|
||||||
kNumCommands = 70,
|
kNumCommands = 71,
|
||||||
kMAX_ARG_TYPES = 10
|
kMAX_ARG_TYPES = 10
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +111,9 @@ class DebuggerParser
|
||||||
// Reference to our debugger object
|
// Reference to our debugger object
|
||||||
Debugger& debugger;
|
Debugger& debugger;
|
||||||
|
|
||||||
|
// Reference to settings object (required for saving certain options)
|
||||||
|
Settings& settings;
|
||||||
|
|
||||||
// The results of the currently running command
|
// The results of the currently running command
|
||||||
ostringstream commandResult;
|
ostringstream commandResult;
|
||||||
|
|
||||||
|
@ -138,7 +122,6 @@ class DebuggerParser
|
||||||
StringList argStrings;
|
StringList argStrings;
|
||||||
int argCount;
|
int argCount;
|
||||||
|
|
||||||
BaseFormat defaultBase;
|
|
||||||
StringList watches;
|
StringList watches;
|
||||||
|
|
||||||
// List of available command methods
|
// List of available command methods
|
||||||
|
@ -206,6 +189,7 @@ class DebuggerParser
|
||||||
void executeTrapread();
|
void executeTrapread();
|
||||||
void executeTrapwrite();
|
void executeTrapwrite();
|
||||||
void executeType();
|
void executeType();
|
||||||
|
void executeUHex();
|
||||||
void executeUndef();
|
void executeUndef();
|
||||||
void executeV();
|
void executeV();
|
||||||
void executeWatch();
|
void executeWatch();
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
#include "DiStella.hxx"
|
#include "DiStella.hxx"
|
||||||
|
using namespace Common;
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
||||||
|
@ -210,7 +211,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
|
||||||
if(myDbg.addressType(k+myOffset) == CartDebug::ADDR_ROM)
|
if(myDbg.addressType(k+myOffset) == CartDebug::ADDR_ROM)
|
||||||
{
|
{
|
||||||
reservedLabel.str("");
|
reservedLabel.str("");
|
||||||
reservedLabel << "L" << HEX4 << (k+myOffset);
|
reservedLabel << "L" << Base::HEX4 << (k+myOffset);
|
||||||
myReserved.Label.insert(make_pair(k+myOffset, reservedLabel.str()));
|
myReserved.Label.insert(make_pair(k+myOffset, reservedLabel.str()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -249,21 +250,21 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
if (pass == 3)
|
if (pass == 3)
|
||||||
{
|
{
|
||||||
if (check_bit(myPC, CartDebug::REFERENCED))
|
if (check_bit(myPC, CartDebug::REFERENCED))
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4 << myPC+myOffset << "'";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4 << myPC+myOffset << "'";
|
||||||
else
|
else
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "' '";
|
||||||
|
|
||||||
bool isPGfx = check_bit(myPC, CartDebug::PGFX);
|
bool isPGfx = check_bit(myPC, CartDebug::PGFX);
|
||||||
const string& bit_string = isPGfx ? "\x1f" : "\x1e";
|
const string& bit_string = isPGfx ? "\x1f" : "\x1e";
|
||||||
uInt8 byte = Debugger::debugger().peek(myPC+myOffset);
|
uInt8 byte = Debugger::debugger().peek(myPC+myOffset);
|
||||||
myDisasmBuf << ".byte $" << HEX2 << (int)byte << " |";
|
myDisasmBuf << ".byte $" << Base::HEX2 << (int)byte << " |";
|
||||||
for(uInt8 i = 0, c = byte; i < 8; ++i, c <<= 1)
|
for(uInt8 i = 0, c = byte; i < 8; ++i, c <<= 1)
|
||||||
myDisasmBuf << ((c > 127) ? bit_string : " ");
|
myDisasmBuf << ((c > 127) ? bit_string : " ");
|
||||||
myDisasmBuf << "| $" << HEX4 << myPC+myOffset << "'";
|
myDisasmBuf << "| $" << Base::HEX4 << myPC+myOffset << "'";
|
||||||
if(mySettings.gfx_format == kBASE_2)
|
if(mySettings.gfx_format == Base::F_2)
|
||||||
myDisasmBuf << Debugger::debugger().valueToString(byte, kBASE_2_8);
|
myDisasmBuf << Base::toString(byte, Base::F_2_8);
|
||||||
else
|
else
|
||||||
myDisasmBuf << HEX2 << (int)byte;
|
myDisasmBuf << Base::HEX2 << (int)byte;
|
||||||
addEntry(isPGfx ? CartDebug::PGFX : CartDebug::GFX);
|
addEntry(isPGfx ? CartDebug::PGFX : CartDebug::GFX);
|
||||||
}
|
}
|
||||||
myPC++;
|
myPC++;
|
||||||
|
@ -276,14 +277,14 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
else if (pass == 3)
|
else if (pass == 3)
|
||||||
{
|
{
|
||||||
if (check_bit(myPC, CartDebug::REFERENCED))
|
if (check_bit(myPC, CartDebug::REFERENCED))
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4 << myPC+myOffset << "'";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4 << myPC+myOffset << "'";
|
||||||
else
|
else
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "' '";
|
||||||
|
|
||||||
uInt8 byte = Debugger::debugger().peek(myPC+myOffset);
|
uInt8 byte = Debugger::debugger().peek(myPC+myOffset);
|
||||||
myDisasmBuf << ".byte $" << HEX2 << (int)byte << " $"
|
myDisasmBuf << ".byte $" << Base::HEX2 << (int)byte << " $"
|
||||||
<< HEX4 << myPC+myOffset << "'"
|
<< Base::HEX4 << myPC+myOffset << "'"
|
||||||
<< HEX2 << (int)byte;
|
<< Base::HEX2 << (int)byte;
|
||||||
addEntry(CartDebug::DATA);
|
addEntry(CartDebug::DATA);
|
||||||
}
|
}
|
||||||
myPC++;
|
myPC++;
|
||||||
|
@ -310,8 +311,8 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
addEntry(CartDebug::ROW);
|
addEntry(CartDebug::ROW);
|
||||||
line_empty = true;
|
line_empty = true;
|
||||||
}
|
}
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4
|
||||||
<< myPC+myOffset << "'.byte " << "$" << HEX2
|
<< myPC+myOffset << "'.byte " << "$" << Base::HEX2
|
||||||
<< (int)Debugger::debugger().peek(myPC+myOffset);
|
<< (int)Debugger::debugger().peek(myPC+myOffset);
|
||||||
myPC++;
|
myPC++;
|
||||||
bytes = 1;
|
bytes = 1;
|
||||||
|
@ -319,7 +320,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
}
|
}
|
||||||
else if(line_empty) // start a new line without a label
|
else if(line_empty) // start a new line without a label
|
||||||
{
|
{
|
||||||
myDisasmBuf << " ' '.byte $" << HEX2 << (int)Debugger::debugger().peek(myPC+myOffset);
|
myDisasmBuf << " ' '.byte $" << Base::HEX2 << (int)Debugger::debugger().peek(myPC+myOffset);
|
||||||
myPC++;
|
myPC++;
|
||||||
bytes = 1;
|
bytes = 1;
|
||||||
line_empty = false;
|
line_empty = false;
|
||||||
|
@ -332,7 +333,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
myDisasmBuf << ",$" << HEX2 << (int)Debugger::debugger().peek(myPC+myOffset);
|
myDisasmBuf << ",$" << Base::HEX2 << (int)Debugger::debugger().peek(myPC+myOffset);
|
||||||
myPC++;
|
myPC++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -360,9 +361,9 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
else if (pass == 3)
|
else if (pass == 3)
|
||||||
{
|
{
|
||||||
if (check_bit(myPC, CartDebug::REFERENCED))
|
if (check_bit(myPC, CartDebug::REFERENCED))
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4 << myPC+myOffset << "'";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4 << myPC+myOffset << "'";
|
||||||
else
|
else
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "' '";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add opcode mneumonic
|
// Add opcode mneumonic
|
||||||
|
@ -376,7 +377,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
{
|
{
|
||||||
addr_mode = IMPLIED;
|
addr_mode = IMPLIED;
|
||||||
if (pass == 3)
|
if (pass == 3)
|
||||||
nextline << ".byte $" << HEX2 << (int)op << " ;";
|
nextline << ".byte $" << Base::HEX2 << (int)op << " ;";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pass == 1)
|
if (pass == 1)
|
||||||
|
@ -399,7 +400,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
else if (pass == 3)
|
else if (pass == 3)
|
||||||
{
|
{
|
||||||
nextline << ourLookup[op].mnemonic;
|
nextline << ourLookup[op].mnemonic;
|
||||||
nextlinebytes << HEX2 << (int)op << " ";
|
nextlinebytes << Base::HEX2 << (int)op << " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add operand(s) for PC values outside the app data range
|
// Add operand(s) for PC values outside the app data range
|
||||||
|
@ -420,22 +421,22 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
/* Line information is already printed; append .byte since last
|
/* Line information is already printed; append .byte since last
|
||||||
instruction will put recompilable object larger that original
|
instruction will put recompilable object larger that original
|
||||||
binary file */
|
binary file */
|
||||||
myDisasmBuf << ".byte $" << HEX2 << (int)op << " $"
|
myDisasmBuf << ".byte $" << Base::HEX2 << (int)op << " $"
|
||||||
<< HEX4 << myPC+myOffset << "'"
|
<< Base::HEX4 << myPC+myOffset << "'"
|
||||||
<< HEX2 << (int)op;
|
<< Base::HEX2 << (int)op;
|
||||||
addEntry(CartDebug::DATA);
|
addEntry(CartDebug::DATA);
|
||||||
|
|
||||||
if (myPC == myAppData.end)
|
if (myPC == myAppData.end)
|
||||||
{
|
{
|
||||||
if (check_bit(myPC, CartDebug::REFERENCED))
|
if (check_bit(myPC, CartDebug::REFERENCED))
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "'L" << HEX4 << myPC+myOffset << "'";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "'L" << Base::HEX4 << myPC+myOffset << "'";
|
||||||
else
|
else
|
||||||
myDisasmBuf << HEX4 << myPC+myOffset << "' '";
|
myDisasmBuf << Base::HEX4 << myPC+myOffset << "' '";
|
||||||
|
|
||||||
op = Debugger::debugger().peek(myPC+myOffset); myPC++;
|
op = Debugger::debugger().peek(myPC+myOffset); myPC++;
|
||||||
myDisasmBuf << ".byte $" << HEX2 << (int)op << " $"
|
myDisasmBuf << ".byte $" << Base::HEX2 << (int)op << " $"
|
||||||
<< HEX4 << myPC+myOffset << "'"
|
<< Base::HEX4 << myPC+myOffset << "'"
|
||||||
<< HEX2 << (int)op;
|
<< Base::HEX2 << (int)op;
|
||||||
addEntry(CartDebug::DATA);
|
addEntry(CartDebug::DATA);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -455,7 +456,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
{
|
{
|
||||||
/* Line information is already printed, but we can remove the
|
/* Line information is already printed, but we can remove the
|
||||||
Instruction (i.e. BMI) by simply clearing the buffer to print */
|
Instruction (i.e. BMI) by simply clearing the buffer to print */
|
||||||
myDisasmBuf << ".byte $" << HEX2 << (int)op;
|
myDisasmBuf << ".byte $" << Base::HEX2 << (int)op;
|
||||||
addEntry(CartDebug::ROW);
|
addEntry(CartDebug::ROW);
|
||||||
nextline.str("");
|
nextline.str("");
|
||||||
nextlinebytes.str("");
|
nextlinebytes.str("");
|
||||||
|
@ -523,7 +524,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
if (labfound == 1)
|
if (labfound == 1)
|
||||||
{
|
{
|
||||||
LABEL_A12_HIGH(ad);
|
LABEL_A12_HIGH(ad);
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
else if (labfound == 4)
|
else if (labfound == 4)
|
||||||
{
|
{
|
||||||
|
@ -531,18 +532,18 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
{
|
{
|
||||||
int tmp = (ad & myAppData.end)+myOffset;
|
int tmp = (ad & myAppData.end)+myOffset;
|
||||||
LABEL_A12_HIGH(tmp);
|
LABEL_A12_HIGH(tmp);
|
||||||
nextlinebytes << HEX2 << (int)(tmp&0xff) << " " << HEX2 << (int)(tmp>>8);
|
nextlinebytes << Base::HEX2 << (int)(tmp&0xff) << " " << Base::HEX2 << (int)(tmp>>8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextline << "$" << HEX4 << ad;
|
nextline << "$" << Base::HEX4 << ad;
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LABEL_A12_LOW(ad);
|
LABEL_A12_LOW(ad);
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -556,7 +557,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
{
|
{
|
||||||
nextline << " ";
|
nextline << " ";
|
||||||
LABEL_A12_LOW((int)d1);
|
LABEL_A12_LOW((int)d1);
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -566,8 +567,8 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
d1 = Debugger::debugger().peek(myPC+myOffset); myPC++;
|
d1 = Debugger::debugger().peek(myPC+myOffset); myPC++;
|
||||||
if (pass == 3)
|
if (pass == 3)
|
||||||
{
|
{
|
||||||
nextline << " #$" << HEX2 << (int)d1 << " ";
|
nextline << " #$" << Base::HEX2 << (int)d1 << " ";
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +596,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
{
|
{
|
||||||
LABEL_A12_HIGH(ad);
|
LABEL_A12_HIGH(ad);
|
||||||
nextline << ",X";
|
nextline << ",X";
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
else if (labfound == 4)
|
else if (labfound == 4)
|
||||||
{
|
{
|
||||||
|
@ -604,19 +605,19 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
int tmp = (ad & myAppData.end)+myOffset;
|
int tmp = (ad & myAppData.end)+myOffset;
|
||||||
LABEL_A12_HIGH(tmp);
|
LABEL_A12_HIGH(tmp);
|
||||||
nextline << ",X";
|
nextline << ",X";
|
||||||
nextlinebytes << HEX2 << (int)(tmp&0xff) << " " << HEX2 << (int)(tmp>>8);
|
nextlinebytes << Base::HEX2 << (int)(tmp&0xff) << " " << Base::HEX2 << (int)(tmp>>8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextline << "$" << HEX4 << ad << ",X";
|
nextline << "$" << Base::HEX4 << ad << ",X";
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LABEL_A12_LOW(ad);
|
LABEL_A12_LOW(ad);
|
||||||
nextline << ",X";
|
nextline << ",X";
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -645,7 +646,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
{
|
{
|
||||||
LABEL_A12_HIGH(ad);
|
LABEL_A12_HIGH(ad);
|
||||||
nextline << ",Y";
|
nextline << ",Y";
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
else if (labfound == 4)
|
else if (labfound == 4)
|
||||||
{
|
{
|
||||||
|
@ -654,19 +655,19 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
int tmp = (ad & myAppData.end)+myOffset;
|
int tmp = (ad & myAppData.end)+myOffset;
|
||||||
LABEL_A12_HIGH(tmp);
|
LABEL_A12_HIGH(tmp);
|
||||||
nextline << ",Y";
|
nextline << ",Y";
|
||||||
nextlinebytes << HEX2 << (int)(tmp&0xff) << " " << HEX2 << (int)(tmp>>8);
|
nextlinebytes << Base::HEX2 << (int)(tmp&0xff) << " " << Base::HEX2 << (int)(tmp>>8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
nextline << "$" << HEX4 << ad << ",Y";
|
nextline << "$" << Base::HEX4 << ad << ",Y";
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LABEL_A12_LOW(ad);
|
LABEL_A12_LOW(ad);
|
||||||
nextline << ",Y";
|
nextline << ",Y";
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -681,7 +682,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
nextline << " (";
|
nextline << " (";
|
||||||
LABEL_A12_LOW(d1);
|
LABEL_A12_LOW(d1);
|
||||||
nextline << ",X)";
|
nextline << ",X)";
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -695,7 +696,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
nextline << " (";
|
nextline << " (";
|
||||||
LABEL_A12_LOW(d1);
|
LABEL_A12_LOW(d1);
|
||||||
nextline << "),Y";
|
nextline << "),Y";
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -710,7 +711,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
LABEL_A12_LOW(d1);
|
LABEL_A12_LOW(d1);
|
||||||
nextline << ",X";
|
nextline << ",X";
|
||||||
}
|
}
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -724,7 +725,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
LABEL_A12_LOW(d1);
|
LABEL_A12_LOW(d1);
|
||||||
nextline << ",Y";
|
nextline << ",Y";
|
||||||
}
|
}
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -753,9 +754,9 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
LABEL_A12_HIGH(ad);
|
LABEL_A12_HIGH(ad);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
nextline << " $" << HEX4 << ad;
|
nextline << " $" << Base::HEX4 << ad;
|
||||||
|
|
||||||
nextlinebytes << HEX2 << (int)d1;
|
nextlinebytes << Base::HEX2 << (int)d1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -793,7 +794,7 @@ void DiStella::disasm(uInt32 distart, int pass)
|
||||||
nextline << ")";
|
nextline << ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
nextlinebytes << HEX2 << (int)(ad&0xff) << " " << HEX2 << (int)(ad>>8);
|
nextlinebytes << Base::HEX2 << (int)(ad&0xff) << " " << Base::HEX2 << (int)(ad>>8);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -997,9 +998,7 @@ void DiStella::addEntry(CartDebug::DisasmType type)
|
||||||
else if(mySettings.show_addresses && tag.type == CartDebug::CODE)
|
else if(mySettings.show_addresses && tag.type == CartDebug::CODE)
|
||||||
{
|
{
|
||||||
// Have addresses indented, to differentiate from actual labels
|
// Have addresses indented, to differentiate from actual labels
|
||||||
char address[7];
|
tag.label = " " + Base::toString(tag.address, Base::F_16_4);
|
||||||
BSPF_snprintf(address, 6, " %4X", tag.address);
|
|
||||||
tag.label = address;
|
|
||||||
tag.hllabel = false;
|
tag.hllabel = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1065,7 @@ void DiStella::processDirectives(const CartDebug::DirectiveList& directives)
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DiStella::Settings DiStella::settings = {
|
DiStella::Settings DiStella::settings = {
|
||||||
kBASE_2, // gfx_format
|
Base::F_2, // gfx_format
|
||||||
true, // resolve_code (opposite of -d in Distella)
|
true, // resolve_code (opposite of -d in Distella)
|
||||||
true, // show_addresses (not used externally; always off)
|
true, // show_addresses (not used externally; always off)
|
||||||
false, // aflag (-a in Distella)
|
false, // aflag (-a in Distella)
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
|
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
#include "bspf.hxx"
|
#include "Base.hxx"
|
||||||
#include "CartDebug.hxx"
|
#include "CartDebug.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
This class is a wrapper around the Distella code. Much of the code remains
|
This class is a wrapper around the Distella code. Much of the code remains
|
||||||
|
@ -45,7 +45,7 @@ class DiStella
|
||||||
// This will eventually grow to include all options supported by
|
// This will eventually grow to include all options supported by
|
||||||
// standalone Distella
|
// standalone Distella
|
||||||
typedef struct {
|
typedef struct {
|
||||||
BaseFormat gfx_format;
|
Common::Base::Format gfx_format;
|
||||||
bool resolve_code; // Attempt to detect code vs. data sections
|
bool resolve_code; // Attempt to detect code vs. data sections
|
||||||
bool show_addresses; // Show PC addresses (always off for external output)
|
bool show_addresses; // Show PC addresses (always off for external output)
|
||||||
bool aflag; // Turns 'A' off in accumulator instructions (-a in Distella)
|
bool aflag; // Turns 'A' off in accumulator instructions (-a in Distella)
|
||||||
|
@ -94,7 +94,7 @@ class DiStella
|
||||||
inline void labelA12High(stringstream& buf, uInt8 op, uInt16 addr, int labfound)
|
inline void labelA12High(stringstream& buf, uInt8 op, uInt16 addr, int labfound)
|
||||||
{
|
{
|
||||||
if(!myDbg.getLabel(buf, addr, true))
|
if(!myDbg.getLabel(buf, addr, true))
|
||||||
buf << "L" << HEX4 << addr;
|
buf << "L" << Common::Base::HEX4 << addr;
|
||||||
}
|
}
|
||||||
inline void labelA12Low(stringstream& buf, uInt8 op, uInt16 addr, int labfound)
|
inline void labelA12Low(stringstream& buf, uInt8 op, uInt16 addr, int labfound)
|
||||||
{
|
{
|
||||||
|
|
|
@ -61,7 +61,7 @@ const DebuggerState& RiotDebug::getState()
|
||||||
myState.TIM1T = tim1T();
|
myState.TIM1T = tim1T();
|
||||||
myState.TIM8T = tim8T();
|
myState.TIM8T = tim8T();
|
||||||
myState.TIM64T = tim64T();
|
myState.TIM64T = tim64T();
|
||||||
myState.TIM1024T = tim1024T();
|
myState.T1024T = tim1024T();
|
||||||
myState.INTIM = intim();
|
myState.INTIM = intim();
|
||||||
myState.TIMINT = timint();
|
myState.TIMINT = timint();
|
||||||
myState.TIMCLKS = timClocks();
|
myState.TIMCLKS = timClocks();
|
||||||
|
@ -99,7 +99,7 @@ void RiotDebug::saveOldState()
|
||||||
myOldState.TIM1T = tim1T();
|
myOldState.TIM1T = tim1T();
|
||||||
myOldState.TIM8T = tim8T();
|
myOldState.TIM8T = tim8T();
|
||||||
myOldState.TIM64T = tim64T();
|
myOldState.TIM64T = tim64T();
|
||||||
myOldState.TIM1024T = tim1024T();
|
myOldState.T1024T = tim1024T();
|
||||||
myOldState.INTIM = intim();
|
myOldState.INTIM = intim();
|
||||||
myOldState.TIMINT = timint();
|
myOldState.TIMINT = timint();
|
||||||
myOldState.TIMCLKS = timClocks();
|
myOldState.TIMCLKS = timClocks();
|
||||||
|
@ -313,41 +313,28 @@ string RiotDebug::toString()
|
||||||
const RiotState& oldstate = (RiotState&) getOldState();
|
const RiotState& oldstate = (RiotState&) getOldState();
|
||||||
|
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
buf << myDebugger.valueToString(0x280) + "/SWCHA(R)="
|
buf << "280/SWCHA(R)=" << myDebugger.invIfChanged(state.SWCHA_R, oldstate.SWCHA_R)
|
||||||
<< myDebugger.invIfChanged(state.SWCHA_R, oldstate.SWCHA_R) << " "
|
<< " 280/SWCHA(W)=" << myDebugger.invIfChanged(state.SWCHA_W, oldstate.SWCHA_W)
|
||||||
<< myDebugger.valueToString(0x280) + "/SWCHA(W)="
|
<< " 281/SWACNT=" << myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT)
|
||||||
<< myDebugger.invIfChanged(state.SWCHA_W, oldstate.SWCHA_W) << " "
|
<< endl
|
||||||
<< myDebugger.valueToString(0x281) + "/SWACNT="
|
<< "282/SWCHB(R)=" << myDebugger.invIfChanged(state.SWCHB_R, oldstate.SWCHB_R)
|
||||||
<< myDebugger.invIfChanged(state.SWACNT, oldstate.SWACNT) << " "
|
<< " 282/SWCHB(W)=" << myDebugger.invIfChanged(state.SWCHB_W, oldstate.SWCHB_W)
|
||||||
<< myDebugger.valueToString(0x282) + "/SWCHB(R)="
|
<< " 283/SWBCNT=" << myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT)
|
||||||
<< myDebugger.invIfChanged(state.SWCHB_R, oldstate.SWCHB_R) << " "
|
|
||||||
<< myDebugger.valueToString(0x282) + "/SWCHB(W)="
|
|
||||||
<< myDebugger.invIfChanged(state.SWCHB_W, oldstate.SWCHB_W) << " "
|
|
||||||
<< myDebugger.valueToString(0x283) + "/SWBCNT="
|
|
||||||
<< myDebugger.invIfChanged(state.SWBCNT, oldstate.SWBCNT) << " "
|
|
||||||
<< endl
|
<< endl
|
||||||
|
|
||||||
// These are squirrely: some symbol files will define these as
|
// These are squirrely: some symbol files will define these as
|
||||||
// 0x284-0x287. Doesn't actually matter, these registers repeat
|
// 0x284-0x287. Doesn't actually matter, these registers repeat
|
||||||
// every 16 bytes.
|
// every 16 bytes.
|
||||||
<< myDebugger.valueToString(0x294) + "/TIM1T="
|
<< "294/TIM1T=" << myDebugger.invIfChanged(state.TIM1T, oldstate.TIM1T)
|
||||||
<< myDebugger.invIfChanged(state.TIM1T, oldstate.TIM1T) << " "
|
<< " 295/TIM8T=" << myDebugger.invIfChanged(state.TIM8T, oldstate.TIM8T)
|
||||||
<< myDebugger.valueToString(0x295) + "/TIM8T="
|
<< " 296/TIM64T=" << myDebugger.invIfChanged(state.TIM64T, oldstate.TIM64T)
|
||||||
<< myDebugger.invIfChanged(state.TIM8T, oldstate.TIM8T) << " "
|
<< " 297/T1024T=" << myDebugger.invIfChanged(state.T1024T, oldstate.T1024T)
|
||||||
<< myDebugger.valueToString(0x296) + "/TIM64T="
|
|
||||||
<< myDebugger.invIfChanged(state.TIM64T, oldstate.TIM64T) << " "
|
|
||||||
<< myDebugger.valueToString(0x297) + "/TIM1024T="
|
|
||||||
<< myDebugger.invIfChanged(state.TIM1024T, oldstate.TIM1024T) << " "
|
|
||||||
<< endl
|
<< endl
|
||||||
|
|
||||||
<< myDebugger.valueToString(0x284) + "/INTIM="
|
<< "0x284/INTIM=" << myDebugger.invIfChanged(state.INTIM, oldstate.INTIM)
|
||||||
<< myDebugger.invIfChanged(state.INTIM, oldstate.INTIM) << " "
|
<< " 285/TIMINT=" << myDebugger.invIfChanged(state.TIMINT, oldstate.TIMINT)
|
||||||
<< myDebugger.valueToString(0x285) + "/TIMINT="
|
<< " Timer_Clocks=" << myDebugger.invIfChanged(state.TIMCLKS, oldstate.TIMCLKS)
|
||||||
<< myDebugger.invIfChanged(state.TIMINT, oldstate.TIMINT) << " "
|
<< " INTIM_Clocks=" << myDebugger.invIfChanged(state.INTIMCLKS, oldstate.INTIMCLKS)
|
||||||
<< "Timer_Clocks="
|
|
||||||
<< myDebugger.invIfChanged(state.TIMCLKS, oldstate.TIMCLKS) << " "
|
|
||||||
<< "INTIM_Clocks="
|
|
||||||
<< myDebugger.invIfChanged(state.INTIMCLKS, oldstate.INTIMCLKS) << " "
|
|
||||||
<< endl
|
<< endl
|
||||||
|
|
||||||
<< "Left/P0diff: " << diffP0String() << " Right/P1diff: " << diffP0String()
|
<< "Left/P0diff: " << diffP0String() << " Right/P1diff: " << diffP0String()
|
||||||
|
|
|
@ -38,7 +38,7 @@ class RiotState : public DebuggerState
|
||||||
BoolArray swchbWriteBits;
|
BoolArray swchbWriteBits;
|
||||||
BoolArray swbcntBits;
|
BoolArray swbcntBits;
|
||||||
|
|
||||||
uInt8 TIM1T, TIM8T, TIM64T, TIM1024T, INTIM, TIMINT;
|
uInt8 TIM1T, TIM8T, TIM64T, T1024T, INTIM, TIMINT;
|
||||||
Int32 TIMCLKS, INTIMCLKS;
|
Int32 TIMCLKS, INTIMCLKS;
|
||||||
|
|
||||||
// These are actually from the TIA, but are I/O related
|
// These are actually from the TIA, but are I/O related
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
#include "System.hxx"
|
#include "System.hxx"
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
#include "TIA.hxx"
|
#include "TIA.hxx"
|
||||||
|
@ -740,7 +741,7 @@ string TIADebug::toString()
|
||||||
buf << "00: ";
|
buf << "00: ";
|
||||||
for (uInt8 j = 0; j < 0x010; j++)
|
for (uInt8 j = 0; j < 0x010; j++)
|
||||||
{
|
{
|
||||||
buf << HEX2 << (int)mySystem.peek(j) << " ";
|
buf << Common::Base::HEX2 << (int)mySystem.peek(j) << " ";
|
||||||
if(j == 0x07) buf << "- ";
|
if(j == 0x07) buf << "- ";
|
||||||
}
|
}
|
||||||
buf << endl;
|
buf << endl;
|
||||||
|
@ -752,7 +753,7 @@ string TIADebug::toString()
|
||||||
// const TiaState& oldstate = (TiaState&) getOldState();
|
// const TiaState& oldstate = (TiaState&) getOldState();
|
||||||
|
|
||||||
// build up output, then return it.
|
// build up output, then return it.
|
||||||
buf << "scanline " << myDebugger.valueToString(myTIA.scanlines()) << " "
|
buf << "scanline " << dec << myTIA.scanlines() << " "
|
||||||
<< booleanWithLabel("vsync", vsync()) << " "
|
<< booleanWithLabel("vsync", vsync()) << " "
|
||||||
<< booleanWithLabel("vblank", vblank())
|
<< booleanWithLabel("vblank", vblank())
|
||||||
<< endl
|
<< endl
|
||||||
|
@ -765,53 +766,53 @@ string TIADebug::toString()
|
||||||
<< booleanWithLabel("dump_gnd_0123", myTIA.myDumpEnabled)
|
<< booleanWithLabel("dump_gnd_0123", myTIA.myDumpEnabled)
|
||||||
<< endl
|
<< endl
|
||||||
<< "COLUxx: "
|
<< "COLUxx: "
|
||||||
<< "P0=" << myDebugger.valueToString(state.coluRegs[0]) << "/"
|
<< "P0=$" << Common::Base::HEX2 << state.coluRegs[0] << "/"
|
||||||
<< colorSwatch(state.coluRegs[0])
|
<< colorSwatch(state.coluRegs[0])
|
||||||
<< "P1=" << myDebugger.valueToString(state.coluRegs[1]) << "/"
|
<< "P1=$" << Common::Base::HEX2 << state.coluRegs[1] << "/"
|
||||||
<< colorSwatch(state.coluRegs[1])
|
<< colorSwatch(state.coluRegs[1])
|
||||||
<< "PF=" << myDebugger.valueToString(state.coluRegs[2]) << "/"
|
<< "PF=$" << Common::Base::HEX2 << state.coluRegs[2] << "/"
|
||||||
<< colorSwatch(state.coluRegs[2])
|
<< colorSwatch(state.coluRegs[2])
|
||||||
<< "BK=" << myDebugger.valueToString(state.coluRegs[3]) << "/"
|
<< "BK=$" << Common::Base::HEX2 << state.coluRegs[3] << "/"
|
||||||
<< colorSwatch(state.coluRegs[3])
|
<< colorSwatch(state.coluRegs[3])
|
||||||
<< endl
|
<< endl
|
||||||
<< "P0: GR=" << myDebugger.valueToString(state.gr[P0], kBASE_2_8)
|
<< "P0: GR=%" << Common::Base::toString(state.gr[P0], Common::Base::F_2_8)
|
||||||
<< " pos=" << myDebugger.valueToString(state.pos[P0])
|
<< " pos=#" << dec << state.pos[P0]
|
||||||
<< " HM=" << myDebugger.valueToString(state.hm[P0]) << " "
|
<< " HM=$" << Common::Base::HEX2 << state.hm[P0] << " "
|
||||||
<< nusizP0String() << " "
|
<< nusizP0String() << " "
|
||||||
<< booleanWithLabel("refl", refP0()) << " "
|
<< booleanWithLabel("refl", refP0()) << " "
|
||||||
<< booleanWithLabel("delay", vdelP0())
|
<< booleanWithLabel("delay", vdelP0())
|
||||||
<< endl
|
<< endl
|
||||||
<< "P1: GR=" << myDebugger.valueToString(state.gr[P1], kBASE_2_8)
|
<< "P1: GR=%" << Common::Base::toString(state.gr[P1], Common::Base::F_2_8)
|
||||||
<< " pos=" << myDebugger.valueToString(state.pos[P1])
|
<< " pos=#" << dec << state.pos[P1]
|
||||||
<< " HM=" << myDebugger.valueToString(state.hm[P1]) << " "
|
<< " HM=$" << Common::Base::HEX2 << state.hm[P1] << " "
|
||||||
<< nusizP1String() << " "
|
<< nusizP1String() << " "
|
||||||
<< booleanWithLabel("refl", refP1()) << " "
|
<< booleanWithLabel("refl", refP1()) << " "
|
||||||
<< booleanWithLabel("delay", vdelP1())
|
<< booleanWithLabel("delay", vdelP1())
|
||||||
<< endl
|
<< endl
|
||||||
<< "M0: " << (myTIA.myENAM0 ? " ENABLED" : "disabled")
|
<< "M0: " << (myTIA.myENAM0 ? " ENABLED" : "disabled")
|
||||||
<< " pos=" << myDebugger.valueToString(state.pos[M0])
|
<< " pos=#" << dec << state.pos[M0]
|
||||||
<< " HM=" << myDebugger.valueToString(state.hm[M0])
|
<< " HM=$" << Common::Base::HEX2 << state.hm[M0]
|
||||||
<< " size=" << myDebugger.valueToString(state.size[M0]) << " "
|
<< " size=" << dec << state.size[M0] << " "
|
||||||
<< booleanWithLabel("reset", resMP0())
|
<< booleanWithLabel("reset", resMP0())
|
||||||
<< endl
|
<< endl
|
||||||
<< "M1: " << (myTIA.myENAM1 ? " ENABLED" : "disabled")
|
<< "M1: " << (myTIA.myENAM1 ? " ENABLED" : "disabled")
|
||||||
<< " pos=" << myDebugger.valueToString(state.pos[M1])
|
<< " pos=#" << dec << state.pos[M1]
|
||||||
<< " HM=" << myDebugger.valueToString(state.hm[M1])
|
<< " HM=$" << Common::Base::HEX2 << state.hm[M1]
|
||||||
<< " size=" << myDebugger.valueToString(state.size[M1]) << " "
|
<< " size=" << dec << state.size[M1] << " "
|
||||||
<< booleanWithLabel("reset", resMP0())
|
<< booleanWithLabel("reset", resMP0())
|
||||||
<< endl
|
<< endl
|
||||||
<< "BL: " << (myTIA.myENABL ? " ENABLED" : "disabled")
|
<< "BL: " << (myTIA.myENABL ? " ENABLED" : "disabled")
|
||||||
<< " pos=" << myDebugger.valueToString(state.pos[BL])
|
<< " pos=#" << dec << state.pos[BL]
|
||||||
<< " HM=" << myDebugger.valueToString(state.hm[BL])
|
<< " HM=$" << Common::Base::HEX2 << state.hm[BL]
|
||||||
<< " size=" << myDebugger.valueToString(state.size[BL]) << " "
|
<< " size=" << dec << state.size[BL] << " "
|
||||||
<< booleanWithLabel("delay", vdelBL())
|
<< booleanWithLabel("delay", vdelBL())
|
||||||
<< endl
|
<< endl
|
||||||
<< "PF0: " << myDebugger.valueToString(state.pf[0], kBASE_2_8) << "/"
|
<< "PF0: %" << Common::Base::toString(state.pf[0], Common::Base::F_2_8) << "/$"
|
||||||
<< myDebugger.valueToString(state.pf[0])
|
<< Common::Base::HEX2 << state.pf[0]
|
||||||
<< " PF1: " << myDebugger.valueToString(state.pf[1], kBASE_2_8) << "/"
|
<< " PF1: %" << Common::Base::toString(state.pf[1], Common::Base::F_2_8) << "/$"
|
||||||
<< myDebugger.valueToString(state.pf[1])
|
<< Common::Base::HEX2 << state.pf[1]
|
||||||
<< " PF2: " << myDebugger.valueToString(state.pf[2], kBASE_2_8) << "/"
|
<< " PF2: %" << Common::Base::toString(state.pf[2], Common::Base::F_2_8) << "/$"
|
||||||
<< myDebugger.valueToString(state.pf[2])
|
<< Common::Base::HEX2 << state.pf[2]
|
||||||
<< endl << " "
|
<< endl << " "
|
||||||
<< booleanWithLabel("reflect", refPF()) << " "
|
<< booleanWithLabel("reflect", refPF()) << " "
|
||||||
<< booleanWithLabel("score", scorePF()) << " "
|
<< booleanWithLabel("score", scorePF()) << " "
|
||||||
|
@ -836,15 +837,15 @@ string TIADebug::toString()
|
||||||
<< endl << " "
|
<< endl << " "
|
||||||
<< booleanWithLabel("m0_m1 ", collM0_M1())
|
<< booleanWithLabel("m0_m1 ", collM0_M1())
|
||||||
<< endl
|
<< endl
|
||||||
<< "AUDF0: " << myDebugger.valueToString(myTIA.myAUDF0)
|
<< "AUDF0: $" << Common::Base::HEX2 << (int)myTIA.myAUDF0
|
||||||
<< "/" << audFreq(myTIA.myAUDF0) << " "
|
<< "/" << audFreq(myTIA.myAUDF0) << " "
|
||||||
<< "AUDC0: " << myDebugger.valueToString(myTIA.myAUDC0) << " "
|
<< "AUDC0: $" << Common::Base::HEX2 << (int)myTIA.myAUDC0 << " "
|
||||||
<< "AUDV0: " << myDebugger.valueToString(myTIA.myAUDV0)
|
<< "AUDV0: $" << Common::Base::HEX2 << (int)myTIA.myAUDV0
|
||||||
<< endl
|
<< endl
|
||||||
<< "AUDF1: " << myDebugger.valueToString(myTIA.myAUDF1)
|
<< "AUDF1: $" << Common::Base::HEX2 << (int)myTIA.myAUDF1
|
||||||
<< "/" << audFreq(myTIA.myAUDF1) << " "
|
<< "/" << audFreq(myTIA.myAUDF1) << " "
|
||||||
<< "AUDC1: " << myDebugger.valueToString(myTIA.myAUDC1) << " "
|
<< "AUDC1: $" << Common::Base::HEX2 << (int)myTIA.myAUDC1 << " "
|
||||||
<< "AUDV1: " << myDebugger.valueToString(myTIA.myAUDV1)
|
<< "AUDV1: $" << Common::Base::HEX2 << (int)myTIA.myAUDV1
|
||||||
;
|
;
|
||||||
// note: last line should not contain \n, caller will add.
|
// note: last line should not contain \n, caller will add.
|
||||||
return buf.str();
|
return buf.str();
|
||||||
|
|
|
@ -45,7 +45,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"AUDF:", kTextAlignLeft);
|
"AUDF:", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
myAudF = new DataGridWidget(boss, font, xpos, ypos,
|
myAudF = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
2, 1, 2, 5, kBASE_16);
|
2, 1, 2, 5, Common::Base::F_16);
|
||||||
myAudF->setTarget(this);
|
myAudF->setTarget(this);
|
||||||
myAudF->setID(kAUDFID);
|
myAudF->setID(kAUDFID);
|
||||||
myAudF->setEditable(false);
|
myAudF->setEditable(false);
|
||||||
|
@ -55,7 +55,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
{
|
{
|
||||||
new StaticTextWidget(boss, font, xpos + col*myAudF->colWidth() + 7,
|
new StaticTextWidget(boss, font, xpos + col*myAudF->colWidth() + 7,
|
||||||
ypos - lineHeight, fontWidth, fontHeight,
|
ypos - lineHeight, fontWidth, fontHeight,
|
||||||
instance().debugger().valueToString(col, kBASE_16_1),
|
Common::Base::toString(col, Common::Base::F_16_1),
|
||||||
kTextAlignLeft);
|
kTextAlignLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"AUDC:", kTextAlignLeft);
|
"AUDC:", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
myAudC = new DataGridWidget(boss, font, xpos, ypos,
|
myAudC = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
2, 1, 2, 4, kBASE_16);
|
2, 1, 2, 4, Common::Base::F_16);
|
||||||
myAudC->setTarget(this);
|
myAudC->setTarget(this);
|
||||||
myAudC->setID(kAUDCID);
|
myAudC->setID(kAUDCID);
|
||||||
myAudC->setEditable(false);
|
myAudC->setEditable(false);
|
||||||
|
@ -77,7 +77,7 @@ AudioWidget::AudioWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"AUDV:", kTextAlignLeft);
|
"AUDV:", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
myAudV = new DataGridWidget(boss, font, xpos, ypos,
|
myAudV = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
2, 1, 2, 4, kBASE_16);
|
2, 1, 2, 4, Common::Base::F_16);
|
||||||
myAudV->setTarget(this);
|
myAudV->setTarget(this);
|
||||||
myAudV->setID(kAUDVID);
|
myAudV->setID(kAUDVID);
|
||||||
myAudV->setEditable(false);
|
myAudV->setEditable(false);
|
||||||
|
|
|
@ -40,7 +40,7 @@ Cartridge0840Widget::Cartridge0840Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,6 @@ Cartridge2KWidget::Cartridge2KWidget(
|
||||||
|
|
||||||
ostringstream info;
|
ostringstream info;
|
||||||
info << "Standard 2K cartridge, non-bankswitched\n"
|
info << "Standard 2K cartridge, non-bankswitched\n"
|
||||||
<< "Accessible @ $" << HEX4 << start << " - " << "$" << (start + size - 1);
|
<< "Accessible @ $" << Common::Base::HEX4 << start << " - " << "$" << (start + size - 1);
|
||||||
addBaseInformation(size, "Atari", info.str());
|
addBaseInformation(size, "Atari", info.str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ Cartridge3EWidget::Cartridge3EWidget(
|
||||||
// Eventually, we should query this from the debugger/disassembler
|
// Eventually, we should query this from the debugger/disassembler
|
||||||
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
|
info << "Bank RORG" << " = $" << Common::Base::HEX4 << start << "\n";
|
||||||
|
|
||||||
int xpos = 10,
|
int xpos = 10,
|
||||||
ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight;
|
ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight;
|
||||||
|
@ -63,7 +63,8 @@ Cartridge3EWidget::Cartridge3EWidget(
|
||||||
ramitems.push_back("Inactive", "");
|
ramitems.push_back("Inactive", "");
|
||||||
|
|
||||||
ostringstream label;
|
ostringstream label;
|
||||||
label << "Set bank ($" << HEX4 << start << " - $" << (start+0x7FF) << "): ";
|
label << "Set bank ($" << Common::Base::HEX4 << start << " - $"
|
||||||
|
<< (start+0x7FF) << "): ";
|
||||||
|
|
||||||
new StaticTextWidget(_boss, _font, xpos, ypos, font.getStringWidth(label.str()),
|
new StaticTextWidget(_boss, _font, xpos, ypos, font.getStringWidth(label.str()),
|
||||||
myFontHeight, label.str(), kTextAlignLeft);
|
myFontHeight, label.str(), kTextAlignLeft);
|
||||||
|
|
|
@ -39,7 +39,7 @@ Cartridge3FWidget::Cartridge3FWidget(
|
||||||
// Eventually, we should query this from the debugger/disassembler
|
// Eventually, we should query this from the debugger/disassembler
|
||||||
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
uInt16 start = (cart.myImage[size-3] << 8) | cart.myImage[size-4];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank RORG" << " = $" << HEX4 << start << "\n";
|
info << "Bank RORG" << " = $" << Common::Base::HEX4 << start << "\n";
|
||||||
|
|
||||||
int xpos = 10,
|
int xpos = 10,
|
||||||
ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight;
|
ypos = addBaseInformation(size, "TigerVision", info.str()) + myLineHeight;
|
||||||
|
@ -51,7 +51,8 @@ Cartridge3FWidget::Cartridge3FWidget(
|
||||||
items.push_back(b + " ($3F)");
|
items.push_back(b + " ($3F)");
|
||||||
}
|
}
|
||||||
ostringstream label;
|
ostringstream label;
|
||||||
label << "Set bank ($" << HEX4 << start << " - $" << (start+0x7FF) << "): ";
|
label << "Set bank ($" << Common::Base::HEX4 << start << " - $" <<
|
||||||
|
(start+0x7FF) << "): ";
|
||||||
myBank =
|
myBank =
|
||||||
new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($3F) "),
|
new PopUpWidget(boss, font, xpos, ypos-2, font.getStringWidth("0 ($3F) "),
|
||||||
myLineHeight, items, label.str(),
|
myLineHeight, items, label.str(),
|
||||||
|
|
|
@ -32,6 +32,7 @@ Cartridge4KWidget::Cartridge4KWidget(
|
||||||
|
|
||||||
ostringstream info;
|
ostringstream info;
|
||||||
info << "Standard 4K cartridge, non-bankswitched\n"
|
info << "Standard 4K cartridge, non-bankswitched\n"
|
||||||
<< "Accessible @ $" << HEX4 << start << " - " << "$" << (start + 0xFFF);
|
<< "Accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||||
|
<< "$" << (start + 0xFFF);
|
||||||
addBaseInformation(4096, "Atari", info.str());
|
addBaseInformation(4096, "Atari", info.str());
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,7 +73,7 @@ CartridgeCMWidget::CartridgeCMWidget(
|
||||||
myFontHeight, "Current column: ", kTextAlignLeft);
|
myFontHeight, "Current column: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myColumn = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 2, 8, kBASE_16);
|
myColumn = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 2, 8, Common::Base::F_16);
|
||||||
myColumn->setTarget(this);
|
myColumn->setTarget(this);
|
||||||
myColumn->setEditable(false);
|
myColumn->setEditable(false);
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@ CartridgeCVWidget::CartridgeCVWidget(
|
||||||
info << "CV 2K ROM + 1K RAM , non-bankswitched\n"
|
info << "CV 2K ROM + 1K RAM , non-bankswitched\n"
|
||||||
<< "1024 bytes RAM @ $F000 - $F7FF\n"
|
<< "1024 bytes RAM @ $F000 - $F7FF\n"
|
||||||
<< " $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
|
<< " $F000 - $F3FF (R), $F400 - $F7FF (W)\n"
|
||||||
<< "ROM accessible @ $" << HEX4 << start << " - "
|
<< "ROM accessible @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + size - 1);
|
<< "$" << (start + size - 1);
|
||||||
|
|
||||||
addBaseInformation(cart.mySize, "CommaVid", info.str());
|
addBaseInformation(cart.mySize, "CommaVid", info.str());
|
||||||
|
|
|
@ -75,7 +75,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Top Registers: ", kTextAlignLeft);
|
myFontHeight, "Top Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myTops = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myTops = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myTops->setTarget(this);
|
myTops->setTarget(this);
|
||||||
myTops->setEditable(false);
|
myTops->setEditable(false);
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Bottom Registers: ", kTextAlignLeft);
|
myFontHeight, "Bottom Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myBottoms = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myBottoms = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myBottoms->setTarget(this);
|
myBottoms->setTarget(this);
|
||||||
myBottoms->setEditable(false);
|
myBottoms->setEditable(false);
|
||||||
|
|
||||||
|
@ -95,7 +95,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Counter Registers: ", kTextAlignLeft);
|
myFontHeight, "Counter Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myCounters = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 4, 16, kBASE_16_4);
|
myCounters = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 4, 16, Common::Base::F_16_4);
|
||||||
myCounters->setTarget(this);
|
myCounters->setTarget(this);
|
||||||
myCounters->setEditable(false);
|
myCounters->setEditable(false);
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Frac Counters: ", kTextAlignLeft);
|
myFontHeight, "Frac Counters: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myFracCounters = new DataGridWidget(boss, font, xpos, ypos-2, 4, 2, 8, 32, kBASE_16_8);
|
myFracCounters = new DataGridWidget(boss, font, xpos, ypos-2, 4, 2, 8, 32, Common::Base::F_16_8);
|
||||||
myFracCounters->setTarget(this);
|
myFracCounters->setTarget(this);
|
||||||
myFracCounters->setEditable(false);
|
myFracCounters->setEditable(false);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Frac Increments: ", kTextAlignLeft);
|
myFontHeight, "Frac Increments: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myFracIncrements = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myFracIncrements = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myFracIncrements->setTarget(this);
|
myFracIncrements->setTarget(this);
|
||||||
myFracIncrements->setEditable(false);
|
myFracIncrements->setEditable(false);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Function Params: ", kTextAlignLeft);
|
myFontHeight, "Function Params: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myParameter = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myParameter = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myParameter->setTarget(this);
|
myParameter->setTarget(this);
|
||||||
myParameter->setEditable(false);
|
myParameter->setEditable(false);
|
||||||
|
|
||||||
|
@ -135,7 +135,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Music Counters: ", kTextAlignLeft);
|
myFontHeight, "Music Counters: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myMusicCounters = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 8, 32, kBASE_16_8);
|
myMusicCounters = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 8, 32, Common::Base::F_16_8);
|
||||||
myMusicCounters->setTarget(this);
|
myMusicCounters->setTarget(this);
|
||||||
myMusicCounters->setEditable(false);
|
myMusicCounters->setEditable(false);
|
||||||
|
|
||||||
|
@ -145,7 +145,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Music Frequencies: ", kTextAlignLeft);
|
myFontHeight, "Music Frequencies: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myMusicFrequencies = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 8, 32, kBASE_16_8);
|
myMusicFrequencies = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 8, 32, Common::Base::F_16_8);
|
||||||
myMusicFrequencies->setTarget(this);
|
myMusicFrequencies->setTarget(this);
|
||||||
myMusicFrequencies->setEditable(false);
|
myMusicFrequencies->setEditable(false);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Music Waveforms: ", kTextAlignLeft);
|
myFontHeight, "Music Waveforms: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myMusicWaveforms = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 4, 16, kBASE_16_4);
|
myMusicWaveforms = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 4, 16, Common::Base::F_16_4);
|
||||||
myMusicWaveforms->setTarget(this);
|
myMusicWaveforms->setTarget(this);
|
||||||
myMusicWaveforms->setEditable(false);
|
myMusicWaveforms->setEditable(false);
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ CartridgeDPCPlusWidget::CartridgeDPCPlusWidget(
|
||||||
myFontHeight, "Current random number: ", kTextAlignLeft);
|
myFontHeight, "Current random number: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myRandom = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 8, 32, kBASE_16_8);
|
myRandom = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 8, 32, Common::Base::F_16_8);
|
||||||
myRandom->setTarget(this);
|
myRandom->setTarget(this);
|
||||||
myRandom->setEditable(false);
|
myRandom->setEditable(false);
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << (start + 0x80) << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x80) << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
myFontHeight, "Top Registers: ", kTextAlignLeft);
|
myFontHeight, "Top Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myTops = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myTops = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myTops->setTarget(this);
|
myTops->setTarget(this);
|
||||||
myTops->setEditable(false);
|
myTops->setEditable(false);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
myFontHeight, "Bottom Registers: ", kTextAlignLeft);
|
myFontHeight, "Bottom Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myBottoms = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myBottoms = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myBottoms->setTarget(this);
|
myBottoms->setTarget(this);
|
||||||
myBottoms->setEditable(false);
|
myBottoms->setEditable(false);
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
myFontHeight, "Counter Registers: ", kTextAlignLeft);
|
myFontHeight, "Counter Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myCounters = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 4, 16, kBASE_16_4);
|
myCounters = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 4, 16, Common::Base::F_16_4);
|
||||||
myCounters->setTarget(this);
|
myCounters->setTarget(this);
|
||||||
myCounters->setEditable(false);
|
myCounters->setEditable(false);
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
myFontHeight, "Flag Registers: ", kTextAlignLeft);
|
myFontHeight, "Flag Registers: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myFlags = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, kBASE_16);
|
myFlags = new DataGridWidget(boss, font, xpos, ypos-2, 8, 1, 2, 8, Common::Base::F_16);
|
||||||
myFlags->setTarget(this);
|
myFlags->setTarget(this);
|
||||||
myFlags->setEditable(false);
|
myFlags->setEditable(false);
|
||||||
|
|
||||||
|
@ -115,7 +115,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
myFontHeight, "Music mode (DF5/DF6/DF7): ", kTextAlignLeft);
|
myFontHeight, "Music mode (DF5/DF6/DF7): ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myMusicMode = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 2, 8, kBASE_16);
|
myMusicMode = new DataGridWidget(boss, font, xpos, ypos-2, 3, 1, 2, 8, Common::Base::F_16);
|
||||||
myMusicMode->setTarget(this);
|
myMusicMode->setTarget(this);
|
||||||
myMusicMode->setEditable(false);
|
myMusicMode->setEditable(false);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ CartridgeDPCWidget::CartridgeDPCWidget(
|
||||||
myFontHeight, "Current random number: ", kTextAlignLeft);
|
myFontHeight, "Current random number: ", kTextAlignLeft);
|
||||||
xpos += lwidth;
|
xpos += lwidth;
|
||||||
|
|
||||||
myRandom = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 2, 8, kBASE_16);
|
myRandom = new DataGridWidget(boss, font, xpos, ypos-2, 1, 1, 2, 8, Common::Base::F_16);
|
||||||
myRandom->setTarget(this);
|
myRandom->setTarget(this);
|
||||||
myRandom->setEditable(false);
|
myRandom->setEditable(false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
class GuiObject;
|
class GuiObject;
|
||||||
class ButtonWidget;
|
class ButtonWidget;
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
#include "Font.hxx"
|
#include "Font.hxx"
|
||||||
#include "Command.hxx"
|
#include "Command.hxx"
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
|
|
|
@ -41,8 +41,8 @@ CartridgeEFSCWidget::CartridgeEFSCWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << dec << i << " @ $" << HEX4 << (start + 0x100) << " - "
|
info << "Bank " << dec << i << " @ $" << Common::Base::HEX4 << (start + 0x100)
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< " - " << "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
int xpos = 10,
|
int xpos = 10,
|
||||||
|
|
|
@ -39,7 +39,7 @@ CartridgeEFWidget::CartridgeEFWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << dec << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << dec << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ CartridgeF0Widget::CartridgeF0Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << dec << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << dec << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << "\n";
|
<< "$" << (start + 0xFFF) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ CartridgeF4SCWidget::CartridgeF4SCWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << (start + 0x100) << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ CartridgeF4Widget::CartridgeF4Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ CartridgeF6SCWidget::CartridgeF6SCWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << (start + 0x100) << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ CartridgeF6Widget::CartridgeF6Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ CartridgeF8SCWidget::CartridgeF8SCWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << (start + 0x100) << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x100) << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ CartridgeF8Widget::CartridgeF8Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ CartridgeFA2Widget::CartridgeFA2Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << (start + 0x200) << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x200) << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ CartridgeFAWidget::CartridgeFAWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << (start + 0x200) << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << (start + 0x200) << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << (spot+i) << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@ CartridgeSBWidget::CartridgeSBWidget(
|
||||||
ostringstream info, bank;
|
ostringstream info, bank;
|
||||||
info << "SB SUPERbanking, 32 or 64 4K banks\n"
|
info << "SB SUPERbanking, 32 or 64 4K banks\n"
|
||||||
<< "Hotspots are from $800 to $"
|
<< "Hotspots are from $800 to $"
|
||||||
<< HEX2 << (0x800 + myCart.bankCount() - 1) << ", including\n"
|
<< Common::Base::HEX2 << (0x800 + myCart.bankCount() - 1) << ", including\n"
|
||||||
<< "mirrors ($900, $A00, $B00, ...)\n"
|
<< "mirrors ($900, $A00, $B00, ...)\n"
|
||||||
<< "Startup bank = " << dec << cart.myStartBank << "\n";
|
<< "Startup bank = " << dec << cart.myStartBank << "\n";
|
||||||
|
|
||||||
|
@ -44,10 +44,11 @@ CartridgeSBWidget::CartridgeSBWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << dec << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << dec << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
||||||
|
|
||||||
bank << dec << setw(2) << setfill(' ') << i << " ($" << HEX2 << spot << ")";
|
bank << dec << setw(2) << setfill(' ') << i << " ($" << Common::Base::HEX2
|
||||||
|
<< spot << ")";
|
||||||
items.push_back(bank.str());
|
items.push_back(bank.str());
|
||||||
bank.str("");
|
bank.str("");
|
||||||
}
|
}
|
||||||
|
@ -90,7 +91,7 @@ string CartridgeSBWidget::bankState()
|
||||||
ostringstream& buf = buffer();
|
ostringstream& buf = buffer();
|
||||||
|
|
||||||
buf << "Bank = " << myCart.myCurrentBank
|
buf << "Bank = " << myCart.myCurrentBank
|
||||||
<< ", hotspot = $" << HEX2 << (myCart.myCurrentBank + 0x800);
|
<< ", hotspot = $" << Common::Base::HEX2 << (myCart.myCurrentBank + 0x800);
|
||||||
|
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ CartridgeUAWidget::CartridgeUAWidget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << i << " @ $" << Common::Base::HEX4 << start << " - "
|
||||||
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
<< "$" << (start + 0xFFF) << " (hotspot = $" << spot << ")\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -41,8 +41,8 @@ CartridgeX07Widget::CartridgeX07Widget(
|
||||||
{
|
{
|
||||||
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
uInt16 start = (cart.myImage[offset+1] << 8) | cart.myImage[offset];
|
||||||
start -= start % 0x1000;
|
start -= start % 0x1000;
|
||||||
info << "Bank " << dec << i << " @ $" << HEX4 << start << " - "
|
info << "Bank " << dec << i << " @ $" << Common::Base::HEX4 << start
|
||||||
<< "$" << (start + 0xFFF) << "\n";
|
<< " - " << "$" << (start + 0xFFF) << "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
int xpos = 10,
|
int xpos = 10,
|
||||||
|
|
|
@ -48,7 +48,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
new StaticTextWidget(boss, font, xpos, ypos+2, lwidth-2, fontHeight,
|
new StaticTextWidget(boss, font, xpos, ypos+2, lwidth-2, fontHeight,
|
||||||
"PC:", kTextAlignLeft);
|
"PC:", kTextAlignLeft);
|
||||||
myPCGrid =
|
myPCGrid =
|
||||||
new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 4, 16, kBASE_16);
|
new DataGridWidget(boss, font, xpos + lwidth, ypos, 1, 1, 4, 16, Common::Base::F_16);
|
||||||
myPCGrid->setTarget(this);
|
myPCGrid->setTarget(this);
|
||||||
myPCGrid->setID(kPCRegID);
|
myPCGrid->setID(kPCRegID);
|
||||||
addFocusWidget(myPCGrid);
|
addFocusWidget(myPCGrid);
|
||||||
|
@ -62,7 +62,7 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
// Create a 1x4 grid with labels for the other CPU registers
|
// Create a 1x4 grid with labels for the other CPU registers
|
||||||
xpos = x + lwidth; ypos += myPCGrid->getHeight() + 1;
|
xpos = x + lwidth; ypos += myPCGrid->getHeight() + 1;
|
||||||
myCpuGrid =
|
myCpuGrid =
|
||||||
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 2, 8, kBASE_16);
|
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 2, 8, Common::Base::F_16);
|
||||||
myCpuGrid->setTarget(this);
|
myCpuGrid->setTarget(this);
|
||||||
myCpuGrid->setID(kCpuRegID);
|
myCpuGrid->setID(kCpuRegID);
|
||||||
addFocusWidget(myCpuGrid);
|
addFocusWidget(myCpuGrid);
|
||||||
|
@ -70,17 +70,17 @@ CpuWidget::CpuWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
// Create a 1x4 grid with decimal and binary values for the other CPU registers
|
// Create a 1x4 grid with decimal and binary values for the other CPU registers
|
||||||
xpos = x + lwidth + myPCGrid->getWidth() + 10;
|
xpos = x + lwidth + myPCGrid->getWidth() + 10;
|
||||||
myCpuGridDecValue =
|
myCpuGridDecValue =
|
||||||
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 3, 8, kBASE_10);
|
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 3, 8, Common::Base::F_10);
|
||||||
myCpuGridDecValue->setEditable(false);
|
myCpuGridDecValue->setEditable(false);
|
||||||
xpos += myCpuGridDecValue->getWidth() + 5;
|
xpos += myCpuGridDecValue->getWidth() + 5;
|
||||||
myCpuGridBinValue =
|
myCpuGridBinValue =
|
||||||
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 8, kBASE_2);
|
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 8, Common::Base::F_2);
|
||||||
myCpuGridBinValue->setEditable(false);
|
myCpuGridBinValue->setEditable(false);
|
||||||
|
|
||||||
// Create a label and 1x3 grid showing the source of data for A/X/Y registers
|
// Create a label and 1x3 grid showing the source of data for A/X/Y registers
|
||||||
xpos += myCpuGridBinValue->getWidth() + 20;
|
xpos += myCpuGridBinValue->getWidth() + 20;
|
||||||
myCpuDataSrcGrid =
|
myCpuDataSrcGrid =
|
||||||
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 4, 16, kBASE_16);
|
new DataGridWidget(boss, font, xpos, ypos, 1, 4, 4, 16, Common::Base::F_16);
|
||||||
myCpuDataSrcGrid->setEditable(false);
|
myCpuDataSrcGrid->setEditable(false);
|
||||||
new StaticTextWidget(boss, font, xpos-font.getMaxCharWidth(),
|
new StaticTextWidget(boss, font, xpos-font.getMaxCharWidth(),
|
||||||
ypos+myCpuDataSrcGrid->getHeight() + 4,
|
ypos+myCpuDataSrcGrid->getHeight() + 4,
|
||||||
|
|
|
@ -30,7 +30,8 @@
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
DataGridWidget::DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, int cols, int rows,
|
int x, int y, int cols, int rows,
|
||||||
int colchars, int bits, BaseFormat base,
|
int colchars, int bits,
|
||||||
|
Common::Base::Format base,
|
||||||
bool useScrollbar)
|
bool useScrollbar)
|
||||||
: EditableWidget(boss, font, x, y,
|
: EditableWidget(boss, font, x, y,
|
||||||
cols*(colchars * font.getMaxCharWidth() + 8) + 1,
|
cols*(colchars * font.getMaxCharWidth() + 8) + 1,
|
||||||
|
@ -114,10 +115,7 @@ cerr << "alist.size() = " << alist.size()
|
||||||
// An efficiency thing
|
// An efficiency thing
|
||||||
string temp;
|
string temp;
|
||||||
for(int i = 0; i < size; ++i)
|
for(int i = 0; i < size; ++i)
|
||||||
{
|
_valueStringList.push_back(Common::Base::toString(_valueList[i], _base));
|
||||||
temp = instance().debugger().valueToString(_valueList[i], _base);
|
|
||||||
_valueStringList.push_back(temp);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
cerr << "_addrList.size() = " << _addrList.size()
|
cerr << "_addrList.size() = " << _addrList.size()
|
||||||
|
@ -196,7 +194,7 @@ void DataGridWidget::setValue(int position, int value, bool changed)
|
||||||
if(position >= 0 && uInt32(position) < _valueList.size())
|
if(position >= 0 && uInt32(position) < _valueList.size())
|
||||||
{
|
{
|
||||||
// Correctly format the data for viewing
|
// Correctly format the data for viewing
|
||||||
_editString = instance().debugger().valueToString(value, _base);
|
_editString = Common::Base::toString(value, _base);
|
||||||
|
|
||||||
_valueStringList[position] = _editString;
|
_valueStringList[position] = _editString;
|
||||||
_changedList[position] = changed;
|
_changedList[position] = changed;
|
||||||
|
@ -658,22 +656,22 @@ void DataGridWidget::endEditMode()
|
||||||
{
|
{
|
||||||
switch(_base)
|
switch(_base)
|
||||||
{
|
{
|
||||||
case kBASE_16:
|
case Common::Base::F_16:
|
||||||
case kBASE_16_1:
|
case Common::Base::F_16_1:
|
||||||
case kBASE_16_2:
|
case Common::Base::F_16_2:
|
||||||
case kBASE_16_4:
|
case Common::Base::F_16_4:
|
||||||
case kBASE_16_8:
|
case Common::Base::F_16_8:
|
||||||
_editString.insert(0, 1, '$');
|
_editString.insert(0, 1, '$');
|
||||||
break;
|
break;
|
||||||
case kBASE_2:
|
case Common::Base::F_2:
|
||||||
case kBASE_2_8:
|
case Common::Base::F_2_8:
|
||||||
case kBASE_2_16:
|
case Common::Base::F_2_16:
|
||||||
_editString.insert(0, 1, '\\');
|
_editString.insert(0, 1, '\\');
|
||||||
break;
|
break;
|
||||||
case kBASE_10:
|
case Common::Base::F_10:
|
||||||
_editString.insert(0, 1, '#');
|
_editString.insert(0, 1, '#');
|
||||||
break;
|
break;
|
||||||
case kBASE_DEFAULT:
|
case Common::Base::F_DEFAULT:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ class ScrollBarWidget;
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
#include "EditableWidget.hxx"
|
#include "EditableWidget.hxx"
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
|
#include "Base.hxx"
|
||||||
#include "Rect.hxx"
|
#include "Rect.hxx"
|
||||||
|
|
||||||
/* DataGridWidget */
|
/* DataGridWidget */
|
||||||
|
@ -45,7 +46,8 @@ class DataGridWidget : public EditableWidget
|
||||||
public:
|
public:
|
||||||
DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
DataGridWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
int x, int y, int cols, int rows,
|
int x, int y, int cols, int rows,
|
||||||
int colchars, int bits, BaseFormat format = kBASE_DEFAULT,
|
int colchars, int bits,
|
||||||
|
Common::Base::Format format = Common::Base::F_DEFAULT,
|
||||||
bool useScrollbar = false);
|
bool useScrollbar = false);
|
||||||
virtual ~DataGridWidget();
|
virtual ~DataGridWidget();
|
||||||
|
|
||||||
|
@ -114,7 +116,7 @@ class DataGridWidget : public EditableWidget
|
||||||
int _lowerBound;
|
int _lowerBound;
|
||||||
int _upperBound;
|
int _upperBound;
|
||||||
|
|
||||||
BaseFormat _base;
|
Common::Base::Format _base;
|
||||||
|
|
||||||
IntArray _addrList;
|
IntArray _addrList;
|
||||||
IntArray _valueList;
|
IntArray _valueList;
|
||||||
|
|
|
@ -50,7 +50,7 @@ DrivingWidget::DrivingWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
|
|
||||||
xpos += myGreyDown->getWidth() + 10; ypos -= 10;
|
xpos += myGreyDown->getWidth() + 10; ypos -= 10;
|
||||||
myGreyValue = new DataGridWidget(boss, font, xpos, ypos,
|
myGreyValue = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 2, 8, kBASE_16);
|
1, 1, 2, 8, Common::Base::F_16);
|
||||||
myGreyValue->setTarget(this);
|
myGreyValue->setTarget(this);
|
||||||
myGreyValue->setEditable(false);
|
myGreyValue->setEditable(false);
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
// Add a scrollbar, since there may be more than 128 bytes of RAM available
|
// Add a scrollbar, since there may be more than 128 bytes of RAM available
|
||||||
xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth;
|
xpos = x; ypos = y + lineHeight; lwidth = 4 * fontWidth;
|
||||||
myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos,
|
myRamGrid = new DataGridWidget(boss, font, xpos + lwidth, ypos,
|
||||||
16, 8, 2, 8, kBASE_16, true);
|
16, 8, 2, 8, Common::Base::F_16, true);
|
||||||
myRamGrid->setTarget(this);
|
myRamGrid->setTarget(this);
|
||||||
addFocusWidget(myRamGrid);
|
addFocusWidget(myRamGrid);
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ RamWidget::RamWidget(GuiObject* boss, const GUI::Font& font, int x, int y)
|
||||||
new StaticTextWidget(boss, font, xpos + col*myRamGrid->colWidth() + lwidth + 8,
|
new StaticTextWidget(boss, font, xpos + col*myRamGrid->colWidth() + lwidth + 8,
|
||||||
ypos - lineHeight,
|
ypos - lineHeight,
|
||||||
fontWidth, fontHeight,
|
fontWidth, fontHeight,
|
||||||
instance().debugger().valueToString(col, kBASE_16_1),
|
Common::Base::toString(col, Common::Base::F_16_1),
|
||||||
kTextAlignLeft);
|
kTextAlignLeft);
|
||||||
}
|
}
|
||||||
for(int row = 0; row < 8; ++row)
|
for(int row = 0; row < 8; ++row)
|
||||||
|
@ -179,8 +179,8 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
myUndoAddress = addr;
|
myUndoAddress = addr;
|
||||||
myUndoValue = oldval;
|
myUndoValue = oldval;
|
||||||
|
|
||||||
myDecValue->setText(instance().debugger().valueToString(value, kBASE_10));
|
myDecValue->setText(Common::Base::toString(value, Common::Base::F_10));
|
||||||
myBinValue->setText(instance().debugger().valueToString(value, kBASE_2));
|
myBinValue->setText(Common::Base::toString(value, Common::Base::F_2));
|
||||||
myRevertButton->setEnabled(true);
|
myRevertButton->setEnabled(true);
|
||||||
myUndoButton->setEnabled(true);
|
myUndoButton->setEnabled(true);
|
||||||
break;
|
break;
|
||||||
|
@ -192,8 +192,8 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
value = myRamGrid->getSelectedValue();
|
value = myRamGrid->getSelectedValue();
|
||||||
|
|
||||||
myLabel->setText(dbg.getLabel(state.rport[addr], true));
|
myLabel->setText(dbg.getLabel(state.rport[addr], true));
|
||||||
myDecValue->setText(instance().debugger().valueToString(value, kBASE_10));
|
myDecValue->setText(Common::Base::toString(value, Common::Base::F_10));
|
||||||
myBinValue->setText(instance().debugger().valueToString(value, kBASE_2));
|
myBinValue->setText(Common::Base::toString(value, Common::Base::F_2));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,7 +98,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
CREATE_IO_REGS("SWCHB(R):", mySWCHBReadBits, 0, false);
|
CREATE_IO_REGS("SWCHB(R):", mySWCHBReadBits, 0, false);
|
||||||
|
|
||||||
// Timer registers (R/W)
|
// Timer registers (R/W)
|
||||||
const char* writeNames[] = { "TIM1T:", "TIM8T:", "TIM64T:", "TIM1024T:" };
|
const char* writeNames[] = { "TIM1T:", "TIM8T:", "TIM64T:", "T1024T:" };
|
||||||
xpos = 10; ypos += 2*lineHeight;
|
xpos = 10; ypos += 2*lineHeight;
|
||||||
for(int row = 0; row < 4; ++row)
|
for(int row = 0; row < 4; ++row)
|
||||||
{
|
{
|
||||||
|
@ -106,7 +106,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
9*fontWidth, fontHeight, writeNames[row], kTextAlignLeft);
|
9*fontWidth, fontHeight, writeNames[row], kTextAlignLeft);
|
||||||
}
|
}
|
||||||
xpos += 9*fontWidth + 5;
|
xpos += 9*fontWidth + 5;
|
||||||
myTimWrite = new DataGridWidget(boss, font, xpos, ypos, 1, 4, 2, 8, kBASE_16);
|
myTimWrite = new DataGridWidget(boss, font, xpos, ypos, 1, 4, 2, 8, Common::Base::F_16);
|
||||||
myTimWrite->setTarget(this);
|
myTimWrite->setTarget(this);
|
||||||
myTimWrite->setID(kTimWriteID);
|
myTimWrite->setID(kTimWriteID);
|
||||||
addFocusWidget(myTimWrite);
|
addFocusWidget(myTimWrite);
|
||||||
|
@ -120,7 +120,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
11*fontWidth, fontHeight, readNames[row], kTextAlignLeft);
|
11*fontWidth, fontHeight, readNames[row], kTextAlignLeft);
|
||||||
}
|
}
|
||||||
xpos += t->getWidth() + 5;
|
xpos += t->getWidth() + 5;
|
||||||
myTimRead = new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 32, kBASE_16);
|
myTimRead = new DataGridWidget(boss, font, xpos, ypos, 1, 4, 8, 32, Common::Base::F_16);
|
||||||
myTimRead->setTarget(this);
|
myTimRead->setTarget(this);
|
||||||
myTimRead->setEditable(false);
|
myTimRead->setEditable(false);
|
||||||
|
|
||||||
|
@ -142,7 +142,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
6*fontWidth, fontHeight, contLeftReadNames[row], kTextAlignLeft);
|
6*fontWidth, fontHeight, contLeftReadNames[row], kTextAlignLeft);
|
||||||
}
|
}
|
||||||
xpos += 6*fontWidth + 5;
|
xpos += 6*fontWidth + 5;
|
||||||
myLeftINPT = new DataGridWidget(boss, font, xpos, ypos, 1, 3, 2, 8, kBASE_16);
|
myLeftINPT = new DataGridWidget(boss, font, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16);
|
||||||
myLeftINPT->setTarget(this);
|
myLeftINPT->setTarget(this);
|
||||||
myLeftINPT->setEditable(false);
|
myLeftINPT->setEditable(false);
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ RiotWidget::RiotWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
6*fontWidth, fontHeight, contRightReadNames[row], kTextAlignLeft);
|
6*fontWidth, fontHeight, contRightReadNames[row], kTextAlignLeft);
|
||||||
}
|
}
|
||||||
xpos += 6*fontWidth + 5;
|
xpos += 6*fontWidth + 5;
|
||||||
myRightINPT = new DataGridWidget(boss, font, xpos, ypos, 1, 3, 2, 8, kBASE_16);
|
myRightINPT = new DataGridWidget(boss, font, xpos, ypos, 1, 3, 2, 8, Common::Base::F_16);
|
||||||
myRightINPT->setTarget(this);
|
myRightINPT->setTarget(this);
|
||||||
myRightINPT->setEditable(false);
|
myRightINPT->setEditable(false);
|
||||||
|
|
||||||
|
@ -307,8 +307,8 @@ void RiotWidget::loadConfig()
|
||||||
changed.push_back(state.TIM8T != oldstate.TIM8T);
|
changed.push_back(state.TIM8T != oldstate.TIM8T);
|
||||||
alist.push_back(kTim64TID); vlist.push_back(state.TIM64T);
|
alist.push_back(kTim64TID); vlist.push_back(state.TIM64T);
|
||||||
changed.push_back(state.TIM64T != oldstate.TIM64T);
|
changed.push_back(state.TIM64T != oldstate.TIM64T);
|
||||||
alist.push_back(kTim1024TID); vlist.push_back(state.TIM1024T);
|
alist.push_back(kTim1024TID); vlist.push_back(state.T1024T);
|
||||||
changed.push_back(state.TIM1024T != oldstate.TIM1024T);
|
changed.push_back(state.T1024T != oldstate.T1024T);
|
||||||
myTimWrite->setList(alist, vlist, changed);
|
myTimWrite->setList(alist, vlist, changed);
|
||||||
|
|
||||||
// Update timer read registers
|
// Update timer read registers
|
||||||
|
|
|
@ -557,23 +557,23 @@ bool RomListWidget::tryInsertChar(char c, int pos)
|
||||||
c = tolower(c);
|
c = tolower(c);
|
||||||
switch(_base)
|
switch(_base)
|
||||||
{
|
{
|
||||||
case kBASE_16:
|
case Common::Base::F_16:
|
||||||
case kBASE_16_1:
|
case Common::Base::F_16_1:
|
||||||
case kBASE_16_2:
|
case Common::Base::F_16_2:
|
||||||
case kBASE_16_4:
|
case Common::Base::F_16_4:
|
||||||
case kBASE_16_8:
|
case Common::Base::F_16_8:
|
||||||
insert = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || c == ' ';
|
insert = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || c == ' ';
|
||||||
break;
|
break;
|
||||||
case kBASE_2:
|
case Common::Base::F_2:
|
||||||
case kBASE_2_8:
|
case Common::Base::F_2_8:
|
||||||
case kBASE_2_16:
|
case Common::Base::F_2_16:
|
||||||
insert = c == '0' || c == '1' || c == ' ';
|
insert = c == '0' || c == '1' || c == ' ';
|
||||||
break;
|
break;
|
||||||
case kBASE_10:
|
case Common::Base::F_10:
|
||||||
if((c >= '0' && c <= '9') || c == ' ')
|
if((c >= '0' && c <= '9') || c == ' ')
|
||||||
insert = true;
|
insert = true;
|
||||||
break;
|
break;
|
||||||
case kBASE_DEFAULT:
|
case Common::Base::F_DEFAULT:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -600,7 +600,7 @@ void RomListWidget::startEditMode()
|
||||||
_base = DiStella::settings.gfx_format;
|
_base = DiStella::settings.gfx_format;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
_base = instance().debugger().parser().base();
|
_base = Common::Base::format();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Widget gets raw data while editing
|
// Widget gets raw data while editing
|
||||||
|
|
|
@ -26,8 +26,8 @@ class PackedBitArray;
|
||||||
class CheckListWidget;
|
class CheckListWidget;
|
||||||
|
|
||||||
#include "Array.hxx"
|
#include "Array.hxx"
|
||||||
|
#include "Base.hxx"
|
||||||
#include "CartDebug.hxx"
|
#include "CartDebug.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
|
||||||
#include "EditableWidget.hxx"
|
#include "EditableWidget.hxx"
|
||||||
|
|
||||||
/** RomListWidget */
|
/** RomListWidget */
|
||||||
|
@ -38,7 +38,7 @@ class RomListWidget : public EditableWidget
|
||||||
kBPointChangedCmd = 'RLbp', // 'data' will be disassembly line number,
|
kBPointChangedCmd = 'RLbp', // 'data' will be disassembly line number,
|
||||||
// 'id' will be the checkbox state
|
// 'id' will be the checkbox state
|
||||||
kRomChangedCmd = 'RLpr', // 'data' will be disassembly line number
|
kRomChangedCmd = 'RLpr', // 'data' will be disassembly line number
|
||||||
// 'id' will be the BaseFormat of the data
|
// 'id' will be the Base::Format of the data
|
||||||
kSetPCCmd = 'STpc', // 'data' will be disassembly line number
|
kSetPCCmd = 'STpc', // 'data' will be disassembly line number
|
||||||
kRuntoPCCmd = 'RTpc', // 'data' will be disassembly line number
|
kRuntoPCCmd = 'RTpc', // 'data' will be disassembly line number
|
||||||
kDisassembleCmd = 'REds',
|
kDisassembleCmd = 'REds',
|
||||||
|
@ -102,8 +102,8 @@ class RomListWidget : public EditableWidget
|
||||||
int _selectedItem;
|
int _selectedItem;
|
||||||
int _highlightedItem;
|
int _highlightedItem;
|
||||||
bool _editMode;
|
bool _editMode;
|
||||||
BaseFormat _base; // base used during editing
|
|
||||||
StellaKey _currentKeyDown;
|
StellaKey _currentKeyDown;
|
||||||
|
Common::Base::Format _base; // base used during editing
|
||||||
|
|
||||||
const CartDebug::Disassembly* myDisasm;
|
const CartDebug::Disassembly* myDisasm;
|
||||||
const PackedBitArray* myBPState;
|
const PackedBitArray* myBPState;
|
||||||
|
|
|
@ -112,7 +112,7 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
case RomListWidget::kRomChangedCmd:
|
case RomListWidget::kRomChangedCmd:
|
||||||
// 'data' is the line in the disassemblylist to be accessed
|
// 'data' is the line in the disassemblylist to be accessed
|
||||||
// 'id' is the base to use for the data to be changed
|
// 'id' is the base to use for the data to be changed
|
||||||
patchROM(data, myRomList->getText(), (BaseFormat)id);
|
patchROM(data, myRomList->getText(), (Common::Base::Format)id);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RomListWidget::kSetPCCmd:
|
case RomListWidget::kSetPCCmd:
|
||||||
|
@ -151,12 +151,12 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
|
||||||
// 'data' is the boolean value
|
// 'data' is the boolean value
|
||||||
if(data)
|
if(data)
|
||||||
{
|
{
|
||||||
DiStella::settings.gfx_format = kBASE_2;
|
DiStella::settings.gfx_format = Common::Base::F_2;
|
||||||
instance().settings().setValue("dis.gfxformat", "2");
|
instance().settings().setValue("dis.gfxformat", "2");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DiStella::settings.gfx_format = kBASE_16;
|
DiStella::settings.gfx_format = Common::Base::F_16;
|
||||||
instance().settings().setValue("dis.gfxformat", "16");
|
instance().settings().setValue("dis.gfxformat", "16");
|
||||||
}
|
}
|
||||||
invalidate();
|
invalidate();
|
||||||
|
@ -214,7 +214,8 @@ void RomWidget::runtoPC(int disasm_line)
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
void RomWidget::patchROM(int disasm_line, const string& bytes, BaseFormat base)
|
void RomWidget::patchROM(int disasm_line, const string& bytes,
|
||||||
|
Common::Base::Format base)
|
||||||
{
|
{
|
||||||
const CartDebug::DisassemblyList& list =
|
const CartDebug::DisassemblyList& list =
|
||||||
instance().debugger().cartDebug().disassembly().list;
|
instance().debugger().cartDebug().disassembly().list;
|
||||||
|
@ -226,13 +227,13 @@ void RomWidget::patchROM(int disasm_line, const string& bytes, BaseFormat base)
|
||||||
|
|
||||||
// Temporarily set to correct base, so we don't have to prefix each byte
|
// Temporarily set to correct base, so we don't have to prefix each byte
|
||||||
// with the type of data
|
// with the type of data
|
||||||
BaseFormat oldbase = instance().debugger().parser().base();
|
Common::Base::Format oldbase = Common::Base::format();
|
||||||
|
|
||||||
instance().debugger().parser().setBase(base);
|
Common::Base::setFormat(base);
|
||||||
command << "rom #" << list[disasm_line].address << " " << bytes;
|
command << "rom #" << list[disasm_line].address << " " << bytes;
|
||||||
instance().debugger().run(command.str());
|
instance().debugger().run(command.str());
|
||||||
|
|
||||||
// Restore previous base
|
// Restore previous base
|
||||||
instance().debugger().parser().setBase(oldbase);
|
Common::Base::setFormat(oldbase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,8 +23,8 @@
|
||||||
class GuiObject;
|
class GuiObject;
|
||||||
class EditTextWidget;
|
class EditTextWidget;
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
#include "Command.hxx"
|
#include "Command.hxx"
|
||||||
#include "DebuggerParser.hxx"
|
|
||||||
#include "RomListWidget.hxx"
|
#include "RomListWidget.hxx"
|
||||||
|
|
||||||
class RomWidget : public Widget, public CommandSender
|
class RomWidget : public Widget, public CommandSender
|
||||||
|
@ -50,7 +50,8 @@ class RomWidget : public Widget, public CommandSender
|
||||||
void setBreak(int disasm_line, bool state);
|
void setBreak(int disasm_line, bool state);
|
||||||
void setPC(int disasm_line);
|
void setPC(int disasm_line);
|
||||||
void runtoPC(int disasm_line);
|
void runtoPC(int disasm_line);
|
||||||
void patchROM(int disasm_line, const string& bytes, BaseFormat base);
|
void patchROM(int disasm_line, const string& bytes,
|
||||||
|
Common::Base::Format base);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RomListWidget* myRomList;
|
RomListWidget* myRomList;
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
// $Id$
|
// $Id$
|
||||||
//============================================================================
|
//============================================================================
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
#include "OSystem.hxx"
|
#include "OSystem.hxx"
|
||||||
#include "FrameBuffer.hxx"
|
#include "FrameBuffer.hxx"
|
||||||
#include "Debugger.hxx"
|
#include "Debugger.hxx"
|
||||||
|
@ -122,15 +123,15 @@ void TiaInfoWidget::loadConfig()
|
||||||
Debugger& dbg = instance().debugger();
|
Debugger& dbg = instance().debugger();
|
||||||
TIADebug& tia = dbg.tiaDebug();
|
TIADebug& tia = dbg.tiaDebug();
|
||||||
|
|
||||||
myFrameCount->setText(dbg.valueToString(tia.frameCount(), kBASE_10));
|
myFrameCount->setText(Common::Base::toString(tia.frameCount(), Common::Base::F_10));
|
||||||
myFrameCycles->setText(dbg.valueToString(dbg.cycles(), kBASE_10));
|
myFrameCycles->setText(Common::Base::toString(dbg.cycles(), Common::Base::F_10));
|
||||||
|
|
||||||
myVSync->setState(tia.vsync());
|
myVSync->setState(tia.vsync());
|
||||||
myVBlank->setState(tia.vblank());
|
myVBlank->setState(tia.vblank());
|
||||||
|
|
||||||
int clk = tia.clocksThisLine();
|
int clk = tia.clocksThisLine();
|
||||||
myScanlineCount->setText(dbg.valueToString(tia.scanlines(), kBASE_10));
|
myScanlineCount->setText(Common::Base::toString(tia.scanlines(), Common::Base::F_10));
|
||||||
myScanlineCycles->setText(dbg.valueToString(clk/3, kBASE_10));
|
myScanlineCycles->setText(Common::Base::toString(clk/3, Common::Base::F_10));
|
||||||
myPixelPosition->setText(dbg.valueToString(clk-68, kBASE_10));
|
myPixelPosition->setText(Common::Base::toString(clk-68, Common::Base::F_10));
|
||||||
myColorClocks->setText(dbg.valueToString(clk, kBASE_10));
|
myColorClocks->setText(Common::Base::toString(clk, Common::Base::F_10));
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
}
|
}
|
||||||
xpos += 7*fontWidth + 5;
|
xpos += 7*fontWidth + 5;
|
||||||
myColorRegs = new DataGridWidget(boss, font, xpos, ypos,
|
myColorRegs = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 4, 2, 8, kBASE_16);
|
1, 4, 2, 8, Common::Base::F_16);
|
||||||
myColorRegs->setTarget(this);
|
myColorRegs->setTarget(this);
|
||||||
myColorRegs->setID(kColorRegsID);
|
myColorRegs->setID(kColorRegsID);
|
||||||
addFocusWidget(myColorRegs);
|
addFocusWidget(myColorRegs);
|
||||||
|
@ -200,7 +200,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Pos: #", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += t->getWidth() + 2;
|
xpos += t->getWidth() + 2;
|
||||||
myPosP0 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosP0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 3, 8, kBASE_10);
|
1, 1, 3, 8, Common::Base::F_10);
|
||||||
myPosP0->setTarget(this);
|
myPosP0->setTarget(this);
|
||||||
myPosP0->setID(kPosP0ID);
|
myPosP0->setID(kPosP0ID);
|
||||||
myPosP0->setRange(0, 160);
|
myPosP0->setRange(0, 160);
|
||||||
|
@ -213,7 +213,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"HM:", kTextAlignLeft);
|
"HM:", kTextAlignLeft);
|
||||||
xpos += 3*fontWidth + 5;
|
xpos += 3*fontWidth + 5;
|
||||||
myHMP0 = new DataGridWidget(boss, font, xpos, ypos,
|
myHMP0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 4, kBASE_16_1);
|
1, 1, 1, 4, Common::Base::F_16_1);
|
||||||
myHMP0->setTarget(this);
|
myHMP0->setTarget(this);
|
||||||
myHMP0->setID(kHMP0ID);
|
myHMP0->setID(kHMP0ID);
|
||||||
addFocusWidget(myHMP0);
|
addFocusWidget(myHMP0);
|
||||||
|
@ -240,7 +240,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"NusizP0:", kTextAlignLeft);
|
"NusizP0:", kTextAlignLeft);
|
||||||
xpos += 8*fontWidth + 5;
|
xpos += 8*fontWidth + 5;
|
||||||
myNusizP0 = new DataGridWidget(boss, font, xpos, ypos,
|
myNusizP0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 3, kBASE_16_1);
|
1, 1, 1, 3, Common::Base::F_16_1);
|
||||||
myNusizP0->setTarget(this);
|
myNusizP0->setTarget(this);
|
||||||
myNusizP0->setID(kNusizP0ID);
|
myNusizP0->setID(kNusizP0ID);
|
||||||
addFocusWidget(myNusizP0);
|
addFocusWidget(myNusizP0);
|
||||||
|
@ -269,7 +269,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Pos: #", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += t->getWidth() + 2;
|
xpos += t->getWidth() + 2;
|
||||||
myPosP1 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosP1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 3, 8, kBASE_10);
|
1, 1, 3, 8, Common::Base::F_10);
|
||||||
myPosP1->setTarget(this);
|
myPosP1->setTarget(this);
|
||||||
myPosP1->setID(kPosP1ID);
|
myPosP1->setID(kPosP1ID);
|
||||||
myPosP1->setRange(0, 160);
|
myPosP1->setRange(0, 160);
|
||||||
|
@ -281,7 +281,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"HM:", kTextAlignLeft);
|
"HM:", kTextAlignLeft);
|
||||||
xpos += 3*fontWidth + 5;
|
xpos += 3*fontWidth + 5;
|
||||||
myHMP1 = new DataGridWidget(boss, font, xpos, ypos,
|
myHMP1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 4, kBASE_16_1);
|
1, 1, 1, 4, Common::Base::F_16_1);
|
||||||
myHMP1->setTarget(this);
|
myHMP1->setTarget(this);
|
||||||
myHMP1->setID(kHMP1ID);
|
myHMP1->setID(kHMP1ID);
|
||||||
addFocusWidget(myHMP1);
|
addFocusWidget(myHMP1);
|
||||||
|
@ -307,7 +307,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"NusizP1:", kTextAlignLeft);
|
"NusizP1:", kTextAlignLeft);
|
||||||
xpos += 8*fontWidth + 5;
|
xpos += 8*fontWidth + 5;
|
||||||
myNusizP1 = new DataGridWidget(boss, font, xpos, ypos,
|
myNusizP1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 3, kBASE_16_1);
|
1, 1, 1, 3, Common::Base::F_16_1);
|
||||||
myNusizP1->setTarget(this);
|
myNusizP1->setTarget(this);
|
||||||
myNusizP1->setID(kNusizP1ID);
|
myNusizP1->setID(kNusizP1ID);
|
||||||
addFocusWidget(myNusizP1);
|
addFocusWidget(myNusizP1);
|
||||||
|
@ -337,7 +337,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Pos: #", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += t->getWidth() + 2;
|
xpos += t->getWidth() + 2;
|
||||||
myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosM0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 3, 8, kBASE_10);
|
1, 1, 3, 8, Common::Base::F_10);
|
||||||
myPosM0->setTarget(this);
|
myPosM0->setTarget(this);
|
||||||
myPosM0->setID(kPosM0ID);
|
myPosM0->setID(kPosM0ID);
|
||||||
myPosM0->setRange(0, 160);
|
myPosM0->setRange(0, 160);
|
||||||
|
@ -349,7 +349,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"HM:", kTextAlignLeft);
|
"HM:", kTextAlignLeft);
|
||||||
xpos += 3*fontWidth + 5;
|
xpos += 3*fontWidth + 5;
|
||||||
myHMM0 = new DataGridWidget(boss, font, xpos, ypos,
|
myHMM0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 4, kBASE_16_1);
|
1, 1, 1, 4, Common::Base::F_16_1);
|
||||||
myHMM0->setTarget(this);
|
myHMM0->setTarget(this);
|
||||||
myHMM0->setID(kHMM0ID);
|
myHMM0->setID(kHMM0ID);
|
||||||
addFocusWidget(myHMM0);
|
addFocusWidget(myHMM0);
|
||||||
|
@ -360,7 +360,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Size:", kTextAlignLeft);
|
"Size:", kTextAlignLeft);
|
||||||
xpos += 5*fontWidth + 5;
|
xpos += 5*fontWidth + 5;
|
||||||
myNusizM0 = new DataGridWidget(boss, font, xpos, ypos,
|
myNusizM0 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 2, kBASE_16_1);
|
1, 1, 1, 2, Common::Base::F_16_1);
|
||||||
myNusizM0->setTarget(this);
|
myNusizM0->setTarget(this);
|
||||||
myNusizM0->setID(kNusizM0ID);
|
myNusizM0->setID(kNusizM0ID);
|
||||||
addFocusWidget(myNusizM0);
|
addFocusWidget(myNusizM0);
|
||||||
|
@ -393,7 +393,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Pos: #", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += t->getWidth() + 2;
|
xpos += t->getWidth() + 2;
|
||||||
myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
|
myPosM1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 3, 8, kBASE_10);
|
1, 1, 3, 8, Common::Base::F_10);
|
||||||
myPosM1->setTarget(this);
|
myPosM1->setTarget(this);
|
||||||
myPosM1->setID(kPosM1ID);
|
myPosM1->setID(kPosM1ID);
|
||||||
myPosM1->setRange(0, 160);
|
myPosM1->setRange(0, 160);
|
||||||
|
@ -405,7 +405,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"HM:", kTextAlignLeft);
|
"HM:", kTextAlignLeft);
|
||||||
xpos += 3*fontWidth + 5;
|
xpos += 3*fontWidth + 5;
|
||||||
myHMM1 = new DataGridWidget(boss, font, xpos, ypos,
|
myHMM1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 4, kBASE_16_1);
|
1, 1, 1, 4, Common::Base::F_16_1);
|
||||||
myHMM1->setTarget(this);
|
myHMM1->setTarget(this);
|
||||||
myHMM1->setID(kHMM1ID);
|
myHMM1->setID(kHMM1ID);
|
||||||
addFocusWidget(myHMM1);
|
addFocusWidget(myHMM1);
|
||||||
|
@ -416,7 +416,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Size:", kTextAlignLeft);
|
"Size:", kTextAlignLeft);
|
||||||
xpos += 5*fontWidth + 5;
|
xpos += 5*fontWidth + 5;
|
||||||
myNusizM1 = new DataGridWidget(boss, font, xpos, ypos,
|
myNusizM1 = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 2, kBASE_16_1);
|
1, 1, 1, 2, Common::Base::F_16_1);
|
||||||
myNusizM1->setTarget(this);
|
myNusizM1->setTarget(this);
|
||||||
myNusizM1->setID(kNusizM1ID);
|
myNusizM1->setID(kNusizM1ID);
|
||||||
addFocusWidget(myNusizM1);
|
addFocusWidget(myNusizM1);
|
||||||
|
@ -449,7 +449,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Pos: #", kTextAlignLeft);
|
"Pos: #", kTextAlignLeft);
|
||||||
xpos += t->getWidth() + 2;
|
xpos += t->getWidth() + 2;
|
||||||
myPosBL = new DataGridWidget(boss, font, xpos, ypos,
|
myPosBL = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 3, 8, kBASE_10);
|
1, 1, 3, 8, Common::Base::F_10);
|
||||||
myPosBL->setTarget(this);
|
myPosBL->setTarget(this);
|
||||||
myPosBL->setID(kPosBLID);
|
myPosBL->setID(kPosBLID);
|
||||||
myPosBL->setRange(0, 160);
|
myPosBL->setRange(0, 160);
|
||||||
|
@ -461,7 +461,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"HM:", kTextAlignLeft);
|
"HM:", kTextAlignLeft);
|
||||||
xpos += 3*fontWidth + 5;
|
xpos += 3*fontWidth + 5;
|
||||||
myHMBL = new DataGridWidget(boss, font, xpos, ypos,
|
myHMBL = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 4, kBASE_16_1);
|
1, 1, 1, 4, Common::Base::F_16_1);
|
||||||
myHMBL->setTarget(this);
|
myHMBL->setTarget(this);
|
||||||
myHMBL->setID(kHMBLID);
|
myHMBL->setID(kHMBLID);
|
||||||
addFocusWidget(myHMBL);
|
addFocusWidget(myHMBL);
|
||||||
|
@ -472,7 +472,7 @@ TiaWidget::TiaWidget(GuiObject* boss, const GUI::Font& font,
|
||||||
"Size:", kTextAlignLeft);
|
"Size:", kTextAlignLeft);
|
||||||
xpos += 5*fontWidth + 5;
|
xpos += 5*fontWidth + 5;
|
||||||
mySizeBL = new DataGridWidget(boss, font, xpos, ypos,
|
mySizeBL = new DataGridWidget(boss, font, xpos, ypos,
|
||||||
1, 1, 1, 2, kBASE_16_1);
|
1, 1, 1, 2, Common::Base::F_16_1);
|
||||||
mySizeBL->setTarget(this);
|
mySizeBL->setTarget(this);
|
||||||
mySizeBL->setID(kSizeBLID);
|
mySizeBL->setID(kSizeBLID);
|
||||||
addFocusWidget(mySizeBL);
|
addFocusWidget(mySizeBL);
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
#include "CommandMenu.hxx"
|
#include "CommandMenu.hxx"
|
||||||
#include "Console.hxx"
|
#include "Console.hxx"
|
||||||
#include "DialogContainer.hxx"
|
#include "DialogContainer.hxx"
|
||||||
|
@ -117,6 +118,9 @@ void EventHandler::initialize()
|
||||||
|
|
||||||
// Set number of lines a mousewheel will scroll
|
// Set number of lines a mousewheel will scroll
|
||||||
ScrollBarWidget::setWheelLines(myOSystem->settings().getInt("mwheel"));
|
ScrollBarWidget::setWheelLines(myOSystem->settings().getInt("mwheel"));
|
||||||
|
|
||||||
|
// Integer to string conversions (for HEX) use upper or lower-case
|
||||||
|
Common::Base::setHexUppercase(myOSystem->settings().getBool("dbg.uhex"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -1780,7 +1784,7 @@ void EventHandler::saveComboMapping()
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
inline bool EventHandler::eventIsAnalog(Event::Type event) const
|
inline bool EventHandler::eventIsAnalog(Event::Type event) const
|
||||||
{
|
{
|
||||||
switch((int)event)
|
switch(event)
|
||||||
{
|
{
|
||||||
case Event::PaddleZeroAnalog:
|
case Event::PaddleZeroAnalog:
|
||||||
case Event::PaddleOneAnalog:
|
case Event::PaddleOneAnalog:
|
||||||
|
|
|
@ -137,7 +137,8 @@ Settings::Settings(OSystem* osystem)
|
||||||
setExternal("romloadcount", "0");
|
setExternal("romloadcount", "0");
|
||||||
setExternal("maxres", "");
|
setExternal("maxres", "");
|
||||||
|
|
||||||
// Debugger disassembly options
|
// Debugger/disassembly options
|
||||||
|
setInternal("dbg.uhex", "true");
|
||||||
setInternal("dis.resolve", "true");
|
setInternal("dis.resolve", "true");
|
||||||
setInternal("dis.gfxformat", "2");
|
setInternal("dis.gfxformat", "2");
|
||||||
setInternal("dis.showaddr", "true");
|
setInternal("dis.showaddr", "true");
|
||||||
|
|
|
@ -27,7 +27,9 @@
|
||||||
#ifdef THUMB_SUPPORT
|
#ifdef THUMB_SUPPORT
|
||||||
|
|
||||||
#include "bspf.hxx"
|
#include "bspf.hxx"
|
||||||
|
#include "Base.hxx"
|
||||||
#include "Thumbulator.hxx"
|
#include "Thumbulator.hxx"
|
||||||
|
using namespace Common;
|
||||||
|
|
||||||
// Uncomment the following to enable specific functionality
|
// Uncomment the following to enable specific functionality
|
||||||
// WARNING!!! This slows the runtime to a crawl
|
// WARNING!!! This slows the runtime to a crawl
|
||||||
|
@ -79,7 +81,7 @@ string Thumbulator::run( void )
|
||||||
inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, const char* msg)
|
inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, const char* msg)
|
||||||
{
|
{
|
||||||
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
||||||
<< opcode << "(" << HEX8 << v1 << "), " << msg << endl;
|
<< opcode << "(" << Base::HEX8 << v1 << "), " << msg << endl;
|
||||||
dump_regs();
|
dump_regs();
|
||||||
if(trapOnFatal)
|
if(trapOnFatal)
|
||||||
throw statusMsg.str();
|
throw statusMsg.str();
|
||||||
|
@ -91,7 +93,7 @@ inline int Thumbulator::fatalError(const char* opcode, uInt32 v1, uInt32 v2,
|
||||||
const char* msg)
|
const char* msg)
|
||||||
{
|
{
|
||||||
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
statusMsg << "Thumb ARM emulation fatal error: " << endl
|
||||||
<< opcode << "(" << HEX8 << v1 << "," << v2 << "), " << msg << endl;
|
<< opcode << "(" << Base::HEX8 << v1 << "," << v2 << "), " << msg << endl;
|
||||||
dump_regs();
|
dump_regs();
|
||||||
if(trapOnFatal)
|
if(trapOnFatal)
|
||||||
throw statusMsg.str();
|
throw statusMsg.str();
|
||||||
|
@ -114,13 +116,13 @@ void Thumbulator::dump_regs( void )
|
||||||
{
|
{
|
||||||
for (int cnt = 1; cnt < 14; cnt++)
|
for (int cnt = 1; cnt < 14; cnt++)
|
||||||
{
|
{
|
||||||
statusMsg << "R" << cnt << " = " << HEX8 << reg_sys[cnt-1] << " ";
|
statusMsg << "R" << cnt << " = " << Base::HEX8 << reg_sys[cnt-1] << " ";
|
||||||
if(cnt % 4 == 0) statusMsg << endl;
|
if(cnt % 4 == 0) statusMsg << endl;
|
||||||
}
|
}
|
||||||
statusMsg << endl
|
statusMsg << endl
|
||||||
<< "SP = " << HEX8 << reg_svc[13] << " "
|
<< "SP = " << Base::HEX8 << reg_svc[13] << " "
|
||||||
<< "LR = " << HEX8 << reg_svc[14] << " "
|
<< "LR = " << Base::HEX8 << reg_svc[14] << " "
|
||||||
<< "PC = " << HEX8 << reg_sys[15] << " "
|
<< "PC = " << Base::HEX8 << reg_sys[15] << " "
|
||||||
<< endl;
|
<< endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +145,7 @@ uInt32 Thumbulator::fetch16 ( uInt32 addr )
|
||||||
#else
|
#else
|
||||||
data=rom[addr];
|
data=rom[addr];
|
||||||
#endif
|
#endif
|
||||||
DO_DBUG(statusMsg << "fetch16(" << HEX8 << addr << ")=" << HEX4 << data << endl);
|
DO_DBUG(statusMsg << "fetch16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
|
|
||||||
case 0x40000000: //RAM
|
case 0x40000000: //RAM
|
||||||
|
@ -154,7 +156,7 @@ uInt32 Thumbulator::fetch16 ( uInt32 addr )
|
||||||
#else
|
#else
|
||||||
data=ram[addr];
|
data=ram[addr];
|
||||||
#endif
|
#endif
|
||||||
DO_DBUG(statusMsg << "fetch16(" << HEX8 << addr << ")=" << HEX4 << data << endl);
|
DO_DBUG(statusMsg << "fetch16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
}
|
}
|
||||||
return fatalError("fetch16", addr, "abort");
|
return fatalError("fetch16", addr, "abort");
|
||||||
|
@ -170,7 +172,7 @@ uInt32 Thumbulator::fetch32 ( uInt32 addr )
|
||||||
if(addr<0x50)
|
if(addr<0x50)
|
||||||
{
|
{
|
||||||
data=read32(addr);
|
data=read32(addr);
|
||||||
DO_DBUG(statusMsg << "fetch32(" << HEX8 << addr << ")=" << HEX8 << data << endl);
|
DO_DBUG(statusMsg << "fetch32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl);
|
||||||
if(addr==0x00000000) return(data);
|
if(addr==0x00000000) return(data);
|
||||||
if(addr==0x00000004) return(data);
|
if(addr==0x00000004) return(data);
|
||||||
fatalError("fetch32", addr, "abort");
|
fatalError("fetch32", addr, "abort");
|
||||||
|
@ -180,7 +182,7 @@ uInt32 Thumbulator::fetch32 ( uInt32 addr )
|
||||||
data =fetch16(addr+2);
|
data =fetch16(addr+2);
|
||||||
data<<=16;
|
data<<=16;
|
||||||
data|=fetch16(addr+0);
|
data|=fetch16(addr+0);
|
||||||
DO_DBUG(statusMsg << "fetch32(" << HEX8 << addr << ")=" << HEX8 << data << endl);
|
DO_DBUG(statusMsg << "fetch32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
}
|
}
|
||||||
return fatalError("fetch32", addr, "abort");
|
return fatalError("fetch32", addr, "abort");
|
||||||
|
@ -198,7 +200,7 @@ void Thumbulator::write16 ( uInt32 addr, uInt32 data )
|
||||||
|
|
||||||
writes++;
|
writes++;
|
||||||
|
|
||||||
DO_DBUG(statusMsg << "write16(" << HEX8 << addr << "," << HEX8 << data << ")" << endl);
|
DO_DBUG(statusMsg << "write16(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")" << endl);
|
||||||
|
|
||||||
switch(addr&0xF0000000)
|
switch(addr&0xF0000000)
|
||||||
{
|
{
|
||||||
|
@ -215,7 +217,7 @@ void Thumbulator::write16 ( uInt32 addr, uInt32 data )
|
||||||
case 0xE0000000: //MAMCR
|
case 0xE0000000: //MAMCR
|
||||||
if(addr == 0xE01FC000)
|
if(addr == 0xE01FC000)
|
||||||
{
|
{
|
||||||
DO_DBUG(statusMsg << "write16(" << HEX8 << "MAMCR" << "," << HEX8 << data << ") *" << endl);
|
DO_DBUG(statusMsg << "write16(" << Base::HEX8 << "MAMCR" << "," << Base::HEX8 << data << ") *" << endl);
|
||||||
mamcr = data;
|
mamcr = data;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -229,7 +231,7 @@ void Thumbulator::write32 ( uInt32 addr, uInt32 data )
|
||||||
if(addr&3)
|
if(addr&3)
|
||||||
fatalError("write32", addr, "abort - misaligned");
|
fatalError("write32", addr, "abort - misaligned");
|
||||||
|
|
||||||
DO_DBUG(statusMsg << "write32(" << HEX8 << addr << "," << HEX8 << data << ")" << endl);
|
DO_DBUG(statusMsg << "write32(" << Base::HEX8 << addr << "," << Base::HEX8 << data << ")" << endl);
|
||||||
|
|
||||||
switch(addr&0xF0000000)
|
switch(addr&0xF0000000)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +249,7 @@ void Thumbulator::write32 ( uInt32 addr, uInt32 data )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case 0xD0000000: //debug
|
case 0xD0000000: //debug
|
||||||
statusMsg << "[" << HEX8 << read_register(14) << "]["
|
statusMsg << "[" << Base::HEX8 << read_register(14) << "]["
|
||||||
<< addr << "] " << data << endl;
|
<< addr << "] " << data << endl;
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -283,7 +285,7 @@ uInt32 Thumbulator::read16 ( uInt32 addr )
|
||||||
#else
|
#else
|
||||||
data=rom[addr];
|
data=rom[addr];
|
||||||
#endif
|
#endif
|
||||||
DO_DBUG(statusMsg << "read16(" << HEX8 << addr << ")=" << HEX4 << data << endl);
|
DO_DBUG(statusMsg << "read16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
|
|
||||||
case 0x40000000: //RAM
|
case 0x40000000: //RAM
|
||||||
|
@ -294,7 +296,7 @@ uInt32 Thumbulator::read16 ( uInt32 addr )
|
||||||
#else
|
#else
|
||||||
data=ram[addr];
|
data=ram[addr];
|
||||||
#endif
|
#endif
|
||||||
DO_DBUG(statusMsg << "read16(" << HEX8 << addr << ")=" << HEX4 << data << endl);
|
DO_DBUG(statusMsg << "read16(" << Base::HEX8 << addr << ")=" << Base::HEX4 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
|
|
||||||
case 0xE0000000: //MAMCR
|
case 0xE0000000: //MAMCR
|
||||||
|
@ -321,7 +323,7 @@ uInt32 Thumbulator::read32 ( uInt32 addr )
|
||||||
data =read16(addr+2);
|
data =read16(addr+2);
|
||||||
data<<=16;
|
data<<=16;
|
||||||
data|=read16(addr+0);
|
data|=read16(addr+0);
|
||||||
DO_DBUG(statusMsg << "read32(" << HEX8 << addr << ")=" << HEX8 << data << endl);
|
DO_DBUG(statusMsg << "read32(" << Base::HEX8 << addr << ")=" << Base::HEX8 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
}
|
}
|
||||||
return fatalError("read32", addr, "abort");
|
return fatalError("read32", addr, "abort");
|
||||||
|
@ -341,7 +343,7 @@ uInt32 Thumbulator::read_register ( uInt32 reg )
|
||||||
default: data=reg_sys[reg]; break;
|
default: data=reg_sys[reg]; break;
|
||||||
case 13: case 14: data=reg_svc[reg]; break;
|
case 13: case 14: data=reg_svc[reg]; break;
|
||||||
}
|
}
|
||||||
DO_DBUG(statusMsg << "read_register(" << dec << reg << ")=" << HEX8 << data << endl);
|
DO_DBUG(statusMsg << "read_register(" << dec << reg << ")=" << Base::HEX8 << data << endl);
|
||||||
return(data);
|
return(data);
|
||||||
}
|
}
|
||||||
return fatalError("read_register", cpsr, "invalid cpsr mode");
|
return fatalError("read_register", cpsr, "invalid cpsr mode");
|
||||||
|
@ -352,7 +354,7 @@ uInt32 Thumbulator::write_register ( uInt32 reg, uInt32 data )
|
||||||
{
|
{
|
||||||
reg&=0xF;
|
reg&=0xF;
|
||||||
|
|
||||||
DO_DBUG(statusMsg << "write_register(" << dec << reg << "," << HEX8 << data << ")" << endl);
|
DO_DBUG(statusMsg << "write_register(" << dec << reg << "," << Base::HEX8 << data << ")" << endl);
|
||||||
switch(cpsr&0x1F)
|
switch(cpsr&0x1F)
|
||||||
{
|
{
|
||||||
case MODE_SVC:
|
case MODE_SVC:
|
||||||
|
@ -446,7 +448,7 @@ int Thumbulator::execute ( void )
|
||||||
inst=fetch16(pc-2);
|
inst=fetch16(pc-2);
|
||||||
pc+=2;
|
pc+=2;
|
||||||
write_register(15,pc);
|
write_register(15,pc);
|
||||||
DO_DISS(statusMsg << HEX8 << (pc-5) << ": " << HEX4 << inst << " ");
|
DO_DISS(statusMsg << Base::HEX8 << (pc-5) << ": " << Base::HEX4 << inst << " ");
|
||||||
|
|
||||||
instructions++;
|
instructions++;
|
||||||
|
|
||||||
|
@ -479,7 +481,7 @@ int Thumbulator::execute ( void )
|
||||||
if(rb)
|
if(rb)
|
||||||
{
|
{
|
||||||
DO_DISS(statusMsg << "adds r" << dec << rd << ",r" << dec << rn << ","
|
DO_DISS(statusMsg << "adds r" << dec << rd << ",r" << dec << rn << ","
|
||||||
<< "#0x" << HEX2 << rb << endl);
|
<< "#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(rn);
|
ra=read_register(rn);
|
||||||
rc=ra+rb;
|
rc=ra+rb;
|
||||||
//fprintf(stderr,"0x%08X = 0x%08X + 0x%08X\n",rc,ra,rb);
|
//fprintf(stderr,"0x%08X = 0x%08X + 0x%08X\n",rc,ra,rb);
|
||||||
|
@ -501,7 +503,7 @@ int Thumbulator::execute ( void )
|
||||||
{
|
{
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x7;
|
rd=(inst>>8)&0x7;
|
||||||
DO_DISS(statusMsg << "adds r" << dec << rd << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "adds r" << dec << rd << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(rd);
|
ra=read_register(rd);
|
||||||
rc=ra+rb;
|
rc=ra+rb;
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
|
@ -555,7 +557,7 @@ int Thumbulator::execute ( void )
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x7;
|
rd=(inst>>8)&0x7;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "add r" << dec << rd << ",PC,#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "add r" << dec << rd << ",PC,#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(15);
|
ra=read_register(15);
|
||||||
rc=(ra&(~3))+rb;
|
rc=(ra&(~3))+rb;
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
|
@ -568,7 +570,7 @@ int Thumbulator::execute ( void )
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x7;
|
rd=(inst>>8)&0x7;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "add r" << dec << rd << ",SP,#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "add r" << dec << rd << ",SP,#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(13);
|
ra=read_register(13);
|
||||||
rc=ra+rb;
|
rc=ra+rb;
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
|
@ -580,7 +582,7 @@ int Thumbulator::execute ( void )
|
||||||
{
|
{
|
||||||
rb=(inst>>0)&0x7F;
|
rb=(inst>>0)&0x7F;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "add SP,#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "add SP,#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(13);
|
ra=read_register(13);
|
||||||
rc=ra+rb;
|
rc=ra+rb;
|
||||||
write_register(13,rc);
|
write_register(13,rc);
|
||||||
|
@ -608,7 +610,7 @@ int Thumbulator::execute ( void )
|
||||||
rd=(inst>>0)&0x07;
|
rd=(inst>>0)&0x07;
|
||||||
rm=(inst>>3)&0x07;
|
rm=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
DO_DISS(statusMsg << "asrs r" << dec << rd << ",r" << dec << rm << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "asrs r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
rc=read_register(rm);
|
rc=read_register(rm);
|
||||||
if(rb==0)
|
if(rb==0)
|
||||||
{
|
{
|
||||||
|
@ -693,7 +695,7 @@ int Thumbulator::execute ( void )
|
||||||
switch(op)
|
switch(op)
|
||||||
{
|
{
|
||||||
case 0x0: //b eq z set
|
case 0x0: //b eq z set
|
||||||
DO_DISS(statusMsg << "beq 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "beq 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(cpsr&CPSR_Z)
|
if(cpsr&CPSR_Z)
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -701,7 +703,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x1: //b ne z clear
|
case 0x1: //b ne z clear
|
||||||
DO_DISS(statusMsg << "bne 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bne 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(!(cpsr&CPSR_Z))
|
if(!(cpsr&CPSR_Z))
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -709,7 +711,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x2: //b cs c set
|
case 0x2: //b cs c set
|
||||||
DO_DISS(statusMsg << "bcs 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bcs 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(cpsr&CPSR_C)
|
if(cpsr&CPSR_C)
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -717,7 +719,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x3: //b cc c clear
|
case 0x3: //b cc c clear
|
||||||
DO_DISS(statusMsg << "bcc 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bcc 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(!(cpsr&CPSR_C))
|
if(!(cpsr&CPSR_C))
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -725,7 +727,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x4: //b mi n set
|
case 0x4: //b mi n set
|
||||||
DO_DISS(statusMsg << "bmi 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bmi 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(cpsr&CPSR_N)
|
if(cpsr&CPSR_N)
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -733,7 +735,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x5: //b pl n clear
|
case 0x5: //b pl n clear
|
||||||
DO_DISS(statusMsg << "bpl 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bpl 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(!(cpsr&CPSR_N))
|
if(!(cpsr&CPSR_N))
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -741,7 +743,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x6: //b vs v set
|
case 0x6: //b vs v set
|
||||||
DO_DISS(statusMsg << "bvs 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bvs 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(cpsr&CPSR_V)
|
if(cpsr&CPSR_V)
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -749,7 +751,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x7: //b vc v clear
|
case 0x7: //b vc v clear
|
||||||
DO_DISS(statusMsg << "bvc 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bvc 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if(!(cpsr&CPSR_V))
|
if(!(cpsr&CPSR_V))
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -757,7 +759,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x8: //b hi c set z clear
|
case 0x8: //b hi c set z clear
|
||||||
DO_DISS(statusMsg << "bhi 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bhi 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if((cpsr&CPSR_C)&&(!(cpsr&CPSR_Z)))
|
if((cpsr&CPSR_C)&&(!(cpsr&CPSR_Z)))
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -765,7 +767,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0x9: //b ls c clear or z set
|
case 0x9: //b ls c clear or z set
|
||||||
DO_DISS(statusMsg << "bls 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bls 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
if((cpsr&CPSR_Z)||(!(cpsr&CPSR_C)))
|
if((cpsr&CPSR_Z)||(!(cpsr&CPSR_C)))
|
||||||
{
|
{
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
|
@ -773,7 +775,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0xA: //b ge N == V
|
case 0xA: //b ge N == V
|
||||||
DO_DISS(statusMsg << "bge 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bge 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
ra=0;
|
ra=0;
|
||||||
if( (cpsr&CPSR_N) && (cpsr&CPSR_V) ) ra++;
|
if( (cpsr&CPSR_N) && (cpsr&CPSR_V) ) ra++;
|
||||||
if((!(cpsr&CPSR_N))&&(!(cpsr&CPSR_V))) ra++;
|
if((!(cpsr&CPSR_N))&&(!(cpsr&CPSR_V))) ra++;
|
||||||
|
@ -784,7 +786,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0xB: //b lt N != V
|
case 0xB: //b lt N != V
|
||||||
DO_DISS(statusMsg << "blt 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "blt 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
ra=0;
|
ra=0;
|
||||||
if((!(cpsr&CPSR_N))&&(cpsr&CPSR_V)) ra++;
|
if((!(cpsr&CPSR_N))&&(cpsr&CPSR_V)) ra++;
|
||||||
if((!(cpsr&CPSR_V))&&(cpsr&CPSR_N)) ra++;
|
if((!(cpsr&CPSR_V))&&(cpsr&CPSR_N)) ra++;
|
||||||
|
@ -795,7 +797,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0xC: //b gt Z==0 and N == V
|
case 0xC: //b gt Z==0 and N == V
|
||||||
DO_DISS(statusMsg << "bgt 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bgt 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
ra=0;
|
ra=0;
|
||||||
if( (cpsr&CPSR_N) && (cpsr&CPSR_V) ) ra++;
|
if( (cpsr&CPSR_N) && (cpsr&CPSR_V) ) ra++;
|
||||||
if((!(cpsr&CPSR_N))&&(!(cpsr&CPSR_V))) ra++;
|
if((!(cpsr&CPSR_N))&&(!(cpsr&CPSR_V))) ra++;
|
||||||
|
@ -807,7 +809,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
|
|
||||||
case 0xD: //b le Z==1 or N != V
|
case 0xD: //b le Z==1 or N != V
|
||||||
DO_DISS(statusMsg << "ble 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "ble 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
ra=0;
|
ra=0;
|
||||||
if((!(cpsr&CPSR_N))&&(cpsr&CPSR_V)) ra++;
|
if((!(cpsr&CPSR_N))&&(cpsr&CPSR_V)) ra++;
|
||||||
if((!(cpsr&CPSR_V))&&(cpsr&CPSR_N)) ra++;
|
if((!(cpsr&CPSR_V))&&(cpsr&CPSR_N)) ra++;
|
||||||
|
@ -837,7 +839,7 @@ int Thumbulator::execute ( void )
|
||||||
rb<<=1;
|
rb<<=1;
|
||||||
rb+=pc;
|
rb+=pc;
|
||||||
rb+=2;
|
rb+=2;
|
||||||
DO_DISS(statusMsg << "B 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "B 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -861,7 +863,7 @@ int Thumbulator::execute ( void )
|
||||||
if((inst&0xFF00)==0xBE00)
|
if((inst&0xFF00)==0xBE00)
|
||||||
{
|
{
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
statusMsg << "bkpt 0x" << HEX2 << rb << endl;
|
statusMsg << "bkpt 0x" << Base::HEX2 << rb << endl;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -884,7 +886,7 @@ int Thumbulator::execute ( void )
|
||||||
rb|=inst&((1<<11)-1);
|
rb|=inst&((1<<11)-1);
|
||||||
rb<<=1;
|
rb<<=1;
|
||||||
rb+=pc;
|
rb+=pc;
|
||||||
DO_DISS(statusMsg << "bl 0x" << HEX8 << (rb-3) << endl);
|
DO_DISS(statusMsg << "bl 0x" << Base::HEX8 << (rb-3) << endl);
|
||||||
write_register(14,pc-2);
|
write_register(14,pc-2);
|
||||||
write_register(15,rb);
|
write_register(15,rb);
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -961,7 +963,7 @@ int Thumbulator::execute ( void )
|
||||||
{
|
{
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rn=(inst>>8)&0x07;
|
rn=(inst>>8)&0x07;
|
||||||
DO_DISS(statusMsg << "cmp r" << dec << rn << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "cmp r" << dec << rn << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(rn);
|
ra=read_register(rn);
|
||||||
rc=ra-rb;
|
rc=ra-rb;
|
||||||
//fprintf(stderr,"0x%08X 0x%08X\n",ra,rb);
|
//fprintf(stderr,"0x%08X 0x%08X\n",ra,rb);
|
||||||
|
@ -1017,7 +1019,7 @@ int Thumbulator::execute ( void )
|
||||||
if(cpsr&CPSR_Z) statusMsg << "Z"; else statusMsg << "z";
|
if(cpsr&CPSR_Z) statusMsg << "Z"; else statusMsg << "z";
|
||||||
if(cpsr&CPSR_C) statusMsg << "C"; else statusMsg << "c";
|
if(cpsr&CPSR_C) statusMsg << "C"; else statusMsg << "c";
|
||||||
if(cpsr&CPSR_V) statusMsg << "V"; else statusMsg << "v";
|
if(cpsr&CPSR_V) statusMsg << "V"; else statusMsg << "v";
|
||||||
statusMsg << " -- 0x" << HEX8 << ra << " 0x" << HEX8 << rb << endl;
|
statusMsg << " -- 0x" << Base::HEX8 << ra << " 0x" << Base::HEX8 << rb << endl;
|
||||||
#endif
|
#endif
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
@ -1094,7 +1096,7 @@ int Thumbulator::execute ( void )
|
||||||
rn=(inst>>3)&0x07;
|
rn=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "ldr r" << dec << rd << ",[r" << dec << rn << ",#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "ldr r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
rb=read_register(rn)+rb;
|
rb=read_register(rn)+rb;
|
||||||
rc=read32(rb);
|
rc=read32(rb);
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
|
@ -1120,11 +1122,11 @@ int Thumbulator::execute ( void )
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x07;
|
rd=(inst>>8)&0x07;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "ldr r" << dec << rd << ",[PC+#0x" << HEX2 << rb << "] ");
|
DO_DISS(statusMsg << "ldr r" << dec << rd << ",[PC+#0x" << Base::HEX2 << rb << "] ");
|
||||||
ra=read_register(15);
|
ra=read_register(15);
|
||||||
ra&=~3;
|
ra&=~3;
|
||||||
rb+=ra;
|
rb+=ra;
|
||||||
DO_DISS(statusMsg << ";@ 0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << ";@ 0x" << Base::HEX2 << rb << endl);
|
||||||
rc=read32(rb);
|
rc=read32(rb);
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
return(0);
|
return(0);
|
||||||
|
@ -1136,7 +1138,7 @@ int Thumbulator::execute ( void )
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x07;
|
rd=(inst>>8)&0x07;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "ldr r" << dec << rd << ",[SP+#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "ldr r" << dec << rd << ",[SP+#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
ra=read_register(13);
|
ra=read_register(13);
|
||||||
//ra&=~3;
|
//ra&=~3;
|
||||||
rb+=ra;
|
rb+=ra;
|
||||||
|
@ -1151,7 +1153,7 @@ int Thumbulator::execute ( void )
|
||||||
rd=(inst>>0)&0x07;
|
rd=(inst>>0)&0x07;
|
||||||
rn=(inst>>3)&0x07;
|
rn=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
DO_DISS(statusMsg << "ldrb r" << dec << rd << ",[r" << dec << rn << ",#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "ldrb r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
rb=read_register(rn)+rb;
|
rb=read_register(rn)+rb;
|
||||||
rc=read16(rb&(~1));
|
rc=read16(rb&(~1));
|
||||||
if(rb&1)
|
if(rb&1)
|
||||||
|
@ -1192,7 +1194,7 @@ int Thumbulator::execute ( void )
|
||||||
rn=(inst>>3)&0x07;
|
rn=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
rb<<=1;
|
rb<<=1;
|
||||||
DO_DISS(statusMsg << "ldrh r" << dec << rd << ",[r" << dec << rn << ",#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "ldrh r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
rb=read_register(rn)+rb;
|
rb=read_register(rn)+rb;
|
||||||
rc=read16(rb);
|
rc=read16(rb);
|
||||||
write_register(rd,rc&0xFFFF);
|
write_register(rd,rc&0xFFFF);
|
||||||
|
@ -1255,7 +1257,7 @@ int Thumbulator::execute ( void )
|
||||||
rd=(inst>>0)&0x07;
|
rd=(inst>>0)&0x07;
|
||||||
rm=(inst>>3)&0x07;
|
rm=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
DO_DISS(statusMsg << "lsls r" << dec << rd << ",r" << dec << rm << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "lsls r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
rc=read_register(rm);
|
rc=read_register(rm);
|
||||||
if(rb==0)
|
if(rb==0)
|
||||||
{
|
{
|
||||||
|
@ -1314,7 +1316,7 @@ int Thumbulator::execute ( void )
|
||||||
rd=(inst>>0)&0x07;
|
rd=(inst>>0)&0x07;
|
||||||
rm=(inst>>3)&0x07;
|
rm=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
DO_DISS(statusMsg << "lsrs r" << dec << rd << ",r" << dec << rm << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "lsrs r" << dec << rd << ",r" << dec << rm << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
rc=read_register(rm);
|
rc=read_register(rm);
|
||||||
if(rb==0)
|
if(rb==0)
|
||||||
{
|
{
|
||||||
|
@ -1370,7 +1372,7 @@ int Thumbulator::execute ( void )
|
||||||
{
|
{
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x07;
|
rd=(inst>>8)&0x07;
|
||||||
DO_DISS(statusMsg << "movs r" << dec << rd << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "movs r" << dec << rd << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
write_register(rd,rb);
|
write_register(rd,rb);
|
||||||
do_nflag(rb);
|
do_nflag(rb);
|
||||||
do_zflag(rb);
|
do_zflag(rb);
|
||||||
|
@ -1700,7 +1702,7 @@ int Thumbulator::execute ( void )
|
||||||
rn=(inst>>3)&0x07;
|
rn=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "str r" << dec << rd << ",[r" << dec << rn << ",#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "str r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
rb=read_register(rn)+rb;
|
rb=read_register(rn)+rb;
|
||||||
rc=read_register(rd);
|
rc=read_register(rd);
|
||||||
write32(rb,rc);
|
write32(rb,rc);
|
||||||
|
@ -1726,7 +1728,7 @@ int Thumbulator::execute ( void )
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x07;
|
rd=(inst>>8)&0x07;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "str r" << dec << rd << ",[SP,#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "str r" << dec << rd << ",[SP,#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
rb=read_register(13)+rb;
|
rb=read_register(13)+rb;
|
||||||
//fprintf(stderr,"0x%08X\n",rb);
|
//fprintf(stderr,"0x%08X\n",rb);
|
||||||
rc=read_register(rd);
|
rc=read_register(rd);
|
||||||
|
@ -1740,7 +1742,7 @@ int Thumbulator::execute ( void )
|
||||||
rd=(inst>>0)&0x07;
|
rd=(inst>>0)&0x07;
|
||||||
rn=(inst>>3)&0x07;
|
rn=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
DO_DISS(statusMsg << "strb r" << dec << rd << ",[r" << dec << rn << ",#0x" << HEX8 << rb << "]" << endl);
|
DO_DISS(statusMsg << "strb r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX8 << rb << "]" << endl);
|
||||||
rb=read_register(rn)+rb;
|
rb=read_register(rn)+rb;
|
||||||
rc=read_register(rd);
|
rc=read_register(rd);
|
||||||
ra=read16(rb&(~1));
|
ra=read16(rb&(~1));
|
||||||
|
@ -1789,7 +1791,7 @@ int Thumbulator::execute ( void )
|
||||||
rn=(inst>>3)&0x07;
|
rn=(inst>>3)&0x07;
|
||||||
rb=(inst>>6)&0x1F;
|
rb=(inst>>6)&0x1F;
|
||||||
rb<<=1;
|
rb<<=1;
|
||||||
DO_DISS(statusMsg << "strh r" << dec << rd << ",[r" << dec << rn << ",#0x" << HEX2 << rb << "]" << endl);
|
DO_DISS(statusMsg << "strh r" << dec << rd << ",[r" << dec << rn << ",#0x" << Base::HEX2 << rb << "]" << endl);
|
||||||
rb=read_register(rn)+rb;
|
rb=read_register(rn)+rb;
|
||||||
rc=read_register(rd);
|
rc=read_register(rd);
|
||||||
write16(rb,rc&0xFFFF);
|
write16(rb,rc&0xFFFF);
|
||||||
|
@ -1815,7 +1817,7 @@ int Thumbulator::execute ( void )
|
||||||
rd=(inst>>0)&7;
|
rd=(inst>>0)&7;
|
||||||
rn=(inst>>3)&7;
|
rn=(inst>>3)&7;
|
||||||
rb=(inst>>6)&7;
|
rb=(inst>>6)&7;
|
||||||
DO_DISS(statusMsg << "subs r" << dec << rd << ",r" << dec << rn << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "subs r" << dec << rd << ",r" << dec << rn << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(rn);
|
ra=read_register(rn);
|
||||||
rc=ra-rb;
|
rc=ra-rb;
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
|
@ -1831,7 +1833,7 @@ int Thumbulator::execute ( void )
|
||||||
{
|
{
|
||||||
rb=(inst>>0)&0xFF;
|
rb=(inst>>0)&0xFF;
|
||||||
rd=(inst>>8)&0x07;
|
rd=(inst>>8)&0x07;
|
||||||
DO_DISS(statusMsg << "subs r" << dec << rd << ",#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "subs r" << dec << rd << ",#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(rd);
|
ra=read_register(rd);
|
||||||
rc=ra-rb;
|
rc=ra-rb;
|
||||||
write_register(rd,rc);
|
write_register(rd,rc);
|
||||||
|
@ -1865,7 +1867,7 @@ int Thumbulator::execute ( void )
|
||||||
{
|
{
|
||||||
rb=inst&0x7F;
|
rb=inst&0x7F;
|
||||||
rb<<=2;
|
rb<<=2;
|
||||||
DO_DISS(statusMsg << "sub SP,#0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "sub SP,#0x" << Base::HEX2 << rb << endl);
|
||||||
ra=read_register(13);
|
ra=read_register(13);
|
||||||
ra-=rb;
|
ra-=rb;
|
||||||
write_register(13,ra);
|
write_register(13,ra);
|
||||||
|
@ -1876,8 +1878,8 @@ int Thumbulator::execute ( void )
|
||||||
if((inst&0xFF00)==0xDF00)
|
if((inst&0xFF00)==0xDF00)
|
||||||
{
|
{
|
||||||
rb=inst&0xFF;
|
rb=inst&0xFF;
|
||||||
DO_DISS(statusMsg << "swi 0x" << HEX2 << rb << endl);
|
DO_DISS(statusMsg << "swi 0x" << Base::HEX2 << rb << endl);
|
||||||
statusMsg << endl << endl << "swi 0x" << HEX2 << rb << endl;
|
statusMsg << endl << endl << "swi 0x" << Base::HEX2 << rb << endl;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1945,7 +1947,7 @@ int Thumbulator::execute ( void )
|
||||||
return(0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
statusMsg << "invalid instruction " << HEX8 << pc << " " << HEX4 << inst << endl;
|
statusMsg << "invalid instruction " << Base::HEX8 << pc << " " << Base::HEX4 << inst << endl;
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
//extern "C" {
|
//extern "C" {
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
|
#include "Base.hxx"
|
||||||
#include "Expression.hxx"
|
#include "Expression.hxx"
|
||||||
#include "CartDebug.hxx"
|
#include "CartDebug.hxx"
|
||||||
#include "CpuDebug.hxx"
|
#include "CpuDebug.hxx"
|
||||||
|
@ -107,21 +108,21 @@ inline bool is_operator(char x)
|
||||||
// responsibility, not the lexer's
|
// responsibility, not the lexer's
|
||||||
int const_to_int(char *c) {
|
int const_to_int(char *c) {
|
||||||
// what base is the input in?
|
// what base is the input in?
|
||||||
BaseFormat base = Debugger::debugger().parser().base();
|
Common::Base::Format format = Common::Base::format();
|
||||||
|
|
||||||
switch(*c) {
|
switch(*c) {
|
||||||
case '\\':
|
case '\\':
|
||||||
base = kBASE_2;
|
format = Common::Base::F_2;
|
||||||
c++;
|
c++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '#':
|
case '#':
|
||||||
base = kBASE_10;
|
format = Common::Base::F_10;
|
||||||
c++;
|
c++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '$':
|
case '$':
|
||||||
base = kBASE_16;
|
format = Common::Base::F_16;
|
||||||
c++;
|
c++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -130,8 +131,8 @@ int const_to_int(char *c) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
switch(base) {
|
switch(format) {
|
||||||
case kBASE_2:
|
case Common::Base::F_2:
|
||||||
while(*c) {
|
while(*c) {
|
||||||
if(*c != '0' && *c != '1')
|
if(*c != '0' && *c != '1')
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -141,7 +142,7 @@ int const_to_int(char *c) {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case kBASE_10:
|
case Common::Base::F_10:
|
||||||
while(*c) {
|
while(*c) {
|
||||||
if(!isdigit(*c))
|
if(!isdigit(*c))
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -151,7 +152,7 @@ int const_to_int(char *c) {
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
case kBASE_16:
|
case Common::Base::F_16:
|
||||||
while(*c) { // FIXME: error check!
|
while(*c) { // FIXME: error check!
|
||||||
if(!isxdigit(*c))
|
if(!isxdigit(*c))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
Loading…
Reference in New Issue