diff --git a/.gitignore b/.gitignore index 5c61997e4..060311938 100644 --- a/.gitignore +++ b/.gitignore @@ -22,6 +22,10 @@ DerivedData ROMImages/* OSBindings/Mac/Clock SignalTests/Atari\ ROMs +# Exclude intermediate build products +*.o +.sconsign.dblite + # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index f71756601..7efc7f426 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -11,28 +11,10 @@ using namespace WD; -WD1770::Status::Status() : - type(Status::One), - write_protect(false), - record_type(false), - spin_up(false), - record_not_found(false), - crc_error(false), - seek_error(false), - lost_data(false), - data_request(false), - interrupt_request(false), - busy(false) {} - WD1770::WD1770(Personality p) : Storage::Disk::MFMController(8000000), - interesting_event_mask_(static_cast(Event1770::Command)), - resume_point_(0), - delay_time_(0), - index_hole_count_target_(-1), - delegate_(nullptr), personality_(p), - head_is_loaded_(false) { + interesting_event_mask_(static_cast(Event1770::Command)) { set_is_double_density(false); posit_event(static_cast(Event1770::Command)); } diff --git a/Components/1770/1770.hpp b/Components/1770/1770.hpp index 0f8205a0d..aa15a5259 100644 --- a/Components/1770/1770.hpp +++ b/Components/1770/1770.hpp @@ -85,20 +85,19 @@ class WD1770: public Storage::Disk::MFMController { inline bool has_head_load_line() { return (personality_ == P1793 ); } struct Status { - Status(); - bool write_protect; - bool record_type; - bool spin_up; - bool record_not_found; - bool crc_error; - bool seek_error; - bool lost_data; - bool data_request; - bool interrupt_request; - bool busy; + bool write_protect = false; + bool record_type = false; + bool spin_up = false; + bool record_not_found = false; + bool crc_error = false; + bool seek_error = false; + bool lost_data = false; + bool data_request = false; + bool interrupt_request = false; + bool busy = false; enum { One, Two, Three - } type; + } type = One; } status_; uint8_t track_; uint8_t sector_; @@ -106,7 +105,7 @@ class WD1770: public Storage::Disk::MFMController { uint8_t command_; int index_hole_count_; - int index_hole_count_target_; + int index_hole_count_target_ = -1; int distance_into_section_; int step_direction_; @@ -121,17 +120,17 @@ class WD1770: public Storage::Disk::MFMController { }; void posit_event(int type); int interesting_event_mask_; - int resume_point_; - unsigned int delay_time_; + int resume_point_ = 0; + unsigned int delay_time_ = 0; // ID buffer uint8_t header_[6]; // 1793 head-loading logic - bool head_is_loaded_; + bool head_is_loaded_ = false; // delegate - Delegate *delegate_; + Delegate *delegate_ = nullptr; }; } diff --git a/Components/6532/6532.hpp b/Components/6532/6532.hpp index a2477c321..40b03a75b 100644 --- a/Components/6532/6532.hpp +++ b/Components/6532/6532.hpp @@ -121,12 +121,9 @@ template 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((rand() & 0xff) << 10), .activeShift = 10, .writtenShift = 10, .interrupt_enabled = false} {} + MOS6532() { + timer_.value = static_cast((rand() & 0xff) << 10); + } inline void set_port_did_change(int port) { if(!port) { @@ -154,26 +151,26 @@ template 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; } diff --git a/Components/6560/6560.cpp b/Components/6560/6560.cpp index 39907e705..909702b5f 100644 --- a/Components/6560/6560.cpp +++ b/Components/6560/6560.cpp @@ -8,13 +8,9 @@ #include "6560.hpp" -using namespace MOS; +#include -Speaker::Speaker() : - volume_(0), - control_registers_{0, 0, 0, 0}, - shift_registers_{0, 0, 0, 0}, - counters_{2, 1, 0, 0} {} // create a slight phase offset for the three channels +using namespace MOS; void Speaker::set_volume(uint8_t volume) { enqueue([=]() { diff --git a/Components/6560/6560.hpp b/Components/6560/6560.hpp index 2c3717910..c5a921923 100644 --- a/Components/6560/6560.hpp +++ b/Components/6560/6560.hpp @@ -18,8 +18,6 @@ namespace MOS { // audio state class Speaker: public ::Outputs::Filter { public: - Speaker(); - void set_volume(uint8_t volume); void set_control(int channel, uint8_t value); @@ -27,10 +25,10 @@ class Speaker: public ::Outputs::Filter { void skip_samples(unsigned int number_of_samples); private: - unsigned int counters_[4]; - unsigned int shift_registers_[4]; - uint8_t control_registers_[4]; - uint8_t volume_; + unsigned int counters_[4] = {2, 1, 0, 0}; // create a slight phase offset for the three channels + unsigned int shift_registers_[4] = {0, 0, 0, 0}; + uint8_t control_registers_[4] = {0, 0, 0, 0}; + uint8_t volume_ = 0; }; /*! @@ -45,12 +43,7 @@ template class MOS6560 { public: MOS6560() : crt_(new Outputs::CRT::CRT(65*4, 4, Outputs::CRT::NTSC60, 2)), - speaker_(new Speaker), - horizontal_counter_(0), - vertical_counter_(0), - cycles_since_speaker_update_(0), - is_odd_frame_(false), - is_odd_line_(false) { + speaker_(new Speaker) { crt_->set_composite_sampling_function( "float composite_sample(usampler2D texID, vec2 coordinate, vec2 iCoordinate, float phase, float amplitude)" "{" @@ -432,7 +425,7 @@ template class MOS6560 { unsigned int cycles_in_state_; // counters that cover an entire field - int horizontal_counter_, vertical_counter_, full_frame_counter_; + int horizontal_counter_ = 0, vertical_counter_ = 0, full_frame_counter_; // latches dictating start and length of drawing bool vertical_drawing_latch_, horizontal_drawing_latch_; @@ -447,7 +440,7 @@ template class MOS6560 { // data latched from the bus uint8_t character_code_, character_colour_, character_value_; - bool is_odd_frame_, is_odd_line_; + bool is_odd_frame_ = false, is_odd_line_ = false; // lookup table from 6560 colour index to appropriate PAL/NTSC value uint16_t colours_[16]; diff --git a/Components/AY38910/AY38910.cpp b/Components/AY38910/AY38910.cpp index 85d8d5f21..cb862cd0e 100644 --- a/Components/AY38910/AY38910.cpp +++ b/Components/AY38910/AY38910.cpp @@ -10,16 +10,7 @@ using namespace GI::AY38910; -AY38910::AY38910() : - selected_register_(0), - tone_counters_{0, 0, 0}, tone_periods_{0, 0, 0}, tone_outputs_{0, 0, 0}, - noise_shift_register_(0xffff), noise_period_(0), noise_counter_(0), noise_output_(0), - envelope_divider_(0), envelope_period_(0), envelope_position_(0), - master_divider_(0), - output_registers_{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, - port_handler_(nullptr) { - output_registers_[8] = output_registers_[9] = output_registers_[10] = 0; - +AY38910::AY38910() { // set up envelope lookup tables for(int c = 0; c < 16; c++) { for(int p = 0; p < 32; p++) { diff --git a/Components/AY38910/AY38910.hpp b/Components/AY38910/AY38910.hpp index d02aff8cd..1dcd6c6f0 100644 --- a/Components/AY38910/AY38910.hpp +++ b/Components/AY38910/AY38910.hpp @@ -89,24 +89,25 @@ class AY38910: public ::Outputs::Filter { void get_samples(unsigned int number_of_samples, int16_t *target); private: - int selected_register_; - uint8_t registers_[16], output_registers_[16]; + int selected_register_ = 0; + uint8_t registers_[16]; + uint8_t output_registers_[16] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}; uint8_t port_inputs_[2]; - int master_divider_; + int master_divider_ = 0; - int tone_periods_[3]; - int tone_counters_[3]; - int tone_outputs_[3]; + int tone_periods_[3] = {0, 0, 0}; + int tone_counters_[3] = {0, 0, 0}; + int tone_outputs_[3] = {0, 0, 0}; - int noise_period_; - int noise_counter_; - int noise_shift_register_; - int noise_output_; + int noise_period_ = 0; + int noise_counter_ = 0; + int noise_shift_register_ = 0xffff; + int noise_output_ = 0; - int envelope_period_; - int envelope_divider_; - int envelope_position_; + int envelope_period_ = 0; + int envelope_divider_ = 0; + int envelope_position_ = 0; int envelope_shapes_[16][32]; int envelope_overflow_masks_[16]; @@ -129,7 +130,7 @@ class AY38910: public ::Outputs::Filter { inline void evaluate_output_volume(); inline void update_bus(); - PortHandler *port_handler_; + PortHandler *port_handler_ = nullptr; }; } diff --git a/Concurrency/AsyncTaskQueue.hpp b/Concurrency/AsyncTaskQueue.hpp index 34c54bb61..e426453f7 100644 --- a/Concurrency/AsyncTaskQueue.hpp +++ b/Concurrency/AsyncTaskQueue.hpp @@ -9,10 +9,12 @@ #ifndef AsyncTaskQueue_hpp #define AsyncTaskQueue_hpp +#include +#include +#include +#include #include #include -#include -#include #ifdef __APPLE__ #include diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 38e1b1b06..b35582948 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -602,9 +602,9 @@ class i8255PortHandler : public Intel::i8255::PortHandler { const Motorola::CRTC::CRTC6845 &crtc, AYDeferrer &ay, Storage::Tape::BinaryTapePlayer &tape_player) : - key_state_(key_state), - crtc_(crtc), ay_(ay), + crtc_(crtc), + key_state_(key_state), tape_player_(tape_player) {} /// The i8255 will call this to set a new output value of @c value for @c port. @@ -658,8 +658,8 @@ class i8255PortHandler : public Intel::i8255::PortHandler { private: AYDeferrer &ay_; - KeyboardState &key_state_; const Motorola::CRTC::CRTC6845 &crtc_; + KeyboardState &key_state_; Storage::Tape::BinaryTapePlayer &tape_player_; }; @@ -674,12 +674,13 @@ class ConcreteMachine: public: ConcreteMachine() : z80_(*this), - crtc_counter_(HalfCycles(4)), // This starts the CRTC exactly out of phase with the CPU's memory accesses - crtc_(Motorola::CRTC::HD6845S, crtc_bus_handler_), crtc_bus_handler_(ram_, interrupt_timer_), - i8255_(i8255_port_handler_), + crtc_(Motorola::CRTC::HD6845S, crtc_bus_handler_), i8255_port_handler_(key_state_, crtc_, ay_, tape_player_), - tape_player_(8000000) { + i8255_(i8255_port_handler_), + tape_player_(8000000), + crtc_counter_(HalfCycles(4)) // This starts the CRTC exactly out of phase with the CPU's memory accesses + { // primary clock is 4Mhz set_clock_rate(4000000); diff --git a/Machines/Atari2600/Atari2600.cpp b/Machines/Atari2600/Atari2600.cpp index 34e67e806..7806e9282 100644 --- a/Machines/Atari2600/Atari2600.cpp +++ b/Machines/Atari2600/Atari2600.cpp @@ -53,8 +53,8 @@ class Joystick: public Inputs::Joystick { } private: - size_t shift_, fire_tia_input_; Bus *bus_; + size_t shift_, fire_tia_input_; }; class ConcreteMachine: diff --git a/Machines/Atari2600/Cartridges/Pitfall2.hpp b/Machines/Atari2600/Cartridges/Pitfall2.hpp index 36cd1ff59..aed11320d 100644 --- a/Machines/Atari2600/Cartridges/Pitfall2.hpp +++ b/Machines/Atari2600/Cartridges/Pitfall2.hpp @@ -16,11 +16,7 @@ class Pitfall2: public BusExtender { public: Pitfall2(uint8_t *rom_base, size_t rom_size) : BusExtender(rom_base, rom_size), - rom_ptr_(rom_base), - random_number_generator_(0), - featcher_address_{0, 0, 0, 0, 0, 0, 0, 0}, - mask_{0, 0, 0, 0, 0, 0, 0, 0}, - cycles_since_audio_update_(0) {} + rom_ptr_(rom_base) {} void advance_cycles(int cycles) { cycles_since_audio_update_ += cycles; @@ -119,13 +115,13 @@ class Pitfall2: public BusExtender { return level_table[table_position]; } - uint16_t featcher_address_[8]; - uint8_t top_[8], bottom_[8], mask_[8]; + uint16_t featcher_address_[8] = {0, 0, 0, 0, 0, 0, 0, 0}; + uint8_t top_[8], bottom_[8], mask_[8] = {0, 0, 0, 0, 0, 0, 0, 0}; uint8_t music_mode_[3]; - uint8_t random_number_generator_; + uint8_t random_number_generator_ = 0; uint8_t *rom_ptr_; uint8_t audio_channel_[3]; - Cycles cycles_since_audio_update_; + Cycles cycles_since_audio_update_ = 0; }; } diff --git a/Machines/Atari2600/PIA.hpp b/Machines/Atari2600/PIA.hpp index afd0603aa..cf3900357 100644 --- a/Machines/Atari2600/PIA.hpp +++ b/Machines/Atari2600/PIA.hpp @@ -9,6 +9,8 @@ #ifndef Atari2600_PIA_h #define Atari2600_PIA_h +#include + #include "../../Components/6532/6532.hpp" namespace Atari2600 { diff --git a/Machines/Atari2600/TIA.cpp b/Machines/Atari2600/TIA.cpp index 885ab69bf..16ac3fe45 100644 --- a/Machines/Atari2600/TIA.cpp +++ b/Machines/Atari2600/TIA.cpp @@ -20,16 +20,7 @@ namespace { uint8_t reverse_table[256]; } -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) -{ +TIA::TIA(bool create_crt) { if(create_crt) { crt_.reset(new Outputs::CRT::CRT(cycles_per_line * 2 - 1, 1, Outputs::CRT::DisplayType::NTSC60, 1)); crt_->set_output_device(Outputs::CRT::Television); diff --git a/Machines/Atari2600/TIA.hpp b/Machines/Atari2600/TIA.hpp index 5426ea989..510d8350a 100644 --- a/Machines/Atari2600/TIA.hpp +++ b/Machines/Atari2600/TIA.hpp @@ -81,10 +81,10 @@ class TIA { std::function line_end_function_; // 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 - 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 alignas(alignof(uint32_t)) uint8_t collision_buffer_[160]; @@ -97,7 +97,7 @@ class TIA { Missile1 = (1 << 5) }; - int collision_flags_; + int collision_flags_ = 0; int collision_flags_by_buffer_vaules_[64]; // colour mapping tables @@ -118,19 +118,20 @@ class TIA { uint8_t colour_palette_[4]; // playfield state - int background_half_mask_; + int background_half_mask_ = 0; enum class PlayfieldPriority { Standard, Score, OnTop } playfield_priority_; - uint32_t background_[2]; // contains two 20-bit bitfields representing the background state; - // at index 0 is the left-hand side of the playfield with bit 0 being - // the first bit to display, bit 1 the second, etc. Index 1 contains - // a mirror image of index 0. If the playfield is being displayed in - // mirroring mode, background_[0] will be output on the left and - // background_[1] on the right; otherwise background_[0] will be - // output twice. + uint32_t background_[2] = {0, 0}; + // contains two 20-bit bitfields representing the background state; + // at index 0 is the left-hand side of the playfield with bit 0 being + // the first bit to display, bit 1 the second, etc. Index 1 contains + // a mirror image of index 0. If the playfield is being displayed in + // mirroring mode, background_[0] will be output on the left and + // background_[1] on the right; otherwise background_[0] will be + // output twice. // objects template struct Object { @@ -287,7 +288,7 @@ class TIA { } ball_; // motion - bool horizontal_blank_extend_; + bool horizontal_blank_extend_ = false; template void perform_border_motion(T &object, int start, int end); template void perform_motion_step(T &object); @@ -300,8 +301,8 @@ class TIA { inline void output_for_cycles(int number_of_cycles); inline void output_line(); - int pixels_start_location_; - uint8_t *pixel_target_; + int pixels_start_location_ = 0; + uint8_t *pixel_target_ = nullptr; inline void output_pixels(int start, int end); }; diff --git a/Machines/CRTMachine.hpp b/Machines/CRTMachine.hpp index 55ed44f93..1b8f62016 100644 --- a/Machines/CRTMachine.hpp +++ b/Machines/CRTMachine.hpp @@ -23,8 +23,6 @@ namespace CRTMachine { */ class Machine: public ROMMachine::Machine { public: - Machine() : clock_is_unlimited_(false), delegate_(nullptr) {} - /*! Causes the machine to set up its CRT and, if it has one, speaker. The caller guarantees that an OpenGL context is bound. @@ -75,9 +73,9 @@ class Machine: public ROMMachine::Machine { } private: - Delegate *delegate_; - double clock_rate_; - bool clock_is_unlimited_; + Delegate *delegate_ = nullptr; + double clock_rate_ = 1.0; + bool clock_is_unlimited_ = false; }; } diff --git a/Machines/Commodore/1540/Implementation/C1540.cpp b/Machines/Commodore/1540/Implementation/C1540.cpp index 316c0ab0d..a3f32869f 100644 --- a/Machines/Commodore/1540/Implementation/C1540.cpp +++ b/Machines/Commodore/1540/Implementation/C1540.cpp @@ -6,24 +6,24 @@ // Copyright © 2016 Thomas Harte. All rights reserved. // -#include "C1540.hpp" +#include "../C1540.hpp" -#include #include +#include +#include #include "../../../../Storage/Disk/Encodings/CommodoreGCR.hpp" using namespace Commodore::C1540; MachineBase::MachineBase() : - m6502_(*this), - shift_register_(0), Storage::Disk::Controller(1000000), - serial_port_(new SerialPort), + m6502_(*this), + drive_(new Storage::Disk::Drive(1000000, 300, 2)), serial_port_VIA_port_handler_(new SerialPortVIA(serial_port_VIA_)), + serial_port_(new SerialPort), drive_VIA_(drive_VIA_port_handler_), - serial_port_VIA_(*serial_port_VIA_port_handler_), - drive_(new Storage::Disk::Drive(1000000, 300, 2)) { + serial_port_VIA_(*serial_port_VIA_port_handler_) { // attach the serial port to its VIA and vice versa serial_port_->set_serial_port_via(serial_port_VIA_port_handler_); serial_port_VIA_port_handler_->set_serial_port(serial_port_); diff --git a/Machines/Commodore/1540/Implementation/C1540Base.hpp b/Machines/Commodore/1540/Implementation/C1540Base.hpp index ab776898d..ed8384a60 100644 --- a/Machines/Commodore/1540/Implementation/C1540Base.hpp +++ b/Machines/Commodore/1540/Implementation/C1540Base.hpp @@ -147,7 +147,7 @@ class MachineBase: MOS::MOS6522::MOS6522 drive_VIA_; MOS::MOS6522::MOS6522 serial_port_VIA_; - int shift_register_, bit_window_offset_; + int shift_register_ = 0, bit_window_offset_; virtual void process_input_bit(int value); virtual void process_index_hole(); }; diff --git a/Machines/Commodore/SerialBus.cpp b/Machines/Commodore/SerialBus.cpp index 6ef4bef84..e0fa9dcfa 100644 --- a/Machines/Commodore/SerialBus.cpp +++ b/Machines/Commodore/SerialBus.cpp @@ -8,6 +8,8 @@ #include "SerialBus.hpp" +#include + using namespace Commodore::Serial; const char *::Commodore::Serial::StringForLine(Line line) { diff --git a/Machines/Commodore/SerialBus.hpp b/Machines/Commodore/SerialBus.hpp index a63319247..2af316d78 100644 --- a/Machines/Commodore/SerialBus.hpp +++ b/Machines/Commodore/SerialBus.hpp @@ -9,6 +9,8 @@ #ifndef SerialBus_hpp #define SerialBus_hpp +#include +#include #include namespace Commodore { diff --git a/Machines/Commodore/Vic-20/Vic20.cpp b/Machines/Commodore/Vic-20/Vic20.cpp index 27ea0335a..c479d674f 100644 --- a/Machines/Commodore/Vic-20/Vic20.cpp +++ b/Machines/Commodore/Vic-20/Vic20.cpp @@ -267,15 +267,13 @@ class ConcreteMachine: public: ConcreteMachine() : m6502_(*this), - rom_(nullptr), - is_running_at_zero_cost_(false), - tape_(new Storage::Tape::BinaryTapePlayer(1022727)), user_port_via_port_handler_(new UserPortVIA), keyboard_via_port_handler_(new KeyboardVIA), serial_port_(new SerialPort), serial_bus_(new ::Commodore::Serial::Bus), user_port_via_(*user_port_via_port_handler_), - keyboard_via_(*keyboard_via_port_handler_) { + keyboard_via_(*keyboard_via_port_handler_), + tape_(new Storage::Tape::BinaryTapePlayer(1022727)) { // communicate the tape to the user-port VIA user_port_via_port_handler_->set_tape(tape_); @@ -453,7 +451,7 @@ class ConcreteMachine: write_to_map(mos6560_->video_memory_map, screen_memory_, 0x3000, sizeof(screen_memory_)); mos6560_->colour_memory = colour_memory_; - write_to_map(processor_read_memory_map_, basic_rom_.data(), 0xc000, basic_rom_.size()); + write_to_map(processor_read_memory_map_, basic_rom_.data(), 0xc000, static_cast(basic_rom_.size())); ROM character_rom; ROM kernel_rom; @@ -480,9 +478,9 @@ class ConcreteMachine: break; } - write_to_map(processor_read_memory_map_, roms_[character_rom].data(), 0x8000, roms_[character_rom].size()); - write_to_map(mos6560_->video_memory_map, roms_[character_rom].data(), 0x0000, roms_[character_rom].size()); - write_to_map(processor_read_memory_map_, roms_[kernel_rom].data(), 0xe000, roms_[kernel_rom].size()); + write_to_map(processor_read_memory_map_, roms_[character_rom].data(), 0x8000, static_cast(roms_[character_rom].size())); + write_to_map(mos6560_->video_memory_map, roms_[character_rom].data(), 0x0000, static_cast(roms_[character_rom].size())); + write_to_map(processor_read_memory_map_, roms_[kernel_rom].data(), 0xe000, static_cast(roms_[kernel_rom].size())); // install the inserted ROM if there is one if(rom_) { @@ -648,7 +646,7 @@ class ConcreteMachine: std::vector kernel_rom_; uint8_t expansion_ram_[0x8000]; - uint8_t *rom_; + uint8_t *rom_ = nullptr; uint16_t rom_address_, rom_length_; uint8_t user_basic_memory_[0x0400]; @@ -688,7 +686,7 @@ class ConcreteMachine: // Tape std::shared_ptr tape_; bool use_fast_tape_hack_; - bool is_running_at_zero_cost_; + bool is_running_at_zero_cost_ = false; // Disk std::shared_ptr<::Commodore::C1540::Machine> c1540_; diff --git a/Machines/Electron/Tape.hpp b/Machines/Electron/Tape.hpp index 8456805da..93dad713b 100644 --- a/Machines/Electron/Tape.hpp +++ b/Machines/Electron/Tape.hpp @@ -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; diff --git a/Machines/Electron/Video.cpp b/Machines/Electron/Video.cpp index 2386c93b6..2e577ccf3 100644 --- a/Machines/Electron/Video.cpp +++ b/Machines/Electron/Video.cpp @@ -8,6 +8,8 @@ #include "Video.hpp" +#include + using namespace Electron; #define graphics_line(v) ((((v) >> 7) - first_graphics_line + field_divider_line) % field_divider_line) diff --git a/Machines/KeyboardMachine.hpp b/Machines/KeyboardMachine.hpp index 4839a1005..a9522b2eb 100644 --- a/Machines/KeyboardMachine.hpp +++ b/Machines/KeyboardMachine.hpp @@ -9,6 +9,8 @@ #ifndef KeyboardMachine_h #define KeyboardMachine_h +#include + #include "../Inputs/Keyboard.hpp" namespace KeyboardMachine { diff --git a/Machines/Oric/Microdisc.cpp b/Machines/Oric/Microdisc.cpp index 681701a62..a9701967e 100644 --- a/Machines/Oric/Microdisc.cpp +++ b/Machines/Oric/Microdisc.cpp @@ -18,13 +18,7 @@ namespace { const int head_load_request_counter_target = 7653333; } -Microdisc::Microdisc() : - irq_enable_(false), - delegate_(nullptr), - paging_flags_(BASICDisable), - head_load_request_counter_(-1), - WD1770(P1793), - last_control_(0) { +Microdisc::Microdisc() : WD1770(P1793) { set_control_register(last_control_, 0xff); } diff --git a/Machines/Oric/Microdisc.hpp b/Machines/Oric/Microdisc.hpp index 69c0338fe..1ea325dc7 100644 --- a/Machines/Oric/Microdisc.hpp +++ b/Machines/Oric/Microdisc.hpp @@ -45,11 +45,11 @@ class Microdisc: public WD::WD1770 { bool get_drive_is_ready(); std::shared_ptr drives_[4]; int selected_drive_; - bool irq_enable_; - int paging_flags_; - int head_load_request_counter_; - Delegate *delegate_; - uint8_t last_control_; + bool irq_enable_ = false; + int paging_flags_ = BASICDisable; + int head_load_request_counter_ = -1; + Delegate *delegate_ = nullptr; + uint8_t last_control_ = 0; }; } diff --git a/Machines/Oric/Oric.cpp b/Machines/Oric/Oric.cpp index c2b53c71f..dce38c4c4 100644 --- a/Machines/Oric/Oric.cpp +++ b/Machines/Oric/Oric.cpp @@ -182,9 +182,9 @@ class ConcreteMachine: public: ConcreteMachine() : m6502_(*this), - paged_rom_(rom_), + via_port_handler_(tape_player_, keyboard_), via_(via_port_handler_), - via_port_handler_(tape_player_, keyboard_) { + paged_rom_(rom_) { set_clock_rate(1000000); via_port_handler_.set_interrupt_delegate(this); tape_player_.set_delegate(this); diff --git a/Machines/Oric/Video.cpp b/Machines/Oric/Video.cpp index f5f5d41f1..36866fdb1 100644 --- a/Machines/Oric/Video.cpp +++ b/Machines/Oric/Video.cpp @@ -21,12 +21,9 @@ namespace { VideoOutput::VideoOutput(uint8_t *memory) : ram_(memory), - frame_counter_(0), counter_(0), - is_graphics_mode_(false), - character_set_base_address_(0xb400), + crt_(new Outputs::CRT::CRT(64*6, 6, Outputs::CRT::DisplayType::PAL50, 2)), v_sync_start_position_(PAL50VSyncStartPosition), v_sync_end_position_(PAL50VSyncEndPosition), - counter_period_(PAL50Period), next_frame_is_sixty_hertz_(false), - crt_(new Outputs::CRT::CRT(64*6, 6, Outputs::CRT::DisplayType::PAL50, 2)) { + counter_period_(PAL50Period) { crt_->set_rgb_sampling_function( "vec3 rgb_sample(usampler2D sampler, vec2 coordinate, vec2 icoordinate)" "{" diff --git a/Machines/Oric/Video.hpp b/Machines/Oric/Video.hpp index 162091501..cb95a579a 100644 --- a/Machines/Oric/Video.hpp +++ b/Machines/Oric/Video.hpp @@ -27,7 +27,7 @@ class VideoOutput { std::shared_ptr crt_; // Counters and limits - int counter_, frame_counter_; + int counter_ = 0, frame_counter_ = 0; int v_sync_start_position_, v_sync_end_position_, counter_period_; // Output target and device @@ -38,11 +38,11 @@ class VideoOutput { // Registers uint8_t ink_, paper_; - int character_set_base_address_; + int character_set_base_address_ = 0xb400; inline void set_character_set_base_address(); - bool is_graphics_mode_; - bool next_frame_is_sixty_hertz_; + bool is_graphics_mode_ = false; + bool next_frame_is_sixty_hertz_ = false; bool use_alternative_character_set_; bool use_double_height_characters_; bool blink_text_; diff --git a/Machines/Utility/Typer.cpp b/Machines/Utility/Typer.cpp index 678c64ea7..61297237f 100644 --- a/Machines/Utility/Typer.cpp +++ b/Machines/Utility/Typer.cpp @@ -7,16 +7,16 @@ // #include "Typer.hpp" -#include + +#include +#include using namespace Utility; Typer::Typer(const char *string, HalfCycles delay, HalfCycles frequency, std::unique_ptr character_mapper, Delegate *delegate) : - counter_(-delay), frequency_(frequency), - string_pointer_(0), + counter_(-delay), delegate_(delegate), - phase_(0), character_mapper_(std::move(character_mapper)) { size_t string_size = strlen(string) + 3; string_ = (char *)malloc(string_size); diff --git a/Machines/Utility/Typer.hpp b/Machines/Utility/Typer.hpp index 39570d0e4..33500b3f9 100644 --- a/Machines/Utility/Typer.hpp +++ b/Machines/Utility/Typer.hpp @@ -63,11 +63,11 @@ class Typer { private: char *string_; - size_t string_pointer_; + size_t string_pointer_ = 0; HalfCycles frequency_; HalfCycles counter_; - int phase_; + int phase_ = 0; Delegate *delegate_; std::unique_ptr character_mapper_; diff --git a/Machines/ZX8081/Video.cpp b/Machines/ZX8081/Video.cpp index 89c73fc9e..f92e60479 100644 --- a/Machines/ZX8081/Video.cpp +++ b/Machines/ZX8081/Video.cpp @@ -11,11 +11,7 @@ using namespace ZX8081; Video::Video() : - crt_(new Outputs::CRT::CRT(207 * 2, 1, Outputs::CRT::DisplayType::PAL50, 1)), - line_data_(nullptr), - line_data_pointer_(nullptr), - cycles_since_update_(0), - sync_(false) { + crt_(new Outputs::CRT::CRT(207 * 2, 1, Outputs::CRT::DisplayType::PAL50, 1)) { // Set a composite sampling function that assumes 8bpp input grayscale. // TODO: lessen this to 1bpp. diff --git a/Machines/ZX8081/Video.hpp b/Machines/ZX8081/Video.hpp index 29aa00821..d6ef09cf3 100644 --- a/Machines/ZX8081/Video.hpp +++ b/Machines/ZX8081/Video.hpp @@ -42,9 +42,10 @@ class Video { void output_byte(uint8_t byte); private: - bool sync_; - uint8_t *line_data_, *line_data_pointer_; - unsigned int cycles_since_update_; + bool sync_ = false; + uint8_t *line_data_ = nullptr; + uint8_t *line_data_pointer_ = nullptr; + unsigned int cycles_since_update_ = 0; std::shared_ptr crt_; void flush(bool next_sync); diff --git a/Machines/ZX8081/ZX8081.cpp b/Machines/ZX8081/ZX8081.cpp index e587f4561..55a96108b 100644 --- a/Machines/ZX8081/ZX8081.cpp +++ b/Machines/ZX8081/ZX8081.cpp @@ -36,13 +36,7 @@ template class ConcreteMachine: public: ConcreteMachine() : z80_(*this), - vsync_(false), - hsync_(false), - nmi_is_enabled_(false), - tape_player_(ZX8081ClockRate), - use_fast_tape_hack_(false), - tape_advance_delay_(0), - has_latched_video_byte_(false) { + tape_player_(ZX8081ClockRate) { set_clock_rate(ZX8081ClockRate); clear_all_keys(); } @@ -367,8 +361,8 @@ template class ConcreteMachine: std::vector rom_; uint16_t rom_mask_; - bool vsync_, hsync_; - int line_counter_; + bool vsync_ = false, hsync_ = false; + int line_counter_ = 0; uint8_t key_states_[8]; ZX8081::KeyboardMapper keyboard_mapper_; @@ -377,17 +371,17 @@ template class ConcreteMachine: Storage::Tape::ZX8081::Parser parser_; bool is_zx81_; - bool nmi_is_enabled_; + bool nmi_is_enabled_ = false; HalfCycles vsync_start_, vsync_end_; HalfCycles horizontal_counter_; - uint8_t latched_video_byte_; - bool has_latched_video_byte_; + uint8_t latched_video_byte_ = 0; + bool has_latched_video_byte_ = false; - bool use_fast_tape_hack_; + bool use_fast_tape_hack_ = false; bool use_automatic_tape_motor_control_; - HalfCycles tape_advance_delay_; + HalfCycles tape_advance_delay_ = 0; #pragma mark - Video diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index e8c6029ad..5510aa6c0 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -3651,6 +3651,10 @@ GCC_WARN_SIGN_COMPARE = YES; INFOPLIST_FILE = "Clock Signal/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wreorder", + ); PRODUCT_BUNDLE_IDENTIFIER = "TH.Clock-Signal"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Clock Signal/ClockSignal-Bridging-Header.h"; @@ -3685,6 +3689,10 @@ GCC_WARN_SIGN_COMPARE = YES; INFOPLIST_FILE = "Clock Signal/Info.plist"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks"; + OTHER_CPLUSPLUSFLAGS = ( + "$(OTHER_CFLAGS)", + "-Wreorder", + ); PRODUCT_BUNDLE_IDENTIFIER = "TH.Clock-Signal"; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Clock Signal/ClockSignal-Bridging-Header.h"; diff --git a/OSBindings/SDL/SConstruct b/OSBindings/SDL/SConstruct new file mode 100644 index 000000000..6c3001bc5 --- /dev/null +++ b/OSBindings/SDL/SConstruct @@ -0,0 +1,77 @@ +import glob + +# create build environment +env = Environment() + +# determine compiler and linker flags for SDL +env.ParseConfig('sdl2-config --cflags') +env.ParseConfig('sdl2-config --libs') + +# gather a list of source files +SOURCES = glob.glob('*.cpp') + +SOURCES += glob.glob('../../Components/1770/*.cpp') +SOURCES += glob.glob('../../Components/6522/Implementation/*.cpp') +SOURCES += glob.glob('../../Components/6560/*.cpp') +SOURCES += glob.glob('../../Components/8272/*.cpp') +SOURCES += glob.glob('../../Components/AY38910/*.cpp') + +SOURCES += glob.glob('../../Concurrency/*.cpp') + +SOURCES += glob.glob('../../Inputs/*.cpp') + +SOURCES += glob.glob('../../Machines/*.cpp') +SOURCES += glob.glob('../../Machines/AmstradCPC/*.cpp') +SOURCES += glob.glob('../../Machines/Atari2600/*.cpp') +SOURCES += glob.glob('../../Machines/Commodore/*.cpp') +SOURCES += glob.glob('../../Machines/Commodore/1540/Implementation/*.cpp') +SOURCES += glob.glob('../../Machines/Commodore/Vic-20/*.cpp') +SOURCES += glob.glob('../../Machines/Electron/*.cpp') +SOURCES += glob.glob('../../Machines/Oric/*.cpp') +SOURCES += glob.glob('../../Machines/Utility/*.cpp') +SOURCES += glob.glob('../../Machines/ZX8081/*.cpp') + +SOURCES += glob.glob('../../Outputs/CRT/*.cpp') +SOURCES += glob.glob('../../Outputs/CRT/Internals/*.cpp') +SOURCES += glob.glob('../../Outputs/CRT/Internals/Shaders/*.cpp') + +SOURCES += glob.glob('../../Processors/6502/Implementation/*.cpp') +SOURCES += glob.glob('../../Processors/Z80/Implementation/*.cpp') + +SOURCES += glob.glob('../../SignalProcessing/*.cpp') + +SOURCES += glob.glob('../../StaticAnalyser/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/Acorn/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/AmstradCPC/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/Atari/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/Commodore/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/Disassembler/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/Oric/*.cpp') +SOURCES += glob.glob('../../StaticAnalyser/ZX8081/*.cpp') + +SOURCES += glob.glob('../../Storage/*.cpp') +SOURCES += glob.glob('../../Storage/Cartridge/*.cpp') +SOURCES += glob.glob('../../Storage/Cartridge/Encodings/*.cpp') +SOURCES += glob.glob('../../Storage/Cartridge/Formats/*.cpp') +SOURCES += glob.glob('../../Storage/Data/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/Controller/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/DiskImage/Formats/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/DiskImage/Formats/Utility/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/DPLL/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/Encodings/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/Encodings/MFM/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/Parsers/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/Track/*.cpp') +SOURCES += glob.glob('../../Storage/Disk/Data/*.cpp') +SOURCES += glob.glob('../../Storage/Tape/*.cpp') +SOURCES += glob.glob('../../Storage/Tape/Formats/*.cpp') +SOURCES += glob.glob('../../Storage/Tape/Parsers/*.cpp') + +# add additional compiler flags +env.Append(CCFLAGS = ['--std=c++11', '-O3']) +# add additional libraries to link against +env.Append(LIBS = ['libz', 'pthread', 'GL']) + +# build target +env.Program(target = 'clksignal', source = SOURCES) diff --git a/Outputs/CRT/CRT.cpp b/Outputs/CRT/CRT.cpp index 14487acda..badf2b09d 100644 --- a/Outputs/CRT/CRT.cpp +++ b/Outputs/CRT/CRT.cpp @@ -7,7 +7,7 @@ // #include "CRT.hpp" -#include "CRTOpenGL.hpp" +#include "Internals/CRTOpenGL.hpp" #include #include #include @@ -343,37 +343,33 @@ void CRT::output_scan(const Scan *const scan) { These all merely channel into advance_cycles, supplying appropriate arguments */ void CRT::output_sync(unsigned int number_of_cycles) { - Scan scan{ - .type = Scan::Type::Sync, - .number_of_cycles = number_of_cycles - }; + Scan scan; + scan.type = Scan::Type::Sync; + scan.number_of_cycles = number_of_cycles; output_scan(&scan); } void CRT::output_blank(unsigned int number_of_cycles) { - Scan scan { - .type = Scan::Type::Blank, - .number_of_cycles = number_of_cycles - }; + Scan scan; + scan.type = Scan::Type::Blank; + scan.number_of_cycles = number_of_cycles; output_scan(&scan); } void CRT::output_level(unsigned int number_of_cycles) { openGL_output_builder_.texture_builder.reduce_previous_allocation_to(1); - Scan scan { - .type = Scan::Type::Level, - .number_of_cycles = number_of_cycles, - }; + Scan scan; + scan.type = Scan::Type::Level; + scan.number_of_cycles = number_of_cycles; output_scan(&scan); } void CRT::output_colour_burst(unsigned int number_of_cycles, uint8_t phase, uint8_t amplitude) { - Scan scan { - .type = Scan::Type::ColourBurst, - .number_of_cycles = number_of_cycles, - .phase = phase, - .amplitude = amplitude - }; + Scan scan; + scan.type = Scan::Type::ColourBurst; + scan.number_of_cycles = number_of_cycles; + scan.phase = phase; + scan.amplitude = amplitude; output_scan(&scan); } @@ -383,10 +379,9 @@ void CRT::output_default_colour_burst(unsigned int number_of_cycles) { void CRT::output_data(unsigned int number_of_cycles, unsigned int source_divider) { openGL_output_builder_.texture_builder.reduce_previous_allocation_to(number_of_cycles / source_divider); - Scan scan { - .type = Scan::Type::Data, - .number_of_cycles = number_of_cycles, - }; + Scan scan; + scan.type = Scan::Type::Data; + scan.number_of_cycles = number_of_cycles; output_scan(&scan); } diff --git a/Outputs/CRT/CRTTypes.hpp b/Outputs/CRT/CRTTypes.hpp index 842c2f9f3..f983ed35b 100644 --- a/Outputs/CRT/CRTTypes.hpp +++ b/Outputs/CRT/CRTTypes.hpp @@ -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 { diff --git a/Outputs/CRT/Internals/ArrayBuilder.cpp b/Outputs/CRT/Internals/ArrayBuilder.cpp index 30c4cf6aa..5a71d3778 100644 --- a/Outputs/CRT/Internals/ArrayBuilder.cpp +++ b/Outputs/CRT/Internals/ArrayBuilder.cpp @@ -8,6 +8,8 @@ #include "ArrayBuilder.hpp" +#include + using namespace Outputs::CRT; ArrayBuilder::ArrayBuilder(size_t input_size, size_t output_size) : diff --git a/Outputs/CRT/Internals/CRTOpenGL.cpp b/Outputs/CRT/Internals/CRTOpenGL.cpp index bfccfdc52..a74968606 100644 --- a/Outputs/CRT/Internals/CRTOpenGL.cpp +++ b/Outputs/CRT/Internals/CRTOpenGL.cpp @@ -5,7 +5,7 @@ // Copyright © 2016 Thomas Harte. All rights reserved. // -#include "CRT.hpp" +#include "../CRT.hpp" #include #include diff --git a/Outputs/CRT/Internals/CRTOpenGL.hpp b/Outputs/CRT/Internals/CRTOpenGL.hpp index 4dbacf0c5..b0344c254 100644 --- a/Outputs/CRT/Internals/CRTOpenGL.hpp +++ b/Outputs/CRT/Internals/CRTOpenGL.hpp @@ -13,7 +13,7 @@ #include "CRTConstants.hpp" #include "OpenGL.hpp" #include "TextureTarget.hpp" -#include "Shader.hpp" +#include "Shaders/Shader.hpp" #include "ArrayBuilder.hpp" #include "TextureBuilder.hpp" diff --git a/Outputs/CRT/Internals/Flywheel.hpp b/Outputs/CRT/Internals/Flywheel.hpp index 92a0d75a6..5b83edcf6 100644 --- a/Outputs/CRT/Internals/Flywheel.hpp +++ b/Outputs/CRT/Internals/Flywheel.hpp @@ -34,8 +34,8 @@ struct Flywheel { retrace_time_(retrace_time), sync_error_window_(sync_error_window), counter_(0), - expected_next_sync_(standard_period), counter_before_retrace_(standard_period - retrace_time), + expected_next_sync_(standard_period), number_of_surprises_(0) {} enum SyncEvent { diff --git a/Outputs/CRT/Internals/OpenGL.hpp b/Outputs/CRT/Internals/OpenGL.hpp index 629ebd501..f400e97fa 100644 --- a/Outputs/CRT/Internals/OpenGL.hpp +++ b/Outputs/CRT/Internals/OpenGL.hpp @@ -17,6 +17,9 @@ #include #include #endif +#else +#define GL_GLEXT_PROTOTYPES +#include #endif #endif /* OpenGL_h */ diff --git a/Outputs/CRT/Internals/Shaders/IntermediateShader.cpp b/Outputs/CRT/Internals/Shaders/IntermediateShader.cpp index 5bfad3f8a..0185afb98 100644 --- a/Outputs/CRT/Internals/Shaders/IntermediateShader.cpp +++ b/Outputs/CRT/Internals/Shaders/IntermediateShader.cpp @@ -8,9 +8,11 @@ #include "IntermediateShader.hpp" -#include -#include -#include +#include +#include +#include +#include + #include "../../../../SignalProcessing/FIRFilter.hpp" using namespace OpenGL; diff --git a/Outputs/CRT/Internals/Shaders/Shader.cpp b/Outputs/CRT/Internals/Shaders/Shader.cpp index 5010dab0e..66f1c05a2 100644 --- a/Outputs/CRT/Internals/Shaders/Shader.cpp +++ b/Outputs/CRT/Internals/Shaders/Shader.cpp @@ -8,7 +8,8 @@ #include "Shader.hpp" -#include +#include +#include using namespace OpenGL; diff --git a/Outputs/CRT/Internals/Shaders/Shader.hpp b/Outputs/CRT/Internals/Shaders/Shader.hpp index 1a9fc8099..0aaaf3087 100644 --- a/Outputs/CRT/Internals/Shaders/Shader.hpp +++ b/Outputs/CRT/Internals/Shaders/Shader.hpp @@ -9,7 +9,7 @@ #ifndef Shader_hpp #define Shader_hpp -#include "OpenGL.hpp" +#include "../OpenGL.hpp" #include #include #include diff --git a/Outputs/CRT/Internals/TextureBuilder.cpp b/Outputs/CRT/Internals/TextureBuilder.cpp index 471521028..6538789ed 100644 --- a/Outputs/CRT/Internals/TextureBuilder.cpp +++ b/Outputs/CRT/Internals/TextureBuilder.cpp @@ -51,12 +51,7 @@ struct DefaultBookender: public TextureBuilder::Bookender { } TextureBuilder::TextureBuilder(size_t bytes_per_pixel, GLenum texture_unit) : - bytes_per_pixel_(bytes_per_pixel), - write_areas_start_x_(0), - write_areas_start_y_(0), - first_unsubmitted_y_(0), - is_full_(false), - number_of_write_areas_(0) { + bytes_per_pixel_(bytes_per_pixel) { image_.resize(bytes_per_pixel * InputBufferBuilderWidth * InputBufferBuilderHeight); glGenTextures(1, &texture_name_); diff --git a/Outputs/CRT/Internals/TextureBuilder.hpp b/Outputs/CRT/Internals/TextureBuilder.hpp index 5e094f596..25191420f 100644 --- a/Outputs/CRT/Internals/TextureBuilder.hpp +++ b/Outputs/CRT/Internals/TextureBuilder.hpp @@ -127,15 +127,15 @@ class TextureBuilder { // the list of write areas that have ascended to the flush queue std::vector write_areas_; - size_t number_of_write_areas_; - bool is_full_, was_full_; - uint16_t first_unsubmitted_y_; + size_t number_of_write_areas_ = 0; + bool is_full_ = false, was_full_ = false; + uint16_t first_unsubmitted_y_ = 0; inline uint8_t *pointer_to_location(uint16_t x, uint16_t y); // Usually: the start position for the current batch of write areas. // Caveat: reset to the origin upon a submit. So used in comparison by flush to // determine whether the current batch of write areas needs to be relocated. - uint16_t write_areas_start_x_, write_areas_start_y_; + uint16_t write_areas_start_x_ = 0, write_areas_start_y_ = 0; std::unique_ptr bookender_; }; diff --git a/Outputs/CRT/Internals/TextureTarget.cpp b/Outputs/CRT/Internals/TextureTarget.cpp index b7778fe77..dbb907b73 100644 --- a/Outputs/CRT/Internals/TextureTarget.cpp +++ b/Outputs/CRT/Internals/TextureTarget.cpp @@ -15,11 +15,8 @@ using namespace OpenGL; TextureTarget::TextureTarget(GLsizei width, GLsizei height, GLenum texture_unit, GLint mag_filter) : _width(width), _height(height), - _pixel_shader(nullptr), - _drawing_vertex_array(0), - _drawing_array_buffer(0), - _set_aspect_ratio(0.0f), - _texture_unit(texture_unit) { + _texture_unit(texture_unit), + _set_aspect_ratio(0.0f) { glGenFramebuffers(1, &_framebuffer); glBindFramebuffer(GL_FRAMEBUFFER, _framebuffer); diff --git a/Outputs/CRT/Internals/TextureTarget.hpp b/Outputs/CRT/Internals/TextureTarget.hpp index 122d12572..c7e8d5151 100644 --- a/Outputs/CRT/Internals/TextureTarget.hpp +++ b/Outputs/CRT/Internals/TextureTarget.hpp @@ -73,7 +73,7 @@ class TextureTarget { GLenum _texture_unit; std::unique_ptr _pixel_shader; - GLuint _drawing_vertex_array, _drawing_array_buffer; + GLuint _drawing_vertex_array = 0, _drawing_array_buffer = 0; float _set_aspect_ratio; }; diff --git a/Outputs/Speaker.hpp b/Outputs/Speaker.hpp index 868fb5967..5437ffda5 100644 --- a/Outputs/Speaker.hpp +++ b/Outputs/Speaker.hpp @@ -9,8 +9,10 @@ #ifndef Speaker_hpp #define Speaker_hpp +#include #include #include +#include #include #include @@ -81,7 +83,7 @@ class Speaker { set_needs_updated_filter_coefficients(); } - Speaker() : buffer_in_progress_pointer_(0), requested_number_of_taps_(0), high_frequency_cut_off_(-1.0), _queue(new Concurrency::AsyncTaskQueue) {} + Speaker() : _queue(new Concurrency::AsyncTaskQueue) {} /*! Ensures any deferred processing occurs now. @@ -105,9 +107,10 @@ class Speaker { std::shared_ptr>> queued_functions_; std::vector buffer_in_progress_; - float high_frequency_cut_off_; - size_t buffer_in_progress_pointer_; - size_t number_of_taps_, requested_number_of_taps_; + float high_frequency_cut_off_ = -1.0; + size_t buffer_in_progress_pointer_ = 0; + size_t number_of_taps_; + size_t requested_number_of_taps_ = 0; bool coefficients_are_dirty_; Delegate *delegate_ = nullptr; diff --git a/Processors/6502/Implementation/6502Storage.cpp b/Processors/6502/Implementation/6502Storage.cpp index 9e226266d..688bee285 100644 --- a/Processors/6502/Implementation/6502Storage.cpp +++ b/Processors/6502/Implementation/6502Storage.cpp @@ -244,19 +244,7 @@ const ProcessorStorage::MicroOp ProcessorStorage::operations[256][10] = { #undef Immediate #undef Implied -ProcessorStorage::ProcessorStorage() : - is_jammed_(false), - ready_line_is_enabled_(false), - ready_is_active_(false), - inverse_interrupt_flag_(0), - irq_request_history_(0), - s_(0), - next_bus_operation_(BusOperation::None), - interrupt_requests_(InterruptRequestFlags::PowerOn), - irq_line_(0), - nmi_line_is_enabled_(false), - set_overflow_line_is_enabled_(false), - scheduled_program_counter_(nullptr) { +ProcessorStorage::ProcessorStorage() { // only the interrupt flag is defined upon reset but get_flags isn't going to // mask the other flags so we need to do that, at least carry_flag_ &= Flag::Carry; diff --git a/Processors/6502/Implementation/6502Storage.hpp b/Processors/6502/Implementation/6502Storage.hpp index 27a19fe3c..227def011 100644 --- a/Processors/6502/Implementation/6502Storage.hpp +++ b/Processors/6502/Implementation/6502Storage.hpp @@ -64,14 +64,14 @@ class ProcessorStorage { static const MicroOp operations[256][10]; - const MicroOp *scheduled_program_counter_; + const MicroOp *scheduled_program_counter_ = nullptr; /* Storage for the 6502 registers; F is stored as individual flags. */ RegisterPair pc_, last_operation_pc_; - uint8_t a_, x_, y_, s_; - uint8_t carry_flag_, negative_result_, zero_result_, decimal_flag_, overflow_flag_, inverse_interrupt_flag_; + uint8_t a_, x_, y_, s_ = 0; + uint8_t carry_flag_, negative_result_, zero_result_, decimal_flag_, overflow_flag_, inverse_interrupt_flag_ = 0; /* Temporary state for the micro programs. @@ -83,7 +83,7 @@ class ProcessorStorage { Temporary storage allowing a common dispatch point for calling perform_bus_operation; possibly deferring is no longer of value. */ - BusOperation next_bus_operation_; + BusOperation next_bus_operation_ = BusOperation::None; uint16_t bus_address_; uint8_t *bus_value_; @@ -105,7 +105,7 @@ class ProcessorStorage { */ inline void set_flags(uint8_t flags); - bool is_jammed_; + bool is_jammed_ = false; Cycles cycles_left_to_run_; enum InterruptRequestFlags: uint8_t { @@ -115,13 +115,13 @@ class ProcessorStorage { PowerOn = 0x10, }; - uint8_t interrupt_requests_; + uint8_t interrupt_requests_ = InterruptRequestFlags::PowerOn; - bool ready_is_active_; - bool ready_line_is_enabled_; + bool ready_is_active_ = false; + bool ready_line_is_enabled_ = false; - uint8_t irq_line_, irq_request_history_; - bool nmi_line_is_enabled_, set_overflow_line_is_enabled_; + uint8_t irq_line_ = 0, irq_request_history_ = 0; + bool nmi_line_is_enabled_ = false, set_overflow_line_is_enabled_ = false; /*! Gets the program representing an RST response. diff --git a/Processors/Z80/Implementation/Z80Implementation.hpp b/Processors/Z80/Implementation/Z80Implementation.hpp index 5e09d9f6d..de98267b5 100644 --- a/Processors/Z80/Implementation/Z80Implementation.hpp +++ b/Processors/Z80/Implementation/Z80Implementation.hpp @@ -849,7 +849,6 @@ template < class T, break; case MicroOp::IndexedPlaceHolder: - printf("Hit placeholder!!!\n"); return; } #undef set_parity diff --git a/Processors/Z80/Implementation/Z80Storage.cpp b/Processors/Z80/Implementation/Z80Storage.cpp index a531e93a7..8b606312c 100644 --- a/Processors/Z80/Implementation/Z80Storage.cpp +++ b/Processors/Z80/Implementation/Z80Storage.cpp @@ -7,20 +7,11 @@ // #include "../Z80.hpp" +#include using namespace CPU::Z80; -ProcessorStorage::ProcessorStorage() : - halt_mask_(0xff), - interrupt_mode_(0), - wait_line_(false), - request_status_(Interrupt::PowerOn), - last_request_status_(Interrupt::PowerOn), - irq_line_(false), - nmi_line_(false), - bus_request_line_(false), - pc_increment_(1), - scheduled_program_counter_(nullptr) { +ProcessorStorage::ProcessorStorage() { set_flags(0xff); } diff --git a/Processors/Z80/Implementation/Z80Storage.hpp b/Processors/Z80/Implementation/Z80Storage.hpp index 04b39e33f..b45cead2e 100644 --- a/Processors/Z80/Implementation/Z80Storage.hpp +++ b/Processors/Z80/Implementation/Z80Storage.hpp @@ -121,8 +121,8 @@ class ProcessorStorage { RegisterPair ix_, iy_, pc_, sp_; RegisterPair ir_, refresh_addr_; bool iff1_, iff2_; - int interrupt_mode_; - uint16_t pc_increment_; + int interrupt_mode_ = 0; + uint16_t pc_increment_ = 1; uint8_t sign_result_; // the sign flag is set if the value in sign_result_ is negative uint8_t zero_result_; // the zero flag is set if the value in zero_result_ is zero uint8_t half_carry_result_; // the half-carry flag is set if bit 4 of half_carry_result_ is set @@ -130,7 +130,7 @@ class ProcessorStorage { uint8_t parity_overflow_result_; // the parity/overflow flag is set if the corresponding bit of parity_overflow_result_ is set uint8_t subtract_flag_; // contains a copy of the subtract flag in isolation uint8_t carry_result_; // the carry flag is set if bit 0 of carry_result_ is set - uint8_t halt_mask_; + uint8_t halt_mask_ = 0xff; HalfCycles number_of_cycles_; @@ -140,17 +140,17 @@ class ProcessorStorage { Reset = 0x04, PowerOn = 0x08 }; - uint8_t request_status_; - uint8_t last_request_status_; - bool irq_line_, nmi_line_; - bool bus_request_line_; - bool wait_line_; + uint8_t request_status_ = Interrupt::PowerOn; + uint8_t last_request_status_ = Interrupt::PowerOn; + bool irq_line_ = false, nmi_line_ = false; + bool bus_request_line_ = false; + bool wait_line_ = false; uint8_t operation_; RegisterPair temp16_, memptr_; uint8_t temp8_; - const MicroOp *scheduled_program_counter_; + const MicroOp *scheduled_program_counter_ = nullptr; std::vector conditional_call_untaken_program_; std::vector reset_program_; diff --git a/SignalProcessing/FIRFilter.cpp b/SignalProcessing/FIRFilter.cpp index 8eabeb663..8531ab3cc 100644 --- a/SignalProcessing/FIRFilter.cpp +++ b/SignalProcessing/FIRFilter.cpp @@ -31,11 +31,6 @@ using namespace SignalProcessing; "DIGITAL SIGNAL PROCESSING, II", IEEE Press, pages 123–126. */ - -// our little fixed point scheme -#define kCSKaiserBesselFilterFixedMultiplier 32767.0f -#define kCSKaiserBesselFilterFixedShift 15 - /*! Evaluates the 0th order Bessel function at @c a. */ float FIRFilter::ino(float a) { float d = 0.0f; diff --git a/SignalProcessing/FIRFilter.hpp b/SignalProcessing/FIRFilter.hpp index e98c7a725..8f7afaf39 100644 --- a/SignalProcessing/FIRFilter.hpp +++ b/SignalProcessing/FIRFilter.hpp @@ -34,6 +34,10 @@ namespace SignalProcessing { class FIRFilter { + private: + static constexpr float kCSKaiserBesselFilterFixedMultiplier = 32767.0f; + static constexpr int kCSKaiserBesselFilterFixedShift = 15; + public: /*! Creates an instance of @c FIRFilter. diff --git a/SignalProcessing/Stepper.hpp b/SignalProcessing/Stepper.hpp index 509e28224..6db2cef5d 100644 --- a/SignalProcessing/Stepper.hpp +++ b/SignalProcessing/Stepper.hpp @@ -87,10 +87,10 @@ class Stepper { } private: - uint64_t whole_step_; - int64_t adjustment_up_, adjustment_down_; int64_t accumulated_error_; uint64_t input_rate_, output_rate_; + uint64_t whole_step_; + int64_t adjustment_up_, adjustment_down_; }; } diff --git a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp b/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp index 943f85255..246371deb 100644 --- a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp +++ b/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp @@ -8,13 +8,16 @@ #include "StaticAnalyser.hpp" +#include +#include + #include "../../Storage/Disk/Parsers/CPM.hpp" #include "../../Storage/Disk/Encodings/MFM/Parser.hpp" static bool strcmp_insensitive(const char *a, const char *b) { if(strlen(a) != strlen(b)) return false; while(*a) { - if(tolower(*a) != towlower(*b)) return false; + if(tolower(*a) != tolower(*b)) return false; a++; b++; } diff --git a/StaticAnalyser/Commodore/File.hpp b/StaticAnalyser/Commodore/File.hpp index 6a4eda72d..a6bab1e0e 100644 --- a/StaticAnalyser/Commodore/File.hpp +++ b/StaticAnalyser/Commodore/File.hpp @@ -16,14 +16,12 @@ namespace StaticAnalyser { namespace Commodore { struct File { - File() : is_closed(false), is_locked(false) {} - std::wstring name; std::vector raw_name; uint16_t starting_address; uint16_t ending_address; - bool is_locked; - bool is_closed; + bool is_locked = false; + bool is_closed = false; enum { RelocatableProgram, NonRelocatableProgram, diff --git a/StaticAnalyser/StaticAnalyser.cpp b/StaticAnalyser/StaticAnalyser.cpp index 87e960aba..0676fd903 100644 --- a/StaticAnalyser/StaticAnalyser.cpp +++ b/StaticAnalyser/StaticAnalyser.cpp @@ -9,6 +9,7 @@ #include "StaticAnalyser.hpp" #include +#include // Analysers #include "Acorn/StaticAnalyser.hpp" diff --git a/Storage/Data/ZX8081.hpp b/Storage/Data/ZX8081.hpp index 780cc8a15..03e5c25f8 100644 --- a/Storage/Data/ZX8081.hpp +++ b/Storage/Data/ZX8081.hpp @@ -9,9 +9,10 @@ #ifndef Storage_Data_ZX8081_hpp #define Storage_Data_ZX8081_hpp +#include +#include #include #include -#include namespace Storage { namespace Data { diff --git a/Storage/Disk/Controller/MFMDiskController.cpp b/Storage/Disk/Controller/MFMDiskController.cpp index 55e57c4b7..c0b625c6d 100644 --- a/Storage/Disk/Controller/MFMDiskController.cpp +++ b/Storage/Disk/Controller/MFMDiskController.cpp @@ -14,9 +14,8 @@ using namespace Storage::Disk; MFMController::MFMController(Cycles clock_rate) : Storage::Disk::Controller(clock_rate), - crc_generator_(0x1021, 0xffff), - data_mode_(DataMode::Scanning), - shifter_(&crc_generator_) { + shifter_(&crc_generator_), + crc_generator_(0x1021, 0xffff) { } void MFMController::process_index_hole() { diff --git a/Storage/Disk/Controller/MFMDiskController.hpp b/Storage/Disk/Controller/MFMDiskController.hpp index 372f04a93..60c152e35 100644 --- a/Storage/Disk/Controller/MFMDiskController.hpp +++ b/Storage/Disk/Controller/MFMDiskController.hpp @@ -157,7 +157,7 @@ class MFMController: public Controller { // input configuration bool is_double_density_; - DataMode data_mode_; + DataMode data_mode_ = DataMode::Scanning; // writing int last_bit_; diff --git a/Storage/Disk/DiskImage/Formats/D64.cpp b/Storage/Disk/DiskImage/Formats/D64.cpp index cd6bde7af..7f35b2397 100644 --- a/Storage/Disk/DiskImage/Formats/D64.cpp +++ b/Storage/Disk/DiskImage/Formats/D64.cpp @@ -9,6 +9,7 @@ #include "D64.hpp" #include +#include #include #include "../../Track/PCMTrack.hpp" diff --git a/Storage/Disk/DiskImage/Formats/G64.cpp b/Storage/Disk/DiskImage/Formats/G64.cpp index 3bb7870d5..8e04c70ef 100644 --- a/Storage/Disk/DiskImage/Formats/G64.cpp +++ b/Storage/Disk/DiskImage/Formats/G64.cpp @@ -8,7 +8,9 @@ #include "G64.hpp" +#include #include + #include "../../Track/PCMTrack.hpp" #include "../../Encodings/CommodoreGCR.hpp" diff --git a/Storage/Disk/DiskImage/Formats/SSD.cpp b/Storage/Disk/DiskImage/Formats/SSD.cpp index d5fcf570b..0b6cbb939 100644 --- a/Storage/Disk/DiskImage/Formats/SSD.cpp +++ b/Storage/Disk/DiskImage/Formats/SSD.cpp @@ -8,6 +8,8 @@ #include "SSD.hpp" +#include + #include "Utility/ImplicitSectors.hpp" namespace { diff --git a/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp b/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp index 5c1f62852..c2d601298 100644 --- a/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp +++ b/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp @@ -8,6 +8,8 @@ #include "ImplicitSectors.hpp" +#include + #include "../../../Encodings/MFM/Sector.hpp" #include "../../../Encodings/MFM/Encoder.hpp" #include "../../../Encodings/MFM/Constants.hpp" diff --git a/Storage/Disk/Drive.cpp b/Storage/Disk/Drive.cpp index 3e809e3d6..9566428c3 100644 --- a/Storage/Disk/Drive.cpp +++ b/Storage/Disk/Drive.cpp @@ -8,7 +8,7 @@ #include "Drive.hpp" -#include "UnformattedTrack.hpp" +#include "Track/UnformattedTrack.hpp" #include #include diff --git a/Storage/Disk/Encodings/MFM/Encoder.hpp b/Storage/Disk/Encodings/MFM/Encoder.hpp index 791f10450..971746f6d 100644 --- a/Storage/Disk/Encodings/MFM/Encoder.hpp +++ b/Storage/Disk/Encodings/MFM/Encoder.hpp @@ -10,7 +10,9 @@ #define Storage_Disk_Encodings_MFM_hpp #include +#include #include + #include "Sector.hpp" #include "../../Track/Track.hpp" #include "../../../../NumberTheory/CRC.hpp" diff --git a/Storage/Disk/Encodings/MFM/Parser.cpp b/Storage/Disk/Encodings/MFM/Parser.cpp index 5bdda087b..171f00784 100644 --- a/Storage/Disk/Encodings/MFM/Parser.cpp +++ b/Storage/Disk/Encodings/MFM/Parser.cpp @@ -15,7 +15,7 @@ using namespace Storage::Encodings::MFM; Parser::Parser(bool is_mfm, const std::shared_ptr &disk) : - is_mfm_(is_mfm), disk_(disk) {} + disk_(disk), is_mfm_(is_mfm) {} void Parser::install_sectors_from_track(const Storage::Disk::Track::Address &address) { if(sectors_by_address_by_track_.find(address) != sectors_by_address_by_track_.end()) { diff --git a/Storage/Disk/Parsers/CPM.cpp b/Storage/Disk/Parsers/CPM.cpp index 81e26b6ae..03fab488f 100644 --- a/Storage/Disk/Parsers/CPM.cpp +++ b/Storage/Disk/Parsers/CPM.cpp @@ -8,6 +8,9 @@ #include "CPM.hpp" +#include +#include + #include "../Encodings/MFM/Parser.hpp" using namespace Storage::Disk::CPM; diff --git a/Storage/Disk/Track/PCMSegment.hpp b/Storage/Disk/Track/PCMSegment.hpp index f8bebdc17..e072c24f5 100644 --- a/Storage/Disk/Track/PCMSegment.hpp +++ b/Storage/Disk/Track/PCMSegment.hpp @@ -10,6 +10,7 @@ #define PCMSegment_hpp #include +#include #include #include "../../Storage.hpp" diff --git a/Storage/FileHolder.cpp b/Storage/FileHolder.cpp index 4fec9ef73..62a0ee470 100644 --- a/Storage/FileHolder.cpp +++ b/Storage/FileHolder.cpp @@ -8,6 +8,7 @@ #include "FileHolder.hpp" +#include #include using namespace Storage; diff --git a/Storage/Tape/Formats/CommodoreTAP.cpp b/Storage/Tape/Formats/CommodoreTAP.cpp index 428339cbb..74c7747fb 100644 --- a/Storage/Tape/Formats/CommodoreTAP.cpp +++ b/Storage/Tape/Formats/CommodoreTAP.cpp @@ -13,7 +13,6 @@ using namespace Storage::Tape; CommodoreTAP::CommodoreTAP(const char *file_name) : - is_at_end_(false), file_(file_name) { if(!file_.check_signature("C64-TAPE-RAW")) diff --git a/Storage/Tape/Formats/CommodoreTAP.hpp b/Storage/Tape/Formats/CommodoreTAP.hpp index d1f981ad0..ac3e637f1 100644 --- a/Storage/Tape/Formats/CommodoreTAP.hpp +++ b/Storage/Tape/Formats/CommodoreTAP.hpp @@ -44,7 +44,7 @@ class CommodoreTAP: public Tape { uint32_t file_size_; Pulse current_pulse_; - bool is_at_end_; + bool is_at_end_ = false; }; } diff --git a/Storage/Tape/Formats/TZX.cpp b/Storage/Tape/Formats/TZX.cpp index 1c5dfe9ed..b8fa84a89 100644 --- a/Storage/Tape/Formats/TZX.cpp +++ b/Storage/Tape/Formats/TZX.cpp @@ -300,12 +300,14 @@ void TZX::ignore_group_end() { } void TZX::ignore_jump_to_block() { - __unused uint16_t target = file_.get16le(); + uint16_t target = file_.get16le(); + (void)target; printf("Ignoring TZX jump\n"); } void TZX::ignore_loop_start() { - __unused uint16_t number_of_repetitions = file_.get16le(); + uint16_t number_of_repetitions = file_.get16le(); + (void)number_of_repetitions; printf("Ignoring TZX loop\n"); } @@ -313,7 +315,7 @@ void TZX::ignore_loop_end() { } void TZX::ignore_call_sequence() { - __unused uint16_t number_of_entries = file_.get16le(); + uint16_t number_of_entries = file_.get16le(); file_.seek(number_of_entries * sizeof(uint16_t), SEEK_CUR); printf("Ignoring TZX call sequence\n"); } @@ -323,7 +325,7 @@ void TZX::ignore_return_from_sequence() { } void TZX::ignore_select_block() { - __unused uint16_t length_of_block = file_.get16le(); + uint16_t length_of_block = file_.get16le(); file_.seek(length_of_block, SEEK_CUR); printf("Ignoring TZX select block\n"); } @@ -337,9 +339,10 @@ void TZX::ignore_text_description() { } void TZX::ignore_message_block() { - __unused uint8_t time_for_display = file_.get8(); + uint8_t time_for_display = file_.get8(); uint8_t length = file_.get8(); file_.seek(length, SEEK_CUR); + (void)time_for_display; printf("Ignoring TZX message\n"); } diff --git a/Storage/Tape/Formats/TapePRG.cpp b/Storage/Tape/Formats/TapePRG.cpp index 8b8bc1d2f..e1131fa8d 100644 --- a/Storage/Tape/Formats/TapePRG.cpp +++ b/Storage/Tape/Formats/TapePRG.cpp @@ -49,10 +49,6 @@ using namespace Storage::Tape; PRG::PRG(const char *file_name) : - bit_phase_(3), - file_phase_(FilePhaseLeadIn), - phase_offset_(0), - copy_mask_(0x80), file_(file_name) { // There's really no way to validate other than that if this file is larger than 64kb, diff --git a/Storage/Tape/Formats/TapePRG.hpp b/Storage/Tape/Formats/TapePRG.hpp index e8a91f63b..907f09a3b 100644 --- a/Storage/Tape/Formats/TapePRG.hpp +++ b/Storage/Tape/Formats/TapePRG.hpp @@ -50,10 +50,10 @@ class PRG: public Tape { FilePhaseHeaderDataGap, FilePhaseData, FilePhaseAtEnd - } file_phase_; - int phase_offset_; + } file_phase_ = FilePhaseLeadIn; + int phase_offset_ = 0; - int bit_phase_; + int bit_phase_ = 3; enum OutputToken { Leader, Zero, @@ -65,7 +65,7 @@ class PRG: public Tape { void get_next_output_token(); uint8_t output_byte_; uint8_t check_digit_; - uint8_t copy_mask_; + uint8_t copy_mask_ = 0x80; }; } diff --git a/Storage/Tape/Formats/TapeUEF.cpp b/Storage/Tape/Formats/TapeUEF.cpp index cb59703fc..b43d7ac36 100644 --- a/Storage/Tape/Formats/TapeUEF.cpp +++ b/Storage/Tape/Formats/TapeUEF.cpp @@ -68,10 +68,7 @@ static int gzget32(gzFile file) { using namespace Storage::Tape; -UEF::UEF(const char *file_name) : - time_base_(1200), - is_300_baud_(false), - platform_type_(TargetPlatform::Acorn) { +UEF::UEF(const char *file_name) { file_ = gzopen(file_name, "rb"); char identifier[10]; diff --git a/Storage/Tape/Formats/TapeUEF.hpp b/Storage/Tape/Formats/TapeUEF.hpp index 41ba07c6a..989846261 100644 --- a/Storage/Tape/Formats/TapeUEF.hpp +++ b/Storage/Tape/Formats/TapeUEF.hpp @@ -41,11 +41,11 @@ class UEF : public PulseQueuedTape, public TargetPlatform::TypeDistinguisher { void set_platform_type(); TargetPlatform::Type target_platform_type(); - TargetPlatform::Type platform_type_; + TargetPlatform::Type platform_type_ = TargetPlatform::Acorn; gzFile file_; - unsigned int time_base_; - bool is_300_baud_; + unsigned int time_base_ = 1200; + bool is_300_baud_ = false; struct Chunk { uint16_t id; diff --git a/Storage/Tape/Parsers/Commodore.cpp b/Storage/Tape/Parsers/Commodore.cpp index a676b6356..257ce5fb6 100644 --- a/Storage/Tape/Parsers/Commodore.cpp +++ b/Storage/Tape/Parsers/Commodore.cpp @@ -7,15 +7,14 @@ // #include "Commodore.hpp" + +#include #include "../../Data/Commodore.hpp" using namespace Storage::Tape::Commodore; Parser::Parser() : - Storage::Tape::PulseClassificationParser(), - wave_period_(0.0f), - previous_was_high_(false), - parity_byte_(0) {} + Storage::Tape::PulseClassificationParser() {} /*! Advances to the next block on the tape, treating it as a header, then consumes, parses, and returns it. diff --git a/Storage/Tape/Parsers/Commodore.hpp b/Storage/Tape/Parsers/Commodore.hpp index 9c7c0bbf4..991168595 100644 --- a/Storage/Tape/Parsers/Commodore.hpp +++ b/Storage/Tape/Parsers/Commodore.hpp @@ -99,7 +99,7 @@ class Parser: public Storage::Tape::PulseClassificationParser &tape, uint8_t value); - uint8_t parity_byte_; + uint8_t parity_byte_ = 0; void reset_parity_byte(); uint8_t get_parity_byte(); void add_parity_byte(uint8_t byte); @@ -127,8 +127,8 @@ class Parser: public Storage::Tape::PulseClassificationParser &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); diff --git a/Storage/Tape/Parsers/TapeParser.hpp b/Storage/Tape/Parsers/TapeParser.hpp index d171c4dd6..013f7bcdb 100644 --- a/Storage/Tape/Parsers/TapeParser.hpp +++ b/Storage/Tape/Parsers/TapeParser.hpp @@ -20,7 +20,6 @@ namespace Tape { template class Parser { public: - Parser() : has_next_symbol_(false), error_flag_(false) {} /// Resets the error flag. void reset_error_flag() { error_flag_ = false; } /// @returns @c true if an error has occurred since the error flag was last reset; @c false otherwise. @@ -81,9 +80,9 @@ template class Parser { error_flag_ = true; } - bool error_flag_; + bool error_flag_ = false; SymbolType next_symbol_; - bool has_next_symbol_; + bool has_next_symbol_ = false; }; /*! diff --git a/Storage/Tape/Tape.cpp b/Storage/Tape/Tape.cpp index dcbbea3de..d551247ec 100644 --- a/Storage/Tape/Tape.cpp +++ b/Storage/Tape/Tape.cpp @@ -117,7 +117,7 @@ void TapePlayer::process_next_event() { #pragma mark - Binary Player BinaryTapePlayer::BinaryTapePlayer(unsigned int input_clock_rate) : - TapePlayer(input_clock_rate), motor_is_running_(false), input_level_(false), delegate_(nullptr) + TapePlayer(input_clock_rate) {} bool BinaryTapePlayer::is_sleeping() { diff --git a/Storage/Tape/Tape.hpp b/Storage/Tape/Tape.hpp index d0e7b27ee..1cc2aa435 100644 --- a/Storage/Tape/Tape.hpp +++ b/Storage/Tape/Tape.hpp @@ -146,10 +146,10 @@ class BinaryTapePlayer: public TapePlayer { bool is_sleeping(); protected: - Delegate *delegate_; + Delegate *delegate_ = nullptr; virtual void process_input_pulse(const Storage::Tape::Tape::Pulse &pulse); - bool input_level_; - bool motor_is_running_; + bool input_level_ = false; + bool motor_is_running_ = false; }; }