2nd part of Distella updates

This commit is contained in:
thrust26 2017-09-15 14:56:54 +02:00
parent 78d73976dc
commit 5f68b0565d
10 changed files with 1149 additions and 739 deletions

View File

@ -82,8 +82,9 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
myBankInfo.push_back(info);
// We know the address for the startup bank right now
myBankInfo[myConsole.cartridge().startBank()].addressList.push_back(myDebugger.dpeek(0xfffc));
addLabel("START", myDebugger.dpeek(0xfffc));
myBankInfo[myConsole.cartridge().startBank()].addressList.push_front(myDebugger.dpeek(0xfffc));
addLabel("Start", myDebugger.dpeek(0xfffc, DATA));
addLabel("Break", myDebugger.dpeek(0xfffe));
// Add system equates
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
@ -114,16 +115,17 @@ CartDebug::CartDebug(Debugger& dbg, Console& console, const OSystem& osystem)
myDisassembly.list.reserve(2048);
// Add settings for Distella
DiStella::settings.gfx_format =
DiStella::settings.gfxFormat =
myOSystem.settings().getInt("dis.gfxformat") == 16 ? Base::F_16 : Base::F_2;
DiStella::settings.resolve_code =
DiStella::settings.resolveCode =
myOSystem.settings().getBool("dis.resolve");
DiStella::settings.show_addresses =
DiStella::settings.showAddresses =
myOSystem.settings().getBool("dis.showaddr");
DiStella::settings.aflag = false; // Not currently configurable
DiStella::settings.fflag = true; // Not currently configurable
DiStella::settings.rflag = myOSystem.settings().getBool("dis.relocate");
DiStella::settings.bwidth = 9; // TODO - configure based on window size
DiStella::settings.aFlag = false; // Not currently configurable
DiStella::settings.fFlag = true; // Not currently configurable
DiStella::settings.rFlag = myOSystem.settings().getBool("dis.relocate");
DiStella::settings.bFlag = true; // Not currently configurable
DiStella::settings.bytesWidth = 8+1; // TODO - configure based on window size
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -263,34 +265,28 @@ bool CartDebug::disassemble(bool force)
// 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)
{
AddressList::const_iterator i;
for(i = addresses.cbegin(); i != addresses.cend(); ++i)
{
if(PC < *i)
{
addresses.insert(i, PC);
break;
}
else if(PC == *i) // already present
if (PC == *i) // already present
break;
}
// Otherwise, add the item at the end
if(i == addresses.end())
addresses.push_back(PC);
if (i == addresses.end())
addresses.push_back(PC);
}
// Always attempt to resolve code sections unless it's been
// specifically disabled
bool found = fillDisassemblyList(info, PC);
if(!found && DiStella::settings.resolve_code)
if(!found && DiStella::settings.resolveCode)
{
// Temporarily turn off code resolution
DiStella::settings.resolve_code = false;
DiStella::settings.resolveCode = false;
fillDisassemblyList(info, PC);
DiStella::settings.resolve_code = true;
DiStella::settings.resolveCode = true;
}
}
@ -973,20 +969,21 @@ string CartDebug::saveDisassembly()
// We can't print the header to the disassembly until it's actually
// been processed; therefore buffer output to a string first
ostringstream buf;
buf << "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n;\n"
<< "; MAIN PROGRAM\n"
<< ";\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
buf << "\n\n;***********************************************************\n"
<< "; Program Code + Data\n"
<< ";***********************************************************\n\n";
// Use specific settings for disassembly output
// This will most likely differ from what you see in the debugger
DiStella::Settings settings;
settings.gfx_format = DiStella::settings.gfx_format;
settings.resolve_code = true;
settings.show_addresses = false;
settings.aflag = false; // Otherwise DASM gets confused
settings.fflag = DiStella::settings.fflag;
settings.rflag = DiStella::settings.rflag;
settings.bwidth = 8+1; // same as Stella debugger
settings.gfxFormat = DiStella::settings.gfxFormat;
settings.resolveCode = true;
settings.showAddresses = false;
settings.aFlag = false; // Otherwise DASM gets confused
settings.fFlag = DiStella::settings.fFlag;
settings.rFlag = DiStella::settings.rFlag;
settings.bytesWidth = 8+1; // same as Stella debugger
settings.bFlag = DiStella::settings.bFlag;; // process break routine (TODO)
Disassembly disasm;
disasm.list.reserve(2048);
@ -1001,6 +998,9 @@ string CartDebug::saveDisassembly()
disasm.list.clear();
DiStella distella(*this, disasm.list, info, settings,
myDisLabels, myDisDirectives, myReserved);
//if (myReserved.breakFound)
// addLabel("BREAK", myDebugger.dpeek(0xfffe));
buf << " SEG CODE\n"
<< " ORG $" << Base::HEX4 << info.offset << "\n\n";
@ -1031,7 +1031,7 @@ string CartDebug::saveDisassembly()
}
case CartDebug::GFX:
{
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
buf << ".byte " << (settings.gfxFormat == Base::F_2 ? "%" : "$")
<< tag.bytes << " ; |";
for(int c = 12; c < 20; ++c)
buf << ((tag.disasm[c] == '\x1e') ? "#" : " ");
@ -1040,7 +1040,7 @@ string CartDebug::saveDisassembly()
}
case CartDebug::PGFX:
{
buf << ".byte " << (settings.gfx_format == Base::F_2 ? "%" : "$")
buf << ".byte " << (settings.gfxFormat == Base::F_2 ? "%" : "$")
<< tag.bytes << " ; |";
for(int c = 12; c < 20; ++c)
buf << ((tag.disasm[c] == '\x1f') ? "*" : " ");
@ -1087,9 +1087,9 @@ string CartDebug::saveDisassembly()
addrUsed = addrUsed || myReserved.IOReadWrite[addr];
if(addrUsed)
{
out << ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
<< "; TIA AND IO CONSTANTS\n"
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
out << "\n;-----------------------------------------------------------\n"
<< "; TIA and IO constants accessed\n"
<< ";-----------------------------------------------------------\n\n";
for(uInt16 addr = 0x00; addr <= 0x0F; ++addr)
if(myReserved.TIARead[addr] && ourTIAMnemonicR[addr])
out << ALIGN(16) << ourTIAMnemonicR[addr] << "= $"
@ -1109,9 +1109,9 @@ string CartDebug::saveDisassembly()
addrUsed = addrUsed || myReserved.ZPRAM[addr-0x80];
if(addrUsed)
{
out << "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
<< "; RIOT RAM (zero-page)\n"
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
out << "\n\n;-----------------------------------------------------------\n"
<< "; RIOT RAM (zero-page) labels\n"
<< ";-----------------------------------------------------------\n\n";
for(uInt16 addr = 0x80; addr <= 0xFF; ++addr)
{
if(myReserved.ZPRAM[addr-0x80] &&
@ -1125,18 +1125,18 @@ string CartDebug::saveDisassembly()
if(myReserved.Label.size() > 0)
{
out << "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
<< "; NON LOCATABLE\n"
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
out << "\n\n;-----------------------------------------------------------\n"
<< "; Non Locatable Labels\n"
<< ";-----------------------------------------------------------\n\n";
for(const auto& iter: myReserved.Label)
out << ALIGN(16) << iter.second << "= $" << iter.first << "\n";
}
if(myUserLabels.size() > 0)
{
out << "\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n"
<< "; USER DEFINED\n"
<< ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n";
out << "\n\n;-----------------------------------------------------------\n"
<< "; User Defined Labels\n"
<< ";-----------------------------------------------------------\n\n";
int max_len = 16;
for(const auto& iter: myUserLabels)
max_len = std::max(max_len, int(iter.second.size()));

View File

@ -52,9 +52,9 @@ class CartDebug : public DebuggerSystem
public:
enum DisasmType {
NONE = 0,
REFERENCED = 1 << 0, /* code somewhere in the program references it,
REFERENCED = 1 << 0, /* 0x01, code somewhere in the program references it,
i.e. LDA $F372 referenced $F372 */
VALID_ENTRY = 1 << 1, /* addresses that can have a label placed in front of it.
VALID_ENTRY = 1 << 1, /* 0x02, addresses that can have a label placed in front of it.
A good counterexample would be "FF00: LDA $FE00"; $FF01
would be in the middle of a multi-byte instruction, and
therefore cannot be labelled. */
@ -63,12 +63,12 @@ class CartDebug : public DebuggerSystem
// debugger, or specified in a Distella cfg file, and are listed in order
// of decreasing hierarchy
//
CODE = 1 << 7, // disassemble-able code segments
TCODE = 1 << 6, // (tentative) disassemble-able code segments
GFX = 1 << 5, // addresses loaded into GRPx registers
PGFX = 1 << 4, // addresses loaded into PFx registers
DATA = 1 << 3, // addresses loaded into registers other than GRPx / PFx
ROW = 1 << 2 // all other addresses
CODE = 1 << 7, // 0x80, disassemble-able code segments
TCODE = 1 << 6, // 0x40, (tentative) disassemble-able code segments
GFX = 1 << 5, // 0x20, addresses loaded into GRPx registers
PGFX = 1 << 4, // 0x10, addresses loaded into PFx registers
DATA = 1 << 3, // 0x08, addresses loaded into registers other than GRPx / PFx
ROW = 1 << 2 // 0x04, all other addresses
};
struct DisassemblyTag {
DisasmType type;
@ -317,6 +317,7 @@ class CartDebug : public DebuggerSystem
bool IOReadWrite[24];
bool ZPRAM[128];
AddrToLabel Label;
bool breakFound;
};
ReservedEquates myReserved;

View File

@ -206,8 +206,8 @@ class Debugger : public DialogContainer
static Debugger& debugger() { return *myStaticDebugger; }
/* These are now exposed so Expressions can use them. */
int peek(int addr) { return mySystem.peek(addr); }
int dpeek(int addr) { return mySystem.peek(addr) | (mySystem.peek(addr+1) << 8); }
int peek(int addr, uInt8 flags = 0) { return mySystem.peek(addr, flags); }
int dpeek(int addr, uInt8 flags = 0) { return mySystem.peek(addr, flags) | (mySystem.peek(addr+1, flags) << 8); }
int getAccessFlags(uInt16 addr) const
{ return mySystem.getAccessFlags(addr); }
void setAccessFlags(uInt16 addr, uInt8 flags)

File diff suppressed because it is too large Load Diff

View File

@ -42,13 +42,14 @@ class DiStella
// This will eventually grow to include all options supported by
// standalone Distella
struct Settings {
Common::Base::Format gfx_format;
bool resolve_code; // Attempt to detect code vs. data sections
bool show_addresses; // Show PC addresses (always off for external output)
bool aflag; // Turns 'A' off in accumulator instructions (-a in Distella)
bool fflag; // Forces correct address length (-f in Distella)
bool rflag; // Relocate calls out of address range (-r in Distella)
int bwidth; // Number of bytes to use per line (with .byte xxx)
Common::Base::Format gfxFormat;
bool resolveCode; // Attempt to detect code vs. data sections
bool showAddresses; // Show PC addresses (always off for external output)
bool aFlag; // Turns 'A' off in accumulator instructions (-a in Distella)
bool fFlag; // Forces correct address length (-f in Distella)
bool rFlag; // Relocate calls out of address range (-r in Distella)
bool bFlag; // Process break routine (-b in Distella)
int bytesWidth; // Number of bytes to use per line (with .byte xxx)
};
static Settings settings; // Default settings
@ -81,11 +82,13 @@ class DiStella
// These functions are part of the original Distella code
void disasm(uInt32 distart, int pass);
void disasmPass1(uInt32 distart);
bool check_range(uInt16 start, uInt16 end) const;
int mark(uInt32 address, uInt8 mask, bool directive = false);
bool checkBit(uInt16 address, uInt8 mask) const;
bool checkBit(uInt16 address, uInt8 mask, bool useDebugger = true) const;
bool DiStella::checkBits(uInt16 address, uInt8 mask, uInt8 notMask) const;
bool checkBits(uInt16 address, uInt8 mask, uInt8 notMask, bool useDebugger = true) const;
void outputGraphics();
void outputBytes(CartDebug::DisasmType type);
@ -118,7 +121,7 @@ class DiStella
CartDebug::ReservedEquates& myReserved;
stringstream myDisasmBuf;
std::queue<uInt16> myAddressQueue;
uInt16 myOffset, myPC, myPCEnd, myPass;
uInt16 myOffset, myPC, myPCEnd;
uInt16 mySegType;
struct resource {
@ -184,6 +187,7 @@ class DiStella
AccessMode source;
ReadWriteMode rw_mode;
uInt8 cycles;
uInt8 bytes;
};
static const Instruction_tag ourLookup[256];

View File

@ -582,7 +582,7 @@ void RomListWidget::startEditMode()
{
case CartDebug::GFX:
case CartDebug::PGFX:
_base = DiStella::settings.gfx_format;
_base = DiStella::settings.gfxFormat;
break;
default:
_base = Common::Base::format();

View File

@ -122,18 +122,18 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case RomListWidget::kTentativeCodeCmd:
{
// 'data' is the boolean value
DiStella::settings.resolve_code = data;
DiStella::settings.resolveCode = data;
instance().settings().setValue("dis.resolve",
DiStella::settings.resolve_code);
DiStella::settings.resolveCode);
invalidate();
break;
}
case RomListWidget::kPCAddressesCmd:
// 'data' is the boolean value
DiStella::settings.show_addresses = data;
DiStella::settings.showAddresses = data;
instance().settings().setValue("dis.showaddr",
DiStella::settings.show_addresses);
DiStella::settings.showAddresses);
invalidate();
break;
@ -141,12 +141,12 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// 'data' is the boolean value
if(data)
{
DiStella::settings.gfx_format = Common::Base::F_2;
DiStella::settings.gfxFormat = Common::Base::F_2;
instance().settings().setValue("dis.gfxformat", "2");
}
else
{
DiStella::settings.gfx_format = Common::Base::F_16;
DiStella::settings.gfxFormat = Common::Base::F_16;
instance().settings().setValue("dis.gfxformat", "16");
}
invalidate();
@ -154,9 +154,9 @@ void RomWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
case RomListWidget::kAddrRelocationCmd:
// 'data' is the boolean value
DiStella::settings.rflag = data;
DiStella::settings.rFlag = data;
instance().settings().setValue("dis.relocate",
DiStella::settings.rflag);
DiStella::settings.rFlag);
invalidate();
break;
}

File diff suppressed because it is too large Load Diff

View File

@ -38,7 +38,7 @@
#ifndef CLEAR_LAST_PEEK
#ifdef DEBUGGER_SUPPORT
#define CLEAR_LAST_PEEK(_addr) _addr = -1;
#define CLEAR_LAST_PEEK(_addr) _addr = 0;
#else
#define CLEAR_LAST_PEEK(_addr)
#endif
@ -83,25 +83,29 @@ define(M6502_ABSOLUTEX_READ, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
intermediateAddress = high | uInt8(low + X);
operand = peek(intermediateAddress, DISASM_DATA);
if((low + X) > 0xFF)
{
operand = peek(intermediateAddress, DISASM_NONE);
intermediateAddress = (high | low) + X;
operand = peek(intermediateAddress, DISASM_DATA);
}
else
{
operand = peek(intermediateAddress, DISASM_DATA);
}
}')
define(M6502_ABSOLUTEX_WRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + X), DISASM_DATA);
peek(high | uInt8(low + X), DISASM_NONE);
operandAddress = (high | low) + X;
}')
define(M6502_ABSOLUTEX_READMODIFYWRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + X), DISASM_DATA);
peek(high | uInt8(low + X), DISASM_NONE);
operandAddress = (high | low) + X;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -111,25 +115,29 @@ define(M6502_ABSOLUTEY_READ, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
intermediateAddress = high | uInt8(low + Y);
operand = peek(intermediateAddress, DISASM_DATA);
if((low + Y) > 0xFF)
{
operand = peek(intermediateAddress, DISASM_NONE);
intermediateAddress = (high | low) + Y;
operand = peek(intermediateAddress, DISASM_DATA);
}
else
{
operand = peek(intermediateAddress, DISASM_DATA);
}
}')
define(M6502_ABSOLUTEY_WRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
peek(high | uInt8(low + Y), DISASM_NONE);
operandAddress = (high | low) + Y;
}')
define(M6502_ABSOLUTEY_READMODIFYWRITE, `{
uInt16 low = peek(PC++, DISASM_CODE);
uInt16 high = (uInt16(peek(PC++, DISASM_CODE)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
peek(high | uInt8(low + Y), DISASM_NONE);
operandAddress = (high | low) + Y;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -152,20 +160,20 @@ define(M6502_ZERO_READMODIFYWRITE, `{
define(M6502_ZEROX_READ, `{
intermediateAddress = peek(PC++, DISASM_CODE);
peek(intermediateAddress, DISASM_DATA);
peek(intermediateAddress, DISASM_NONE);
intermediateAddress += X;
operand = peek(intermediateAddress, DISASM_DATA);
}')
define(M6502_ZEROX_WRITE, `{
operandAddress = peek(PC++, DISASM_CODE);
peek(operandAddress, DISASM_DATA);
peek(operandAddress, DISASM_NONE);
operandAddress = (operandAddress + X) & 0xFF;
}')
define(M6502_ZEROX_READMODIFYWRITE, `{
operandAddress = peek(PC++, DISASM_CODE);
peek(operandAddress, DISASM_DATA);
peek(operandAddress, DISASM_NONE);
operandAddress = (operandAddress + X) & 0xFF;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -173,20 +181,20 @@ define(M6502_ZEROX_READMODIFYWRITE, `{
define(M6502_ZEROY_READ, `{
intermediateAddress = peek(PC++, DISASM_CODE);
peek(intermediateAddress, DISASM_DATA);
peek(intermediateAddress, DISASM_NONE);
intermediateAddress += Y;
operand = peek(intermediateAddress, DISASM_DATA);
}')
define(M6502_ZEROY_WRITE, `{
operandAddress = peek(PC++, DISASM_CODE);
peek(operandAddress, DISASM_DATA);
peek(operandAddress, DISASM_NONE);
operandAddress = (operandAddress + Y) & 0xFF;
}')
define(M6502_ZEROY_READMODIFYWRITE, `{
operandAddress = peek(PC++, DISASM_CODE);
peek(operandAddress, DISASM_DATA);
peek(operandAddress, DISASM_NONE);
operandAddress = (operandAddress + Y) & 0xFF;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
@ -205,7 +213,7 @@ define(M6502_INDIRECT, `{
define(M6502_INDIRECTX_READ, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
peek(pointer, DISASM_DATA);
peek(pointer, DISASM_NONE);
pointer += X;
intermediateAddress = peek(pointer++, DISASM_DATA);
intermediateAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
@ -214,7 +222,7 @@ define(M6502_INDIRECTX_READ, `{
define(M6502_INDIRECTX_WRITE, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
peek(pointer, DISASM_DATA);
peek(pointer, DISASM_NONE);
pointer += X;
operandAddress = peek(pointer++, DISASM_DATA);
operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
@ -222,7 +230,7 @@ define(M6502_INDIRECTX_WRITE, `{
define(M6502_INDIRECTX_READMODIFYWRITE, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
peek(pointer, DISASM_DATA);
peek(pointer, DISASM_NONE);
pointer += X;
operandAddress = peek(pointer++, DISASM_DATA);
operandAddress |= (uInt16(peek(pointer, DISASM_DATA)) << 8);
@ -235,19 +243,23 @@ define(M6502_INDIRECTY_READ, `{
uInt16 low = peek(pointer++, DISASM_DATA);
uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
intermediateAddress = high | uInt8(low + Y);
operand = peek(intermediateAddress, DISASM_DATA);
if((low + Y) > 0xFF)
{
operand = peek(intermediateAddress, DISASM_NONE);
intermediateAddress = (high | low) + Y;
operand = peek(intermediateAddress, DISASM_DATA);
}
else
{
operand = peek(intermediateAddress, DISASM_DATA);
}
}')
define(M6502_INDIRECTY_WRITE, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
uInt16 low = peek(pointer++, DISASM_DATA);
uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
peek(high | uInt8(low + Y), DISASM_NONE);
operandAddress = (high | low) + Y;
}')
@ -255,13 +267,12 @@ define(M6502_INDIRECTY_READMODIFYWRITE, `{
uInt8 pointer = peek(PC++, DISASM_CODE);
uInt16 low = peek(pointer++, DISASM_DATA);
uInt16 high = (uInt16(peek(pointer, DISASM_DATA)) << 8);
peek(high | uInt8(low + Y), DISASM_DATA);
peek(high | uInt8(low + Y), DISASM_NONE);
operandAddress = (high | low) + Y;
operand = peek(operandAddress, DISASM_DATA);
poke(operandAddress, operand);
}')
define(M6502_BCC, `{
if(!C)
{
@ -484,7 +495,7 @@ define(M6502_BIT, `{
}')
define(M6502_BRK, `{
peek(PC++, DISASM_CODE);
peek(PC++, DISASM_NONE);
B = true;
@ -494,8 +505,8 @@ define(M6502_BRK, `{
I = true;
PC = peek(0xfffe, DISASM_NONE);
PC |= (uInt16(peek(0xffff, DISASM_NONE)) << 8);
PC = peek(0xfffe, DISASM_DATA);
PC |= (uInt16(peek(0xffff, DISASM_DATA)) << 8);
}')
define(M6502_CLC, `{
@ -996,7 +1007,8 @@ define(M6502_TYA, `{
N = A & 0x80;
}')
//////////////////////////////////////////////////
// ADC
case 0x69:
M6502_IMMEDIATE_READ
M6502_ADC
@ -1037,20 +1049,23 @@ M6502_INDIRECTY_READ
M6502_ADC
break;
//////////////////////////////////////////////////
// ASR
case 0x4b:
M6502_IMMEDIATE_READ
M6502_ASR
break;
//////////////////////////////////////////////////
// ANC
case 0x0b:
case 0x2b:
M6502_IMMEDIATE_READ
M6502_ANC
break;
//////////////////////////////////////////////////
// AND
case 0x29:
M6502_IMMEDIATE_READ
M6502_AND
@ -1091,19 +1106,22 @@ M6502_INDIRECTY_READ
M6502_AND
break;
//////////////////////////////////////////////////
// ANE
case 0x8b:
M6502_IMMEDIATE_READ
M6502_ANE
break;
//////////////////////////////////////////////////
// ARR
case 0x6b:
M6502_IMMEDIATE_READ
M6502_ARR
break;
//////////////////////////////////////////////////
// ASL
case 0x0a:
M6502_IMPLIED
M6502_ASLA
@ -1129,7 +1147,20 @@ M6502_ABSOLUTEX_READMODIFYWRITE
M6502_ASL
break;
//////////////////////////////////////////////////
// BIT
case 0x24:
M6502_ZERO_READ
M6502_BIT
break;
case 0x2C:
M6502_ABSOLUTE_READ
M6502_BIT
break;
//////////////////////////////////////////////////
// Branches
case 0x90:
M6502_IMMEDIATE_READ
M6502_BCC
@ -1148,17 +1179,6 @@ M6502_BEQ
break;
case 0x24:
M6502_ZERO_READ
M6502_BIT
break;
case 0x2C:
M6502_ABSOLUTE_READ
M6502_BIT
break;
case 0x30:
M6502_IMMEDIATE_READ
M6502_BMI
@ -1177,11 +1197,6 @@ M6502_BPL
break;
case 0x00:
M6502_BRK
break;
case 0x50:
M6502_IMMEDIATE_READ
M6502_BVC
@ -1193,31 +1208,42 @@ M6502_IMMEDIATE_READ
M6502_BVS
break;
//////////////////////////////////////////////////
// BRK
case 0x00:
M6502_BRK
break;
//////////////////////////////////////////////////
// CLC
case 0x18:
M6502_IMPLIED
M6502_CLC
break;
//////////////////////////////////////////////////
// CLD
case 0xd8:
M6502_IMPLIED
M6502_CLD
break;
//////////////////////////////////////////////////
// CLI
case 0x58:
M6502_IMPLIED
M6502_CLI
break;
//////////////////////////////////////////////////
// CLV
case 0xb8:
M6502_IMPLIED
M6502_CLV
break;
//////////////////////////////////////////////////
// CMP
case 0xc9:
M6502_IMMEDIATE_READ
M6502_CMP
@ -1258,7 +1284,8 @@ M6502_INDIRECTY_READ
M6502_CMP
break;
//////////////////////////////////////////////////
// CPX
case 0xe0:
M6502_IMMEDIATE_READ
M6502_CPX
@ -1274,7 +1301,8 @@ M6502_ABSOLUTE_READ
M6502_CPX
break;
//////////////////////////////////////////////////
// CPY
case 0xc0:
M6502_IMMEDIATE_READ
M6502_CPY
@ -1290,7 +1318,8 @@ M6502_ABSOLUTE_READ
M6502_CPY
break;
//////////////////////////////////////////////////
// DCP
case 0xcf:
M6502_ABSOLUTE_READMODIFYWRITE
M6502_DCP
@ -1326,7 +1355,8 @@ M6502_INDIRECTY_READMODIFYWRITE
M6502_DCP
break;
//////////////////////////////////////////////////
// DEC
case 0xc6:
M6502_ZERO_READMODIFYWRITE
M6502_DEC
@ -1347,19 +1377,22 @@ M6502_ABSOLUTEX_READMODIFYWRITE
M6502_DEC
break;
//////////////////////////////////////////////////
// DEX
case 0xca:
M6502_IMPLIED
M6502_DEX
break;
//////////////////////////////////////////////////
// DEY
case 0x88:
M6502_IMPLIED
M6502_DEY
break;
//////////////////////////////////////////////////
// EOR
case 0x49:
M6502_IMMEDIATE_READ
M6502_EOR
@ -1400,7 +1433,8 @@ M6502_INDIRECTY_READ
M6502_EOR
break;
//////////////////////////////////////////////////
// INC
case 0xe6:
M6502_ZERO_READMODIFYWRITE
M6502_INC
@ -1421,19 +1455,22 @@ M6502_ABSOLUTEX_READMODIFYWRITE
M6502_INC
break;
//////////////////////////////////////////////////
// INX
case 0xe8:
M6502_IMPLIED
M6502_INX
break;
//////////////////////////////////////////////////
// INY
case 0xc8:
M6502_IMPLIED
M6502_INY
break;
//////////////////////////////////////////////////
// ISB
case 0xef:
M6502_ABSOLUTE_READMODIFYWRITE
M6502_ISB
@ -1469,7 +1506,8 @@ M6502_INDIRECTY_READMODIFYWRITE
M6502_ISB
break;
//////////////////////////////////////////////////
// JMP
case 0x4c:
M6502_ABSOLUTE_WRITE
M6502_JMP
@ -1480,12 +1518,14 @@ M6502_INDIRECT
M6502_JMP
break;
//////////////////////////////////////////////////
// JSR
case 0x20:
M6502_JSR
break;
//////////////////////////////////////////////////
// LAS
case 0xbb:
M6502_ABSOLUTEY_READ
M6502_LAS
@ -1657,7 +1697,8 @@ M6502_LDY
break;
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// LSR
case 0x4a:
M6502_IMPLIED
M6502_LSRA
@ -1684,13 +1725,15 @@ M6502_ABSOLUTEX_READMODIFYWRITE
M6502_LSR
break;
//////////////////////////////////////////////////
// LXA
case 0xab:
M6502_IMMEDIATE_READ
M6502_LXA
break;
//////////////////////////////////////////////////
// NOP
case 0x1a:
case 0x3a:
case 0x5a:
@ -1795,35 +1838,40 @@ M6502_ORA
break;
//////////////////////////////////////////////////
//////////////////////////////////////////////////
// PHA
case 0x48:
M6502_IMPLIED
// TODO - add tracking for this opcode
M6502_PHA
break;
//////////////////////////////////////////////////
// PHP
case 0x08:
M6502_IMPLIED
// TODO - add tracking for this opcode
M6502_PHP
break;
//////////////////////////////////////////////////
// PLA
case 0x68:
M6502_IMPLIED
// TODO - add tracking for this opcode
M6502_PLA
break;
//////////////////////////////////////////////////
// PLP
case 0x28:
M6502_IMPLIED
// TODO - add tracking for this opcode
M6502_PLP
break;
//////////////////////////////////////////////////
// RLA
case 0x2f:
M6502_ABSOLUTE_READMODIFYWRITE
M6502_RLA
@ -1859,13 +1907,13 @@ M6502_INDIRECTY_READMODIFYWRITE
M6502_RLA
break;
//////////////////////////////////////////////////
// ROL
case 0x2a:
M6502_IMPLIED
M6502_ROLA
break;
case 0x26:
M6502_ZERO_READMODIFYWRITE
M6502_ROL
@ -1886,7 +1934,8 @@ M6502_ABSOLUTEX_READMODIFYWRITE
M6502_ROL
break;
//////////////////////////////////////////////////
// ROR
case 0x6a:
M6502_IMPLIED
M6502_RORA
@ -1912,7 +1961,8 @@ M6502_ABSOLUTEX_READMODIFYWRITE
M6502_ROR
break;
//////////////////////////////////////////////////
// RRA
case 0x6f:
M6502_ABSOLUTE_READMODIFYWRITE
M6502_RRA
@ -1948,19 +1998,22 @@ M6502_INDIRECTY_READMODIFYWRITE
M6502_RRA
break;
//////////////////////////////////////////////////
// RTI
case 0x40:
M6502_IMPLIED
M6502_RTI
break;
//////////////////////////////////////////////////
// RTS
case 0x60:
M6502_IMPLIED
M6502_RTS
break;
//////////////////////////////////////////////////
// SAX
case 0x8f:
M6502_ABSOLUTE_WRITE
M6502_SAX
@ -1981,7 +2034,8 @@ M6502_INDIRECTX_WRITE
M6502_SAX
break;
//////////////////////////////////////////////////
// SBC
case 0xe9:
case 0xeb:
M6502_IMMEDIATE_READ
@ -2023,31 +2077,36 @@ M6502_INDIRECTY_READ
M6502_SBC
break;
//////////////////////////////////////////////////
// SBX
case 0xcb:
M6502_IMMEDIATE_READ
M6502_SBX
break;
//////////////////////////////////////////////////
// SEC
case 0x38:
M6502_IMPLIED
M6502_SEC
break;
//////////////////////////////////////////////////
// SED
case 0xf8:
M6502_IMPLIED
M6502_SED
break;
//////////////////////////////////////////////////
// SEI
case 0x78:
M6502_IMPLIED
M6502_SEI
break;
//////////////////////////////////////////////////
// SHA
case 0x9f:
M6502_ABSOLUTEY_WRITE
M6502_SHA
@ -2058,25 +2117,29 @@ M6502_INDIRECTY_WRITE
M6502_SHA
break;
//////////////////////////////////////////////////
// SHS
case 0x9b:
M6502_ABSOLUTEY_WRITE
M6502_SHS
break;
//////////////////////////////////////////////////
// SHX
case 0x9e:
M6502_ABSOLUTEY_WRITE
M6502_SHX
break;
//////////////////////////////////////////////////
// SHY
case 0x9c:
M6502_ABSOLUTEX_WRITE
M6502_SHY
break;
//////////////////////////////////////////////////
// SLO
case 0x0f:
M6502_ABSOLUTE_READMODIFYWRITE
M6502_SLO
@ -2112,7 +2175,8 @@ M6502_INDIRECTY_READMODIFYWRITE
M6502_SLO
break;
//////////////////////////////////////////////////
// SRE
case 0x4f:
M6502_ABSOLUTE_READMODIFYWRITE
M6502_SRE

View File

@ -113,6 +113,9 @@ uInt8 System::peek(uInt16 addr, uInt8 flags)
{
PageAccess& access = myPageAccessTable[(addr & ADDRESS_MASK) >> PAGE_SHIFT];
if (addr == 0xf52c /*0xf505*/)
addr = addr;
#ifdef DEBUGGER_SUPPORT
// Set access type
if(access.codeAccessBase)
@ -142,6 +145,9 @@ void System::poke(uInt16 addr, uInt8 value)
uInt16 page = (addr & ADDRESS_MASK) >> PAGE_SHIFT;
PageAccess& access = myPageAccessTable[page];
if (addr == 0xf52c /*0xf505*/)
addr = addr;
// See if this page uses direct accessing or not
if(access.directPokeBase)
{
@ -181,6 +187,8 @@ void System::setAccessFlags(uInt16 addr, uInt8 flags)
{
#ifdef DEBUGGER_SUPPORT
PageAccess& access = myPageAccessTable[(addr & ADDRESS_MASK) >> PAGE_SHIFT];
if (addr == 0xf52c /*0xf505*/)
addr = addr;
if(access.codeAccessBase)
*(access.codeAccessBase + (addr & PAGE_MASK)) |= flags;