mirror of
https://github.com/TomHarte/CLK.git
synced 2024-10-07 21:57:46 +00:00
Corrects order-of-initialisation errors in the TIA.
This commit is contained in:
parent
cb0f58ab7a
commit
4add2c1051
@ -20,16 +20,7 @@ namespace {
|
|||||||
uint8_t reverse_table[256];
|
uint8_t reverse_table[256];
|
||||||
}
|
}
|
||||||
|
|
||||||
TIA::TIA(bool create_crt) :
|
TIA::TIA(bool create_crt) {
|
||||||
horizontal_counter_(0),
|
|
||||||
pixels_start_location_(0),
|
|
||||||
output_mode_(0),
|
|
||||||
pixel_target_(nullptr),
|
|
||||||
background_{0, 0},
|
|
||||||
background_half_mask_(0),
|
|
||||||
horizontal_blank_extend_(false),
|
|
||||||
collision_flags_(0)
|
|
||||||
{
|
|
||||||
if(create_crt) {
|
if(create_crt) {
|
||||||
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);
|
||||||
|
@ -81,10 +81,10 @@ class TIA {
|
|||||||
std::function<void(uint8_t *output_buffer)> line_end_function_;
|
std::function<void(uint8_t *output_buffer)> line_end_function_;
|
||||||
|
|
||||||
// the master counter; counts from 0 to 228 with all visible pixels being in the final 160
|
// the master counter; counts from 0 to 228 with all visible pixels being in the final 160
|
||||||
int horizontal_counter_;
|
int horizontal_counter_ = 0;
|
||||||
|
|
||||||
// contains flags to indicate whether sync or blank are currently active
|
// contains flags to indicate whether sync or blank are currently active
|
||||||
int output_mode_;
|
int output_mode_ = 0;
|
||||||
|
|
||||||
// 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];
|
||||||
@ -97,7 +97,7 @@ class TIA {
|
|||||||
Missile1 = (1 << 5)
|
Missile1 = (1 << 5)
|
||||||
};
|
};
|
||||||
|
|
||||||
int collision_flags_;
|
int collision_flags_ = 0;
|
||||||
int collision_flags_by_buffer_vaules_[64];
|
int collision_flags_by_buffer_vaules_[64];
|
||||||
|
|
||||||
// colour mapping tables
|
// colour mapping tables
|
||||||
@ -118,19 +118,20 @@ class TIA {
|
|||||||
uint8_t colour_palette_[4];
|
uint8_t colour_palette_[4];
|
||||||
|
|
||||||
// playfield state
|
// playfield state
|
||||||
int background_half_mask_;
|
int background_half_mask_ = 0;
|
||||||
enum class PlayfieldPriority {
|
enum class PlayfieldPriority {
|
||||||
Standard,
|
Standard,
|
||||||
Score,
|
Score,
|
||||||
OnTop
|
OnTop
|
||||||
} playfield_priority_;
|
} playfield_priority_;
|
||||||
uint32_t background_[2]; // contains two 20-bit bitfields representing the background state;
|
uint32_t background_[2] = {0, 0};
|
||||||
// at index 0 is the left-hand side of the playfield with bit 0 being
|
// contains two 20-bit bitfields representing the background state;
|
||||||
// the first bit to display, bit 1 the second, etc. Index 1 contains
|
// at index 0 is the left-hand side of the playfield with bit 0 being
|
||||||
// a mirror image of index 0. If the playfield is being displayed in
|
// the first bit to display, bit 1 the second, etc. Index 1 contains
|
||||||
// mirroring mode, background_[0] will be output on the left and
|
// a mirror image of index 0. If the playfield is being displayed in
|
||||||
// background_[1] on the right; otherwise background_[0] will be
|
// mirroring mode, background_[0] will be output on the left and
|
||||||
// output twice.
|
// background_[1] on the right; otherwise background_[0] will be
|
||||||
|
// output twice.
|
||||||
|
|
||||||
// objects
|
// objects
|
||||||
template<class T> struct Object {
|
template<class T> struct Object {
|
||||||
@ -287,7 +288,7 @@ class TIA {
|
|||||||
} ball_;
|
} ball_;
|
||||||
|
|
||||||
// motion
|
// motion
|
||||||
bool horizontal_blank_extend_;
|
bool horizontal_blank_extend_ = false;
|
||||||
template<class T> void perform_border_motion(T &object, int start, int end);
|
template<class T> void perform_border_motion(T &object, int start, int end);
|
||||||
template<class T> void perform_motion_step(T &object);
|
template<class T> void perform_motion_step(T &object);
|
||||||
|
|
||||||
@ -300,8 +301,8 @@ class TIA {
|
|||||||
inline void output_for_cycles(int number_of_cycles);
|
inline void output_for_cycles(int number_of_cycles);
|
||||||
inline void output_line();
|
inline void output_line();
|
||||||
|
|
||||||
int pixels_start_location_;
|
int pixels_start_location_ = 0;
|
||||||
uint8_t *pixel_target_;
|
uint8_t *pixel_target_ = nullptr;
|
||||||
inline void output_pixels(int start, int end);
|
inline void output_pixels(int start, int end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user