diff --git a/Machines/Atari2600/TIA.cpp b/Machines/Atari2600/TIA.cpp index 63b3bb569..177ddc830 100644 --- a/Machines/Atari2600/TIA.cpp +++ b/Machines/Atari2600/TIA.cpp @@ -176,15 +176,6 @@ void TIA::set_output_mode(Atari2600::TIA::OutputMode output_mode) /* speaker_->set_input_rate((float)(get_clock_rate() / 38.0));*/ } -TIA::~TIA() -{ -} - - // justification for +5: "we need to wait at least 71 [clocks] before the HMOVE operation is complete"; - // which will take 16*4 + 2 = 66 cycles from the first compare, implying the first compare must be - // in five cycles from now - - void TIA::run_for_cycles(int number_of_cycles) { // if part way through a line, definitely perform a partial, at most up to the end of the line @@ -457,11 +448,11 @@ void TIA::output_for_cycles(int number_of_cycles) int latent_start = output_cursor + 4; int latent_end = horizontal_counter_ + 4; draw_playfield(latent_start, latent_end); - draw_player(player_[0], CollisionType::Player0, output_cursor, horizontal_counter_); - draw_player(player_[1], CollisionType::Player1, output_cursor, horizontal_counter_); - draw_missile(missile_[0], CollisionType::Missile0, output_cursor, horizontal_counter_); - draw_missile(missile_[1], CollisionType::Missile1, output_cursor, horizontal_counter_); - draw_ball(output_cursor, horizontal_counter_); + draw_object(player_[0], (uint8_t)CollisionType::Player0, output_cursor, horizontal_counter_); + draw_object(player_[1], (uint8_t)CollisionType::Player1, output_cursor, horizontal_counter_); + draw_object(missile_[0], (uint8_t)CollisionType::Missile0, output_cursor, horizontal_counter_); + draw_object(missile_[1], (uint8_t)CollisionType::Missile1, output_cursor, horizontal_counter_); + draw_object(ball_, (uint8_t)CollisionType::Ball, output_cursor, horizontal_counter_); // convert to television signals @@ -746,20 +737,3 @@ template void TIA::draw_object_visible(T &object, const uint8_t collisi } } } - -#pragma mark - Player output - -void TIA::draw_player(Player &player, CollisionType collision_identity, int start, int end) -{ - draw_object(player, (uint8_t)collision_identity, start, end); -} - -void TIA::draw_missile(Missile &missile, CollisionType collision_identity, int start, int end) -{ - draw_object(missile, (uint8_t)collision_identity, start, end); -} - -void TIA::draw_ball(int start, int end) -{ - draw_object(ball_, (uint8_t)CollisionType::Ball, start, end); -} diff --git a/Machines/Atari2600/TIA.hpp b/Machines/Atari2600/TIA.hpp index 1ed9040ab..3914092c0 100644 --- a/Machines/Atari2600/TIA.hpp +++ b/Machines/Atari2600/TIA.hpp @@ -17,13 +17,10 @@ namespace Atari2600 { class TIA { public: TIA(); - ~TIA(); - // The supplied hook is for unit testing only; if instantiated with a line_end_function then it will // be called with the latest collision buffer upon the conclusion of each line. What's a collision // buffer? It's an implementation detail. If you're not writing a unit test, leave it alone. TIA(std::function line_end_function); - TIA(bool create_crt); enum class OutputMode { NTSC, PAL @@ -79,6 +76,7 @@ class TIA { virtual std::shared_ptr get_crt() { return crt_; } private: + TIA(bool create_crt); std::shared_ptr crt_; std::function line_end_function_; @@ -275,15 +273,11 @@ class TIA { // drawing methods and state template void draw_object(T &, const uint8_t collision_identity, int start, int end); template void draw_object_visible(T &, const uint8_t collision_identity, int start, int end); + inline void draw_playfield(int start, int end); inline void output_for_cycles(int number_of_cycles); inline void output_line(); - inline void draw_playfield(int start, int end); - inline void draw_player(Player &player, CollisionType collision_identity, int start, int end); - inline void draw_missile(Missile &missile, CollisionType collision_identity, int start, int end); - inline void draw_ball(int start, int end); - int pixels_start_location_; uint8_t *pixel_target_; inline void output_pixels(int start, int end);