mirror of https://github.com/stella-emu/stella.git
Renamed some of the TIA tables to shorter names.
git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1673 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
378549a715
commit
ada27762f5
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIA.cxx,v 1.103 2009-01-24 18:17:34 stephena Exp $
|
||||
// $Id: TIA.cxx,v 1.104 2009-02-08 21:07:06 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
//#define DEBUG_HMOVE
|
||||
|
@ -143,12 +143,12 @@ void TIA::reset()
|
|||
// Some default values for the "current" variables
|
||||
myCurrentGRP0 = 0;
|
||||
myCurrentGRP1 = 0;
|
||||
myCurrentBLMask = TIATables::BallMaskTable[0][0];
|
||||
myCurrentM0Mask = TIATables::MissleMaskTable[0][0][0];
|
||||
myCurrentM1Mask = TIATables::MissleMaskTable[0][0][0];
|
||||
myCurrentP0Mask = TIATables::PlayerMaskTable[0][0][0];
|
||||
myCurrentP1Mask = TIATables::PlayerMaskTable[0][0][0];
|
||||
myCurrentPFMask = TIATables::PlayfieldTable[0];
|
||||
myCurrentBLMask = TIATables::BLMask[0][0];
|
||||
myCurrentM0Mask = TIATables::MxMask[0][0][0];
|
||||
myCurrentM1Mask = TIATables::MxMask[0][0][0];
|
||||
myCurrentP0Mask = TIATables::PxMask[0][0][0];
|
||||
myCurrentP1Mask = TIATables::PxMask[0][0][0];
|
||||
myCurrentPFMask = TIATables::PFMask[0];
|
||||
|
||||
myMotionClockP0 = 0;
|
||||
myMotionClockP1 = 0;
|
||||
|
@ -341,12 +341,12 @@ bool TIA::save(Serializer& out) const
|
|||
out.putByte((char)myCurrentGRP1);
|
||||
|
||||
// pointers
|
||||
// myCurrentBLMask = TIATables::BallMaskTable[0][0];
|
||||
// myCurrentM0Mask = TIATables::MissleMaskTable[0][0][0];
|
||||
// myCurrentM1Mask = TIATables::MissleMaskTable[0][0][0];
|
||||
// myCurrentP0Mask = TIATables::PlayerMaskTable[0][0][0];
|
||||
// myCurrentP1Mask = TIATables::PlayerMaskTable[0][0][0];
|
||||
// myCurrentPFMask = TIATables::PlayfieldTable[0];
|
||||
// myCurrentBLMask = TIATables::BLMask[0][0];
|
||||
// myCurrentM0Mask = TIATables::MxMask[0][0][0];
|
||||
// myCurrentM1Mask = TIATables::MxMask[0][0][0];
|
||||
// myCurrentP0Mask = TIATables::PxMask[0][0][0];
|
||||
// myCurrentP1Mask = TIATables::PxMask[0][0][0];
|
||||
// myCurrentPFMask = TIATables::PFMask[0];
|
||||
|
||||
out.putInt(myLastHMOVEClock);
|
||||
out.putBool(myHMOVEBlankEnabled);
|
||||
|
@ -438,12 +438,12 @@ bool TIA::load(Deserializer& in)
|
|||
myCurrentGRP1 = (uInt8) in.getByte();
|
||||
|
||||
// pointers
|
||||
// myCurrentBLMask = TIATables::BallMaskTable[0][0];
|
||||
// myCurrentM0Mask = TIATables::MissleMaskTable[0][0][0];
|
||||
// myCurrentM1Mask = TIATables::MissleMaskTable[0][0][0];
|
||||
// myCurrentP0Mask = TIATables::PlayerMaskTable[0][0][0];
|
||||
// myCurrentP1Mask = TIATables::PlayerMaskTable[0][0][0];
|
||||
// myCurrentPFMask = TIATables::PlayfieldTable[0];
|
||||
// myCurrentBLMask = TIATables::BLMask[0][0];
|
||||
// myCurrentM0Mask = TIATables::MxMask[0][0][0];
|
||||
// myCurrentM1Mask = TIATables::MxMask[0][0][0];
|
||||
// myCurrentP0Mask = TIATables::PxMask[0][0][0];
|
||||
// myCurrentP1Mask = TIATables::PxMask[0][0][0];
|
||||
// myCurrentPFMask = TIATables::PFMask[0];
|
||||
|
||||
myLastHMOVEClock = (Int32) in.getInt();
|
||||
myHMOVEBlankEnabled = in.getBool();
|
||||
|
@ -812,7 +812,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
myCOLUP0 : ((myCurrentGRP1 & *mP1) ? myCOLUP1 : myCOLUBK);
|
||||
|
||||
if((myCurrentGRP0 & *mP0) && (myCurrentGRP1 & *mP1))
|
||||
myCollision |= TIATables::CollisionTable[P0Bit | P1Bit];
|
||||
myCollision |= TIATables::CollisionMask[P0Bit | P1Bit];
|
||||
|
||||
++mP0; ++mP1; ++myFramePointer;
|
||||
}
|
||||
|
@ -913,7 +913,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
*myFramePointer = *mM0 ? myCOLUP0 : (*mM1 ? myCOLUP1 : myCOLUBK);
|
||||
|
||||
if(*mM0 && *mM1)
|
||||
myCollision |= TIATables::CollisionTable[M0Bit | M1Bit];
|
||||
myCollision |= TIATables::CollisionMask[M0Bit | M1Bit];
|
||||
|
||||
++mM0; ++mM1; ++myFramePointer;
|
||||
}
|
||||
|
@ -940,7 +940,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
*myFramePointer = (*mM0 ? myCOLUP0 : (*mBL ? myCOLUPF : myCOLUBK));
|
||||
|
||||
if(*mBL && *mM0)
|
||||
myCollision |= TIATables::CollisionTable[BLBit | M0Bit];
|
||||
myCollision |= TIATables::CollisionMask[BLBit | M0Bit];
|
||||
|
||||
++mBL; ++mM0; ++myFramePointer;
|
||||
}
|
||||
|
@ -967,7 +967,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
*myFramePointer = (*mBL ? myCOLUPF : (*mM0 ? myCOLUP0 : myCOLUBK));
|
||||
|
||||
if(*mBL && *mM0)
|
||||
myCollision |= TIATables::CollisionTable[BLBit | M0Bit];
|
||||
myCollision |= TIATables::CollisionMask[BLBit | M0Bit];
|
||||
|
||||
++mBL; ++mM0; ++myFramePointer;
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
*myFramePointer = (*mM1 ? myCOLUP1 : (*mBL ? myCOLUPF : myCOLUBK));
|
||||
|
||||
if(*mBL && *mM1)
|
||||
myCollision |= TIATables::CollisionTable[BLBit | M1Bit];
|
||||
myCollision |= TIATables::CollisionMask[BLBit | M1Bit];
|
||||
|
||||
++mBL; ++mM1; ++myFramePointer;
|
||||
}
|
||||
|
@ -1023,7 +1023,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
*myFramePointer = (*mBL ? myCOLUPF : (*mM1 ? myCOLUP1 : myCOLUBK));
|
||||
|
||||
if(*mBL && *mM1)
|
||||
myCollision |= TIATables::CollisionTable[BLBit | M1Bit];
|
||||
myCollision |= TIATables::CollisionMask[BLBit | M1Bit];
|
||||
|
||||
++mBL; ++mM1; ++myFramePointer;
|
||||
}
|
||||
|
@ -1051,7 +1051,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
(*mBL ? myCOLUPF : myCOLUBK);
|
||||
|
||||
if(*mBL && (myCurrentGRP1 & *mP1))
|
||||
myCollision |= TIATables::CollisionTable[BLBit | P1Bit];
|
||||
myCollision |= TIATables::CollisionMask[BLBit | P1Bit];
|
||||
|
||||
++mBL; ++mP1; ++myFramePointer;
|
||||
}
|
||||
|
@ -1079,7 +1079,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
((myCurrentGRP1 & *mP1) ? myCOLUP1 : myCOLUBK);
|
||||
|
||||
if(*mBL && (myCurrentGRP1 & *mP1))
|
||||
myCollision |= TIATables::CollisionTable[BLBit | P1Bit];
|
||||
myCollision |= TIATables::CollisionMask[BLBit | P1Bit];
|
||||
|
||||
++mBL; ++mP1; ++myFramePointer;
|
||||
}
|
||||
|
@ -1106,7 +1106,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
myCOLUP0 : ((myPF & *mPF) ? myCOLUPF : myCOLUBK);
|
||||
|
||||
if((myPF & *mPF) && (myCurrentGRP0 & *mP0))
|
||||
myCollision |= TIATables::CollisionTable[PFBit | P0Bit];
|
||||
myCollision |= TIATables::CollisionMask[PFBit | P0Bit];
|
||||
|
||||
++mPF; ++mP0; ++myFramePointer;
|
||||
}
|
||||
|
@ -1134,7 +1134,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
((myCurrentGRP0 & *mP0) ? myCOLUP0 : myCOLUBK);
|
||||
|
||||
if((myPF & *mPF) && (myCurrentGRP0 & *mP0))
|
||||
myCollision |= TIATables::CollisionTable[PFBit | P0Bit];
|
||||
myCollision |= TIATables::CollisionMask[PFBit | P0Bit];
|
||||
|
||||
++mPF; ++mP0; ++myFramePointer;
|
||||
}
|
||||
|
@ -1162,7 +1162,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
myCOLUP1 : ((myPF & *mPF) ? myCOLUPF : myCOLUBK);
|
||||
|
||||
if((myPF & *mPF) && (myCurrentGRP1 & *mP1))
|
||||
myCollision |= TIATables::CollisionTable[PFBit | P1Bit];
|
||||
myCollision |= TIATables::CollisionMask[PFBit | P1Bit];
|
||||
|
||||
++mPF; ++mP1; ++myFramePointer;
|
||||
}
|
||||
|
@ -1190,7 +1190,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
((myCurrentGRP1 & *mP1) ? myCOLUP1 : myCOLUBK);
|
||||
|
||||
if((myPF & *mPF) && (myCurrentGRP1 & *mP1))
|
||||
myCollision |= TIATables::CollisionTable[PFBit | P1Bit];
|
||||
myCollision |= TIATables::CollisionMask[PFBit | P1Bit];
|
||||
|
||||
++mPF; ++mP1; ++myFramePointer;
|
||||
}
|
||||
|
@ -1218,7 +1218,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
*myFramePointer = ((myPF & *mPF) || *mBL) ? myCOLUPF : myCOLUBK;
|
||||
|
||||
if((myPF & *mPF) && *mBL)
|
||||
myCollision |= TIATables::CollisionTable[PFBit | BLBit];
|
||||
myCollision |= TIATables::CollisionMask[PFBit | BLBit];
|
||||
|
||||
++mPF; ++mBL; ++myFramePointer;
|
||||
}
|
||||
|
@ -1248,7 +1248,7 @@ inline void TIA::updateFrameScanline(uInt32 clocksToUpdate, uInt32 hpos)
|
|||
if((myEnabledObjects & M0Bit) && myCurrentM0Mask[hpos])
|
||||
enabled |= M0Bit;
|
||||
|
||||
myCollision |= TIATables::CollisionTable[enabled];
|
||||
myCollision |= TIATables::CollisionMask[enabled];
|
||||
*myFramePointer = myColor[myPriorityEncoder[hpos < 80 ? 0 : 1]
|
||||
[enabled | myPlayfieldPriorityAndScore]];
|
||||
}
|
||||
|
@ -1344,14 +1344,14 @@ void TIA::updateFrame(Int32 clock)
|
|||
if(myClocksToEndOfScanLine == 228)
|
||||
{
|
||||
// Yes, so set PF mask based on current CTRLPF reflection state
|
||||
myCurrentPFMask = TIATables::PlayfieldTable[myCTRLPF & 0x01];
|
||||
myCurrentPFMask = TIATables::PFMask[myCTRLPF & 0x01];
|
||||
|
||||
// TODO: These should be reset right after the first copy of the player
|
||||
// has passed. However, for now we'll just reset at the end of the
|
||||
// scanline since the other way would be to slow (01/21/99).
|
||||
myCurrentP0Mask = &TIATables::PlayerMaskTable[myPOSP0 & 0x03]
|
||||
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
|
||||
[0][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
|
||||
myCurrentP1Mask = &TIATables::PlayerMaskTable[myPOSP1 & 0x03]
|
||||
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
|
||||
[0][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
|
||||
|
||||
#ifndef NO_HMOVE_FIXES
|
||||
|
@ -1372,18 +1372,18 @@ void TIA::updateFrame(Int32 clock)
|
|||
if(myM0CosmicArkCounter == 1)
|
||||
{
|
||||
// Stretch this missle so it's at least 2 pixels wide
|
||||
myCurrentM0Mask = &TIATables::MissleMaskTable[myPOSM0 & 0x03]
|
||||
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
|
||||
[myNUSIZ0 & 0x07][((myNUSIZ0 & 0x30) >> 4) | 0x01]
|
||||
[160 - (myPOSM0 & 0xFC)];
|
||||
}
|
||||
else if(myM0CosmicArkCounter == 2)
|
||||
{
|
||||
// Missle is disabled on this line
|
||||
myCurrentM0Mask = &TIATables::DisabledMaskTable[0];
|
||||
myCurrentM0Mask = &TIATables::DisabledMask[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
myCurrentM0Mask = &TIATables::MissleMaskTable[myPOSM0 & 0x03]
|
||||
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
|
||||
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
|
||||
}
|
||||
}
|
||||
|
@ -1547,7 +1547,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
addr = addr & 0x003f;
|
||||
|
||||
Int32 clock = mySystem->cycles() * 3;
|
||||
Int16 delay = TIATables::PokeDelayTable[addr];
|
||||
Int16 delay = TIATables::PokeDelay[addr];
|
||||
|
||||
// See if this is a poke to a PF register
|
||||
if(delay == -1)
|
||||
|
@ -1641,10 +1641,10 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
// TODO: Technically the "enable" part, [0], should depend on the current
|
||||
// enabled or disabled state. This mean we probably need a data member
|
||||
// to maintain that state (01/21/99).
|
||||
myCurrentP0Mask = &TIATables::PlayerMaskTable[myPOSP0 & 0x03]
|
||||
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
|
||||
[0][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
|
||||
|
||||
myCurrentM0Mask = &TIATables::MissleMaskTable[myPOSM0 & 0x03]
|
||||
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
|
||||
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
|
||||
|
||||
break;
|
||||
|
@ -1657,10 +1657,10 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
// TODO: Technically the "enable" part, [0], should depend on the current
|
||||
// enabled or disabled state. This mean we probably need a data member
|
||||
// to maintain that state (01/21/99).
|
||||
myCurrentP1Mask = &TIATables::PlayerMaskTable[myPOSP1 & 0x03]
|
||||
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
|
||||
[0][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
|
||||
|
||||
myCurrentM1Mask = &TIATables::MissleMaskTable[myPOSM1 & 0x03]
|
||||
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
|
||||
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
|
||||
|
||||
break;
|
||||
|
@ -1723,10 +1723,10 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
// we're still on the left hand side of the playfield
|
||||
if(((clock - myClockWhenFrameStarted) % 228) < (68 + 79))
|
||||
{
|
||||
myCurrentPFMask = TIATables::PlayfieldTable[myCTRLPF & 0x01];
|
||||
myCurrentPFMask = TIATables::PFMask[myCTRLPF & 0x01];
|
||||
}
|
||||
|
||||
myCurrentBLMask = &TIATables::BallMaskTable[myPOSBL & 0x03]
|
||||
myCurrentBLMask = &TIATables::BLMask[myPOSBL & 0x03]
|
||||
[(myCTRLPF & 0x30) >> 4][160 - (myPOSBL & 0xFC)];
|
||||
|
||||
break;
|
||||
|
@ -1738,7 +1738,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
if(((value & 0x08) && !myREFP0) || (!(value & 0x08) && myREFP0))
|
||||
{
|
||||
myREFP0 = (value & 0x08);
|
||||
myCurrentGRP0 = TIATables::PlayerReflectTable[myCurrentGRP0];
|
||||
myCurrentGRP0 = TIATables::GRPReflect[myCurrentGRP0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1749,7 +1749,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
if(((value & 0x08) && !myREFP1) || (!(value & 0x08) && myREFP1))
|
||||
{
|
||||
myREFP1 = (value & 0x08);
|
||||
myCurrentGRP1 = TIATables::PlayerReflectTable[myCurrentGRP1];
|
||||
myCurrentGRP1 = TIATables::GRPReflect[myCurrentGRP1];
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1796,7 +1796,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
Int32 newx = hpos < HBLANK ? 3 : (((hpos - HBLANK) + 5) % 160);
|
||||
|
||||
// Find out under what condition the player is being reset
|
||||
Int8 when = TIATables::PlayerPositionResetWhenTable[myNUSIZ0 & 7][myPOSP0][newx];
|
||||
Int8 when = TIATables::PxPosResetWhen[myNUSIZ0 & 7][myPOSP0][newx];
|
||||
|
||||
#ifdef DEBUG_HMOVE
|
||||
if((clock - myLastHMOVEClock) < (24 * 3))
|
||||
|
@ -1817,7 +1817,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSP0 = newx;
|
||||
|
||||
// Setup the mask to skip the first copy of the player
|
||||
myCurrentP0Mask = &TIATables::PlayerMaskTable[myPOSP0 & 0x03]
|
||||
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
|
||||
[1][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
|
||||
}
|
||||
// Player is being reset in neither the delay nor display section
|
||||
|
@ -1826,7 +1826,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSP0 = newx;
|
||||
|
||||
// So we setup the mask to skip the first copy of the player
|
||||
myCurrentP0Mask = &TIATables::PlayerMaskTable[myPOSP0 & 0x03]
|
||||
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
|
||||
[1][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
|
||||
}
|
||||
// Player is being reset during the delay section of one of its copies
|
||||
|
@ -1835,7 +1835,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSP0 = newx;
|
||||
|
||||
// So we setup the mask to display all copies of the player
|
||||
myCurrentP0Mask = &TIATables::PlayerMaskTable[myPOSP0 & 0x03]
|
||||
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
|
||||
[0][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
|
||||
}
|
||||
break;
|
||||
|
@ -1847,7 +1847,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
Int32 newx = hpos < HBLANK ? 3 : (((hpos - HBLANK) + 5) % 160);
|
||||
|
||||
// Find out under what condition the player is being reset
|
||||
Int8 when = TIATables::PlayerPositionResetWhenTable[myNUSIZ1 & 7][myPOSP1][newx];
|
||||
Int8 when = TIATables::PxPosResetWhen[myNUSIZ1 & 7][myPOSP1][newx];
|
||||
|
||||
#ifdef DEBUG_HMOVE
|
||||
if((clock - myLastHMOVEClock) < (24 * 3))
|
||||
|
@ -1868,7 +1868,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSP1 = newx;
|
||||
|
||||
// Setup the mask to skip the first copy of the player
|
||||
myCurrentP1Mask = &TIATables::PlayerMaskTable[myPOSP1 & 0x03]
|
||||
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
|
||||
[1][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
|
||||
}
|
||||
// Player is being reset in neither the delay nor display section
|
||||
|
@ -1877,7 +1877,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSP1 = newx;
|
||||
|
||||
// So we setup the mask to skip the first copy of the player
|
||||
myCurrentP1Mask = &TIATables::PlayerMaskTable[myPOSP1 & 0x03]
|
||||
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
|
||||
[1][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
|
||||
}
|
||||
// Player is being reset during the delay section of one of its copies
|
||||
|
@ -1886,7 +1886,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSP1 = newx;
|
||||
|
||||
// So we setup the mask to display all copies of the player
|
||||
myCurrentP1Mask = &TIATables::PlayerMaskTable[myPOSP1 & 0x03]
|
||||
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
|
||||
[0][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
|
||||
}
|
||||
break;
|
||||
|
@ -1920,7 +1920,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSM0 = 8;
|
||||
}
|
||||
#endif
|
||||
myCurrentM0Mask = &TIATables::MissleMaskTable[myPOSM0 & 0x03]
|
||||
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
|
||||
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
|
||||
break;
|
||||
}
|
||||
|
@ -1946,7 +1946,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSM1 = 3;
|
||||
}
|
||||
#endif
|
||||
myCurrentM1Mask = &TIATables::MissleMaskTable[myPOSM1 & 0x03]
|
||||
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
|
||||
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
|
||||
break;
|
||||
}
|
||||
|
@ -2018,7 +2018,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myPOSBL = 8;
|
||||
}
|
||||
#endif
|
||||
myCurrentBLMask = &TIATables::BallMaskTable[myPOSBL & 0x03]
|
||||
myCurrentBLMask = &TIATables::BLMask[myPOSBL & 0x03]
|
||||
[(myCTRLPF & 0x30) >> 4][160 - (myPOSBL & 0xFC)];
|
||||
break;
|
||||
}
|
||||
|
@ -2075,11 +2075,11 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
|
||||
// Get the "current" data for GRP0 base on delay register and reflect
|
||||
uInt8 grp0 = myVDELP0 ? myDGRP0 : myGRP0;
|
||||
myCurrentGRP0 = myREFP0 ? TIATables::PlayerReflectTable[grp0] : grp0;
|
||||
myCurrentGRP0 = myREFP0 ? TIATables::GRPReflect[grp0] : grp0;
|
||||
|
||||
// Get the "current" data for GRP1 base on delay register and reflect
|
||||
uInt8 grp1 = myVDELP1 ? myDGRP1 : myGRP1;
|
||||
myCurrentGRP1 = myREFP1 ? TIATables::PlayerReflectTable[grp1] : grp1;
|
||||
myCurrentGRP1 = myREFP1 ? TIATables::GRPReflect[grp1] : grp1;
|
||||
|
||||
// Set enabled object bits
|
||||
if(myCurrentGRP0 != 0)
|
||||
|
@ -2108,11 +2108,11 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
|
||||
// Get the "current" data for GRP0 base on delay register
|
||||
uInt8 grp0 = myVDELP0 ? myDGRP0 : myGRP0;
|
||||
myCurrentGRP0 = myREFP0 ? TIATables::PlayerReflectTable[grp0] : grp0;
|
||||
myCurrentGRP0 = myREFP0 ? TIATables::GRPReflect[grp0] : grp0;
|
||||
|
||||
// Get the "current" data for GRP1 base on delay register
|
||||
uInt8 grp1 = myVDELP1 ? myDGRP1 : myGRP1;
|
||||
myCurrentGRP1 = myREFP1 ? TIATables::PlayerReflectTable[grp1] : grp1;
|
||||
myCurrentGRP1 = myREFP1 ? TIATables::GRPReflect[grp1] : grp1;
|
||||
|
||||
// Set enabled object bits
|
||||
if(myCurrentGRP0 != 0)
|
||||
|
@ -2212,7 +2212,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myVDELP0 = value & 0x01;
|
||||
|
||||
uInt8 grp0 = myVDELP0 ? myDGRP0 : myGRP0;
|
||||
myCurrentGRP0 = myREFP0 ? TIATables::PlayerReflectTable[grp0] : grp0;
|
||||
myCurrentGRP0 = myREFP0 ? TIATables::GRPReflect[grp0] : grp0;
|
||||
|
||||
if(myCurrentGRP0 != 0)
|
||||
myEnabledObjects |= P0Bit;
|
||||
|
@ -2226,7 +2226,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myVDELP1 = value & 0x01;
|
||||
|
||||
uInt8 grp1 = myVDELP1 ? myDGRP1 : myGRP1;
|
||||
myCurrentGRP1 = myREFP1 ? TIATables::PlayerReflectTable[grp1] : grp1;
|
||||
myCurrentGRP1 = myREFP1 ? TIATables::GRPReflect[grp1] : grp1;
|
||||
|
||||
if(myCurrentGRP1 != 0)
|
||||
myEnabledObjects |= P1Bit;
|
||||
|
@ -2260,7 +2260,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
middle = 4;
|
||||
|
||||
myPOSM0 = (myPOSP0 + middle) % 160;
|
||||
myCurrentM0Mask = &TIATables::MissleMaskTable[myPOSM0 & 0x03]
|
||||
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
|
||||
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
|
||||
}
|
||||
|
||||
|
@ -2288,7 +2288,7 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
middle = 4;
|
||||
|
||||
myPOSM1 = (myPOSP1 + middle) % 160;
|
||||
myCurrentM1Mask = &TIATables::MissleMaskTable[myPOSM1 & 0x03]
|
||||
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
|
||||
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
|
||||
}
|
||||
|
||||
|
@ -2313,11 +2313,11 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
myHMOVEBlankEnabled = true;
|
||||
}
|
||||
|
||||
myPOSP0 += TIATables::CompleteMotionTable[x][myHMP0];
|
||||
myPOSP1 += TIATables::CompleteMotionTable[x][myHMP1];
|
||||
myPOSM0 += TIATables::CompleteMotionTable[x][myHMM0];
|
||||
myPOSM1 += TIATables::CompleteMotionTable[x][myHMM1];
|
||||
myPOSBL += TIATables::CompleteMotionTable[x][myHMBL];
|
||||
myPOSP0 += TIATables::CompleteMotion[x][myHMP0];
|
||||
myPOSP1 += TIATables::CompleteMotion[x][myHMP1];
|
||||
myPOSM0 += TIATables::CompleteMotion[x][myHMM0];
|
||||
myPOSM1 += TIATables::CompleteMotion[x][myHMM1];
|
||||
myPOSBL += TIATables::CompleteMotion[x][myHMBL];
|
||||
|
||||
if(myPOSP0 >= 160)
|
||||
myPOSP0 -= 160;
|
||||
|
@ -2344,17 +2344,17 @@ void TIA::poke(uInt16 addr, uInt8 value)
|
|||
else if(myPOSBL < 0)
|
||||
myPOSBL += 160;
|
||||
|
||||
myCurrentBLMask = &TIATables::BallMaskTable[myPOSBL & 0x03]
|
||||
myCurrentBLMask = &TIATables::BLMask[myPOSBL & 0x03]
|
||||
[(myCTRLPF & 0x30) >> 4][160 - (myPOSBL & 0xFC)];
|
||||
|
||||
myCurrentP0Mask = &TIATables::PlayerMaskTable[myPOSP0 & 0x03]
|
||||
myCurrentP0Mask = &TIATables::PxMask[myPOSP0 & 0x03]
|
||||
[0][myNUSIZ0 & 0x07][160 - (myPOSP0 & 0xFC)];
|
||||
myCurrentP1Mask = &TIATables::PlayerMaskTable[myPOSP1 & 0x03]
|
||||
myCurrentP1Mask = &TIATables::PxMask[myPOSP1 & 0x03]
|
||||
[0][myNUSIZ1 & 0x07][160 - (myPOSP1 & 0xFC)];
|
||||
|
||||
myCurrentM0Mask = &TIATables::MissleMaskTable[myPOSM0 & 0x03]
|
||||
myCurrentM0Mask = &TIATables::MxMask[myPOSM0 & 0x03]
|
||||
[myNUSIZ0 & 0x07][(myNUSIZ0 & 0x30) >> 4][160 - (myPOSM0 & 0xFC)];
|
||||
myCurrentM1Mask = &TIATables::MissleMaskTable[myPOSM1 & 0x03]
|
||||
myCurrentM1Mask = &TIATables::MxMask[myPOSM1 & 0x03]
|
||||
[myNUSIZ1 & 0x07][(myNUSIZ1 & 0x30) >> 4][160 - (myPOSM1 & 0xFC)];
|
||||
|
||||
// Remember what clock HMOVE occured at
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIATables.cxx,v 1.2 2009-02-07 21:50:05 stephena Exp $
|
||||
// $Id: TIATables.cxx,v 1.3 2009-02-08 21:07:06 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -25,116 +25,180 @@
|
|||
void TIATables::computeAllTables()
|
||||
{
|
||||
for(uInt32 i = 0; i < 640; ++i)
|
||||
DisabledMaskTable[i] = 0;
|
||||
DisabledMask[i] = 0;
|
||||
|
||||
computeBallMaskTable();
|
||||
computeCollisionTable();
|
||||
computeMissleMaskTable();
|
||||
computePlayerMaskTable();
|
||||
computePlayerPositionResetWhenTable();
|
||||
computePlayerReflectTable();
|
||||
computePlayfieldMaskTable();
|
||||
buildCollisionMaskTable();
|
||||
buildPxMaskTable();
|
||||
buildMxMaskTable();
|
||||
buildBLMaskTable();
|
||||
buildPFMaskTable();
|
||||
buildGRPReflectTable();
|
||||
buildPxPosResetWhenTable();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computeBallMaskTable()
|
||||
void TIATables::buildCollisionMaskTable()
|
||||
{
|
||||
for(uInt8 i = 0; i < 64; ++i)
|
||||
{
|
||||
CollisionMask[i] = 0;
|
||||
|
||||
if((i & M0Bit) && (i & P1Bit)) // M0-P1
|
||||
CollisionMask[i] |= 0x0001;
|
||||
|
||||
if((i & M0Bit) && (i & P0Bit)) // M0-P0
|
||||
CollisionMask[i] |= 0x0002;
|
||||
|
||||
if((i & M1Bit) && (i & P0Bit)) // M1-P0
|
||||
CollisionMask[i] |= 0x0004;
|
||||
|
||||
if((i & M1Bit) && (i & P1Bit)) // M1-P1
|
||||
CollisionMask[i] |= 0x0008;
|
||||
|
||||
if((i & P0Bit) && (i & PFBit)) // P0-PF
|
||||
CollisionMask[i] |= 0x0010;
|
||||
|
||||
if((i & P0Bit) && (i & BLBit)) // P0-BL
|
||||
CollisionMask[i] |= 0x0020;
|
||||
|
||||
if((i & P1Bit) && (i & PFBit)) // P1-PF
|
||||
CollisionMask[i] |= 0x0040;
|
||||
|
||||
if((i & P1Bit) && (i & BLBit)) // P1-BL
|
||||
CollisionMask[i] |= 0x0080;
|
||||
|
||||
if((i & M0Bit) && (i & PFBit)) // M0-PF
|
||||
CollisionMask[i] |= 0x0100;
|
||||
|
||||
if((i & M0Bit) && (i & BLBit)) // M0-BL
|
||||
CollisionMask[i] |= 0x0200;
|
||||
|
||||
if((i & M1Bit) && (i & PFBit)) // M1-PF
|
||||
CollisionMask[i] |= 0x0400;
|
||||
|
||||
if((i & M1Bit) && (i & BLBit)) // M1-BL
|
||||
CollisionMask[i] |= 0x0800;
|
||||
|
||||
if((i & BLBit) && (i & PFBit)) // BL-PF
|
||||
CollisionMask[i] |= 0x1000;
|
||||
|
||||
if((i & P0Bit) && (i & P1Bit)) // P0-P1
|
||||
CollisionMask[i] |= 0x2000;
|
||||
|
||||
if((i & M0Bit) && (i & M1Bit)) // M0-M1
|
||||
CollisionMask[i] |= 0x4000;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::buildPxMaskTable() // [4][2][8][320]
|
||||
{
|
||||
// First, calculate masks for alignment 0
|
||||
for(Int32 size = 0; size < 4; ++size)
|
||||
{
|
||||
Int32 x;
|
||||
Int32 x, enable, mode;
|
||||
|
||||
// Set all of the masks to false to start with
|
||||
// Set the player mask table to all zeros
|
||||
for(enable = 0; enable < 2; ++enable)
|
||||
for(mode = 0; mode < 8; ++mode)
|
||||
for(x = 0; x < 160; ++x)
|
||||
PxMask[0][enable][mode][x] = 0x00;
|
||||
|
||||
// Now, compute the player mask table
|
||||
for(enable = 0; enable < 2; ++enable)
|
||||
{
|
||||
for(mode = 0; mode < 8; ++mode)
|
||||
{
|
||||
for(x = 0; x < 160 + 72; ++x)
|
||||
{
|
||||
switch(mode)
|
||||
{
|
||||
case 0x00:
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
break;
|
||||
|
||||
case 0x01:
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 16) >= 0) && ((x - 16) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 16);
|
||||
break;
|
||||
|
||||
case 0x02:
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 32);
|
||||
break;
|
||||
|
||||
case 0x03:
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 16) >= 0) && ((x - 16) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 16);
|
||||
else if(((x - 32) >= 0) && ((x - 32) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 32);
|
||||
break;
|
||||
|
||||
case 0x04:
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 64) >= 0) && ((x - 64) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 64);
|
||||
break;
|
||||
|
||||
case 0x05:
|
||||
// For some reason in double size mode the player's output
|
||||
// is delayed by one pixel thus we use > instead of >=
|
||||
if((enable == 0) && (x > 0) && (x <= 16))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> ((x - 1)/2);
|
||||
break;
|
||||
|
||||
case 0x06:
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 32);
|
||||
else if(((x - 64) >= 0) && ((x - 64) < 8))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> (x - 64);
|
||||
break;
|
||||
|
||||
case 0x07:
|
||||
// For some reason in quad size mode the player's output
|
||||
// is delayed by one pixel thus we use > instead of >=
|
||||
if((enable == 0) && (x > 0) && (x <= 32))
|
||||
PxMask[0][enable][mode][x % 160] = 0x80 >> ((x - 1)/4);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy data into wrap-around area
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
BallMaskTable[0][size][x] = false;
|
||||
PxMask[0][enable][mode][x + 160] =
|
||||
PxMask[0][enable][mode][x];
|
||||
}
|
||||
|
||||
// Set the necessary fields true
|
||||
for(x = 0; x < 160 + 8; ++x)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
{
|
||||
BallMaskTable[0][size][x % 160] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy fields into the wrap-around area of the mask
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
BallMaskTable[0][size][x + 160] = BallMaskTable[0][size][x];
|
||||
}
|
||||
}
|
||||
|
||||
// Now, copy data for alignments of 1, 2 and 3
|
||||
for(uInt32 align = 1; align < 4; ++align)
|
||||
{
|
||||
for(uInt32 size = 0; size < 4; ++size)
|
||||
for(enable = 0; enable < 2; ++enable)
|
||||
{
|
||||
for(uInt32 x = 0; x < 320; ++x)
|
||||
for(mode = 0; mode < 8; ++mode)
|
||||
{
|
||||
BallMaskTable[align][size][x] = BallMaskTable[0][size][(x + 320 - align) % 320];
|
||||
for(x = 0; x < 320; ++x)
|
||||
{
|
||||
PxMask[align][enable][mode][x] =
|
||||
PxMask[0][enable][mode][(x + 320 - align) % 320];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computeCollisionTable()
|
||||
{
|
||||
for(uInt8 i = 0; i < 64; ++i)
|
||||
{
|
||||
CollisionTable[i] = 0;
|
||||
|
||||
if((i & M0Bit) && (i & P1Bit)) // M0-P1
|
||||
CollisionTable[i] |= 0x0001;
|
||||
|
||||
if((i & M0Bit) && (i & P0Bit)) // M0-P0
|
||||
CollisionTable[i] |= 0x0002;
|
||||
|
||||
if((i & M1Bit) && (i & P0Bit)) // M1-P0
|
||||
CollisionTable[i] |= 0x0004;
|
||||
|
||||
if((i & M1Bit) && (i & P1Bit)) // M1-P1
|
||||
CollisionTable[i] |= 0x0008;
|
||||
|
||||
if((i & P0Bit) && (i & PFBit)) // P0-PF
|
||||
CollisionTable[i] |= 0x0010;
|
||||
|
||||
if((i & P0Bit) && (i & BLBit)) // P0-BL
|
||||
CollisionTable[i] |= 0x0020;
|
||||
|
||||
if((i & P1Bit) && (i & PFBit)) // P1-PF
|
||||
CollisionTable[i] |= 0x0040;
|
||||
|
||||
if((i & P1Bit) && (i & BLBit)) // P1-BL
|
||||
CollisionTable[i] |= 0x0080;
|
||||
|
||||
if((i & M0Bit) && (i & PFBit)) // M0-PF
|
||||
CollisionTable[i] |= 0x0100;
|
||||
|
||||
if((i & M0Bit) && (i & BLBit)) // M0-BL
|
||||
CollisionTable[i] |= 0x0200;
|
||||
|
||||
if((i & M1Bit) && (i & PFBit)) // M1-PF
|
||||
CollisionTable[i] |= 0x0400;
|
||||
|
||||
if((i & M1Bit) && (i & BLBit)) // M1-BL
|
||||
CollisionTable[i] |= 0x0800;
|
||||
|
||||
if((i & BLBit) && (i & PFBit)) // BL-PF
|
||||
CollisionTable[i] |= 0x1000;
|
||||
|
||||
if((i & P0Bit) && (i & P1Bit)) // P0-P1
|
||||
CollisionTable[i] |= 0x2000;
|
||||
|
||||
if((i & M0Bit) && (i & M1Bit)) // M0-M1
|
||||
CollisionTable[i] |= 0x4000;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computeMissleMaskTable()
|
||||
void TIATables::buildMxMaskTable() // [4][8][4][320]
|
||||
{
|
||||
// First, calculate masks for alignment 0
|
||||
Int32 x, size, number;
|
||||
|
@ -143,7 +207,7 @@ void TIATables::computeMissleMaskTable()
|
|||
for(number = 0; number < 8; ++number)
|
||||
for(size = 0; size < 4; ++size)
|
||||
for(x = 0; x < 160; ++x)
|
||||
MissleMaskTable[0][number][size][x] = false;
|
||||
MxMask[0][number][size][x] = false;
|
||||
|
||||
for(number = 0; number < 8; ++number)
|
||||
{
|
||||
|
@ -155,58 +219,58 @@ void TIATables::computeMissleMaskTable()
|
|||
if((number == 0x00) || (number == 0x05) || (number == 0x07))
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
}
|
||||
// Two copies - close
|
||||
else if(number == 0x01)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 16) >= 0) && ((x - 16) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
}
|
||||
// Two copies - medium
|
||||
else if(number == 0x02)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
}
|
||||
// Three copies - close
|
||||
else if(number == 0x03)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 16) >= 0) && ((x - 16) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
}
|
||||
// Two copies - wide
|
||||
else if(number == 0x04)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 64) >= 0) && ((x - 64) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
}
|
||||
// Three copies - medium
|
||||
else if(number == 0x06)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
else if(((x - 64) >= 0) && ((x - 64) < (1 << size)))
|
||||
MissleMaskTable[0][number][size][x % 160] = true;
|
||||
MxMask[0][number][size][x % 160] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy data into wrap-around area
|
||||
for(x = 0; x < 160; ++x)
|
||||
MissleMaskTable[0][number][size][x + 160] =
|
||||
MissleMaskTable[0][number][size][x];
|
||||
MxMask[0][number][size][x + 160] =
|
||||
MxMask[0][number][size][x];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,8 +283,8 @@ void TIATables::computeMissleMaskTable()
|
|||
{
|
||||
for(x = 0; x < 320; ++x)
|
||||
{
|
||||
MissleMaskTable[align][number][size][x] =
|
||||
MissleMaskTable[0][number][size][(x + 320 - align) % 320];
|
||||
MxMask[align][number][size][x] =
|
||||
MxMask[0][number][size][(x + 320 - align) % 320];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -228,112 +292,106 @@ void TIATables::computeMissleMaskTable()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computePlayerMaskTable()
|
||||
void TIATables::buildBLMaskTable() // [4][4][320]
|
||||
{
|
||||
// First, calculate masks for alignment 0
|
||||
Int32 x, enable, mode;
|
||||
for(Int32 size = 0; size < 4; ++size)
|
||||
{
|
||||
Int32 x;
|
||||
|
||||
// Set the player mask table to all zeros
|
||||
for(enable = 0; enable < 2; ++enable)
|
||||
for(mode = 0; mode < 8; ++mode)
|
||||
for(x = 0; x < 160; ++x)
|
||||
PlayerMaskTable[0][enable][mode][x] = 0x00;
|
||||
|
||||
// Now, compute the player mask table
|
||||
for(enable = 0; enable < 2; ++enable)
|
||||
{
|
||||
for(mode = 0; mode < 8; ++mode)
|
||||
{
|
||||
for(x = 0; x < 160 + 72; ++x)
|
||||
{
|
||||
if(mode == 0x00)
|
||||
{
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
}
|
||||
else if(mode == 0x01)
|
||||
{
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 16) >= 0) && ((x - 16) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 16);
|
||||
}
|
||||
else if(mode == 0x02)
|
||||
{
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 32);
|
||||
}
|
||||
else if(mode == 0x03)
|
||||
{
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 16) >= 0) && ((x - 16) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 16);
|
||||
else if(((x - 32) >= 0) && ((x - 32) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 32);
|
||||
}
|
||||
else if(mode == 0x04)
|
||||
{
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 64) >= 0) && ((x - 64) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 64);
|
||||
}
|
||||
else if(mode == 0x05)
|
||||
{
|
||||
// For some reason in double size mode the player's output
|
||||
// is delayed by one pixel thus we use > instead of >=
|
||||
if((enable == 0) && (x > 0) && (x <= 16))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> ((x - 1)/2);
|
||||
}
|
||||
else if(mode == 0x06)
|
||||
{
|
||||
if((enable == 0) && (x >= 0) && (x < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> x;
|
||||
else if(((x - 32) >= 0) && ((x - 32) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 32);
|
||||
else if(((x - 64) >= 0) && ((x - 64) < 8))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> (x - 64);
|
||||
}
|
||||
else if(mode == 0x07)
|
||||
{
|
||||
// For some reason in quad size mode the player's output
|
||||
// is delayed by one pixel thus we use > instead of >=
|
||||
if((enable == 0) && (x > 0) && (x <= 32))
|
||||
PlayerMaskTable[0][enable][mode][x % 160] = 0x80 >> ((x - 1)/4);
|
||||
}
|
||||
}
|
||||
|
||||
// Copy data into wrap-around area
|
||||
// Set all of the masks to false to start with
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
PlayerMaskTable[0][enable][mode][x + 160] =
|
||||
PlayerMaskTable[0][enable][mode][x];
|
||||
BLMask[0][size][x] = false;
|
||||
}
|
||||
|
||||
// Set the necessary fields true
|
||||
for(x = 0; x < 160 + 8; ++x)
|
||||
{
|
||||
if((x >= 0) && (x < (1 << size)))
|
||||
{
|
||||
BLMask[0][size][x % 160] = true;
|
||||
}
|
||||
}
|
||||
|
||||
// Copy fields into the wrap-around area of the mask
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
BLMask[0][size][x + 160] = BLMask[0][size][x];
|
||||
}
|
||||
}
|
||||
|
||||
// Now, copy data for alignments of 1, 2 and 3
|
||||
for(uInt32 align = 1; align < 4; ++align)
|
||||
{
|
||||
for(enable = 0; enable < 2; ++enable)
|
||||
for(uInt32 size = 0; size < 4; ++size)
|
||||
{
|
||||
for(mode = 0; mode < 8; ++mode)
|
||||
for(uInt32 x = 0; x < 320; ++x)
|
||||
{
|
||||
for(x = 0; x < 320; ++x)
|
||||
{
|
||||
PlayerMaskTable[align][enable][mode][x] =
|
||||
PlayerMaskTable[0][enable][mode][(x + 320 - align) % 320];
|
||||
}
|
||||
BLMask[align][size][x] = BLMask[0][size][(x + 320 - align) % 320];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computePlayerPositionResetWhenTable()
|
||||
void TIATables::buildPFMaskTable() // [2][160]
|
||||
{
|
||||
Int32 x;
|
||||
|
||||
// Compute playfield mask table for non-reflected mode
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
if(x < 16)
|
||||
PFMask[0][x] = 0x00001 << (x / 4);
|
||||
else if(x < 48)
|
||||
PFMask[0][x] = 0x00800 >> ((x - 16) / 4);
|
||||
else if(x < 80)
|
||||
PFMask[0][x] = 0x01000 << ((x - 48) / 4);
|
||||
else if(x < 96)
|
||||
PFMask[0][x] = 0x00001 << ((x - 80) / 4);
|
||||
else if(x < 128)
|
||||
PFMask[0][x] = 0x00800 >> ((x - 96) / 4);
|
||||
else if(x < 160)
|
||||
PFMask[0][x] = 0x01000 << ((x - 128) / 4);
|
||||
}
|
||||
|
||||
// Compute playfield mask table for reflected mode
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
if(x < 16)
|
||||
PFMask[1][x] = 0x00001 << (x / 4);
|
||||
else if(x < 48)
|
||||
PFMask[1][x] = 0x00800 >> ((x - 16) / 4);
|
||||
else if(x < 80)
|
||||
PFMask[1][x] = 0x01000 << ((x - 48) / 4);
|
||||
else if(x < 112)
|
||||
PFMask[1][x] = 0x80000 >> ((x - 80) / 4);
|
||||
else if(x < 144)
|
||||
PFMask[1][x] = 0x00010 << ((x - 112) / 4);
|
||||
else if(x < 160)
|
||||
PFMask[1][x] = 0x00008 >> ((x - 144) / 4);
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::buildGRPReflectTable()
|
||||
{
|
||||
for(uInt16 i = 0; i < 256; ++i)
|
||||
{
|
||||
uInt8 r = 0;
|
||||
|
||||
for(uInt16 t = 1; t <= 128; t *= 2)
|
||||
{
|
||||
r = (r << 1) | ((i & t) ? 0x01 : 0x00);
|
||||
}
|
||||
|
||||
GRPReflect[i] = r;
|
||||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::buildPxPosResetWhenTable()
|
||||
{
|
||||
uInt32 mode, oldx, newx;
|
||||
|
||||
|
@ -349,7 +407,7 @@ void TIATables::computePlayerPositionResetWhenTable()
|
|||
// Set everything to 0 for non-delay/non-display section
|
||||
for(newx = 0; newx < 160; ++newx)
|
||||
{
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx] = 0;
|
||||
PxPosResetWhen[mode][oldx][newx] = 0;
|
||||
}
|
||||
|
||||
// Now, we'll set the entries for non-delay/non-display section
|
||||
|
@ -358,94 +416,94 @@ void TIATables::computePlayerPositionResetWhenTable()
|
|||
if(mode == 0x00)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x01)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 16)) && (newx < (oldx + 16 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 16 + 4) && (newx < (oldx + 16 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x02)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 32)) && (newx < (oldx + 32 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 32 + 4) && (newx < (oldx + 32 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x03)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 16)) && (newx < (oldx + 16 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 32)) && (newx < (oldx + 32 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 16 + 4) && (newx < (oldx + 16 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 32 + 4) && (newx < (oldx + 32 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x04)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 64)) && (newx < (oldx + 64 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 64 + 4) && (newx < (oldx + 64 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x05)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 16)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x06)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 32)) && (newx < (oldx + 32 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
else if((newx >= (oldx + 64)) && (newx < (oldx + 64 + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 32 + 4) && (newx < (oldx + 32 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
else if((newx >= oldx + 64 + 4) && (newx < (oldx + 64 + 4 + 8)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
else if(mode == 0x07)
|
||||
{
|
||||
if((newx >= oldx) && (newx < (oldx + 4)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = -1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = -1;
|
||||
|
||||
if((newx >= oldx + 4) && (newx < (oldx + 4 + 32)))
|
||||
PlayerPositionResetWhenTable[mode][oldx][newx % 160] = 1;
|
||||
PxPosResetWhen[mode][oldx][newx % 160] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -453,9 +511,9 @@ void TIATables::computePlayerPositionResetWhenTable()
|
|||
uInt32 s1 = 0, s2 = 0;
|
||||
for(newx = 0; newx < 160; ++newx)
|
||||
{
|
||||
if(PlayerPositionResetWhenTable[mode][oldx][newx] == -1)
|
||||
if(PxPosResetWhen[mode][oldx][newx] == -1)
|
||||
++s1;
|
||||
if(PlayerPositionResetWhenTable[mode][oldx][newx] == 1)
|
||||
if(PxPosResetWhen[mode][oldx][newx] == 1)
|
||||
++s2;
|
||||
}
|
||||
assert((s1 % 4 == 0) && (s2 % 8 == 0));
|
||||
|
@ -464,72 +522,16 @@ void TIATables::computePlayerPositionResetWhenTable()
|
|||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computePlayerReflectTable()
|
||||
{
|
||||
for(uInt16 i = 0; i < 256; ++i)
|
||||
{
|
||||
uInt8 r = 0;
|
||||
|
||||
for(uInt16 t = 1; t <= 128; t *= 2)
|
||||
{
|
||||
r = (r << 1) | ((i & t) ? 0x01 : 0x00);
|
||||
}
|
||||
|
||||
PlayerReflectTable[i] = r;
|
||||
}
|
||||
}
|
||||
uInt8 TIATables::BLMask[4][4][320];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void TIATables::computePlayfieldMaskTable()
|
||||
{
|
||||
Int32 x;
|
||||
|
||||
// Compute playfield mask table for non-reflected mode
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
if(x < 16)
|
||||
PlayfieldTable[0][x] = 0x00001 << (x / 4);
|
||||
else if(x < 48)
|
||||
PlayfieldTable[0][x] = 0x00800 >> ((x - 16) / 4);
|
||||
else if(x < 80)
|
||||
PlayfieldTable[0][x] = 0x01000 << ((x - 48) / 4);
|
||||
else if(x < 96)
|
||||
PlayfieldTable[0][x] = 0x00001 << ((x - 80) / 4);
|
||||
else if(x < 128)
|
||||
PlayfieldTable[0][x] = 0x00800 >> ((x - 96) / 4);
|
||||
else if(x < 160)
|
||||
PlayfieldTable[0][x] = 0x01000 << ((x - 128) / 4);
|
||||
}
|
||||
|
||||
// Compute playfield mask table for reflected mode
|
||||
for(x = 0; x < 160; ++x)
|
||||
{
|
||||
if(x < 16)
|
||||
PlayfieldTable[1][x] = 0x00001 << (x / 4);
|
||||
else if(x < 48)
|
||||
PlayfieldTable[1][x] = 0x00800 >> ((x - 16) / 4);
|
||||
else if(x < 80)
|
||||
PlayfieldTable[1][x] = 0x01000 << ((x - 48) / 4);
|
||||
else if(x < 112)
|
||||
PlayfieldTable[1][x] = 0x80000 >> ((x - 80) / 4);
|
||||
else if(x < 144)
|
||||
PlayfieldTable[1][x] = 0x00010 << ((x - 112) / 4);
|
||||
else if(x < 160)
|
||||
PlayfieldTable[1][x] = 0x00008 >> ((x - 144) / 4);
|
||||
}
|
||||
}
|
||||
uInt16 TIATables::CollisionMask[64];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIATables::BallMaskTable[4][4][320];
|
||||
uInt8 TIATables::DisabledMask[640];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt16 TIATables::CollisionTable[64];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIATables::DisabledMaskTable[640];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Int16 TIATables::PokeDelayTable[64] = {
|
||||
const Int16 TIATables::PokeDelay[64] = {
|
||||
0, 1, 0, 0, 8, 8, 0, 0, 0, 0, 0, 1, 1, -1, -1, -1,
|
||||
0, 0, 8, 8, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
|
@ -537,7 +539,7 @@ const Int16 TIATables::PokeDelayTable[64] = {
|
|||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIATables::MissleMaskTable[4][8][4][320];
|
||||
uInt8 TIATables::MxMask[4][8][4][320];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const bool TIATables::HMOVEBlankEnableCycles[76] = {
|
||||
|
@ -552,7 +554,7 @@ const bool TIATables::HMOVEBlankEnableCycles[76] = {
|
|||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
const Int32 TIATables::CompleteMotionTable[76][16] = {
|
||||
const Int32 TIATables::CompleteMotion[76][16] = {
|
||||
{ 0, -1, -2, -3, -4, -5, -6, -7, 8, 7, 6, 5, 4, 3, 2, 1}, // HBLANK
|
||||
{ 0, -1, -2, -3, -4, -5, -6, -7, 8, 7, 6, 5, 4, 3, 2, 1}, // HBLANK
|
||||
{ 0, -1, -2, -3, -4, -5, -6, -7, 8, 7, 6, 5, 4, 3, 2, 1}, // HBLANK
|
||||
|
@ -632,13 +634,13 @@ const Int32 TIATables::CompleteMotionTable[76][16] = {
|
|||
};
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIATables::PlayerMaskTable[4][2][8][320];
|
||||
uInt8 TIATables::PxMask[4][2][8][320];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
Int8 TIATables::PlayerPositionResetWhenTable[8][160][160];
|
||||
Int8 TIATables::PxPosResetWhen[8][160][160];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt8 TIATables::PlayerReflectTable[256];
|
||||
uInt8 TIATables::GRPReflect[256];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
uInt32 TIATables::PlayfieldTable[2][160];
|
||||
uInt32 TIATables::PFMask[2][160];
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: TIATables.hxx,v 1.1 2009-01-19 16:52:32 stephena Exp $
|
||||
// $Id: TIATables.hxx,v 1.2 2009-02-08 21:07:06 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef TIA_TABLES_HXX
|
||||
|
@ -102,7 +102,7 @@ enum {
|
|||
here.
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: TIATables.hxx,v 1.1 2009-01-19 16:52:32 stephena Exp $
|
||||
@version $Id: TIATables.hxx,v 1.2 2009-02-08 21:07:06 stephena Exp $
|
||||
*/
|
||||
class TIATables
|
||||
{
|
||||
|
@ -112,61 +112,61 @@ class TIATables
|
|||
*/
|
||||
static void computeAllTables();
|
||||
|
||||
// Ball mask table (entries are true or false)
|
||||
static uInt8 BallMaskTable[4][4][320];
|
||||
|
||||
// Used to set the collision register to the correct value
|
||||
static uInt16 CollisionTable[64];
|
||||
static uInt16 CollisionMask[64];
|
||||
|
||||
// A mask table which can be used when an object is disabled
|
||||
static uInt8 DisabledMaskTable[640];
|
||||
static uInt8 DisabledMask[640];
|
||||
|
||||
// Indicates the update delay associated with poking at a TIA address
|
||||
static const Int16 PokeDelayTable[64];
|
||||
|
||||
// Missle mask table (entries are true or false)
|
||||
static uInt8 MissleMaskTable[4][8][4][320];
|
||||
static const Int16 PokeDelay[64];
|
||||
|
||||
// Used to convert value written in a motion register into
|
||||
// its internal representation
|
||||
static const Int32 CompleteMotionTable[76][16];
|
||||
static const Int32 CompleteMotion[76][16];
|
||||
|
||||
// Indicates if HMOVE blanks should occur for the corresponding cycle
|
||||
static const bool HMOVEBlankEnableCycles[76];
|
||||
|
||||
// Player mask table
|
||||
static uInt8 PlayerMaskTable[4][2][8][320];
|
||||
static uInt8 PxMask[4][2][8][320];
|
||||
|
||||
// Indicates if player is being reset during delay, display or other times
|
||||
static Int8 PlayerPositionResetWhenTable[8][160][160];
|
||||
// Missle mask table (entries are true or false)
|
||||
static uInt8 MxMask[4][8][4][320];
|
||||
|
||||
// Used to reflect a players graphics
|
||||
static uInt8 PlayerReflectTable[256];
|
||||
// Ball mask table (entries are true or false)
|
||||
static uInt8 BLMask[4][4][320];
|
||||
|
||||
// Playfield mask table for reflected and non-reflected playfields
|
||||
static uInt32 PlayfieldTable[2][160];
|
||||
static uInt32 PFMask[2][160];
|
||||
|
||||
// Used to reflect a players graphics
|
||||
static uInt8 GRPReflect[256];
|
||||
|
||||
// Indicates if player is being reset during delay, display or other times
|
||||
static Int8 PxPosResetWhen[8][160][160];
|
||||
|
||||
private:
|
||||
// Compute the ball mask table
|
||||
static void computeBallMaskTable();
|
||||
|
||||
// Compute the collision decode table
|
||||
static void computeCollisionTable();
|
||||
|
||||
// Compute the missle mask table
|
||||
static void computeMissleMaskTable();
|
||||
static void buildCollisionMaskTable();
|
||||
|
||||
// Compute the player mask table
|
||||
static void computePlayerMaskTable();
|
||||
static void buildPxMaskTable();
|
||||
|
||||
// Compute the player position reset when table
|
||||
static void computePlayerPositionResetWhenTable();
|
||||
// Compute the missle mask table
|
||||
static void buildMxMaskTable();
|
||||
|
||||
// Compute the player reflect table
|
||||
static void computePlayerReflectTable();
|
||||
// Compute the ball mask table
|
||||
static void buildBLMaskTable();
|
||||
|
||||
// Compute playfield mask table
|
||||
static void computePlayfieldMaskTable();
|
||||
static void buildPFMaskTable();
|
||||
|
||||
// Compute the player reflect table
|
||||
static void buildGRPReflectTable();
|
||||
|
||||
// Compute the player position reset when table
|
||||
static void buildPxPosResetWhenTable();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue