1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-25 03:32:01 +00:00

Made an attempt properly to populate collision registers from the collision buffer.

This commit is contained in:
Thomas Harte 2017-02-06 21:15:55 -05:00
parent 474e2e8d2c
commit ba165bb70a

View File

@ -39,11 +39,6 @@ TIA::TIA() :
);
}
for(int c = 0; c < 64; c++)
{
collision_flags_by_buffer_vaules_[c] = 0; // TODO
}
for(int c = 0; c < 64; c++)
{
bool has_playfield = c & (int)(CollisionType::Playfield);
@ -53,6 +48,25 @@ TIA::TIA() :
bool has_missile0 = c & (int)(CollisionType::Missile0);
bool has_missile1 = c & (int)(CollisionType::Missile1);
uint8_t collision_registers[8];
collision_registers[0] = ((has_missile0 && has_player1) ? 0x80 : 0x00) | ((has_missile0 && has_player0) ? 0x40 : 0x00);
collision_registers[1] = ((has_missile1 && has_player0) ? 0x80 : 0x00) | ((has_missile1 && has_player1) ? 0x40 : 0x00);
collision_registers[2] = ((has_playfield && has_player0) ? 0x80 : 0x00) | ((has_ball && has_player0) ? 0x40 : 0x00);
collision_registers[3] = ((has_playfield && has_player1) ? 0x80 : 0x00) | ((has_ball && has_player1) ? 0x40 : 0x00);
collision_registers[4] = ((has_playfield && has_missile0) ? 0x80 : 0x00) | ((has_ball && has_missile0) ? 0x40 : 0x00);
collision_registers[5] = ((has_playfield && has_missile1) ? 0x80 : 0x00) | ((has_ball && has_missile1) ? 0x40 : 0x00);
collision_registers[6] = ((has_playfield && has_ball) ? 0x80 : 0x00);
collision_registers[7] = ((has_player0 && has_player1) ? 0x80 : 0x00) | ((has_missile0 && has_missile1) ? 0x40 : 0x00);
collision_flags_by_buffer_vaules_[c] =
(collision_registers[0] >> 6) |
(collision_registers[1] >> 4) |
(collision_registers[2] >> 2) |
(collision_registers[3] >> 0) |
(collision_registers[4] << 2) |
(collision_registers[5] << 4) |
(collision_registers[6] << 6) |
(collision_registers[7] << 8);
// all priority modes show the background if nothing else is present
colour_mask_by_mode_collision_flags_[(int)ColourMode::Standard][c] =
colour_mask_by_mode_collision_flags_[(int)ColourMode::ScoreLeft][c] =