OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
//============================================================================
|
|
|
|
//
|
|
|
|
// 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
|
|
|
|
//
|
2010-04-10 21:37:23 +00:00
|
|
|
// Copyright (c) 1995-2010 by Bradford W. Mott, Stephen Anthony
|
|
|
|
// and the Stella Team
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
//
|
2010-04-10 21:37:23 +00:00
|
|
|
// See the file "License.txt" for information on usage and redistribution of
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
|
|
|
//
|
|
|
|
// $Id$
|
|
|
|
//============================================================================
|
|
|
|
|
|
|
|
#include "bspf.hxx"
|
|
|
|
#include "Array.hxx"
|
|
|
|
#include "System.hxx"
|
2010-10-18 18:39:57 +00:00
|
|
|
#include "FSNode.hxx"
|
2010-02-01 20:00:50 +00:00
|
|
|
#include "DiStella.hxx"
|
2010-10-18 18:39:57 +00:00
|
|
|
#include "Debugger.hxx"
|
2010-03-05 22:02:12 +00:00
|
|
|
#include "CpuDebug.hxx"
|
2010-10-18 18:39:57 +00:00
|
|
|
#include "OSystem.hxx"
|
2010-09-05 17:57:21 +00:00
|
|
|
#include "Settings.hxx"
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
#include "CartDebug.hxx"
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-09-06 00:17:51 +00:00
|
|
|
CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
: DebuggerSystem(dbg, console),
|
2010-09-06 00:17:51 +00:00
|
|
|
myOSystem(osystem),
|
2010-05-12 00:04:14 +00:00
|
|
|
myRWPortAddress(0),
|
2010-06-03 12:41:49 +00:00
|
|
|
myLabelLength(5) // longest pre-defined label
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
|
|
|
// Zero-page RAM is always present
|
|
|
|
addRamArea(0x80, 128, 0, 0);
|
|
|
|
|
|
|
|
// Add extended RAM
|
2010-09-06 00:17:51 +00:00
|
|
|
const RamAreaList& areas = console.cartridge().ramAreas();
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
for(RamAreaList::const_iterator i = areas.begin(); i != areas.end(); ++i)
|
|
|
|
addRamArea(i->start, i->size, i->roffset, i->woffset);
|
2010-03-05 22:02:12 +00:00
|
|
|
|
2010-08-30 12:04:56 +00:00
|
|
|
// Create bank information for each potential bank, and an extra one for ZP RAM
|
2010-09-05 17:57:21 +00:00
|
|
|
uInt16 banksize =
|
|
|
|
!BSPF_equalsIgnoreCase(myConsole.cartridge().name(), "Cartridge2K") ? 4096 : 2048;
|
|
|
|
BankInfo info;
|
|
|
|
for(int i = 0; i < myConsole.cartridge().bankCount(); ++i)
|
2010-08-16 16:41:24 +00:00
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
info.size = banksize; // TODO - get this from Cart class
|
2010-08-30 12:04:56 +00:00
|
|
|
myBankInfo.push_back(info);
|
2010-08-16 16:41:24 +00:00
|
|
|
}
|
2010-09-06 23:29:05 +00:00
|
|
|
info.size = 128; // ZP RAM
|
2010-09-05 17:57:21 +00:00
|
|
|
myBankInfo.push_back(info);
|
2010-03-05 22:02:12 +00:00
|
|
|
|
|
|
|
// We know the address for the startup bank right now
|
2010-08-30 12:04:56 +00:00
|
|
|
myBankInfo[myConsole.cartridge().startBank()].addressList.push_back(myDebugger.dpeek(0xfffc));
|
2010-08-19 21:48:28 +00:00
|
|
|
addLabel("START", myDebugger.dpeek(0xfffc));
|
2010-04-03 12:45:20 +00:00
|
|
|
|
|
|
|
// Add system equates
|
|
|
|
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
|
|
|
mySystemAddresses.insert(make_pair(ourTIAMnemonicR[addr], addr));
|
|
|
|
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
|
|
|
|
mySystemAddresses.insert(make_pair(ourTIAMnemonicW[addr], addr));
|
|
|
|
for(uInt16 addr = 0x280; addr <= 0x297; ++addr)
|
|
|
|
mySystemAddresses.insert(make_pair(ourIOMnemonic[addr-0x280], addr));
|
2010-09-05 17:57:21 +00:00
|
|
|
|
|
|
|
// Add settings for Distella
|
|
|
|
DiStella::settings.gfx_format =
|
2010-09-06 00:17:51 +00:00
|
|
|
myOSystem.settings().getInt("gfxformat") == 16 ? kBASE_16 : kBASE_2;
|
2010-10-03 18:19:09 +00:00
|
|
|
DiStella::settings.show_addresses =
|
|
|
|
myOSystem.settings().getBool("showaddr");
|
2010-03-05 22:02:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartDebug::~CartDebug()
|
|
|
|
{
|
2010-04-03 12:45:20 +00:00
|
|
|
myUserLabels.clear();
|
|
|
|
myUserAddresses.clear();
|
|
|
|
mySystemAddresses.clear();
|
|
|
|
|
2010-08-30 12:04:56 +00:00
|
|
|
for(uInt32 i = 0; i < myBankInfo.size(); ++i)
|
|
|
|
{
|
|
|
|
myBankInfo[i].addressList.clear();
|
|
|
|
myBankInfo[i].directiveList.clear();
|
|
|
|
}
|
|
|
|
myBankInfo.clear();
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartDebug::addRamArea(uInt16 start, uInt16 size,
|
|
|
|
uInt16 roffset, uInt16 woffset)
|
|
|
|
{
|
|
|
|
// First make sure this area isn't already present
|
|
|
|
for(uInt32 i = 0; i < myState.rport.size(); ++i)
|
|
|
|
if(myState.rport[i] == start + roffset ||
|
|
|
|
myState.wport[i] == start + woffset)
|
|
|
|
return;
|
|
|
|
|
|
|
|
// Otherwise, add a new area
|
|
|
|
for(uInt32 i = 0; i < size; ++i)
|
|
|
|
{
|
|
|
|
myState.rport.push_back(i + start + roffset);
|
|
|
|
myState.wport.push_back(i + start + woffset);
|
|
|
|
|
|
|
|
myOldState.rport.push_back(i + start + roffset);
|
|
|
|
myOldState.wport.push_back(i + start + woffset);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const DebuggerState& CartDebug::getState()
|
|
|
|
{
|
|
|
|
myState.ram.clear();
|
|
|
|
for(uInt32 i = 0; i < myState.rport.size(); ++i)
|
2010-06-03 12:41:49 +00:00
|
|
|
myState.ram.push_back(peek(myState.rport[i]));
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
|
|
|
return myState;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartDebug::saveOldState()
|
|
|
|
{
|
|
|
|
myOldState.ram.clear();
|
|
|
|
for(uInt32 i = 0; i < myOldState.rport.size(); ++i)
|
2010-06-03 12:41:49 +00:00
|
|
|
myOldState.ram.push_back(peek(myOldState.rport[i]));
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
2010-03-28 04:26:41 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartDebug::triggerReadFromWritePort(uInt16 addr)
|
|
|
|
{
|
|
|
|
myRWPortAddress = addr;
|
|
|
|
mySystem.setDirtyPage(addr);
|
|
|
|
}
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
int CartDebug::readFromWritePort()
|
|
|
|
{
|
2010-04-12 19:56:14 +00:00
|
|
|
uInt16 addr = myRWPortAddress;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
myRWPortAddress = 0;
|
|
|
|
|
|
|
|
// A read from the write port occurs when the read is actually in the write
|
|
|
|
// port address space AND the last access was actually a read (the latter
|
|
|
|
// differentiates between reads that are normally part of a write cycle vs.
|
2010-02-28 17:12:16 +00:00
|
|
|
// ones that are illegal)
|
2010-04-12 19:56:14 +00:00
|
|
|
if(mySystem.m6502().lastReadAddress() &&
|
2010-04-14 22:35:46 +00:00
|
|
|
(mySystem.getPageAccessType(addr) & System::PA_WRITE) == System::PA_WRITE)
|
2010-04-12 19:56:14 +00:00
|
|
|
return addr;
|
|
|
|
else
|
|
|
|
return 0;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartDebug::toString()
|
|
|
|
{
|
|
|
|
string result;
|
|
|
|
char buf[128];
|
|
|
|
uInt32 bytesPerLine;
|
|
|
|
|
|
|
|
switch(myDebugger.parser().base())
|
|
|
|
{
|
|
|
|
case kBASE_16:
|
|
|
|
case kBASE_10:
|
|
|
|
bytesPerLine = 0x10;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kBASE_2:
|
|
|
|
bytesPerLine = 0x04;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case kBASE_DEFAULT:
|
|
|
|
default:
|
|
|
|
return DebuggerParser::red("invalid base, this is a BUG");
|
|
|
|
}
|
|
|
|
|
|
|
|
const CartState& state = (CartState&) getState();
|
|
|
|
const CartState& oldstate = (CartState&) getOldState();
|
|
|
|
|
|
|
|
uInt32 curraddr = 0, bytesSoFar = 0;
|
|
|
|
for(uInt32 i = 0; i < state.ram.size(); i += bytesPerLine, bytesSoFar += bytesPerLine)
|
|
|
|
{
|
|
|
|
// We detect different 'pages' of RAM when the addresses jump by
|
|
|
|
// more than the number of bytes on the previous line, or when 256
|
|
|
|
// bytes have been previously output
|
|
|
|
if(state.rport[i] - curraddr > bytesPerLine || bytesSoFar >= 256)
|
|
|
|
{
|
|
|
|
sprintf(buf, "%04x: (rport = %04x, wport = %04x)\n",
|
|
|
|
state.rport[i], state.rport[i], state.wport[i]);
|
|
|
|
buf[2] = buf[3] = 'x';
|
|
|
|
result += DebuggerParser::red(buf);
|
|
|
|
bytesSoFar = 0;
|
|
|
|
}
|
|
|
|
curraddr = state.rport[i];
|
|
|
|
sprintf(buf, "%.2x: ", curraddr & 0x00ff);
|
|
|
|
result += buf;
|
|
|
|
|
|
|
|
for(uInt8 j = 0; j < bytesPerLine; ++j)
|
|
|
|
{
|
|
|
|
result += myDebugger.invIfChanged(state.ram[i+j], oldstate.ram[i+j]);
|
|
|
|
result += " ";
|
|
|
|
|
|
|
|
if(j == 0x07) result += " ";
|
|
|
|
}
|
|
|
|
result += "\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-10 20:00:16 +00:00
|
|
|
bool CartDebug::disassemble(const string& resolvedata, bool force)
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-02-07 21:23:26 +00:00
|
|
|
// Test current disassembly; don't re-disassemble if it hasn't changed
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
// Also check if the current PC is in the current list
|
2010-08-19 21:48:28 +00:00
|
|
|
bool bankChanged = myConsole.cartridge().bankChanged();
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
uInt16 PC = myDebugger.cpuDebug().pc();
|
2010-03-26 00:03:35 +00:00
|
|
|
int pcline = addressToLine(PC);
|
2010-08-19 21:48:28 +00:00
|
|
|
bool pcfound = (pcline != -1) && ((uInt32)pcline < myDisassembly.list.size()) &&
|
|
|
|
(myDisassembly.list[pcline].disasm[0] != '.');
|
|
|
|
bool pagedirty = (PC & 0x1000) ? mySystem.isPageDirty(0x1000, 0x1FFF) :
|
|
|
|
mySystem.isPageDirty(0x80, 0xFF);
|
2010-04-14 15:41:42 +00:00
|
|
|
|
2010-08-19 21:48:28 +00:00
|
|
|
bool changed = (force || bankChanged || !pcfound || pagedirty);
|
2010-02-07 21:23:26 +00:00
|
|
|
if(changed)
|
|
|
|
{
|
2010-08-19 21:48:28 +00:00
|
|
|
// Are we disassembling from ROM or ZP RAM?
|
2010-08-30 12:04:56 +00:00
|
|
|
BankInfo& info = (PC & 0x1000) ? myBankInfo[getBank()] :
|
|
|
|
myBankInfo[myBankInfo.size()-1];
|
2010-08-16 16:41:24 +00:00
|
|
|
|
2010-08-19 21:48:28 +00:00
|
|
|
// If the offset has changed, all old addresses must be 'converted'
|
2010-08-16 16:41:24 +00:00
|
|
|
// For example, if the list contains any $fxxx and the address space is now
|
|
|
|
// $bxxx, it must be changed
|
|
|
|
uInt16 offset = (PC - (PC % 0x1000));
|
2010-08-30 12:04:56 +00:00
|
|
|
AddressList& addresses = info.addressList;
|
|
|
|
for(list<uInt16>::iterator i = addresses.begin(); i != addresses.end(); ++i)
|
2010-08-19 21:48:28 +00:00
|
|
|
*i = (*i & 0xFFF) + offset;
|
|
|
|
|
|
|
|
// Only add addresses when absolutely necessary, to cut down on the
|
|
|
|
// work that Distella has to do
|
|
|
|
// Distella expects the addresses to be unique and in sorted order
|
|
|
|
if(bankChanged || !pcfound)
|
2010-04-14 15:41:42 +00:00
|
|
|
{
|
2010-08-19 21:48:28 +00:00
|
|
|
AddressList::iterator i;
|
|
|
|
for(i = addresses.begin(); i != addresses.end(); ++i)
|
|
|
|
{
|
|
|
|
if(PC < *i)
|
|
|
|
{
|
|
|
|
addresses.insert(i, PC);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if(PC == *i) // already present
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
// Otherwise, add the item at the end
|
|
|
|
if(i == addresses.end())
|
|
|
|
addresses.push_back(PC);
|
2010-04-14 15:41:42 +00:00
|
|
|
}
|
2010-03-05 22:02:12 +00:00
|
|
|
|
2010-04-10 20:00:16 +00:00
|
|
|
// Check whether to use the 'resolvedata' functionality from Distella
|
|
|
|
if(resolvedata == "never")
|
2010-08-30 12:04:56 +00:00
|
|
|
fillDisassemblyList(info, false, PC);
|
2010-04-10 20:00:16 +00:00
|
|
|
else if(resolvedata == "always")
|
2010-08-30 12:04:56 +00:00
|
|
|
fillDisassemblyList(info, true, PC);
|
2010-04-10 20:00:16 +00:00
|
|
|
else // 'auto'
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
{
|
2010-04-10 20:00:16 +00:00
|
|
|
// First try with resolvedata on, then turn off if PC isn't found
|
2010-08-30 12:04:56 +00:00
|
|
|
if(!fillDisassemblyList(info, true, PC))
|
|
|
|
fillDisassemblyList(info, false, PC);
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
}
|
|
|
|
}
|
2010-03-05 22:02:12 +00:00
|
|
|
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
return changed;
|
|
|
|
}
|
2010-03-05 22:02:12 +00:00
|
|
|
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-30 12:04:56 +00:00
|
|
|
bool CartDebug::fillDisassemblyList(BankInfo& info, bool resolvedata, uInt16 search)
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
{
|
|
|
|
bool found = false;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
2010-06-05 01:17:03 +00:00
|
|
|
myDisassembly.list.clear();
|
|
|
|
myDisassembly.fieldwidth = 10 + myLabelLength;
|
2010-09-05 17:57:21 +00:00
|
|
|
DiStella distella(*this, myDisassembly.list, info, resolvedata);
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
// Parts of the disassembly will be accessed later in different ways
|
|
|
|
// We place those parts in separate maps, to speed up access
|
|
|
|
myAddrToLineList.clear();
|
2010-06-05 01:17:03 +00:00
|
|
|
for(uInt32 i = 0; i < myDisassembly.list.size(); ++i)
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
{
|
2010-06-05 01:17:03 +00:00
|
|
|
const DisassemblyTag& tag = myDisassembly.list[i];
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
|
2010-08-30 12:04:56 +00:00
|
|
|
// Only addresses marked as 'CODE' can possibly be in the program counter
|
|
|
|
if(tag.type == CODE)
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
{
|
2010-02-07 21:23:26 +00:00
|
|
|
// Create a mapping from addresses to line numbers
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
myAddrToLineList.insert(make_pair(tag.address, i));
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
// Did we find the search value?
|
|
|
|
if(tag.address == search)
|
|
|
|
found = true;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
}
|
|
|
|
return found;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
2010-02-01 20:00:50 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-02-07 21:23:26 +00:00
|
|
|
int CartDebug::addressToLine(uInt16 address) const
|
2010-02-01 20:00:50 +00:00
|
|
|
{
|
2010-02-07 21:23:26 +00:00
|
|
|
map<uInt16, int>::const_iterator iter = myAddrToLineList.find(address);
|
OK, I've finally gotten back to Stella development and fixing the
disassembler. Hopefully this will lead to a new release very soon.
Added 'autocode' commandline argument and associated UI item (in the
RomWidget debugger area), which controls how Distella will use the
'automatic code determination' option. If set to 0/never, this is
completely disabled. If set to 1/always, it is always enabled.
The default is 2/automatic, whereby it is first turned on, and then
turned off if the disassembly doesn't contain the current PC address.
RomListWidget has now been completely reworked, so that it informs
RomWidget of its intent to change breakpoints and patch ROM. If
either of these fail, the action won't be performed, and more
importantly, it won't appear onscreen as if the action has succeeded.
This fixes an old bug whereby patching could fail, yet the onscreen
ROM data was actually changed. Related to this, the list has been
made as efficient as possible, and its contents are never un-necessarily
copied. Also, lines in the disassembly that cannot be modified no
longer show an edit area.
Due to the way the new disassembly works, you can no longer switch between
banks in the RomWidget (Distella would probably fail to disassemble in
such as case).
EditTextWidget can now indicate its contents have changed when adding
text to it.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1966 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-03-18 16:36:12 +00:00
|
|
|
return iter != myAddrToLineList.end() ? iter->second : -1;
|
2010-02-01 20:00:50 +00:00
|
|
|
}
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-02-07 21:23:26 +00:00
|
|
|
string CartDebug::disassemble(uInt16 start, uInt16 lines) const
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-06-05 01:17:03 +00:00
|
|
|
Disassembly disasm;
|
2010-08-30 12:04:56 +00:00
|
|
|
BankInfo info;
|
|
|
|
info.addressList.push_back(start);
|
2010-09-05 17:57:21 +00:00
|
|
|
DiStella distella(*this, disasm.list, info, false);
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
2010-02-07 21:23:26 +00:00
|
|
|
// Fill the string with disassembled data
|
|
|
|
start &= 0xFFF;
|
|
|
|
ostringstream buffer;
|
2010-06-05 01:17:03 +00:00
|
|
|
|
|
|
|
// First find the lines in the range, and determine the longest string
|
2010-08-16 16:41:24 +00:00
|
|
|
uInt32 list_size = disasm.list.size();
|
|
|
|
uInt32 begin = list_size, end = 0, length = 0;
|
|
|
|
for(end = 0; end < list_size && lines > 0; ++end)
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-06-05 01:17:03 +00:00
|
|
|
const CartDebug::DisassemblyTag& tag = disasm.list[end];
|
2010-02-07 21:23:26 +00:00
|
|
|
if((tag.address & 0xfff) >= start)
|
|
|
|
{
|
2010-08-16 16:41:24 +00:00
|
|
|
if(begin == list_size) begin = end;
|
2010-06-05 01:23:39 +00:00
|
|
|
length = BSPF_max(length, (uInt32)tag.disasm.length());
|
2010-06-05 01:17:03 +00:00
|
|
|
|
2010-04-06 15:15:44 +00:00
|
|
|
--lines;
|
2010-02-07 21:23:26 +00:00
|
|
|
}
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
2010-06-05 01:17:03 +00:00
|
|
|
// Now output the disassembly, using as little space as possible
|
|
|
|
for(uInt32 i = begin; i < end; ++i)
|
|
|
|
{
|
|
|
|
const CartDebug::DisassemblyTag& tag = disasm.list[i];
|
|
|
|
buffer << uppercase << hex << setw(4) << setfill('0') << tag.address
|
2010-06-05 01:23:39 +00:00
|
|
|
<< ": " << tag.disasm << setw(length - tag.disasm.length() + 1)
|
2010-06-05 01:17:03 +00:00
|
|
|
<< setfill(' ') << " "
|
2010-08-16 16:41:24 +00:00
|
|
|
<< tag.ccount << " " << tag.bytes << endl;
|
2010-06-05 01:17:03 +00:00
|
|
|
}
|
|
|
|
|
2010-02-07 21:23:26 +00:00
|
|
|
return buffer.str();
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
2010-08-30 12:04:56 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-09-06 00:17:51 +00:00
|
|
|
bool CartDebug::addDirective(CartDebug::DisasmType type,
|
|
|
|
uInt16 start, uInt16 end, int bank)
|
2010-08-30 12:04:56 +00:00
|
|
|
{
|
2010-10-09 17:55:22 +00:00
|
|
|
#define PRINT_TAG(tag) \
|
|
|
|
disasmTypeAsString(cerr, tag.type); \
|
|
|
|
cerr << ": start = " << tag.start << ", end = " << tag.end << endl;
|
|
|
|
|
2010-09-01 16:44:31 +00:00
|
|
|
#define PRINT_LIST(header) \
|
|
|
|
cerr << header << endl; \
|
2010-10-09 17:55:22 +00:00
|
|
|
for(DirectiveList::const_iterator d = list.begin(); d != list.end(); ++d) { \
|
|
|
|
PRINT_TAG((*d)); } \
|
2010-09-01 16:44:31 +00:00
|
|
|
cerr << endl;
|
|
|
|
|
2010-09-06 23:29:05 +00:00
|
|
|
if(end < start || start == 0 || end == 0)
|
|
|
|
return false;
|
|
|
|
|
2010-09-06 00:17:51 +00:00
|
|
|
if(bank < 0) // Do we want the current bank or ZP RAM?
|
|
|
|
bank = (myDebugger.cpuDebug().pc() & 0x1000) ? getBank() : myBankInfo.size()-1;
|
2010-08-30 12:04:56 +00:00
|
|
|
|
2010-09-06 23:29:05 +00:00
|
|
|
bank = BSPF_min(bank, bankCount());
|
2010-09-06 00:17:51 +00:00
|
|
|
BankInfo& info = myBankInfo[bank];
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
DirectiveList& list = info.directiveList;
|
2010-09-06 00:17:51 +00:00
|
|
|
|
2010-08-30 12:04:56 +00:00
|
|
|
DirectiveTag tag;
|
|
|
|
tag.type = type;
|
|
|
|
tag.start = start;
|
|
|
|
tag.end = end;
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
DirectiveList::iterator i;
|
|
|
|
|
|
|
|
// If the same directive and range is added, consider it a removal instead
|
|
|
|
for(i = list.begin(); i != list.end(); ++i)
|
|
|
|
{
|
|
|
|
if(i->type == tag.type && i->start == tag.start && i->end == tag.end)
|
|
|
|
{
|
|
|
|
list.erase(i);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, scan the list and make space for a 'smart' merge
|
|
|
|
// Note that there are 4 possibilities:
|
|
|
|
// 1: a range is completely inside the new range
|
|
|
|
// 2: a range is completely outside the new range
|
|
|
|
// 3: a range overlaps at the beginning of the new range
|
|
|
|
// 4: a range overlaps at the end of the new range
|
|
|
|
for(i = list.begin(); i != list.end(); ++i)
|
|
|
|
{
|
|
|
|
// Case 1: remove range that is completely inside new range
|
2010-09-01 16:44:31 +00:00
|
|
|
if(tag.start <= i->start && tag.end >= i->end)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
2010-10-09 17:55:22 +00:00
|
|
|
i = list.erase(i);
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
}
|
|
|
|
// Case 2: split the old range
|
2010-09-01 16:44:31 +00:00
|
|
|
else if(tag.start >= i->start && tag.end <= i->end)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
2010-09-01 16:44:31 +00:00
|
|
|
// Only split when necessary
|
|
|
|
if(tag.type == i->type)
|
|
|
|
return true; // node is fine as-is
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
// Create new endpoint
|
|
|
|
DirectiveTag tag2;
|
|
|
|
tag2.type = i->type;
|
|
|
|
tag2.start = tag.end + 1;
|
|
|
|
tag2.end = i->end;
|
|
|
|
|
|
|
|
// Modify startpoint
|
|
|
|
i->end = tag.start - 1;
|
|
|
|
|
|
|
|
// Insert new endpoint
|
|
|
|
i++;
|
2010-09-01 16:44:31 +00:00
|
|
|
list.insert(i, tag2);
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
break; // no need to go further; this is the insertion point
|
|
|
|
}
|
|
|
|
// Case 3: truncate end of old range
|
2010-09-01 16:44:31 +00:00
|
|
|
else if(tag.start >= i->start && tag.start <= i->end)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
|
|
|
i->end = tag.start - 1;
|
|
|
|
}
|
|
|
|
// Case 4: truncate start of old range
|
2010-09-01 16:44:31 +00:00
|
|
|
else if(tag.end >= i->start && tag.end <= i->end)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
|
|
|
i->start = tag.end + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// We now know that the new range can be inserted without overlap
|
2010-09-01 16:44:31 +00:00
|
|
|
// Where possible, consecutive ranges should be merged rather than
|
|
|
|
// new nodes created
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
for(i = list.begin(); i != list.end(); ++i)
|
|
|
|
{
|
2010-09-01 16:44:31 +00:00
|
|
|
if(tag.end < i->start) // node should be inserted *before* this one
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
2010-09-01 16:44:31 +00:00
|
|
|
bool createNode = true;
|
|
|
|
|
|
|
|
// Is the new range ending consecutive with the old range beginning?
|
|
|
|
// If so, a merge will suffice
|
|
|
|
if(i->type == tag.type && tag.end + 1 == i->start)
|
|
|
|
{
|
|
|
|
i->start = tag.start;
|
|
|
|
createNode = false; // a merge was done, so a new node isn't needed
|
|
|
|
}
|
|
|
|
|
|
|
|
// Can we also merge with the previous range (if any)?
|
|
|
|
if(i != list.begin())
|
|
|
|
{
|
|
|
|
DirectiveList::iterator p = i;
|
|
|
|
--p;
|
|
|
|
if(p->type == tag.type && p->end + 1 == tag.start)
|
|
|
|
{
|
|
|
|
if(createNode) // a merge with right-hand range didn't previously occur
|
|
|
|
{
|
|
|
|
p->end = tag.end;
|
|
|
|
createNode = false; // a merge was done, so a new node isn't needed
|
|
|
|
}
|
|
|
|
else // merge all three ranges
|
|
|
|
{
|
|
|
|
i->start = p->start;
|
|
|
|
i = list.erase(p);
|
|
|
|
createNode = false; // a merge was done, so a new node isn't needed
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Create the node only when necessary
|
|
|
|
if(createNode)
|
|
|
|
i = list.insert(i, tag);
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// Otherwise, add the tag at the end
|
|
|
|
if(i == list.end())
|
|
|
|
list.push_back(tag);
|
|
|
|
|
|
|
|
return true;
|
2010-08-30 12:04:56 +00:00
|
|
|
}
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
int CartDebug::getBank()
|
|
|
|
{
|
|
|
|
return myConsole.cartridge().bank();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
int CartDebug::bankCount()
|
|
|
|
{
|
|
|
|
return myConsole.cartridge().bankCount();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartDebug::getCartType()
|
|
|
|
{
|
|
|
|
return myConsole.cartridge().name();
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-03 12:45:20 +00:00
|
|
|
bool CartDebug::addLabel(const string& label, uInt16 address)
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-04-03 12:45:20 +00:00
|
|
|
// Only user-defined labels can be added or redefined
|
2010-02-28 17:12:16 +00:00
|
|
|
switch(addressType(address))
|
|
|
|
{
|
|
|
|
case ADDR_TIA:
|
|
|
|
case ADDR_RIOT:
|
2010-04-03 12:45:20 +00:00
|
|
|
return false;
|
2010-02-28 17:12:16 +00:00
|
|
|
default:
|
|
|
|
removeLabel(label);
|
|
|
|
myUserAddresses.insert(make_pair(label, address));
|
|
|
|
myUserLabels.insert(make_pair(address, label));
|
2010-05-12 00:04:14 +00:00
|
|
|
myLabelLength = BSPF_max(myLabelLength, (uInt16)label.size());
|
|
|
|
mySystem.setDirtyPage(address);
|
2010-04-03 12:45:20 +00:00
|
|
|
return true;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
bool CartDebug::removeLabel(const string& label)
|
|
|
|
{
|
2010-02-28 17:12:16 +00:00
|
|
|
// Only user-defined labels can be removed
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
LabelToAddr::iterator iter = myUserAddresses.find(label);
|
|
|
|
if(iter != myUserAddresses.end())
|
|
|
|
{
|
|
|
|
// Erase the label
|
|
|
|
myUserAddresses.erase(iter);
|
|
|
|
|
|
|
|
// And also erase the address assigned to it
|
2010-02-28 17:12:16 +00:00
|
|
|
AddrToLabel::iterator iter2 = myUserLabels.find(iter->second);
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
if(iter2 != myUserLabels.end())
|
|
|
|
myUserLabels.erase(iter2);
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const string& CartDebug::getLabel(uInt16 addr, bool isRead, int places) const
|
|
|
|
{
|
|
|
|
static string result;
|
|
|
|
|
2010-02-28 17:12:16 +00:00
|
|
|
switch(addressType(addr))
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
|
|
|
case ADDR_TIA:
|
2010-02-28 17:12:16 +00:00
|
|
|
return result =
|
|
|
|
(isRead ? ourTIAMnemonicR[addr&0x0f] : ourTIAMnemonicW[addr&0x3f]);
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
2010-02-28 17:12:16 +00:00
|
|
|
case ADDR_RIOT:
|
2010-04-23 19:25:11 +00:00
|
|
|
{
|
|
|
|
uInt16 idx = (addr&0xff) - 0x80;
|
|
|
|
if(idx < 24)
|
|
|
|
return result = ourIOMnemonic[idx];
|
2010-04-23 22:05:57 +00:00
|
|
|
break;
|
2010-04-23 19:25:11 +00:00
|
|
|
}
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
|
|
|
case ADDR_RAM:
|
|
|
|
case ADDR_ROM:
|
2010-02-28 17:12:16 +00:00
|
|
|
{
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// These addresses can never be in the system labels list
|
2010-02-28 17:12:16 +00:00
|
|
|
AddrToLabel::const_iterator iter;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
if((iter = myUserLabels.find(addr)) != myUserLabels.end())
|
2010-02-28 17:12:16 +00:00
|
|
|
return iter->second;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
break;
|
2010-02-28 17:12:16 +00:00
|
|
|
}
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(places > -1)
|
|
|
|
{
|
|
|
|
ostringstream buf;
|
|
|
|
buf << "$" << setw(places) << hex << addr;
|
|
|
|
return result = buf.str();
|
|
|
|
}
|
|
|
|
|
|
|
|
return EmptyString;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
int CartDebug::getAddress(const string& label) const
|
|
|
|
{
|
|
|
|
LabelToAddr::const_iterator iter;
|
|
|
|
|
|
|
|
if((iter = mySystemAddresses.find(label)) != mySystemAddresses.end())
|
2010-04-03 12:45:20 +00:00
|
|
|
return iter->second;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
else if((iter = myUserAddresses.find(label)) != myUserAddresses.end())
|
2010-04-03 12:45:20 +00:00
|
|
|
return iter->second;
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-09-06 23:29:05 +00:00
|
|
|
string CartDebug::loadSymbolFile(string file)
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
// TODO - use similar load logic as loadconfig command
|
|
|
|
if(file == "")
|
|
|
|
file = myOSystem.romFile();
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
string::size_type spos;
|
|
|
|
if( (spos = file.find_last_of('.')) != string::npos )
|
|
|
|
file.replace(spos, file.size(), ".sym");
|
|
|
|
else
|
|
|
|
file += ".sym";
|
|
|
|
|
2010-09-06 23:29:05 +00:00
|
|
|
// TODO - rewrite this to use C++ streams
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
int pos = 0, lines = 0, curVal;
|
|
|
|
string curLabel;
|
|
|
|
char line[1024];
|
|
|
|
|
|
|
|
ifstream in(file.c_str());
|
|
|
|
if(!in.is_open())
|
|
|
|
return "Unable to read symbols from " + file;
|
|
|
|
|
|
|
|
myUserAddresses.clear();
|
|
|
|
myUserLabels.clear();
|
|
|
|
|
|
|
|
while( !in.eof() )
|
|
|
|
{
|
|
|
|
curVal = 0;
|
|
|
|
curLabel = "";
|
|
|
|
|
|
|
|
int got = in.get();
|
|
|
|
|
|
|
|
if(got == -1 || got == '\r' || got == '\n' || pos == 1023) {
|
|
|
|
line[pos] = '\0';
|
|
|
|
pos = 0;
|
|
|
|
|
|
|
|
if(strlen(line) > 0 && line[0] != '-')
|
|
|
|
{
|
|
|
|
curLabel = extractLabel(line);
|
|
|
|
if((curVal = extractValue(line)) < 0)
|
|
|
|
return "invalid symbol file";
|
|
|
|
|
|
|
|
addLabel(curLabel, curVal);
|
|
|
|
|
|
|
|
lines++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
line[pos++] = got;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.close();
|
|
|
|
return "loaded " + file + " OK";
|
|
|
|
}
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-09-06 00:17:51 +00:00
|
|
|
string CartDebug::loadConfigFile(string file)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
2010-09-06 00:17:51 +00:00
|
|
|
FilesystemNode node(file);
|
|
|
|
|
2010-09-06 23:29:05 +00:00
|
|
|
if(file == "")
|
2010-09-06 00:17:51 +00:00
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
// There are three possible locations for loading config files
|
|
|
|
// (in order of decreasing relevance):
|
|
|
|
// 1) ROM dir based on properties entry name
|
|
|
|
// 2) ROM dir based on actual ROM name
|
|
|
|
// 3) CFG dir based on properties entry name
|
|
|
|
|
|
|
|
const string& propsname =
|
|
|
|
myConsole.properties().get(Cartridge_Name) + ".cfg";
|
|
|
|
|
|
|
|
// Case 1
|
|
|
|
FilesystemNode case1(FilesystemNode(myOSystem.romFile()).getParent().getPath() +
|
|
|
|
propsname);
|
|
|
|
if(case1.exists())
|
2010-09-06 00:17:51 +00:00
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
node = case1;
|
2010-09-06 00:17:51 +00:00
|
|
|
}
|
2010-09-06 23:29:05 +00:00
|
|
|
else
|
2010-09-06 00:17:51 +00:00
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
file = myOSystem.romFile();
|
|
|
|
string::size_type spos;
|
|
|
|
if((spos = file.find_last_of('.')) != string::npos )
|
|
|
|
file.replace(spos, file.size(), ".cfg");
|
|
|
|
else
|
|
|
|
file += ".cfg";
|
|
|
|
FilesystemNode case2(file);
|
|
|
|
if(case2.exists())
|
|
|
|
{
|
|
|
|
node = case2;
|
|
|
|
}
|
|
|
|
else // Use global config file based on properties cart name
|
|
|
|
{
|
|
|
|
FilesystemNode case3(myOSystem.cfgDir() + propsname);
|
|
|
|
if(case3.exists())
|
|
|
|
node = case3;
|
|
|
|
}
|
2010-09-06 00:17:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(node.exists() && !node.isDirectory())
|
|
|
|
{
|
|
|
|
ifstream in(node.getPath().c_str());
|
|
|
|
if(!in.is_open())
|
2010-09-06 23:29:05 +00:00
|
|
|
return "Unable to load directives from " + node.getPath();
|
|
|
|
|
|
|
|
// Erase all previous directives
|
|
|
|
for(Common::Array<BankInfo>::iterator bi = myBankInfo.begin();
|
|
|
|
bi != myBankInfo.end(); ++bi)
|
|
|
|
{
|
|
|
|
bi->directiveList.clear();
|
|
|
|
}
|
2010-09-06 00:17:51 +00:00
|
|
|
|
|
|
|
int currentbank = 0;
|
|
|
|
while(!in.eof())
|
|
|
|
{
|
|
|
|
// Skip leading space
|
|
|
|
int c = in.peek();
|
|
|
|
while(c == ' ' && c == '\t')
|
|
|
|
{
|
|
|
|
in.get();
|
|
|
|
c = in.peek();
|
|
|
|
}
|
|
|
|
|
|
|
|
string line;
|
|
|
|
c = in.peek();
|
|
|
|
if(c == '/') // Comment, swallow line and continue
|
|
|
|
{
|
|
|
|
getline(in, line);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
else if(c == '[')
|
|
|
|
{
|
|
|
|
in.get();
|
|
|
|
getline(in, line, ']');
|
|
|
|
stringstream buf(line);
|
|
|
|
buf >> currentbank;
|
|
|
|
}
|
|
|
|
else // Should be commands from this point on
|
|
|
|
{
|
|
|
|
getline(in, line);
|
|
|
|
stringstream buf;
|
|
|
|
buf << line;
|
|
|
|
|
|
|
|
string directive;
|
|
|
|
uInt16 start = 0, end = 0;
|
|
|
|
buf >> directive;
|
|
|
|
if(BSPF_startsWithIgnoreCase(directive, "ORG"))
|
|
|
|
{
|
|
|
|
buf >> hex >> start;
|
|
|
|
// TODO - figure out what to do with this
|
|
|
|
}
|
2010-10-07 22:34:22 +00:00
|
|
|
else if(BSPF_startsWithIgnoreCase(directive, "SKIP"))
|
2010-09-06 00:17:51 +00:00
|
|
|
{
|
|
|
|
buf >> hex >> start;
|
|
|
|
buf >> hex >> end;
|
2010-10-07 22:34:22 +00:00
|
|
|
// addDirective(CartDebug::SKIP, start, end, currentbank);
|
2010-09-06 00:17:51 +00:00
|
|
|
}
|
|
|
|
else if(BSPF_startsWithIgnoreCase(directive, "CODE"))
|
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
buf >> hex >> start >> hex >> end;
|
2010-09-06 00:17:51 +00:00
|
|
|
addDirective(CartDebug::CODE, start, end, currentbank);
|
|
|
|
}
|
2010-10-07 22:34:22 +00:00
|
|
|
else if(BSPF_startsWithIgnoreCase(directive, "GFX"))
|
|
|
|
{
|
|
|
|
buf >> hex >> start >> hex >> end;
|
|
|
|
addDirective(CartDebug::GFX, start, end, currentbank);
|
|
|
|
}
|
2010-09-06 00:17:51 +00:00
|
|
|
else if(BSPF_startsWithIgnoreCase(directive, "DATA"))
|
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
buf >> hex >> start >> hex >> end;
|
2010-09-06 00:17:51 +00:00
|
|
|
addDirective(CartDebug::DATA, start, end, currentbank);
|
|
|
|
}
|
2010-10-07 22:34:22 +00:00
|
|
|
else if(BSPF_startsWithIgnoreCase(directive, "ROW"))
|
2010-09-06 00:17:51 +00:00
|
|
|
{
|
2010-10-07 22:34:22 +00:00
|
|
|
buf >> hex >> start;
|
|
|
|
buf >> hex >> end;
|
|
|
|
addDirective(CartDebug::ROW, start, end, currentbank);
|
2010-09-06 00:17:51 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
in.close();
|
|
|
|
|
|
|
|
return "loaded " + node.getRelativePath() + " OK";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return DebuggerParser::red("config file not found");
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-09-06 00:17:51 +00:00
|
|
|
string CartDebug::saveConfigFile(string file)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
FilesystemNode node(file);
|
|
|
|
|
|
|
|
const string& name = myConsole.properties().get(Cartridge_Name);
|
|
|
|
const string& md5 = myConsole.properties().get(Cartridge_MD5);
|
|
|
|
|
|
|
|
if(file == "")
|
|
|
|
{
|
|
|
|
// There are two possible locations for saving config files
|
|
|
|
// (in order of decreasing relevance):
|
|
|
|
// 1) ROM dir based on properties entry name
|
|
|
|
// 2) ROM dir based on actual ROM name
|
|
|
|
//
|
|
|
|
// In either case, we're using the properties entry, since even ROMs that
|
|
|
|
// don't have a proper entry have a temporary one inserted by OSystem
|
2010-09-11 14:26:21 +00:00
|
|
|
node = FilesystemNode(FilesystemNode(
|
|
|
|
myOSystem.romFile()).getParent().getPath() + name + ".cfg");
|
2010-09-06 23:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(!node.isDirectory())
|
|
|
|
{
|
|
|
|
ofstream out(node.getPath().c_str());
|
|
|
|
if(!out.is_open())
|
|
|
|
return "Unable to save directives to " + node.getPath();
|
|
|
|
|
|
|
|
// Store all bank information
|
|
|
|
out << "//Stella.pro: \"" << name << "\"" << endl
|
|
|
|
<< "//MD5: " << md5 << endl
|
|
|
|
<< endl;
|
|
|
|
for(uInt32 b = 0; b < myConsole.cartridge().bankCount(); ++b)
|
|
|
|
{
|
|
|
|
out << "[" << b << "]" << endl;
|
|
|
|
getBankDirectives(out, myBankInfo[b]);
|
|
|
|
}
|
|
|
|
out.close();
|
|
|
|
|
|
|
|
return "saved " + node.getRelativePath() + " OK";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return DebuggerParser::red("config file not found");
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartDebug::listConfig(int bank)
|
|
|
|
{
|
|
|
|
uInt32 startbank = 0, endbank = bankCount();
|
|
|
|
if(bank >= 0 && bank < bankCount())
|
|
|
|
{
|
|
|
|
startbank = bank;
|
|
|
|
endbank = startbank + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
ostringstream buf;
|
|
|
|
buf << "(items marked '*' are user-defined)" << endl;
|
|
|
|
for(uInt32 b = startbank; b < endbank; ++b)
|
|
|
|
{
|
|
|
|
BankInfo& info = myBankInfo[b];
|
|
|
|
buf << "[" << b << "]" << endl;
|
|
|
|
for(DirectiveList::const_iterator i = info.directiveList.begin();
|
|
|
|
i != info.directiveList.end(); ++i)
|
|
|
|
{
|
2010-09-06 23:29:05 +00:00
|
|
|
if(i->type != CartDebug::NONE)
|
|
|
|
{
|
|
|
|
buf << "(*) ";
|
|
|
|
disasmTypeAsString(buf, i->type);
|
|
|
|
buf << " " << HEX4 << i->start << " " << HEX4 << i->end << endl;
|
|
|
|
}
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
}
|
|
|
|
getBankDirectives(buf, info);
|
|
|
|
}
|
|
|
|
|
|
|
|
return buf.str();
|
|
|
|
}
|
|
|
|
|
2010-09-07 22:03:20 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
string CartDebug::clearConfig(int bank)
|
|
|
|
{
|
|
|
|
uInt32 startbank = 0, endbank = bankCount();
|
|
|
|
if(bank >= 0 && bank < bankCount())
|
|
|
|
{
|
|
|
|
startbank = bank;
|
|
|
|
endbank = startbank + 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
uInt32 count = 0;
|
|
|
|
for(uInt32 b = startbank; b < endbank; ++b)
|
|
|
|
{
|
|
|
|
count += myBankInfo[b].directiveList.size();
|
|
|
|
myBankInfo[b].directiveList.clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
ostringstream buf;
|
|
|
|
if(count > 0)
|
|
|
|
buf << "removed " << dec << count << " directives from "
|
|
|
|
<< dec << (endbank - startbank) << " banks";
|
|
|
|
else
|
|
|
|
buf << "no directives present";
|
|
|
|
return buf.str();
|
|
|
|
}
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-04-08 18:21:00 +00:00
|
|
|
void CartDebug::getCompletions(const char* in, StringList& completions) const
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-04-08 18:21:00 +00:00
|
|
|
// First scan system equates
|
|
|
|
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
if(BSPF_startsWithIgnoreCase(ourTIAMnemonicR[addr], in))
|
2010-04-08 18:21:00 +00:00
|
|
|
completions.push_back(ourTIAMnemonicR[addr]);
|
|
|
|
for(uInt16 addr = 0x00; addr <= 0x3F; ++addr)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
if(BSPF_startsWithIgnoreCase(ourTIAMnemonicW[addr], in))
|
2010-04-08 18:21:00 +00:00
|
|
|
completions.push_back(ourTIAMnemonicW[addr]);
|
|
|
|
for(uInt16 addr = 0; addr <= 0x297-0x280; ++addr)
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
if(BSPF_startsWithIgnoreCase(ourIOMnemonic[addr], in))
|
2010-04-08 18:21:00 +00:00
|
|
|
completions.push_back(ourIOMnemonic[addr]);
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
|
2010-04-08 18:21:00 +00:00
|
|
|
// Now scan user-defined labels
|
|
|
|
LabelToAddr::const_iterator iter;
|
|
|
|
for(iter = myUserAddresses.begin(); iter != myUserAddresses.end(); ++iter)
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
2010-04-08 18:21:00 +00:00
|
|
|
const char* l = iter->first.c_str();
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
if(BSPF_startsWithIgnoreCase(l, in))
|
2010-04-08 18:21:00 +00:00
|
|
|
completions.push_back(l);
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-02-28 17:12:16 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
CartDebug::AddrType CartDebug::addressType(uInt16 addr) const
|
|
|
|
{
|
|
|
|
// Determine the type of address to access the correct list
|
|
|
|
// These addresses were based on (and checked against) Kroko's 2600 memory
|
|
|
|
// map, found at http://www.qotile.net/minidig/docs/2600_mem_map.txt
|
|
|
|
AddrType type = ADDR_ROM;
|
|
|
|
if(addr % 0x2000 < 0x1000)
|
|
|
|
{
|
|
|
|
uInt16 z = addr & 0x00ff;
|
|
|
|
if(z < 0x80)
|
|
|
|
type = ADDR_TIA;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
switch(addr & 0x0f00)
|
|
|
|
{
|
|
|
|
case 0x000:
|
|
|
|
case 0x100:
|
|
|
|
case 0x400:
|
|
|
|
case 0x500:
|
|
|
|
case 0x800:
|
|
|
|
case 0x900:
|
|
|
|
case 0xc00:
|
|
|
|
case 0xd00:
|
|
|
|
type = ADDR_RAM;
|
|
|
|
break;
|
|
|
|
case 0x200:
|
|
|
|
case 0x300:
|
|
|
|
case 0x600:
|
|
|
|
case 0x700:
|
|
|
|
case 0xa00:
|
|
|
|
case 0xb00:
|
|
|
|
case 0xe00:
|
|
|
|
case 0xf00:
|
|
|
|
type = ADDR_RIOT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return type;
|
|
|
|
}
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-09-06 23:29:05 +00:00
|
|
|
void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
{
|
|
|
|
// Disassemble the bank, then scan it for an up-to-date description
|
|
|
|
DisassemblyList list;
|
2010-09-05 17:57:21 +00:00
|
|
|
DiStella distella(*this, list, info, true);
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
|
|
|
|
if(list.size() == 0)
|
|
|
|
return;
|
|
|
|
|
2010-09-01 16:44:31 +00:00
|
|
|
// Start with the offset for this bank
|
|
|
|
buf << "ORG " << HEX4 << info.offset << endl;
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
DisasmType type = list[0].type;
|
|
|
|
uInt16 start = list[0].address, last = list[1].address;
|
|
|
|
if(start == 0) start = info.offset;
|
|
|
|
for(uInt32 i = 1; i < list.size(); ++i)
|
|
|
|
{
|
|
|
|
const DisassemblyTag& tag = list[i];
|
|
|
|
|
|
|
|
if(tag.type == CartDebug::NONE)
|
|
|
|
continue;
|
|
|
|
else if(tag.type != type) // new range has started
|
|
|
|
{
|
2010-09-11 14:26:21 +00:00
|
|
|
// If switching data ranges, make sure the endpoint is valid
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
// This is necessary because DATA sections don't always generate
|
|
|
|
// consecutive numbers/addresses for the range
|
2010-09-11 14:26:21 +00:00
|
|
|
last = tag.address - 1;
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
|
2010-09-06 23:29:05 +00:00
|
|
|
disasmTypeAsString(buf, type);
|
|
|
|
buf << " " << HEX4 << start << " " << HEX4 << last << endl;
|
|
|
|
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
type = tag.type;
|
|
|
|
start = last = tag.address;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
last = tag.address;
|
|
|
|
}
|
|
|
|
// Grab the last directive, making sure it accounts for all remaining space
|
2010-09-06 23:29:05 +00:00
|
|
|
disasmTypeAsString(buf, type);
|
|
|
|
buf << " " << HEX4 << start << " " << HEX4 << (info.offset+info.end) << endl;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
void CartDebug::disasmTypeAsString(ostream& buf, DisasmType type) const
|
|
|
|
{
|
|
|
|
switch(type)
|
|
|
|
{
|
2010-10-07 22:34:22 +00:00
|
|
|
case CartDebug::SKIP: buf << "SKIP"; break;
|
|
|
|
case CartDebug::CODE: buf << "CODE"; break;
|
|
|
|
case CartDebug::GFX: buf << "GFX"; break;
|
|
|
|
case CartDebug::DATA: buf << "DATA"; break;
|
|
|
|
case CartDebug::ROW: buf << "ROW"; break;
|
2010-10-09 17:55:22 +00:00
|
|
|
default: break;
|
2010-09-06 23:29:05 +00:00
|
|
|
}
|
Many big improvements to disassembler directives. Directives are no
longer simply added to a list, but intelligently 'merged' (so that
the entire range represented by all directives contains no overlap).
This makes the disassembly a little faster, since it doesn't have to
iterate redundantly. Still TODO in this area is intelligent insertion
for the same type (ie, if inserting in between like blocks, the
blocks should coalesce, instead of being clipped and then a new range
inserted in between).
Added 'loadconfig' and 'saveconfig' debugger prompt commands, which
will eventually access Distella-like config files. No implementation
is present yet.
Added 'listconfig' debugger command, which lists all directives
currently defined by the user, as well as the directives resulting
from a disassembly of a bank (taking into account extra knowledge
that Stella has WRT cached entry points). This command can show
information for a specified bank, or all banks in the cart.
User-defined directives can now be removed; simply issue the same
command that caused an insertion (ie, attempting to insert the same
type and range will remove it instead).
Fixed bug in Distella processing of directives; similar to the
standalone Distella, directives should be processed *before* any
automatic code determination is done.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2121 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-08-31 16:37:27 +00:00
|
|
|
}
|
|
|
|
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-19 21:48:28 +00:00
|
|
|
string CartDebug::extractLabel(const char *c) const
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
|
|
|
string l = "";
|
|
|
|
while(*c != ' ')
|
|
|
|
l += *c++;
|
|
|
|
|
|
|
|
return l;
|
|
|
|
}
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
2010-08-19 21:48:28 +00:00
|
|
|
int CartDebug::extractValue(const char *c) const
|
OK, this is the first pass at a huge reorganization of the debugger
classes. First off, the distella code has been integrated into a
DiStella class. This code isn't yet tied to the debugger, but it does
at least compile and generate valid output.
The RamDebug class has been replaced by a CartDebug class, which
takes responsibility for the previous RamDebug stuff as well as
things related to Cart address space (read from write ports,
disassembly, etc).
Fixed E7 bankswitching when reading from the write port in the upper
256byte area.
Fixed 'read from write port functionality' in general for all carts
that supported it previously. Basically, if _rwport is enabled, the
address is checked to be an actual read (vs. one that's part of a
normal write cycle), *and* it's actually an illegal access (each
cart/bankswitch type now provides a hint to indicate this condition).
Still TODO is clean up the rework, properly integrate DiStella, and
fix labels and defines (which seem to be completely broken).
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1922 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
2010-01-17 16:48:45 +00:00
|
|
|
{
|
|
|
|
while(*c != ' ')
|
|
|
|
{
|
|
|
|
if(*c == '\0')
|
|
|
|
return -1;
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
|
|
|
|
while(*c == ' ')
|
|
|
|
{
|
|
|
|
if(*c == '\0')
|
|
|
|
return -1;
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
|
|
|
|
int ret = 0;
|
|
|
|
for(int i=0; i<4; i++)
|
|
|
|
{
|
|
|
|
if(*c >= '0' && *c <= '9')
|
|
|
|
ret = (ret << 4) + (*c) - '0';
|
|
|
|
else if(*c >= 'a' && *c <= 'f')
|
|
|
|
ret = (ret << 4) + (*c) - 'a' + 10;
|
|
|
|
else
|
|
|
|
return -1;
|
|
|
|
c++;
|
|
|
|
}
|
|
|
|
return ret;
|
|
|
|
}
|
2010-02-28 17:12:16 +00:00
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const char* CartDebug::ourTIAMnemonicR[16] = {
|
|
|
|
"CXM0P", "CXM1P", "CXP0FB", "CXP1FB", "CXM0FB", "CXM1FB", "CXBLPF", "CXPPMM",
|
|
|
|
"INPT0", "INPT1", "INPT2", "INPT3", "INPT4", "INPT5", "$0E", "$0F"
|
|
|
|
};
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const char* CartDebug::ourTIAMnemonicW[64] = {
|
|
|
|
"VSYNC", "VBLANK", "WSYNC", "RSYNC", "NUSIZ0", "NUSIZ1", "COLUP0", "COLUP1",
|
|
|
|
"COLUPF", "COLUBK", "CTRLPF", "REFP0", "REFP1", "PF0", "PF1", "PF2",
|
|
|
|
"RESP0", "RESP1", "RESM0", "RESM1", "RESBL", "AUDC0", "AUDC1", "AUDF0",
|
|
|
|
"AUDF1", "AUDV0", "AUDV1", "GRP0", "GRP1", "ENAM0", "ENAM1", "ENABL",
|
|
|
|
"HMP0", "HMP1", "HMM0", "HMM1", "HMBL", "VDELP0", "VDELP1", "VDELBL",
|
|
|
|
"RESMP0", "RESMP1", "HMOVE", "HMCLR", "CXCLR", "$2D", "$2E", "$2F",
|
|
|
|
"$30", "$31", "$32", "$33", "$34", "$35", "$36", "$37",
|
|
|
|
"$38", "$39", "$3A", "$3B", "$3C", "$3D", "$3E", "$3F"
|
|
|
|
};
|
|
|
|
|
|
|
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
|
|
|
const char* CartDebug::ourIOMnemonic[24] = {
|
|
|
|
"SWCHA", "SWACNT", "SWCHB", "SWBCNT", "INTIM", "TIMINT", "$0286", "$0287",
|
|
|
|
"$0288", "$0289", "$028A", "$028B", "$028C", "$028D", "$028E", "$028F",
|
|
|
|
"$0290", "$0291", "$0292", "$0293", "TIM1T", "TIM8T", "TIM64T", "T1024T"
|
|
|
|
};
|