improved disassembly of immediate color loads

This commit is contained in:
thrust26 2024-06-05 19:32:40 +02:00
parent 9e37452bab
commit d65eaac19c
4 changed files with 4882 additions and 4861 deletions

View File

@ -376,11 +376,16 @@ void DiStella::disasm(uInt32 distart, int pass)
case AddressingMode::IMMEDIATE: case AddressingMode::IMMEDIATE:
{ {
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC; d1 = Debugger::debugger().peek(myPC + myOffset);
if(pass == 3) { if(pass == 3) {
nextLine << " #$" << Base::HEX2 << static_cast<int>(d1) << " "; if (checkBits(myPC, Device::COL | Device::PCOL | Device::BCOL,
/*Device::CODE |*/ Device::GFX | Device::PGFX))
nextLine << " #" << getColor(d1);
else
nextLine << " #$" << Base::HEX2 << static_cast<int>(d1) << " ";
nextLineBytes << Base::HEX2 << static_cast<int>(d1); nextLineBytes << Base::HEX2 << static_cast<int>(d1);
} }
++myPC;
break; break;
} }
@ -1140,23 +1145,6 @@ void DiStella::outputGraphics()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DiStella::outputColors() void DiStella::outputColors()
{ {
const string NTSC_COLOR[16] = {
"BLACK", "YELLOW", "BROWN", "ORANGE",
"RED", "MAUVE", "VIOLET", "PURPLE",
"BLUE", "BLUE_CYAN", "CYAN", "CYAN_GREEN",
"GREEN", "GREEN_YELLOW", "GREEN_BEIGE", "BEIGE"
};
const string PAL_COLOR[16] = {
"BLACK0", "BLACK1", "YELLOW", "GREEN_YELLOW",
"ORANGE", "GREEN", "RED", "CYAN_GREEN",
"MAUVE", "CYAN", "VIOLET", "BLUE_CYAN",
"PURPLE", "BLUE", "BLACKE", "BLACKF"
};
const string SECAM_COLOR[8] = {
"BLACK", "BLUE", "RED", "PURPLE",
"GREEN", "CYAN", "YELLOW", "WHITE"
};
const uInt8 byte = Debugger::debugger().peek(myPC + myOffset); const uInt8 byte = Debugger::debugger().peek(myPC + myOffset);
// add extra spacing line when switching from non-colors to colors // add extra spacing line when switching from non-colors to colors
@ -1174,25 +1162,10 @@ void DiStella::outputColors()
myDisasmBuf << Base::HEX4 << myPC + myOffset << "' '"; myDisasmBuf << Base::HEX4 << myPC + myOffset << "' '";
// output color // output color
string color; const string color = getColor(byte);
myDisasmBuf << ".byte "; myDisasmBuf << ".byte " << color;
if(myDbg.myConsole.timing() == ConsoleTiming::ntsc) myDisasmBuf << std::setw(static_cast<int>(16 + 3 - color.length())) << std::setfill(' ');
{
color = NTSC_COLOR[byte >> 4];
myDisasmBuf << color << "|$" << Base::HEX1 << (byte & 0xf);
}
else if(myDbg.myConsole.timing() == ConsoleTiming::pal)
{
color = PAL_COLOR[byte >> 4];
myDisasmBuf << color << "|$" << Base::HEX1 << (byte & 0xf);
}
else
{
color = SECAM_COLOR[(byte >> 1) & 0x7];
myDisasmBuf << "$" << Base::HEX1 << (byte >> 4) << "|" << color;
}
myDisasmBuf << std::setw(static_cast<int>(16 - color.length())) << std::setfill(' ');
// output address // output address
myDisasmBuf << "; $" << Base::HEX4 << myPC + myOffset << " " myDisasmBuf << "; $" << Base::HEX4 << myPC + myOffset << " "
@ -1205,6 +1178,47 @@ void DiStella::outputColors()
checkBit(myPC, Device::PCOL) ? Device::PCOL : Device::BCOL); checkBit(myPC, Device::PCOL) ? Device::PCOL : Device::BCOL);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DiStella::getColor(uInt8 byte)
{
const string NTSC_COLOR[16] = {
"BLACK", "YELLOW", "BROWN", "ORANGE",
"RED", "MAUVE", "VIOLET", "PURPLE",
"BLUE", "BLUE_CYAN", "CYAN", "CYAN_GREEN",
"GREEN", "GREEN_YELLOW", "GREEN_BEIGE", "BEIGE"
};
const string PAL_COLOR[16] = {
"BLACK0", "BLACK1", "YELLOW", "GREEN_YELLOW",
"ORANGE", "GREEN", "RED", "CYAN_GREEN",
"MAUVE", "CYAN", "VIOLET", "BLUE_CYAN",
"PURPLE", "BLUE", "BLACKE", "BLACKF"
};
const string SECAM_COLOR[8] = {
"BLACK", "BLUE", "RED", "PURPLE",
"GREEN", "CYAN", "YELLOW", "WHITE"
};
string color;
ostringstream buf;
if (myDbg.myConsole.timing() == ConsoleTiming::ntsc)
{
color = NTSC_COLOR[byte >> 4];
buf << color << "|$" << Base::HEX1 << (byte & 0xf);
}
else if (myDbg.myConsole.timing() == ConsoleTiming::pal)
{
color = PAL_COLOR[byte >> 4];
buf << color << "|$" << Base::HEX1 << (byte & 0xf);
}
else
{
color = SECAM_COLOR[(byte >> 1) & 0x7];
buf << "$" << Base::HEX1 << (byte >> 4) << "|" << color;
}
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void DiStella::outputBytes(Device::AccessType type) void DiStella::outputBytes(Device::AccessType type)
{ {

View File

@ -108,6 +108,7 @@ class DiStella
bool checkBits(uInt16 address, uInt16 mask, uInt16 notMask, bool useDebugger = true) const; bool checkBits(uInt16 address, uInt16 mask, uInt16 notMask, bool useDebugger = true) const;
void outputGraphics(); void outputGraphics();
void outputColors(); void outputColors();
string getColor(uInt8 byte);
void outputBytes(Device::AccessType type); void outputBytes(Device::AccessType type);
// Convenience methods to generate appropriate labels // Convenience methods to generate appropriate labels

File diff suppressed because it is too large Load Diff

View File

@ -1619,8 +1619,9 @@ break;
////////////////////////////////////////////////// //////////////////////////////////////////////////
// LDA // LDA
case 0xa9: case 0xa9:
SET_LAST_PEEK(myLastSrcAddressA, PC)
M6502_IMMEDIATE_READ M6502_IMMEDIATE_READ
CLEAR_LAST_PEEK(myLastSrcAddressA) //CLEAR_LAST_PEEK(myLastSrcAddressA)
M6502_LDA M6502_LDA
break; break;
@ -1671,8 +1672,9 @@ break;
////////////////////////////////////////////////// //////////////////////////////////////////////////
// LDX // LDX
case 0xa2: case 0xa2:
SET_LAST_PEEK(myLastSrcAddressX, PC)
M6502_IMMEDIATE_READ M6502_IMMEDIATE_READ
CLEAR_LAST_PEEK(myLastSrcAddressX) //CLEAR_LAST_PEEK(myLastSrcAddressX)
M6502_LDX M6502_LDX
break; break;
@ -1705,8 +1707,9 @@ break;
////////////////////////////////////////////////// //////////////////////////////////////////////////
// LDY // LDY
case 0xa0: case 0xa0:
SET_LAST_PEEK(myLastSrcAddressY, PC)
M6502_IMMEDIATE_READ M6502_IMMEDIATE_READ
CLEAR_LAST_PEEK(myLastSrcAddressY) //CLEAR_LAST_PEEK(myLastSrcAddressY)
M6502_LDY M6502_LDY
break; break;