diff --git a/src/emucore/tia/DrawCounterDecodes.cxx b/src/emucore/tia/DrawCounterDecodes.cxx index 4ae84f86f..68b309684 100644 --- a/src/emucore/tia/DrawCounterDecodes.cxx +++ b/src/emucore/tia/DrawCounterDecodes.cxx @@ -42,16 +42,17 @@ DrawCounterDecodes::DrawCounterDecodes() for (uInt8 *decodes : decodeTables) { - memset(decodes, 0, 160); - decodes[156] = 1; + memset(decodes, 0, 160); // TJ: magic number 160 = pixel/scanline + decodes[156] = 1; // TJ: set for all copy pattern (first copy) } - myDecodes1[12] = 1; - myDecodes2[28] = 1; - myDecodes3[12] = myDecodes3[28] = 1; - myDecodes4[60] = 1; - myDecodes6[28] = myDecodes6[60] = 1; + myDecodes1[12] = 2; // TJ: two copies close (+16) + myDecodes2[28] = 2; // TJ: two copies med (+32) + myDecodes3[12] = 2; myDecodes3[28] = 3; // TJ: three copies close (+16, +32) + myDecodes4[60] = 2; // TJ: two copies wide (+64) + myDecodes6[28] = 2; myDecodes6[60] = 3; // TJ: three copies medium (+32, +64) + // TJ: assigning decodes to players myPlayerDecodes[0] = myDecodes0; myPlayerDecodes[1] = myDecodes1; myPlayerDecodes[2] = myDecodes2; @@ -61,6 +62,7 @@ DrawCounterDecodes::DrawCounterDecodes() myPlayerDecodes[6] = myDecodes6; myPlayerDecodes[7] = myDecodes0; + // TJ: assigning decodes to missiles myMissileDecodes[0] = myDecodes0; myMissileDecodes[1] = myDecodes1; myMissileDecodes[2] = myDecodes2; diff --git a/src/emucore/tia/DrawCounterDecodes.hxx b/src/emucore/tia/DrawCounterDecodes.hxx index 53c7c725f..4a42e86fd 100644 --- a/src/emucore/tia/DrawCounterDecodes.hxx +++ b/src/emucore/tia/DrawCounterDecodes.hxx @@ -36,10 +36,11 @@ class DrawCounterDecodes private: - uInt8* myPlayerDecodes[8]{nullptr}; + uInt8* myPlayerDecodes[8]{nullptr}; // TJ: one per NUSIZ number and size - uInt8* myMissileDecodes[8]{nullptr}; + uInt8* myMissileDecodes[8]{nullptr}; // TJ: one per NUSIZ number and size + // TJ: 6 scanline pixel arrays, one for each copy pattern uInt8 myDecodes0[160], myDecodes1[160], myDecodes2[160], myDecodes3[160], myDecodes4[160], myDecodes6[160]; diff --git a/src/emucore/tia/Missile.cxx b/src/emucore/tia/Missile.cxx index 14a34f90b..f5922d3a2 100644 --- a/src/emucore/tia/Missile.cxx +++ b/src/emucore/tia/Missile.cxx @@ -40,6 +40,7 @@ void Missile::reset() myIsRendering = false; myIsVisible = false; myRenderCounter = 0; + myCopy = 1; myColor = myObjectColor = myDebugColor = 0; myDebugEnabled = false; collision = myCollisionMaskDisabled; @@ -220,6 +221,23 @@ void Missile::applyColors() myColor = myDebugColor; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 Missile::getColor() const +{ + if(!myDebugEnabled) + return myColor; + else + switch (myCopy) + { + case 2: + return myColor - 2; + case 3: + return myColor + 2; + default: + return myColor; + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 Missile::getPosition() const { diff --git a/src/emucore/tia/Missile.hxx b/src/emucore/tia/Missile.hxx index 32f13294c..2279adc04 100644 --- a/src/emucore/tia/Missile.hxx +++ b/src/emucore/tia/Missile.hxx @@ -65,7 +65,7 @@ class Missile : public Serializable void toggleEnabled(bool enabled); bool isOn() const { return (collision & 0x8000); } - uInt8 getColor() const { return myColor; } + uInt8 getColor() const; uInt8 getPosition() const; void setPosition(uInt8 newPosition); @@ -115,6 +115,7 @@ class Missile : public Serializable bool myIsRendering{false}; bool myIsVisible{false}; Int8 myRenderCounter{0}; + Int8 myCopy{1}; const uInt8* myDecodes{nullptr}; uInt8 myDecodesOffset{0}; // needed for state saving @@ -169,6 +170,7 @@ void Missile::tick(uInt8 hclock, bool isReceivingMclock) if (myDecodes[myCounter] && !myResmp) { myIsRendering = true; myRenderCounter = renderCounterOffset; + myCopy = myDecodes[myCounter]; } else if (myIsRendering) { if (myRenderCounter == -1) { diff --git a/src/emucore/tia/Player.cxx b/src/emucore/tia/Player.cxx index 7dfd173a4..793a825bb 100644 --- a/src/emucore/tia/Player.cxx +++ b/src/emucore/tia/Player.cxx @@ -34,6 +34,7 @@ void Player::reset() isMoving = false; myIsRendering = false; myRenderCounter = 0; + myCopy = 1; myPatternOld = 0; myPatternNew = 0; myIsReflected = 0; @@ -355,6 +356,23 @@ void Player::applyColors() myColor = myDebugColor; } +// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +uInt8 Player::getColor() const +{ + if(!myDebugEnabled) + return myColor; + else + switch(myCopy) + { + case 2: + return myColor - 2; + case 3: + return myColor + 2; + default: + return myColor; + } +} + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - uInt8 Player::getPosition() const { diff --git a/src/emucore/tia/Player.hxx b/src/emucore/tia/Player.hxx index 4b9778697..e7d2d3382 100644 --- a/src/emucore/tia/Player.hxx +++ b/src/emucore/tia/Player.hxx @@ -67,7 +67,7 @@ class Player : public Serializable uInt8 getClock() const { return myCounter; } bool isOn() const { return (collision & 0x8000); } - uInt8 getColor() const { return myColor; } + uInt8 getColor() const; void shufflePatterns(); @@ -125,6 +125,7 @@ class Player : public Serializable bool myIsRendering{false}; Int8 myRenderCounter{0}; Int8 myRenderCounterTripPoint{0}; + Int8 myCopy{1}; uInt8 myDivider{0}; uInt8 myDividerPending{0}; uInt8 mySampleCounter{0}; @@ -186,6 +187,7 @@ void Player::tick() myIsRendering = true; mySampleCounter = 0; myRenderCounter = renderCounterOffset; + myCopy = myDecodes[myCounter]; } else if (myIsRendering) { ++myRenderCounter; diff --git a/src/emucore/tia/TIA.hxx b/src/emucore/tia/TIA.hxx index d12dd62fd..67c7d9da5 100644 --- a/src/emucore/tia/TIA.hxx +++ b/src/emucore/tia/TIA.hxx @@ -76,7 +76,7 @@ class TIA : public Device * Possible palette entries for objects in "fixed debug color mode". */ enum FixedColor { - NTSC_RED = 0x30, + NTSC_RED = 0x42, NTSC_ORANGE = 0x38, NTSC_YELLOW = 0x1c, NTSC_GREEN = 0xc6, @@ -86,7 +86,7 @@ class TIA : public Device PAL_RED = 0x62, PAL_ORANGE = 0x4a, - PAL_YELLOW = 0x2e, + PAL_YELLOW = 0x2c, PAL_GREEN = 0x36, PAL_BLUE = 0xbc, PAL_PURPLE = 0xa6,