1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-18 17:06:15 +00:00

Corrects order-of-initialisation errors in the Amstrad CPC, Vic-20, Oric, Commodore File, MFM disk controller, UEF and Commodore tape parser.

This commit is contained in:
Thomas Harte 2017-11-10 22:47:10 -05:00
parent d60692b6fd
commit d9e56711ce
10 changed files with 25 additions and 36 deletions

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,11 +674,11 @@ 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_),
i8255_(i8255_port_handler_),
crtc_counter_(HalfCycles(4)), // This starts the CRTC exactly out of phase with the CPU's memory accesses
tape_player_(8000000) {
// primary clock is 4Mhz
set_clock_rate(4000000);

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

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

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

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

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

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