1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-06-26 10:29:31 +00:00

Merge pull request #266 from TomHarte/SDLScons

Introduces an SCons build file and corrects remaining Ubuntu build errors
This commit is contained in:
Thomas Harte 2017-11-10 23:43:44 -05:00 committed by GitHub
commit 7adc25694a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
88 changed files with 392 additions and 381 deletions

4
.gitignore vendored
View File

@ -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

View File

@ -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<int>(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<int>(Event1770::Command)) {
set_is_double_density(false);
posit_event(static_cast<int>(Event1770::Command));
}

View File

@ -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;
};
}

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

@ -8,13 +8,9 @@
#include "6560.hpp"
using namespace MOS;
#include <cstring>
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([=]() {

View File

@ -18,8 +18,6 @@ namespace MOS {
// audio state
class Speaker: public ::Outputs::Filter<Speaker> {
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<Speaker> {
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 T> 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 T> 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 T> 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];

View File

@ -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++) {

View File

@ -89,24 +89,25 @@ class AY38910: public ::Outputs::Filter<AY38910> {
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<AY38910> {
inline void evaluate_output_volume();
inline void update_bus();
PortHandler *port_handler_;
PortHandler *port_handler_ = nullptr;
};
}

View File

@ -9,10 +9,12 @@
#ifndef AsyncTaskQueue_hpp
#define AsyncTaskQueue_hpp
#include <atomic>
#include <condition_variable>
#include <functional>
#include <list>
#include <memory>
#include <thread>
#include <list>
#include <condition_variable>
#ifdef __APPLE__
#include <dispatch/dispatch.h>

View File

@ -602,9 +602,9 @@ class i8255PortHandler : public Intel::i8255::PortHandler {
const Motorola::CRTC::CRTC6845<CRTCBusHandler> &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<CRTCBusHandler> &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);

View File

@ -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:

View File

@ -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;
};
}

View File

@ -9,6 +9,8 @@
#ifndef Atari2600_PIA_h
#define Atari2600_PIA_h
#include <cstdint>
#include "../../Components/6532/6532.hpp"
namespace Atari2600 {

View File

@ -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);

View File

@ -81,10 +81,10 @@ class TIA {
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
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<class T> struct Object {
@ -287,7 +288,7 @@ class TIA {
} ball_;
// 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_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);
};

View File

@ -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;
};
}

View File

@ -6,24 +6,24 @@
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#include "C1540.hpp"
#include "../C1540.hpp"
#include <string>
#include <cassert>
#include <cstring>
#include <string>
#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_);

View File

@ -147,7 +147,7 @@ class MachineBase:
MOS::MOS6522::MOS6522<DriveVIA> drive_VIA_;
MOS::MOS6522::MOS6522<SerialPortVIA> 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();
};

View File

@ -8,6 +8,8 @@
#include "SerialBus.hpp"
#include <cstdio>
using namespace Commodore::Serial;
const char *::Commodore::Serial::StringForLine(Line line) {

View File

@ -9,6 +9,8 @@
#ifndef SerialBus_hpp
#define SerialBus_hpp
#include <cstdint>
#include <memory>
#include <vector>
namespace Commodore {

View File

@ -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<uint16_t>(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<uint16_t>(roms_[character_rom].size()));
write_to_map(mos6560_->video_memory_map, roms_[character_rom].data(), 0x0000, static_cast<uint16_t>(roms_[character_rom].size()));
write_to_map(processor_read_memory_map_, roms_[kernel_rom].data(), 0xe000, static_cast<uint16_t>(roms_[kernel_rom].size()));
// install the inserted ROM if there is one
if(rom_) {
@ -648,7 +646,7 @@ class ConcreteMachine:
std::vector<uint8_t> 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<Storage::Tape::BinaryTapePlayer> 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_;

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

@ -8,6 +8,8 @@
#include "Video.hpp"
#include <cstring>
using namespace Electron;
#define graphics_line(v) ((((v) >> 7) - first_graphics_line + field_divider_line) % field_divider_line)

View File

@ -9,6 +9,8 @@
#ifndef KeyboardMachine_h
#define KeyboardMachine_h
#include <cstdint>
#include "../Inputs/Keyboard.hpp"
namespace KeyboardMachine {

View File

@ -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);
}

View File

@ -45,11 +45,11 @@ class Microdisc: public WD::WD1770 {
bool get_drive_is_ready();
std::shared_ptr<Storage::Disk::Drive> 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;
};
}

View File

@ -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);

View File

@ -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)"
"{"

View File

@ -27,7 +27,7 @@ class VideoOutput {
std::shared_ptr<Outputs::CRT::CRT> 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_;

View File

@ -7,16 +7,16 @@
//
#include "Typer.hpp"
#include <stdlib.h>
#include <cstdlib>
#include <cstring>
using namespace Utility;
Typer::Typer(const char *string, HalfCycles delay, HalfCycles frequency, std::unique_ptr<CharacterMapper> 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);

View File

@ -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<CharacterMapper> character_mapper_;

View File

@ -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.

View File

@ -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<Outputs::CRT::CRT> crt_;
void flush(bool next_sync);

View File

@ -36,13 +36,7 @@ template<bool is_zx81> 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<bool is_zx81> class ConcreteMachine:
std::vector<uint8_t> 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<bool is_zx81> 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

View File

@ -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";

77
OSBindings/SDL/SConstruct Normal file
View File

@ -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)

View File

@ -7,7 +7,7 @@
//
#include "CRT.hpp"
#include "CRTOpenGL.hpp"
#include "Internals/CRTOpenGL.hpp"
#include <cstdarg>
#include <cmath>
#include <algorithm>
@ -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);
}

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

@ -8,6 +8,8 @@
#include "ArrayBuilder.hpp"
#include <cstring>
using namespace Outputs::CRT;
ArrayBuilder::ArrayBuilder(size_t input_size, size_t output_size) :

View File

@ -5,7 +5,7 @@
// Copyright © 2016 Thomas Harte. All rights reserved.
//
#include "CRT.hpp"
#include "../CRT.hpp"
#include <cstdlib>
#include <cmath>

View File

@ -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"

View File

@ -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 {

View File

@ -17,6 +17,9 @@
#include <OpenGL/gl3.h>
#include <OpenGL/gl3ext.h>
#endif
#else
#define GL_GLEXT_PROTOTYPES
#include <GL/gl.h>
#endif
#endif /* OpenGL_h */

View File

@ -8,9 +8,11 @@
#include "IntermediateShader.hpp"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include "../../../../SignalProcessing/FIRFilter.hpp"
using namespace OpenGL;

View File

@ -8,7 +8,8 @@
#include "Shader.hpp"
#include <stdio.h>
#include <cstdio>
#include <cstring>
using namespace OpenGL;

View File

@ -9,7 +9,7 @@
#ifndef Shader_hpp
#define Shader_hpp
#include "OpenGL.hpp"
#include "../OpenGL.hpp"
#include <string>
#include <functional>
#include <vector>

View File

@ -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_);

View File

@ -127,15 +127,15 @@ class TextureBuilder {
// the list of write areas that have ascended to the flush queue
std::vector<WriteArea> 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> bookender_;
};

View File

@ -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);

View File

@ -73,7 +73,7 @@ class TextureTarget {
GLenum _texture_unit;
std::unique_ptr<Shader> _pixel_shader;
GLuint _drawing_vertex_array, _drawing_array_buffer;
GLuint _drawing_vertex_array = 0, _drawing_array_buffer = 0;
float _set_aspect_ratio;
};

View File

@ -9,8 +9,10 @@
#ifndef Speaker_hpp
#define Speaker_hpp
#include <cmath>
#include <cstdint>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <memory>
@ -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<std::list<std::function<void(void)>>> queued_functions_;
std::vector<int16_t> 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;

View File

@ -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;

View File

@ -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.

View File

@ -849,7 +849,6 @@ template < class T,
break;
case MicroOp::IndexedPlaceHolder:
printf("Hit placeholder!!!\n");
return;
}
#undef set_parity

View File

@ -7,20 +7,11 @@
//
#include "../Z80.hpp"
#include <cstring>
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);
}

View File

@ -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<MicroOp> conditional_call_untaken_program_;
std::vector<MicroOp> reset_program_;

View File

@ -31,11 +31,6 @@ using namespace SignalProcessing;
"DIGITAL SIGNAL PROCESSING, II", IEEE Press, pages 123126.
*/
// 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;

View File

@ -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.

View File

@ -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_;
};
}

View File

@ -8,13 +8,16 @@
#include "StaticAnalyser.hpp"
#include <algorithm>
#include <cstring>
#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++;
}

View File

@ -16,14 +16,12 @@ namespace StaticAnalyser {
namespace Commodore {
struct File {
File() : is_closed(false), is_locked(false) {}
std::wstring name;
std::vector<uint8_t> 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,

View File

@ -9,6 +9,7 @@
#include "StaticAnalyser.hpp"
#include <cstdlib>
#include <cstring>
// Analysers
#include "Acorn/StaticAnalyser.hpp"

View File

@ -9,9 +9,10 @@
#ifndef Storage_Data_ZX8081_hpp
#define Storage_Data_ZX8081_hpp
#include <cstdint>
#include <memory>
#include <string>
#include <vector>
#include <cstdint>
namespace Storage {
namespace Data {

View File

@ -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() {

View File

@ -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_;

View File

@ -9,6 +9,7 @@
#include "D64.hpp"
#include <algorithm>
#include <cstring>
#include <sys/stat.h>
#include "../../Track/PCMTrack.hpp"

View File

@ -8,7 +8,9 @@
#include "G64.hpp"
#include <cstring>
#include <vector>
#include "../../Track/PCMTrack.hpp"
#include "../../Encodings/CommodoreGCR.hpp"

View File

@ -8,6 +8,8 @@
#include "SSD.hpp"
#include <cstring>
#include "Utility/ImplicitSectors.hpp"
namespace {

View File

@ -8,6 +8,8 @@
#include "ImplicitSectors.hpp"
#include <cstring>
#include "../../../Encodings/MFM/Sector.hpp"
#include "../../../Encodings/MFM/Encoder.hpp"
#include "../../../Encodings/MFM/Constants.hpp"

View File

@ -8,7 +8,7 @@
#include "Drive.hpp"
#include "UnformattedTrack.hpp"
#include "Track/UnformattedTrack.hpp"
#include <algorithm>
#include <cassert>

View File

@ -10,7 +10,9 @@
#define Storage_Disk_Encodings_MFM_hpp
#include <cstdint>
#include <memory>
#include <vector>
#include "Sector.hpp"
#include "../../Track/Track.hpp"
#include "../../../../NumberTheory/CRC.hpp"

View File

@ -15,7 +15,7 @@
using namespace Storage::Encodings::MFM;
Parser::Parser(bool is_mfm, const std::shared_ptr<Storage::Disk::Disk> &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()) {

View File

@ -8,6 +8,9 @@
#include "CPM.hpp"
#include <algorithm>
#include <cstring>
#include "../Encodings/MFM/Parser.hpp"
using namespace Storage::Disk::CPM;

View File

@ -10,6 +10,7 @@
#define PCMSegment_hpp
#include <cstdint>
#include <memory>
#include <vector>
#include "../../Storage.hpp"

View File

@ -8,6 +8,7 @@
#include "FileHolder.hpp"
#include <algorithm>
#include <cstring>
using namespace Storage;

View File

@ -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"))

View File

@ -44,7 +44,7 @@ class CommodoreTAP: public Tape {
uint32_t file_size_;
Pulse current_pulse_;
bool is_at_end_;
bool is_at_end_ = false;
};
}

View File

@ -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");
}

View File

@ -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,

View File

@ -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;
};
}

View File

@ -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];

View File

@ -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;

View File

@ -7,15 +7,14 @@
//
#include "Commodore.hpp"
#include <cstring>
#include "../../Data/Commodore.hpp"
using namespace Storage::Tape::Commodore;
Parser::Parser() :
Storage::Tape::PulseClassificationParser<WaveType, SymbolType>(),
wave_period_(0.0f),
previous_was_high_(false),
parity_byte_(0) {}
Storage::Tape::PulseClassificationParser<WaveType, SymbolType>() {}
/*!
Advances to the next block on the tape, treating it as a header, then consumes, parses, and returns it.

View File

@ -99,7 +99,7 @@ class Parser: public Storage::Tape::PulseClassificationParser<WaveType, SymbolTy
*/
void expect_byte(const std::shared_ptr<Storage::Tape::Tape> &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<WaveType, SymbolTy
a long, medium, short or unrecognised wave period.
*/
void process_pulse(const Storage::Tape::Tape::Pulse &pulse);
bool previous_was_high_;
float wave_period_;
bool previous_was_high_ = false;
float wave_period_ = 0.0f;
/*!
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,

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);

View File

@ -20,7 +20,6 @@ namespace Tape {
template <typename SymbolType> 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 <typename SymbolType> class Parser {
error_flag_ = true;
}
bool error_flag_;
bool error_flag_ = false;
SymbolType next_symbol_;
bool has_next_symbol_;
bool has_next_symbol_ = false;
};
/*!

View File

@ -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() {

View File

@ -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;
};
}