1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-26 08:49:37 +00:00

Corrects initialisation ordering for the ZX80/81, C1540 and AY-3-8910.

This commit is contained in:
Thomas Harte 2017-11-10 22:31:27 -05:00
parent 4cbc87a17d
commit 5b6ea35d96
5 changed files with 29 additions and 44 deletions

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

@ -17,14 +17,13 @@
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

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