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:
parent
d60692b6fd
commit
d9e56711ce
@ -602,9 +602,9 @@ class i8255PortHandler : public Intel::i8255::PortHandler {
|
|||||||
const Motorola::CRTC::CRTC6845<CRTCBusHandler> &crtc,
|
const Motorola::CRTC::CRTC6845<CRTCBusHandler> &crtc,
|
||||||
AYDeferrer &ay,
|
AYDeferrer &ay,
|
||||||
Storage::Tape::BinaryTapePlayer &tape_player) :
|
Storage::Tape::BinaryTapePlayer &tape_player) :
|
||||||
key_state_(key_state),
|
|
||||||
crtc_(crtc),
|
|
||||||
ay_(ay),
|
ay_(ay),
|
||||||
|
crtc_(crtc),
|
||||||
|
key_state_(key_state),
|
||||||
tape_player_(tape_player) {}
|
tape_player_(tape_player) {}
|
||||||
|
|
||||||
/// The i8255 will call this to set a new output value of @c value for @c port.
|
/// 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:
|
private:
|
||||||
AYDeferrer &ay_;
|
AYDeferrer &ay_;
|
||||||
KeyboardState &key_state_;
|
|
||||||
const Motorola::CRTC::CRTC6845<CRTCBusHandler> &crtc_;
|
const Motorola::CRTC::CRTC6845<CRTCBusHandler> &crtc_;
|
||||||
|
KeyboardState &key_state_;
|
||||||
Storage::Tape::BinaryTapePlayer &tape_player_;
|
Storage::Tape::BinaryTapePlayer &tape_player_;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -674,11 +674,11 @@ class ConcreteMachine:
|
|||||||
public:
|
public:
|
||||||
ConcreteMachine() :
|
ConcreteMachine() :
|
||||||
z80_(*this),
|
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_),
|
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_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) {
|
tape_player_(8000000) {
|
||||||
// primary clock is 4Mhz
|
// primary clock is 4Mhz
|
||||||
set_clock_rate(4000000);
|
set_clock_rate(4000000);
|
||||||
|
@ -267,15 +267,13 @@ class ConcreteMachine:
|
|||||||
public:
|
public:
|
||||||
ConcreteMachine() :
|
ConcreteMachine() :
|
||||||
m6502_(*this),
|
m6502_(*this),
|
||||||
rom_(nullptr),
|
|
||||||
is_running_at_zero_cost_(false),
|
|
||||||
tape_(new Storage::Tape::BinaryTapePlayer(1022727)),
|
|
||||||
user_port_via_port_handler_(new UserPortVIA),
|
user_port_via_port_handler_(new UserPortVIA),
|
||||||
keyboard_via_port_handler_(new KeyboardVIA),
|
keyboard_via_port_handler_(new KeyboardVIA),
|
||||||
serial_port_(new SerialPort),
|
serial_port_(new SerialPort),
|
||||||
serial_bus_(new ::Commodore::Serial::Bus),
|
serial_bus_(new ::Commodore::Serial::Bus),
|
||||||
user_port_via_(*user_port_via_port_handler_),
|
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
|
// communicate the tape to the user-port VIA
|
||||||
user_port_via_port_handler_->set_tape(tape_);
|
user_port_via_port_handler_->set_tape(tape_);
|
||||||
|
|
||||||
@ -648,7 +646,7 @@ class ConcreteMachine:
|
|||||||
std::vector<uint8_t> kernel_rom_;
|
std::vector<uint8_t> kernel_rom_;
|
||||||
uint8_t expansion_ram_[0x8000];
|
uint8_t expansion_ram_[0x8000];
|
||||||
|
|
||||||
uint8_t *rom_;
|
uint8_t *rom_ = nullptr;
|
||||||
uint16_t rom_address_, rom_length_;
|
uint16_t rom_address_, rom_length_;
|
||||||
|
|
||||||
uint8_t user_basic_memory_[0x0400];
|
uint8_t user_basic_memory_[0x0400];
|
||||||
@ -688,7 +686,7 @@ class ConcreteMachine:
|
|||||||
// Tape
|
// Tape
|
||||||
std::shared_ptr<Storage::Tape::BinaryTapePlayer> tape_;
|
std::shared_ptr<Storage::Tape::BinaryTapePlayer> tape_;
|
||||||
bool use_fast_tape_hack_;
|
bool use_fast_tape_hack_;
|
||||||
bool is_running_at_zero_cost_;
|
bool is_running_at_zero_cost_ = false;
|
||||||
|
|
||||||
// Disk
|
// Disk
|
||||||
std::shared_ptr<::Commodore::C1540::Machine> c1540_;
|
std::shared_ptr<::Commodore::C1540::Machine> c1540_;
|
||||||
|
@ -182,9 +182,9 @@ class ConcreteMachine:
|
|||||||
public:
|
public:
|
||||||
ConcreteMachine() :
|
ConcreteMachine() :
|
||||||
m6502_(*this),
|
m6502_(*this),
|
||||||
paged_rom_(rom_),
|
via_port_handler_(tape_player_, keyboard_),
|
||||||
via_(via_port_handler_),
|
via_(via_port_handler_),
|
||||||
via_port_handler_(tape_player_, keyboard_) {
|
paged_rom_(rom_) {
|
||||||
set_clock_rate(1000000);
|
set_clock_rate(1000000);
|
||||||
via_port_handler_.set_interrupt_delegate(this);
|
via_port_handler_.set_interrupt_delegate(this);
|
||||||
tape_player_.set_delegate(this);
|
tape_player_.set_delegate(this);
|
||||||
|
@ -16,14 +16,12 @@ namespace StaticAnalyser {
|
|||||||
namespace Commodore {
|
namespace Commodore {
|
||||||
|
|
||||||
struct File {
|
struct File {
|
||||||
File() : is_closed(false), is_locked(false) {}
|
|
||||||
|
|
||||||
std::wstring name;
|
std::wstring name;
|
||||||
std::vector<uint8_t> raw_name;
|
std::vector<uint8_t> raw_name;
|
||||||
uint16_t starting_address;
|
uint16_t starting_address;
|
||||||
uint16_t ending_address;
|
uint16_t ending_address;
|
||||||
bool is_locked;
|
bool is_locked = false;
|
||||||
bool is_closed;
|
bool is_closed = false;
|
||||||
enum {
|
enum {
|
||||||
RelocatableProgram,
|
RelocatableProgram,
|
||||||
NonRelocatableProgram,
|
NonRelocatableProgram,
|
||||||
|
@ -14,9 +14,8 @@ using namespace Storage::Disk;
|
|||||||
|
|
||||||
MFMController::MFMController(Cycles clock_rate) :
|
MFMController::MFMController(Cycles clock_rate) :
|
||||||
Storage::Disk::Controller(clock_rate),
|
Storage::Disk::Controller(clock_rate),
|
||||||
crc_generator_(0x1021, 0xffff),
|
shifter_(&crc_generator_),
|
||||||
data_mode_(DataMode::Scanning),
|
crc_generator_(0x1021, 0xffff) {
|
||||||
shifter_(&crc_generator_) {
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MFMController::process_index_hole() {
|
void MFMController::process_index_hole() {
|
||||||
|
@ -157,7 +157,7 @@ class MFMController: public Controller {
|
|||||||
|
|
||||||
// input configuration
|
// input configuration
|
||||||
bool is_double_density_;
|
bool is_double_density_;
|
||||||
DataMode data_mode_;
|
DataMode data_mode_ = DataMode::Scanning;
|
||||||
|
|
||||||
// writing
|
// writing
|
||||||
int last_bit_;
|
int last_bit_;
|
||||||
|
@ -68,10 +68,7 @@ static int gzget32(gzFile file) {
|
|||||||
|
|
||||||
using namespace Storage::Tape;
|
using namespace Storage::Tape;
|
||||||
|
|
||||||
UEF::UEF(const char *file_name) :
|
UEF::UEF(const char *file_name) {
|
||||||
time_base_(1200),
|
|
||||||
is_300_baud_(false),
|
|
||||||
platform_type_(TargetPlatform::Acorn) {
|
|
||||||
file_ = gzopen(file_name, "rb");
|
file_ = gzopen(file_name, "rb");
|
||||||
|
|
||||||
char identifier[10];
|
char identifier[10];
|
||||||
|
@ -41,11 +41,11 @@ class UEF : public PulseQueuedTape, public TargetPlatform::TypeDistinguisher {
|
|||||||
|
|
||||||
void set_platform_type();
|
void set_platform_type();
|
||||||
TargetPlatform::Type target_platform_type();
|
TargetPlatform::Type target_platform_type();
|
||||||
TargetPlatform::Type platform_type_;
|
TargetPlatform::Type platform_type_ = TargetPlatform::Acorn;
|
||||||
|
|
||||||
gzFile file_;
|
gzFile file_;
|
||||||
unsigned int time_base_;
|
unsigned int time_base_ = 1200;
|
||||||
bool is_300_baud_;
|
bool is_300_baud_ = false;
|
||||||
|
|
||||||
struct Chunk {
|
struct Chunk {
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
|
@ -14,10 +14,7 @@
|
|||||||
using namespace Storage::Tape::Commodore;
|
using namespace Storage::Tape::Commodore;
|
||||||
|
|
||||||
Parser::Parser() :
|
Parser::Parser() :
|
||||||
Storage::Tape::PulseClassificationParser<WaveType, SymbolType>(),
|
Storage::Tape::PulseClassificationParser<WaveType, SymbolType>() {}
|
||||||
wave_period_(0.0f),
|
|
||||||
previous_was_high_(false),
|
|
||||||
parity_byte_(0) {}
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Advances to the next block on the tape, treating it as a header, then consumes, parses, and returns it.
|
Advances to the next block on the tape, treating it as a header, then consumes, parses, and returns it.
|
||||||
|
@ -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);
|
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();
|
void reset_parity_byte();
|
||||||
uint8_t get_parity_byte();
|
uint8_t get_parity_byte();
|
||||||
void add_parity_byte(uint8_t 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.
|
a long, medium, short or unrecognised wave period.
|
||||||
*/
|
*/
|
||||||
void process_pulse(const Storage::Tape::Tape::Pulse &pulse);
|
void process_pulse(const Storage::Tape::Tape::Pulse &pulse);
|
||||||
bool previous_was_high_;
|
bool previous_was_high_ = false;
|
||||||
float wave_period_;
|
float wave_period_ = 0.0f;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,
|
Per the contract with StaticAnalyser::TapeParser; produces any of a word marker, an end-of-block marker,
|
||||||
|
Loading…
Reference in New Issue
Block a user