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

Protects against some further uninitialised values.

This commit is contained in:
Thomas Harte 2020-09-16 18:15:57 -04:00
parent bb57f0bcc7
commit a17d0e428f
2 changed files with 10 additions and 6 deletions

View File

@ -190,7 +190,9 @@ void TMS9918::run_for(const HalfCycles cycles) {
int read_cycles_pool = int_cycles; int read_cycles_pool = int_cycles;
while(write_cycles_pool || read_cycles_pool) { while(write_cycles_pool || read_cycles_pool) {
#ifndef NDEBUG
LineBufferPointer backup = read_pointer_; LineBufferPointer backup = read_pointer_;
#endif
if(write_cycles_pool) { if(write_cycles_pool) {
// Determine how much writing to do. // Determine how much writing to do.
@ -329,8 +331,10 @@ void TMS9918::run_for(const HalfCycles cycles) {
} }
#ifndef NDEBUG
assert(backup.row == read_pointer_.row && backup.column == read_pointer_.column); assert(backup.row == read_pointer_.row && backup.column == read_pointer_.column);
backup = write_pointer_; backup = write_pointer_;
#endif
if(read_cycles_pool) { if(read_cycles_pool) {

View File

@ -381,22 +381,22 @@ struct ScanTarget {
struct ScanStatus { struct ScanStatus {
/// The current (prediced) length of a field (including retrace). /// The current (prediced) length of a field (including retrace).
Time::Seconds field_duration; Time::Seconds field_duration = 0.0;
/// The difference applied to the field_duration estimate during the last field. /// The difference applied to the field_duration estimate during the last field.
Time::Seconds field_duration_gradient; Time::Seconds field_duration_gradient = 0.0;
/// The amount of time this device spends in retrace. /// The amount of time this device spends in retrace.
Time::Seconds retrace_duration; Time::Seconds retrace_duration = 0.0;
/// The distance into the current field, from a small negative amount (in retrace) through /// The distance into the current field, from a small negative amount (in retrace) through
/// 0 (start of visible area field) to 1 (end of field). /// 0 (start of visible area field) to 1 (end of field).
/// ///
/// This will increase monotonically, being a measure /// This will increase monotonically, being a measure
/// of the current vertical position — i.e. if current_position = 0.8 then a caller can /// of the current vertical position — i.e. if current_position = 0.8 then a caller can
/// conclude that the top 80% of the visible part of the display has been painted. /// conclude that the top 80% of the visible part of the display has been painted.
float current_position; float current_position = 0.0f;
/// The total number of hsyncs so far encountered; /// The total number of hsyncs so far encountered;
int hsync_count; int hsync_count = 0;
/// @c true if retrace is currently going on; @c false otherwise. /// @c true if retrace is currently going on; @c false otherwise.
bool is_in_retrace; bool is_in_retrace = false;
/*! /*!
@returns this ScanStatus, with time-relative fields scaled by dividing them by @c dividend. @returns this ScanStatus, with time-relative fields scaled by dividing them by @c dividend.