1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 23:52:26 +00:00

Shunted the collisions buffer onto a separate area of the heap for the time being, as a debugging aid. Also added a few more initial values.

This commit is contained in:
Thomas Harte 2017-02-12 18:16:50 -05:00
parent df8a5cbe6d
commit 0c9be2b09e
2 changed files with 13 additions and 4 deletions

View File

@ -25,7 +25,13 @@ TIA::TIA() :
output_mode_(0), output_mode_(0),
pixel_target_(nullptr), pixel_target_(nullptr),
background_{0, 0}, background_{0, 0},
background_half_mask_(0) background_half_mask_(0),
position_{0, 0, 0, 0, 0},
motion_{0, 0, 0, 0, 0},
is_moving_{false, false, false, false, false},
horizontal_blank_extend_(false),
horizontal_move_start_time_(0),
collision_flags_(0)
{ {
crt_.reset(new Outputs::CRT::CRT(cycles_per_line * 2 + 1, 1, Outputs::CRT::DisplayType::NTSC60, 1)); crt_.reset(new Outputs::CRT::CRT(cycles_per_line * 2 + 1, 1, Outputs::CRT::DisplayType::NTSC60, 1));
crt_->set_output_device(Outputs::CRT::Television); crt_->set_output_device(Outputs::CRT::Television);
@ -122,6 +128,8 @@ TIA::TIA() :
colour_mask_by_mode_collision_flags_[(int)ColourMode::OnTop][c] = (uint8_t)ColourIndex::PlayfieldBall; colour_mask_by_mode_collision_flags_[(int)ColourMode::OnTop][c] = (uint8_t)ColourIndex::PlayfieldBall;
} }
} }
collision_buffer_.resize(160);
} }
void TIA::set_output_mode(Atari2600::TIA::OutputMode output_mode) void TIA::set_output_mode(Atari2600::TIA::OutputMode output_mode)
@ -289,6 +297,7 @@ void TIA::set_player_number_and_size(int player, uint8_t value)
void TIA::set_player_graphic(int player, uint8_t value) void TIA::set_player_graphic(int player, uint8_t value)
{ {
player_[player].graphic[1] = value;
player_[player].graphic[player_[player].graphic_delay ? 1 : 0] = value; player_[player].graphic[player_[player].graphic_delay ? 1 : 0] = value;
player_[player^1].graphic[0] = player_[player^1].graphic[1]; player_[player^1].graphic[0] = player_[player^1].graphic[1];
} }
@ -393,7 +402,7 @@ void TIA::output_for_cycles(int number_of_cycles)
if(!output_cursor) if(!output_cursor)
{ {
memset(collision_buffer_, 0, sizeof(collision_buffer_)); memset(collision_buffer_.data(), 0, 160); // sizeof(collision_buffer_)
horizontal_blank_extend_ = false; horizontal_blank_extend_ = false;
} }

View File

@ -82,7 +82,8 @@ class TIA {
int output_mode_; int output_mode_;
// keeps track of the target pixel buffer for this line and when it was acquired, and a corresponding collision buffer // keeps track of the target pixel buffer for this line and when it was acquired, and a corresponding collision buffer
alignas(alignof(uint32_t)) uint8_t collision_buffer_[160]; // alignas(alignof(uint32_t)) uint8_t collision_buffer_[160];
std::vector<uint8_t> collision_buffer_;
enum class CollisionType : uint8_t { enum class CollisionType : uint8_t {
Playfield = (1 << 0), Playfield = (1 << 0),
Ball = (1 << 1), Ball = (1 << 1),
@ -126,7 +127,6 @@ class TIA {
// mirroring mode, background_[0] will be output on the left and // mirroring mode, background_[0] will be output on the left and
// background_[1] on the right; otherwise background_[0] will be // background_[1] on the right; otherwise background_[0] will be
// output twice. // output twice.
int latched_playfield_value_;
// player state // player state
struct Player { struct Player {