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:
parent
2203499215
commit
cb015c83e1
@ -121,12 +121,9 @@ template <class T> class MOS6532 {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
MOS6532() :
|
MOS6532() {
|
||||||
interrupt_status_(0),
|
timer_.value = static_cast<unsigned int>((rand() & 0xff) << 10);
|
||||||
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} {}
|
|
||||||
|
|
||||||
inline void set_port_did_change(int port) {
|
inline void set_port_did_change(int port) {
|
||||||
if(!port) {
|
if(!port) {
|
||||||
@ -154,26 +151,26 @@ template <class T> class MOS6532 {
|
|||||||
|
|
||||||
struct {
|
struct {
|
||||||
unsigned int value;
|
unsigned int value;
|
||||||
unsigned int activeShift, writtenShift;
|
unsigned int activeShift = 10, writtenShift = 10;
|
||||||
bool interrupt_enabled;
|
bool interrupt_enabled = false;
|
||||||
} timer_;
|
} timer_;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool enabled;
|
bool enabled = false;
|
||||||
bool active_on_positive;
|
bool active_on_positive = false;
|
||||||
uint8_t last_port_value;
|
uint8_t last_port_value = 0;
|
||||||
} a7_interrupt_;
|
} a7_interrupt_;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
uint8_t output_mask, output;
|
uint8_t output_mask = 0, output = 0;
|
||||||
} port_[2];
|
} port_[2];
|
||||||
|
|
||||||
uint8_t interrupt_status_;
|
uint8_t interrupt_status_ = 0;
|
||||||
enum InterruptFlag: uint8_t {
|
enum InterruptFlag: uint8_t {
|
||||||
Timer = 0x80,
|
Timer = 0x80,
|
||||||
PA7 = 0x40
|
PA7 = 0x40
|
||||||
};
|
};
|
||||||
bool interrupt_line_;
|
bool interrupt_line_ = false;
|
||||||
|
|
||||||
// expected to be overridden
|
// expected to be overridden
|
||||||
uint8_t get_port_input(int port) { return 0xff; }
|
uint8_t get_port_input(int port) { return 0xff; }
|
||||||
|
@ -52,12 +52,12 @@ class Tape:
|
|||||||
inline void get_next_tape_pulse();
|
inline void get_next_tape_pulse();
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
int minimum_bits_until_full;
|
int minimum_bits_until_full = 0;
|
||||||
} input_ = {0};
|
} input_;
|
||||||
struct {
|
struct {
|
||||||
unsigned int cycles_into_pulse;
|
unsigned int cycles_into_pulse = 0;
|
||||||
unsigned int bits_remaining_until_empty;
|
unsigned int bits_remaining_until_empty = 0;
|
||||||
} output_ = {.bits_remaining_until_empty = 0, .cycles_into_pulse = 0};
|
} output_;
|
||||||
|
|
||||||
bool is_running_ = false;
|
bool is_running_ = false;
|
||||||
bool is_enabled_ = false;
|
bool is_enabled_ = false;
|
||||||
|
@ -23,7 +23,7 @@ struct Rect {
|
|||||||
|
|
||||||
Rect() {}
|
Rect() {}
|
||||||
Rect(float x, float y, float width, float height) :
|
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 {
|
enum DisplayType {
|
||||||
|
@ -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
|
// Sync is 0x16, either encoded fast or slow; i.e. 0 0110 1000 1
|
||||||
Pattern slow_sync[] =
|
Pattern slow_sync[] =
|
||||||
{
|
{
|
||||||
{.type = WaveType::Long, 8},
|
{WaveType::Long, 8},
|
||||||
{.type = WaveType::Short, 16},
|
{WaveType::Short, 16},
|
||||||
{.type = WaveType::Long, 4},
|
{WaveType::Long, 4},
|
||||||
{.type = WaveType::Short, 8},
|
{WaveType::Short, 8},
|
||||||
{.type = WaveType::Long, 12},
|
{WaveType::Long, 12},
|
||||||
{.type = WaveType::Short, 8},
|
{WaveType::Short, 8},
|
||||||
{.type = WaveType::Unrecognised}
|
{WaveType::Unrecognised}
|
||||||
};
|
};
|
||||||
Pattern fast_sync[] =
|
Pattern fast_sync[] =
|
||||||
{
|
{
|
||||||
{.type = WaveType::Medium, 2},
|
{WaveType::Medium, 2},
|
||||||
{.type = WaveType::Short, 2},
|
{WaveType::Short, 2},
|
||||||
{.type = WaveType::Medium, 1},
|
{WaveType::Medium, 1},
|
||||||
{.type = WaveType::Short, 1},
|
{WaveType::Short, 1},
|
||||||
{.type = WaveType::Medium, 3},
|
{WaveType::Medium, 3},
|
||||||
{.type = WaveType::Short, 1},
|
{WaveType::Short, 1},
|
||||||
{.type = WaveType::Unrecognised}
|
{WaveType::Unrecognised}
|
||||||
};
|
};
|
||||||
|
|
||||||
size_t slow_sync_matching_depth = pattern_matching_depth(waves, slow_sync);
|
size_t slow_sync_matching_depth = pattern_matching_depth(waves, slow_sync);
|
||||||
|
Loading…
Reference in New Issue
Block a user