Added 'showaddr' commandline argument and associated UI item (right-click in

disassembly listing) to show/hide opcode/instruction addresses.

The disassembler now includes hints from current PC location *and* 'code
access points' from the emulation core.  Testing has shown that some ROMs
don't show completely accurate disassembled output unless both options are
used.

Updated most of the remaining bankswitch schemes to use the new 'code access
points' functionality during disassembly, allowing for very accurate
disassembled output.  Note that the more esoteric schemes (AR, 4A50, FE, MC)
are supported for now.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2139 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-10-03 18:19:09 +00:00
parent 5fe91e2841
commit 4b44dcb948
22 changed files with 133 additions and 45 deletions

View File

@ -53,7 +53,6 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
myBankInfo.push_back(info);
// We know the address for the startup bank right now
cerr << "start @ " << HEX4 << myDebugger.dpeek(0xfffc) << endl;
myBankInfo[myConsole.cartridge().startBank()].addressList.push_back(myDebugger.dpeek(0xfffc));
addLabel("START", myDebugger.dpeek(0xfffc));
@ -68,6 +67,8 @@ cerr << "start @ " << HEX4 << myDebugger.dpeek(0xfffc) << endl;
// Add settings for Distella
DiStella::settings.gfx_format =
myOSystem.settings().getInt("gfxformat") == 16 ? kBASE_16 : kBASE_2;
DiStella::settings.show_addresses =
myOSystem.settings().getBool("showaddr");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -90,8 +90,8 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
if(resolvedata)
{
// After we've disassembled from the start address, use all access points
// determined by Stella during emulation
// After we've disassembled from all addresses in the address list,
// use all access points determined by Stella during emulation
int codeAccessPoint = 0;
while(!myAddressQueue.empty())
@ -103,9 +103,16 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
for (uInt32 k = myPCBeg; k <= myPCEnd; k++)
mark(k, REACHABLE);
// When we get to this point, the 'start' address has been processed
// Next we process all addresses determined during emulation to represent
// code, which *haven't* already been considered
// When we get to this point, all addresses have been processed
// starting from the initial one in the address list
// If so, process the next one in the list that hasn't already
// been marked as REACHABLE
// If it *has* been marked, it can be removed from consideration
// in all subsequent passes
//
// Once the address list has been exhausted, we process all addresses
// determined during emulation to represent code, which *haven't* already
// been considered
//
// Note that we can't simply add all addresses right away, since
// the processing of a single address can cause others to be added in
@ -113,14 +120,28 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
// All of these have to be exhausted before considering a new address
if(myAddressQueue.empty())
{
while(it != addresses.end())
{
uInt16 addr = *it;
if(!check_bit(labels[addr-myOffset], REACHABLE))
{
cerr << "(list) marking " << HEX4 << addr << " as CODE\n";
myAddressQueue.push(addr);
++it;
break;
}
else // remove this address, it is redundant
it = addresses.erase(it);
}
// Stella itself can provide hints on whether an address has ever
// been referenced as CODE
while(codeAccessPoint <= myAppData.end)
while(it == addresses.end() && codeAccessPoint <= myAppData.end)
{
if(Debugger::debugger().isCode(codeAccessPoint+myOffset) &&
!check_bit(labels[codeAccessPoint], REACHABLE))
{
cerr << "marking " << hex << (codeAccessPoint+myOffset) << " as CODE\n";
cerr << "(emul) marking " << HEX4 << (codeAccessPoint+myOffset) << " as CODE\n";
myAddressQueue.push(codeAccessPoint+myOffset);
++codeAccessPoint;
break;
@ -769,14 +790,12 @@ void DiStella::addEntry(CartDebug::DisasmType type)
{
if(myDisasmBuf.peek() != ' ')
getline(myDisasmBuf, tag.label, '\'');
else
else if(settings.show_addresses)
{
#if 0
// FIXME - optimize this, and add as an option
stringstream str;
str << setw(4) << hex << tag.address;
str >> tag.label;
#endif
// Have addresses indented, to differentiate from actual labels
char address[8];
sprintf(address, " $%X", tag.address);
tag.label = address;
}
}
}
@ -855,7 +874,8 @@ void DiStella::processDirectives(const CartDebug::DirectiveList& directives)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DiStella::Settings DiStella::settings = {
kBASE_2
kBASE_2, // gfx_format
true // show_addresses
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -62,6 +62,7 @@ class DiStella
// standalone Distella
typedef struct {
BaseFormat gfx_format;
bool show_addresses;
} Settings;
static Settings settings;

View File

@ -64,9 +64,12 @@ RomListWidget::RomListWidget(GuiObject* boss, const GUI::Font& font,
l.push_back("Save ROM", "saverom");
l.push_back("Set PC", "setpc");
l.push_back("RunTo PC", "runtopc");
l.push_back("Re-disassemble", "disasm");
l.push_back("------------------", "");
l.push_back("Show PC addresses", "showaddr");
l.push_back("Hide PC addresses", "hideaddr");
l.push_back("Show GFX as binary", "gfxbin");
l.push_back("Show GFX as hex", "gfxhex");
l.push_back("Re-disassemble", "disasm");
myMenu = new ContextMenu(this, font, l);
// Take advantage of a wide debugger window when possible

View File

@ -175,6 +175,22 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
runtoPC(myRomList->getSelected());
else if(rmb == "disasm")
invalidate();
else if(rmb == "showaddr")
{
if(DiStella::settings.show_addresses)
return;
DiStella::settings.show_addresses = true;
instance().settings().setString("showaddr", "true");
invalidate();
}
else if(rmb == "hideaddr")
{
if(!DiStella::settings.show_addresses)
return;
DiStella::settings.show_addresses = false;
instance().settings().setString("showaddr", "false");
invalidate();
}
else if(rmb == "gfxbin")
{
DiStella::settings.gfx_format = kBASE_2;

View File

@ -154,7 +154,7 @@ bool Cartridge0840::bank(uInt16 bank)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))

View File

@ -25,6 +25,8 @@
#include "TIA.hxx"
#include "Cart4A50.hxx"
// TODO (2010-10-03) - support CodeAccessBase functionality somehow
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Cartridge4A50::Cartridge4A50(const uInt8* image, uInt32 size,
const Settings& settings)

View File

@ -24,6 +24,8 @@
#include "System.hxx"
#include "CartAR.hxx"
// TODO (2010-10-03) - support CodeAccessBase functionality somehow
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeAR::CartridgeAR(const uInt8* image, uInt32 size,
const Settings& settings)

View File

@ -32,6 +32,7 @@ CartridgeDPC::CartridgeDPC(const uInt8* image, uInt32 size,
{
// Make a copy of the entire image
memcpy(myImage, image, BSPF_min(size, 8192u + 2048u + 255u));
createCodeAccessBase(8192);
// Pointer to the program ROM (8K @ 0 byte offset)
myProgramImage = myImage;
@ -89,7 +90,7 @@ void CartridgeDPC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0));
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF8 & ~mask); i < 0x2000; i += (1 << shift))
@ -422,13 +423,14 @@ bool CartridgeDPC::bank(uInt16 bank)
uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map Program ROM image into the system
for(uInt32 address = 0x1080; address < (0x1FF8U & ~mask);
address += (1 << shift))
{
access.directPeekBase = &myProgramImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;

View File

@ -38,6 +38,7 @@ CartridgeDPCPlus::CartridgeDPCPlus(const uInt8* image, uInt32 size,
mySize = BSPF_max(minsize, size);
myImage = new uInt8[mySize];
memcpy(myImage, image, size);
createCodeAccessBase(4096 * 6);
// Pointer to the program ROM (24K @ 0 byte offset)
myProgramImage = myImage;
@ -109,10 +110,10 @@ void CartridgeDPCPlus::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert(((0x1080 & mask) == 0) && ((0x1100 & mask) == 0));
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map all of the accesses to call peek and poke
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))
for(uInt32 i = 0x1000; i < 0x1080; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access);
// Install pages for the startup bank
@ -550,7 +551,18 @@ bool CartridgeDPCPlus::bank(uInt16 bank)
// Remember what bank we're in
myCurrentBank = bank;
uInt16 offset = myCurrentBank << 12;
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map Program ROM image into the system
for(uInt32 address = 0x1080; address < 0x2000; address += (1 << shift))
{
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;
}

View File

@ -29,6 +29,7 @@ CartridgeE0::CartridgeE0(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
createCodeAccessBase(8192);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -58,18 +59,20 @@ void CartridgeE0::install(System& system)
assert(((0x1000 & mask) == 0) && ((0x1400 & mask) == 0) &&
((0x1800 & mask) == 0) && ((0x1C00 & mask) == 0));
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page acessing methods for the first part of the last segment
for(uInt32 i = 0x1C00; i < (0x1FE0U & ~mask); i += (1 << shift))
{
access.directPeekBase = &myImage[7168 + (i & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[7168 + (i & 0x03FF)];
mySystem->setPageAccess(i >> shift, access);
}
myCurrentSlice[3] = 7;
// Set the page accessing methods for the hot spots in the last segment
access.directPeekBase = 0;
access.codeAccessBase = 0;
access.type = System::PA_READ;
for(uInt32 j = (0x1FE0 & ~mask); j < 0x2000; j += (1 << shift))
mySystem->setPageAccess(j >> shift, access);
@ -134,11 +137,12 @@ void CartridgeE0::segmentZero(uInt16 slice)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
for(uInt32 address = 0x1000; address < 0x1400; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
@ -155,11 +159,12 @@ void CartridgeE0::segmentOne(uInt16 slice)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
for(uInt32 address = 0x1400; address < 0x1800; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;
@ -176,11 +181,12 @@ void CartridgeE0::segmentTwo(uInt16 slice)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
for(uInt32 address = 0x1800; address < 0x1C00; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x03FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x03FF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;

View File

@ -29,6 +29,7 @@ CartridgeE7::CartridgeE7(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 16384);
createCodeAccessBase(16384 + 1024);
// This cart can address a 1024 byte bank of RAM @ 0x1000
// and 256 bytes @ 0x1800
@ -74,7 +75,7 @@ void CartridgeE7::install(System& system)
assert(((0x1400 & mask) == 0) && ((0x1800 & mask) == 0) &&
((0x1900 & mask) == 0) && ((0x1A00 & mask) == 0));
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
@ -84,6 +85,7 @@ void CartridgeE7::install(System& system)
for(uInt32 j = 0x1A00; j < (0x1FE0U & ~mask); j += (1 << shift))
{
access.directPeekBase = &myImage[7 * 2048 + (j & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[7 * 2048 + (j & 0x07FF)];
mySystem->setPageAccess(j >> shift, access);
}
myCurrentSlice[1] = 7;
@ -171,7 +173,7 @@ void CartridgeE7::bankRAM(uInt16 bank)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_WRITE);
System::PageAccess access(0, 0, 0, this, System::PA_WRITE);
// Set the page accessing method for the 256 bytes of RAM writing pages
for(uInt32 j = 0x1800; j < 0x1900; j += (1 << shift))
@ -186,6 +188,7 @@ void CartridgeE7::bankRAM(uInt16 bank)
for(uInt32 k = 0x1900; k < 0x1A00; k += (1 << shift))
{
access.directPeekBase = &myRAM[1024 + offset + (k & 0x00FF)];
access.codeAccessBase = &myCodeAccessBase[k & 0x0FFF];
mySystem->setPageAccess(k >> shift, access);
}
myBankChanged = true;
@ -204,18 +207,19 @@ bool CartridgeE7::bank(uInt16 slice)
// Setup the page access methods for the current bank
if(slice != 7)
{
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into first segment
for(uInt32 address = 0x1000; address < 0x1800; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x07FF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x07FF)];
mySystem->setPageAccess(address >> shift, access);
}
}
else
{
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_WRITE);
System::PageAccess access(0, 0, 0, this, System::PA_WRITE);
// Set the page accessing method for the 1K slice of RAM writing pages
for(uInt32 j = 0x1000; j < 0x1400; j += (1 << shift))
@ -230,6 +234,7 @@ bool CartridgeE7::bank(uInt16 slice)
for(uInt32 k = 0x1400; k < 0x1800; k += (1 << shift))
{
access.directPeekBase = &myRAM[k & 0x03FF];
access.codeAccessBase = &myCodeAccessBase[8192 + (k & 0x03FF)];
mySystem->setPageAccess(k >> shift, access);
}
}

View File

@ -29,6 +29,7 @@ CartridgeEF::CartridgeEF(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 1;
@ -56,7 +57,7 @@ void CartridgeEF::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0);
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
@ -102,13 +103,14 @@ bool CartridgeEF::bank(uInt16 bank)
uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FE0U & ~mask);
address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;

View File

@ -29,6 +29,7 @@ CartridgeEFSC::CartridgeEFSC(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
createCodeAccessBase(65536);
// This cart contains 128 bytes extended RAM @ 0x1000
registerRamArea(0x1000, 128, 0x80, 0x00);
@ -66,7 +67,7 @@ void CartridgeEFSC::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0);
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FE0 & ~mask); i < 0x2000; i += (1 << shift))
@ -86,6 +87,7 @@ void CartridgeEFSC::install(System& system)
for(uInt32 k = 0x1080; k < 0x1100; k += (1 << shift))
{
access.directPeekBase = &myRAM[k & 0x007F];
access.codeAccessBase = &myCodeAccessBase[0x80 + (k & 0x007F)];
mySystem->setPageAccess(k >> shift, access);
}
@ -147,13 +149,14 @@ bool CartridgeEFSC::bank(uInt16 bank)
uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1100; address < (0x1FE0U & ~mask);
address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;

View File

@ -29,6 +29,7 @@ CartridgeF0::CartridgeF0(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 1;
@ -57,7 +58,7 @@ void CartridgeF0::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0);
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = (0x1FF0 & ~mask); i < 0x2000; i += (1 << shift))
@ -105,13 +106,14 @@ void CartridgeF0::incbank()
uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < (0x1FF0U & ~mask);
address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
myBankChanged = true;

View File

@ -185,7 +185,7 @@ bool CartridgeFA::bank(uInt16 bank)
uInt16 mask = mySystem->pageMask();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1200; address < (0x1FF8U & ~mask);

View File

@ -23,6 +23,8 @@
#include "System.hxx"
#include "CartFE.hxx"
// TODO (2010-10-03) - support CodeAccessBase functionality somehow
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeFE::CartridgeFE(const uInt8* image, const Settings& settings)
: Cartridge(settings),
@ -54,7 +56,7 @@ void CartridgeFE::install(System& system)
// Make sure the system we're being installed in has a page size that'll work
assert((0x1000 & mask) == 0);
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map all of the accesses to call peek and poke
for(uInt32 i = 0x1000; i < 0x2000; i += (1 << shift))

View File

@ -28,6 +28,7 @@
// accurate the emulation is
// Bankchange and RAM modification cannot be completed until
// adequate test ROMs are available
// TODO (2010-10-03) - support CodeAccessBase functionality somehow
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
CartridgeMC::CartridgeMC(const uInt8* image, uInt32 size,
@ -81,7 +82,7 @@ void CartridgeMC::install(System& system)
// TODO: These TIA accesses may need to be chained, however, at this
// point Chris isn't sure if the hardware will allow it or not
//
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READWRITE);
System::PageAccess access(0, 0, 0, this, System::PA_READWRITE);
for(uInt32 i = 0x00; i < 0x40; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access);

View File

@ -34,6 +34,7 @@ CartridgeSB::CartridgeSB(const uInt8* image, uInt32 size,
// Copy the ROM image into my buffer
memcpy(myImage, image, mySize);
createCodeAccessBase(mySize);
// Remember startup bank
myStartBank = (mySize >> 12) - 1;
@ -73,7 +74,7 @@ void CartridgeSB::install(System& system)
myHotSpotPageAccess[6] = mySystem->getPageAccess(0x0E00 >> shift);
myHotSpotPageAccess[7] = mySystem->getPageAccess(0x0F00 >> shift);
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Set the page accessing methods for the hot spots
for(uInt32 i = 0x0800; i < 0x0FFF; i += (1 << shift))
@ -133,12 +134,13 @@ bool CartridgeSB::bank(uInt16 bank)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;

View File

@ -29,6 +29,7 @@ CartridgeUA::CartridgeUA(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 8192);
createCodeAccessBase(8192);
// Remember startup bank
myStartBank = 0;
@ -61,7 +62,7 @@ void CartridgeUA::install(System& system)
myHotSpotPageAccess = mySystem->getPageAccess(0x0220 >> shift);
// Set the page accessing methods for the hot spots
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
mySystem->setPageAccess(0x0220 >> shift, access);
mySystem->setPageAccess(0x0240 >> shift, access);
@ -141,12 +142,13 @@ bool CartridgeUA::bank(uInt16 bank)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;

View File

@ -31,6 +31,7 @@ CartridgeX07::CartridgeX07(const uInt8* image, const Settings& settings)
{
// Copy the ROM image into my buffer
memcpy(myImage, image, 65536);
createCodeAccessBase(65536);
// Remember startup bank
myStartBank = 0;
@ -61,7 +62,7 @@ void CartridgeX07::install(System& system)
// Set the page accessing methods for the hot spots
// The hotspots use almost all addresses below 0x1000, so we simply grab them
// all and forward the TIA/RIOT calls from the peek and poke methods.
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READWRITE);
System::PageAccess access(0, 0, 0, this, System::PA_READWRITE);
for(uInt32 i = 0x00; i < 0x1000; i += (1 << shift))
mySystem->setPageAccess(i >> shift, access);
@ -125,12 +126,13 @@ bool CartridgeX07::bank(uInt16 bank)
uInt16 shift = mySystem->pageShift();
// Setup the page access methods for the current bank
System::PageAccess access(0, 0, myCodeAccessBase, this, System::PA_READ);
System::PageAccess access(0, 0, 0, this, System::PA_READ);
// Map ROM image into the system
for(uInt32 address = 0x1000; address < 0x2000; address += (1 << shift))
{
access.directPeekBase = &myImage[offset + (address & 0x0FFF)];
access.codeAccessBase = &myCodeAccessBase[offset + (address & 0x0FFF)];
mySystem->setPageAccess(address >> shift, access);
}
return myBankChanged = true;

View File

@ -133,6 +133,7 @@ Settings::Settings(OSystem* osystem)
// Debugger options
setInternal("resolvedata", "auto");
setInternal("gfxformat", "2");
setInternal("showaddr", "true");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -436,6 +437,7 @@ void Settings::usage()
<< " -resolvedata <never| Set automatic code vs. data determination in the disassembler\n"
<< " always|auto>\n"
<< " -gfxformat <2|16> Set base to use for displaying GFX sections in the disassembler\n"
<< " -showaddr <1|0> Show opcode addresses in the disassembler\n"
<< " -debuggerres <WxH> The resolution to use in debugger mode\n"
<< " -break <address> Set a breakpoint at 'address'\n"
<< " -debug Start in debugger mode\n"