1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Eliminated C99-style struct initialisations.

This commit is contained in:
Thomas Harte 2017-11-10 19:14:19 -05:00
parent 2203499215
commit cb015c83e1
4 changed files with 31 additions and 34 deletions

View File

@ -121,12 +121,9 @@ template <class T> class MOS6532 {
}
}
MOS6532() :
interrupt_status_(0),
port_{{.output_mask = 0, .output = 0}, {.output_mask = 0, .output = 0}},
a7_interrupt_({.last_port_value = 0, .enabled = false}),
interrupt_line_(false),
timer_{.value = static_cast<unsigned int>((rand() & 0xff) << 10), .activeShift = 10, .writtenShift = 10, .interrupt_enabled = false} {}
MOS6532() {
timer_.value = static_cast<unsigned int>((rand() & 0xff) << 10);
}
inline void set_port_did_change(int port) {
if(!port) {
@ -154,26 +151,26 @@ template <class T> class MOS6532 {
struct {
unsigned int value;
unsigned int activeShift, writtenShift;
bool interrupt_enabled;
unsigned int activeShift = 10, writtenShift = 10;
bool interrupt_enabled = false;
} timer_;
struct {
bool enabled;
bool active_on_positive;
uint8_t last_port_value;
bool enabled = false;
bool active_on_positive = false;
uint8_t last_port_value = 0;
} a7_interrupt_;
struct {
uint8_t output_mask, output;
uint8_t output_mask = 0, output = 0;
} port_[2];
uint8_t interrupt_status_;
uint8_t interrupt_status_ = 0;
enum InterruptFlag: uint8_t {
Timer = 0x80,
PA7 = 0x40
};
bool interrupt_line_;
bool interrupt_line_ = false;
// expected to be overridden
uint8_t get_port_input(int port) { return 0xff; }

View File

@ -52,12 +52,12 @@ class Tape:
inline void get_next_tape_pulse();
struct {
int minimum_bits_until_full;
} input_ = {0};
int minimum_bits_until_full = 0;
} input_;
struct {
unsigned int cycles_into_pulse;
unsigned int bits_remaining_until_empty;
} output_ = {.bits_remaining_until_empty = 0, .cycles_into_pulse = 0};
unsigned int cycles_into_pulse = 0;
unsigned int bits_remaining_until_empty = 0;
} output_;
bool is_running_ = false;
bool is_enabled_ = false;

View File

@ -23,7 +23,7 @@ struct Rect {
Rect() {}
Rect(float x, float y, float width, float height) :
origin({.x = x, .y = y}), size({.width = width, .height = height}) {}
origin({x, y}), size({width, height}) {}
};
enum DisplayType {

View File

@ -125,23 +125,23 @@ void Parser::inspect_waves(const std::vector<WaveType> &waves)
// Sync is 0x16, either encoded fast or slow; i.e. 0 0110 1000 1
Pattern slow_sync[] =
{
{.type = WaveType::Long, 8},
{.type = WaveType::Short, 16},
{.type = WaveType::Long, 4},
{.type = WaveType::Short, 8},
{.type = WaveType::Long, 12},
{.type = WaveType::Short, 8},
{.type = WaveType::Unrecognised}
{WaveType::Long, 8},
{WaveType::Short, 16},
{WaveType::Long, 4},
{WaveType::Short, 8},
{WaveType::Long, 12},
{WaveType::Short, 8},
{WaveType::Unrecognised}
};
Pattern fast_sync[] =
{
{.type = WaveType::Medium, 2},
{.type = WaveType::Short, 2},
{.type = WaveType::Medium, 1},
{.type = WaveType::Short, 1},
{.type = WaveType::Medium, 3},
{.type = WaveType::Short, 1},
{.type = WaveType::Unrecognised}
{WaveType::Medium, 2},
{WaveType::Short, 2},
{WaveType::Medium, 1},
{WaveType::Short, 1},
{WaveType::Medium, 3},
{WaveType::Short, 1},
{WaveType::Unrecognised}
};
size_t slow_sync_matching_depth = pattern_matching_depth(waves, slow_sync);