mirror of https://github.com/stella-emu/stella.git
improved disassembly of immediate color loads
This commit is contained in:
parent
9e37452bab
commit
d65eaac19c
|
@ -376,11 +376,16 @@ void DiStella::disasm(uInt32 distart, int pass)
|
|||
|
||||
case AddressingMode::IMMEDIATE:
|
||||
{
|
||||
d1 = Debugger::debugger().peek(myPC + myOffset); ++myPC;
|
||||
d1 = Debugger::debugger().peek(myPC + myOffset);
|
||||
if(pass == 3) {
|
||||
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);
|
||||
}
|
||||
++myPC;
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1140,23 +1145,6 @@ void DiStella::outputGraphics()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
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);
|
||||
|
||||
// add extra spacing line when switching from non-colors to colors
|
||||
|
@ -1174,25 +1162,10 @@ void DiStella::outputColors()
|
|||
myDisasmBuf << Base::HEX4 << myPC + myOffset << "' '";
|
||||
|
||||
// output color
|
||||
string color;
|
||||
const string color = getColor(byte);
|
||||
|
||||
myDisasmBuf << ".byte ";
|
||||
if(myDbg.myConsole.timing() == ConsoleTiming::ntsc)
|
||||
{
|
||||
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(' ');
|
||||
myDisasmBuf << ".byte " << color;
|
||||
myDisasmBuf << std::setw(static_cast<int>(16 + 3 - color.length())) << std::setfill(' ');
|
||||
|
||||
// output address
|
||||
myDisasmBuf << "; $" << Base::HEX4 << myPC + myOffset << " "
|
||||
|
@ -1205,6 +1178,47 @@ void DiStella::outputColors()
|
|||
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)
|
||||
{
|
||||
|
|
|
@ -108,6 +108,7 @@ class DiStella
|
|||
bool checkBits(uInt16 address, uInt16 mask, uInt16 notMask, bool useDebugger = true) const;
|
||||
void outputGraphics();
|
||||
void outputColors();
|
||||
string getColor(uInt8 byte);
|
||||
void outputBytes(Device::AccessType type);
|
||||
|
||||
// Convenience methods to generate appropriate labels
|
||||
|
|
|
@ -2363,10 +2363,11 @@ break;
|
|||
//////////////////////////////////////////////////
|
||||
// LDA
|
||||
case 0xa9:
|
||||
SET_LAST_PEEK(myLastSrcAddressA, PC)
|
||||
{
|
||||
operand = peek(PC++, DISASM_CODE);
|
||||
}
|
||||
CLEAR_LAST_PEEK(myLastSrcAddressA)
|
||||
//CLEAR_LAST_PEEK(myLastSrcAddressA)
|
||||
{
|
||||
A = operand;
|
||||
notZ = A;
|
||||
|
@ -2511,10 +2512,11 @@ break;
|
|||
//////////////////////////////////////////////////
|
||||
// LDX
|
||||
case 0xa2:
|
||||
SET_LAST_PEEK(myLastSrcAddressX, PC)
|
||||
{
|
||||
operand = peek(PC++, DISASM_CODE);
|
||||
}
|
||||
CLEAR_LAST_PEEK(myLastSrcAddressX)
|
||||
//CLEAR_LAST_PEEK(myLastSrcAddressX)
|
||||
{
|
||||
X = operand;
|
||||
notZ = X;
|
||||
|
@ -2593,10 +2595,11 @@ break;
|
|||
//////////////////////////////////////////////////
|
||||
// LDY
|
||||
case 0xa0:
|
||||
SET_LAST_PEEK(myLastSrcAddressY, PC)
|
||||
{
|
||||
operand = peek(PC++, DISASM_CODE);
|
||||
}
|
||||
CLEAR_LAST_PEEK(myLastSrcAddressY)
|
||||
//CLEAR_LAST_PEEK(myLastSrcAddressY)
|
||||
{
|
||||
Y = operand;
|
||||
notZ = Y;
|
||||
|
|
|
@ -1619,8 +1619,9 @@ break;
|
|||
//////////////////////////////////////////////////
|
||||
// LDA
|
||||
case 0xa9:
|
||||
SET_LAST_PEEK(myLastSrcAddressA, PC)
|
||||
M6502_IMMEDIATE_READ
|
||||
CLEAR_LAST_PEEK(myLastSrcAddressA)
|
||||
//CLEAR_LAST_PEEK(myLastSrcAddressA)
|
||||
M6502_LDA
|
||||
break;
|
||||
|
||||
|
@ -1671,8 +1672,9 @@ break;
|
|||
//////////////////////////////////////////////////
|
||||
// LDX
|
||||
case 0xa2:
|
||||
SET_LAST_PEEK(myLastSrcAddressX, PC)
|
||||
M6502_IMMEDIATE_READ
|
||||
CLEAR_LAST_PEEK(myLastSrcAddressX)
|
||||
//CLEAR_LAST_PEEK(myLastSrcAddressX)
|
||||
M6502_LDX
|
||||
break;
|
||||
|
||||
|
@ -1705,8 +1707,9 @@ break;
|
|||
//////////////////////////////////////////////////
|
||||
// LDY
|
||||
case 0xa0:
|
||||
SET_LAST_PEEK(myLastSrcAddressY, PC)
|
||||
M6502_IMMEDIATE_READ
|
||||
CLEAR_LAST_PEEK(myLastSrcAddressY)
|
||||
//CLEAR_LAST_PEEK(myLastSrcAddressY)
|
||||
M6502_LDY
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue