Enabled viewing TIA collision and playfield info in the debugger.

This commit is contained in:
Stephen Anthony 2016-12-13 12:03:54 -03:30
parent 7b0a82f04a
commit f982f0257f
4 changed files with 125 additions and 61 deletions

View File

@ -320,22 +320,26 @@ bool TIADebug::priorityPF(int newVal)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool TIADebug::collision(int collID)
bool TIADebug::collision(CollisionBit id) const
{
#if 0 // FIXME
uInt32 mask = 1 << collID;
if(newVal > -1)
switch(id)
{
if(newVal)
myTIA.myCollision |= mask;
else
myTIA.myCollision &= ~mask;
case Cx_M0P1: return myTIA.collCXM0P() & 0x80;
case Cx_M0P0: return myTIA.collCXM0P() & 0x40;
case Cx_M1P0: return myTIA.collCXM1P() & 0x80;
case Cx_M1P1: return myTIA.collCXM1P() & 0x40;
case Cx_P0PF: return myTIA.collCXP0FB() & 0x80;
case Cx_P0BL: return myTIA.collCXP0FB() & 0x40;
case Cx_P1PF: return myTIA.collCXP1FB() & 0x80;
case Cx_P1BL: return myTIA.collCXP1FB() & 0x40;
case Cx_M0PF: return myTIA.collCXM0FB() & 0x80;
case Cx_M0BL: return myTIA.collCXM0FB() & 0x40;
case Cx_M1PF: return myTIA.collCXM1FB() & 0x80;
case Cx_M1BL: return myTIA.collCXM1FB() & 0x40;
case Cx_BLPF: return myTIA.collCXBLPF() & 0x80;
case Cx_P0P1: return myTIA.collCXPPMM() & 0x80;
case Cx_M0M1: return myTIA.collCXPPMM() & 0x40;
}
return myTIA.myCollision & mask;
#endif
return 0;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -416,7 +420,7 @@ uInt8 TIADebug::pf0(int newVal)
if(newVal > -1)
mySystem.poke(PF0, newVal << 4);
return myTIA.myPlayfield.pf0() & 0x0f;
return myTIA.myPlayfield.pf0();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -425,7 +429,7 @@ uInt8 TIADebug::pf1(int newVal)
if(newVal > -1)
mySystem.poke(PF1, newVal);
return (myTIA.myPlayfield.pf1() & 0xff0) >> 4;
return myTIA.myPlayfield.pf1();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -434,7 +438,7 @@ uInt8 TIADebug::pf2(int newVal)
if(newVal > -1)
mySystem.poke(PF2, newVal);
return (myTIA.myPlayfield.pf2() & 0xff000) >> 12;
return myTIA.myPlayfield.pf2();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -121,21 +121,21 @@ class TIADebug : public DebuggerSystem
bool priorityPF(int newVal = -1);
// Collision registers
bool collM0_P1() { return collision(0); }
bool collM0_P0() { return collision(1); }
bool collM1_P0() { return collision(2); }
bool collM1_P1() { return collision(3); }
bool collP0_PF() { return collision(4); }
bool collP0_BL() { return collision(5); }
bool collP1_PF() { return collision(6); }
bool collP1_BL() { return collision(7); }
bool collM0_PF() { return collision(8); }
bool collM0_BL() { return collision(9); }
bool collM1_PF() { return collision(10); }
bool collM1_BL() { return collision(11); }
bool collBL_PF() { return collision(12); }
bool collP0_P1() { return collision(13); }
bool collM0_M1() { return collision(14); }
bool collM0_P1() const { return collision(Cx_M0P1); }
bool collM0_P0() const { return collision(Cx_M0P0); }
bool collM1_P0() const { return collision(Cx_M1P0); }
bool collM1_P1() const { return collision(Cx_M1P1); }
bool collP0_PF() const { return collision(Cx_P0PF); }
bool collP0_BL() const { return collision(Cx_P0BL); }
bool collP1_PF() const { return collision(Cx_P1PF); }
bool collP1_BL() const { return collision(Cx_P1BL); }
bool collM0_PF() const { return collision(Cx_M0PF); }
bool collM0_BL() const { return collision(Cx_M0BL); }
bool collM1_PF() const { return collision(Cx_M1PF); }
bool collM1_BL() const { return collision(Cx_M1BL); }
bool collBL_PF() const { return collision(Cx_BLPF); }
bool collP0_P1() const { return collision(Cx_P0P1); }
bool collM0_M1() const { return collision(Cx_M0M1); }
// TIA strobe registers
void strobeWsync() { mySystem.poke(WSYNC, 0); }
@ -163,7 +163,7 @@ class TIADebug : public DebuggerSystem
string colorSwatch(uInt8 c);
/** Get specific bits in the collision register (used by collXX_XX) */
bool collision(int collID);
bool collision(CollisionBit id) const;
string audFreq(uInt8 div);
string booleanWithLabel(string label, bool value);

View File

@ -251,56 +251,35 @@ uInt8 TIA::peek(uInt16 address)
switch (address & 0x0F) {
case CXM0P:
result = (
((myCollisionMask & CollisionMask::missile0 & CollisionMask::player0) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile0 & CollisionMask::player1) ? 0x80 : 0)
);
result = collCXM0P();
break;
case CXM1P:
result = (
((myCollisionMask & CollisionMask::missile1 & CollisionMask::player1) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile1 & CollisionMask::player0) ? 0x80 : 0)
);
result = collCXM1P();
break;
case CXP0FB:
result = (
((myCollisionMask & CollisionMask::player0 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::player0 & CollisionMask::playfield) ? 0x80 : 0)
);
result = collCXP0FB();
break;
case CXP1FB:
result = (
((myCollisionMask & CollisionMask::player1 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::player1 & CollisionMask::playfield) ? 0x80 : 0)
);
result = collCXP1FB();
break;
case CXM0FB:
result = (
((myCollisionMask & CollisionMask::missile0 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile0 & CollisionMask::playfield) ? 0x80 : 0)
);
result = collCXM0FB();
break;
case CXM1FB:
result = (
((myCollisionMask & CollisionMask::missile1 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile1 & CollisionMask::playfield) ? 0x80 : 0)
);
result = collCXM1FB();
break;
case CXPPMM:
result = (
((myCollisionMask & CollisionMask::missile0 & CollisionMask::missile1) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::player0 & CollisionMask::player1) ? 0x80 : 0)
);
result = collCXPPMM();
break;
case CXBLPF:
result = (myCollisionMask & CollisionMask::ball & CollisionMask::playfield) ? 0x80 : 0;
result = collCXBLPF();
break;
case INPT0:
@ -1245,3 +1224,72 @@ void TIA::updatePaddle(uInt8 idx)
myPaddleReaders[idx].update(double(resistance) / MAX_RESISTANCE,
myTimestamp, myFrameManager.tvMode());
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXM0P() const
{
return (
((myCollisionMask & CollisionMask::missile0 & CollisionMask::player0) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile0 & CollisionMask::player1) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXM1P() const
{
return (
((myCollisionMask & CollisionMask::missile1 & CollisionMask::player1) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile1 & CollisionMask::player0) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXP0FB() const
{
return (
((myCollisionMask & CollisionMask::player0 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::player0 & CollisionMask::playfield) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXP1FB() const
{
return (
((myCollisionMask & CollisionMask::player1 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::player1 & CollisionMask::playfield) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXM0FB() const
{
return (
((myCollisionMask & CollisionMask::missile0 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile0 & CollisionMask::playfield) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXM1FB() const
{
return (
((myCollisionMask & CollisionMask::missile1 & CollisionMask::ball) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::missile1 & CollisionMask::playfield) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXPPMM() const
{
return (
((myCollisionMask & CollisionMask::missile0 & CollisionMask::missile1) ? 0x40 : 0) |
((myCollisionMask & CollisionMask::player0 & CollisionMask::player1) ? 0x80 : 0)
);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt8 TIA::collCXBLPF() const
{
return (myCollisionMask & CollisionMask::ball & CollisionMask::playfield) ? 0x80 : 0;
}

View File

@ -387,6 +387,18 @@ class TIA : public Device
void updatePaddle(uInt8 idx);
/**
Get the result of the specified collision register.
*/
uInt8 collCXM0P() const;
uInt8 collCXM1P() const;
uInt8 collCXP0FB() const;
uInt8 collCXP1FB() const;
uInt8 collCXM0FB() const;
uInt8 collCXM1FB() const;
uInt8 collCXPPMM() const;
uInt8 collCXBLPF() const;
private:
Console& myConsole;