diff --git a/Changes.txt b/Changes.txt index 44a4a0407..30660f2b5 100644 --- a/Changes.txt +++ b/Changes.txt @@ -20,6 +20,10 @@ - RSYNC - YStart autodetection - Proper emulation of RDY during write cycles (WSYNC). + - Fixed debug colors can now be set for each graphical object, from a + choice of 'red', 'orange', 'yellow', 'green', 'blue' and 'purple'. + This is accessible through the new 'tia.dbgcolors' commandline + argument. - ... * Implemented new phosphor emulation mode, which is much closer to real diff --git a/src/debugger/TIADebug.cxx b/src/debugger/TIADebug.cxx index 98c4f174b..3cc2983fc 100644 --- a/src/debugger/TIADebug.cxx +++ b/src/debugger/TIADebug.cxx @@ -52,29 +52,16 @@ const DebuggerState& TIADebug::getState() myState.coluRegs.push_back(coluBK()); // Debug Colors + int mode = myTIA.myFrameManager.layout() == FrameLayout::ntsc ? 0 : 1; myState.fixedCols.clear(); - if(myTIA.myFrameManager.layout() == FrameLayout::ntsc) - { - myState.fixedCols.push_back(myTIA.P0ColorNTSC); - myState.fixedCols.push_back(myTIA.P1ColorNTSC); - myState.fixedCols.push_back(myTIA.PFColorNTSC); - myState.fixedCols.push_back(myTIA.BKColorNTSC); - myState.fixedCols.push_back(myTIA.M0ColorNTSC); - myState.fixedCols.push_back(myTIA.M1ColorNTSC); - myState.fixedCols.push_back(myTIA.BLColorNTSC); - myState.fixedCols.push_back(myTIA.HBLANKColor); - } - else - { - myState.fixedCols.push_back(myTIA.P0ColorPAL); - myState.fixedCols.push_back(myTIA.P1ColorPAL); - myState.fixedCols.push_back(myTIA.PFColorPAL); - myState.fixedCols.push_back(myTIA.BKColorPAL); - myState.fixedCols.push_back(myTIA.M0ColorPAL); - myState.fixedCols.push_back(myTIA.M1ColorPAL); - myState.fixedCols.push_back(myTIA.BLColorPAL); - myState.fixedCols.push_back(myTIA.HBLANKColor); - } + myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::P0]); + myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::P1]); + myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::PF]); + myState.fixedCols.push_back(TIA::FixedColor::BK_GREY); + myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::M0]); + myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::M1]); + myState.fixedCols.push_back(myTIA.myFixedColorPalette[mode][TIA::BL]); + myState.fixedCols.push_back(TIA::FixedColor::HBLANK_WHITE); // Player 0 & 1 and Ball graphics registers myState.gr.clear(); @@ -758,7 +745,7 @@ string TIADebug::colorSwatch(uInt8 c) const ret += char((c >> 1) | 0x80); ret += "\177 "; - ret += "\177\003 "; + ret += "\177\001 "; return ret; } @@ -804,28 +791,24 @@ string TIADebug::debugColors() const { ostringstream buf; - if(myTIA.myFrameManager.layout() == FrameLayout::ntsc) - { - buf << " Red " << colorSwatch(myTIA.P0ColorNTSC) << " Player 0\n" - << " Orange " << colorSwatch(myTIA.M0ColorNTSC) << " Missile 0\n" - << " Yellow " << colorSwatch(myTIA.P1ColorNTSC) << " Player 1\n" - << " Green " << colorSwatch(myTIA.M1ColorNTSC) << " Missile 1\n" - << " Blue " << colorSwatch(myTIA.PFColorNTSC) << " Playfield\n" - << " Purple " << colorSwatch(myTIA.BLColorNTSC) << " Ball\n" - << " Grey " << colorSwatch(myTIA.BKColorNTSC) << " Background\n" - << " White " << colorSwatch(myTIA.HBLANKColor) << " HMOVE\n"; - } - else - { - buf << " Red " << colorSwatch(myTIA.P0ColorPAL) << " Player 0\n" - << " Orange " << colorSwatch(myTIA.M0ColorPAL) << " Missile 0\n" - << " Yellow " << colorSwatch(myTIA.P1ColorPAL) << " Player 1\n" - << " Green " << colorSwatch(myTIA.M1ColorPAL) << " Missile 1\n" - << " Blue " << colorSwatch(myTIA.PFColorPAL) << " Playfield\n" - << " Purple " << colorSwatch(myTIA.BLColorPAL) << " Ball\n" - << " Grey " << colorSwatch(myTIA.BKColorPAL) << " Background\n" - << " White " << colorSwatch(myTIA.HBLANKColor) << " HMOVE\n"; - } + int mode = myTIA.myFrameManager.layout() == FrameLayout::ntsc ? 0 : 1; + buf << " Red " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::P0]) + << " Player 0\n" + << " Orange " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::M0]) + << " Missile 0\n" + << " Yellow " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::P1]) + << " Player 1\n" + << " Green " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::M1]) + << " Missile 1\n" + << " Blue " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::PF]) + << " Playfield\n" + << " Purple " << colorSwatch(myTIA.myFixedColorPalette[mode][TIA::BL]) + << " Ball\n" + << " Grey " << colorSwatch(TIA::FixedColor::BK_GREY) + << " Background\n" + << " White " << colorSwatch(TIA::FixedColor::HBLANK_WHITE) + << " HMOVE\n"; + return buf.str(); } diff --git a/src/emucore/Settings.cxx b/src/emucore/Settings.cxx index ae0769224..84908a796 100644 --- a/src/emucore/Settings.cxx +++ b/src/emucore/Settings.cxx @@ -51,6 +51,7 @@ Settings::Settings(OSystem& osystem) setInternal("tia.aspectn", "90"); setInternal("tia.aspectp", "100"); setInternal("tia.fsfill", "false"); + setInternal("tia.dbgcolors", "roygpb"); // TV filtering options setInternal("tv.filter", "0"); @@ -273,6 +274,10 @@ void Settings::validate() i = getInt("tia.aspectp"); if(i < 80 || i > 120) setInternal("tia.aspectp", "100"); + s = getString("tia.dbgcolors"); + sort(s.begin(), s.end()); + if(s != "bgopry") setInternal("tia.dbgcolors", "roygpb"); + i = getInt("tv.filter"); if(i < 0 || i > 5) setInternal("tv.filter", "0"); diff --git a/src/emucore/tia/TIA.cxx b/src/emucore/tia/TIA.cxx index 600f78327..0b6303a98 100644 --- a/src/emucore/tia/TIA.cxx +++ b/src/emucore/tia/TIA.cxx @@ -88,6 +88,7 @@ TIA::TIA(Console& console, Sound& sound, Settings& settings) } ); + setFixedColorPalette(mySettings.getString("tia.dbgcolors")); myTIAPinsDriven = mySettings.getBool("tiadriven"); myBackground.setTIA(this); @@ -865,14 +866,14 @@ bool TIA::toggleFixedColors(uInt8 mode) // Otherwise, flip the state bool on = (mode == 0 || mode == 1) ? bool(mode) : myColorHBlank == 0; - bool pal = myFrameManager.layout() == FrameLayout::pal; - myMissile0.setDebugColor(pal ? M0ColorPAL : M0ColorNTSC); - myMissile1.setDebugColor(pal ? M1ColorPAL : M1ColorNTSC); - myPlayer0.setDebugColor(pal ? P0ColorPAL : P0ColorNTSC); - myPlayer1.setDebugColor(pal ? P1ColorPAL : P1ColorNTSC); - myBall.setDebugColor(pal ? BLColorPAL : BLColorNTSC); - myPlayfield.setDebugColor(pal ? PFColorPAL : PFColorNTSC); - myBackground.setDebugColor(pal ? BKColorPAL : BKColorNTSC); + int layout = myFrameManager.layout() == FrameLayout::pal ? 1 : 0; + myMissile0.setDebugColor(myFixedColorPalette[layout][FixedObject::M0]); + myMissile1.setDebugColor(myFixedColorPalette[layout][FixedObject::M1]); + myPlayer0.setDebugColor(myFixedColorPalette[layout][FixedObject::P0]); + myPlayer1.setDebugColor(myFixedColorPalette[layout][FixedObject::P1]); + myBall.setDebugColor(myFixedColorPalette[layout][FixedObject::BL]); + myPlayfield.setDebugColor(myFixedColorPalette[layout][FixedObject::PF]); + myBackground.setDebugColor(FixedColor::BK_GREY); myMissile0.enableDebugColors(on); myMissile1.enableDebugColors(on); @@ -881,11 +882,46 @@ bool TIA::toggleFixedColors(uInt8 mode) myBall.enableDebugColors(on); myPlayfield.enableDebugColors(on); myBackground.enableDebugColors(on); - myColorHBlank = on ? HBLANKColor : 0x00; + myColorHBlank = on ? FixedColor::HBLANK_WHITE : 0x00; return on; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +void TIA::setFixedColorPalette(const string& colors) +{ + for(int i = 0; i < 6; ++i) + { + switch(colors[i]) + { + case 'r': + myFixedColorPalette[0][i] = FixedColor::NTSC_RED; + myFixedColorPalette[1][i] = FixedColor::PAL_RED; + break; + case 'o': + myFixedColorPalette[0][i] = FixedColor::NTSC_ORANGE; + myFixedColorPalette[1][i] = FixedColor::PAL_ORANGE; + break; + case 'y': + myFixedColorPalette[0][i] = FixedColor::NTSC_YELLOW; + myFixedColorPalette[1][i] = FixedColor::PAL_YELLOW; + break; + case 'g': + myFixedColorPalette[0][i] = FixedColor::NTSC_GREEN; + myFixedColorPalette[1][i] = FixedColor::PAL_GREEN; + break; + case 'b': + myFixedColorPalette[0][i] = FixedColor::NTSC_BLUE; + myFixedColorPalette[1][i] = FixedColor::PAL_BLUE; + break; + case 'p': + myFixedColorPalette[0][i] = FixedColor::NTSC_PURPLE; + myFixedColorPalette[1][i] = FixedColor::PAL_PURPLE; + break; + } + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - bool TIA::driveUnusedPinsRandom(uInt8 mode) { diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index 7c7f13152..f84a4ee85 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -283,6 +283,17 @@ class TIA : public Device bool toggleFixedColors(uInt8 mode = 2); bool usingFixedColors() const { return myColorHBlank != 0x00; } + /** + Sets the color of each object in 'fixed debug colors' mode. + Note that this doesn't enable/disable fixed colors; it simply + updates the palette that is used. + + @param colors Each character in the 6-char string represents the + first letter of the color to use for + P0/M0/P1/M1/PF/BL, respectively. + */ + void setFixedColorPalette(const string& colors); + /** Enable/disable/query state of 'undriven/floating TIA pins'. @@ -373,25 +384,26 @@ class TIA : public Device enum HState {blank, frame}; enum Priority {pfp, score, normal}; - enum FixedColors { - P0ColorNTSC = 0x30, // red - M0ColorNTSC = 0x38, // orange - P1ColorNTSC = 0x1c, // yellow - M1ColorNTSC = 0xc4, // green - PFColorNTSC = 0x9e, // blue - BLColorNTSC = 0x66, // purple - BKColorNTSC = 0x0a, // grey + enum FixedColor { + NTSC_RED = 0x30, + NTSC_ORANGE = 0x38, + NTSC_YELLOW = 0x1c, + NTSC_GREEN = 0xc4, + NTSC_BLUE = 0x9e, + NTSC_PURPLE = 0x66, - P0ColorPAL = 0x62, // red - M0ColorPAL = 0x4a, // orange - P1ColorPAL = 0x2e, // yellow - M1ColorPAL = 0x34, // green - PFColorPAL = 0xbc, // blue - BLColorPAL = 0xa6, // purple - BKColorPAL = 0x0a, // grey + PAL_RED = 0x62, + PAL_ORANGE = 0x4a, + PAL_YELLOW = 0x2e, + PAL_GREEN = 0x34, + PAL_BLUE = 0xbc, + PAL_PURPLE = 0xa6, - HBLANKColor = 0x0e // white + BK_GREY = 0x0a, + HBLANK_WHITE = 0x0e }; + enum FixedObject { P0, M0, P1, M1, PF, BL }; + FixedColor myFixedColorPalette[2][6]; private: