mirror of
https://github.com/TomHarte/CLK.git
synced 2024-12-27 01:31:42 +00:00
Updates the 1540 for the slightly-more modern world of decoupled drives and disks (!).
This commit is contained in:
parent
d3c385b471
commit
fb9fd26af7
@ -22,7 +22,8 @@ MachineBase::MachineBase() :
|
|||||||
serial_port_(new SerialPort),
|
serial_port_(new SerialPort),
|
||||||
serial_port_VIA_port_handler_(new SerialPortVIA(serial_port_VIA_)),
|
serial_port_VIA_port_handler_(new SerialPortVIA(serial_port_VIA_)),
|
||||||
drive_VIA_(drive_VIA_port_handler_),
|
drive_VIA_(drive_VIA_port_handler_),
|
||||||
serial_port_VIA_(*serial_port_VIA_port_handler_) {
|
serial_port_VIA_(*serial_port_VIA_port_handler_),
|
||||||
|
drive_(new Storage::Disk::Drive(1000000, 300)) {
|
||||||
// attach the serial port to its VIA and vice versa
|
// attach the serial port to its VIA and vice versa
|
||||||
serial_port_->set_serial_port_via(serial_port_VIA_port_handler_);
|
serial_port_->set_serial_port_via(serial_port_VIA_port_handler_);
|
||||||
serial_port_VIA_port_handler_->set_serial_port(serial_port_);
|
serial_port_VIA_port_handler_->set_serial_port(serial_port_);
|
||||||
@ -34,6 +35,9 @@ MachineBase::MachineBase() :
|
|||||||
|
|
||||||
// set a bit rate
|
// set a bit rate
|
||||||
set_expected_bit_length(Storage::Encodings::CommodoreGCR::length_of_a_bit_in_time_zone(3));
|
set_expected_bit_length(Storage::Encodings::CommodoreGCR::length_of_a_bit_in_time_zone(3));
|
||||||
|
|
||||||
|
// attach the only drive there is
|
||||||
|
set_drive(drive_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bus) {
|
void Machine::set_serial_bus(std::shared_ptr<::Commodore::Serial::Bus> serial_bus) {
|
||||||
@ -82,16 +86,14 @@ void Machine::set_rom(const std::vector<uint8_t> &rom) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Machine::set_disk(std::shared_ptr<Storage::Disk::Disk> disk) {
|
void Machine::set_disk(std::shared_ptr<Storage::Disk::Disk> disk) {
|
||||||
std::shared_ptr<Storage::Disk::Drive> drive(new Storage::Disk::Drive(1000000, 300));
|
drive_->set_disk(disk);
|
||||||
drive->set_disk(disk);
|
|
||||||
set_drive(drive);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Machine::run_for(const Cycles cycles) {
|
void Machine::run_for(const Cycles cycles) {
|
||||||
m6502_.run_for(cycles);
|
m6502_.run_for(cycles);
|
||||||
|
|
||||||
bool drive_motor = drive_VIA_port_handler_.get_motor_enabled();
|
bool drive_motor = drive_VIA_port_handler_.get_motor_enabled();
|
||||||
get_drive().set_motor_on(drive_motor);
|
drive_->set_motor_on(drive_motor);
|
||||||
if(drive_motor)
|
if(drive_motor)
|
||||||
Storage::Disk::Controller::run_for(cycles);
|
Storage::Disk::Controller::run_for(cycles);
|
||||||
}
|
}
|
||||||
@ -130,7 +132,7 @@ void MachineBase::process_index_hole() {}
|
|||||||
#pragma mak - Drive VIA delegate
|
#pragma mak - Drive VIA delegate
|
||||||
|
|
||||||
void MachineBase::drive_via_did_step_head(void *driveVIA, int direction) {
|
void MachineBase::drive_via_did_step_head(void *driveVIA, int direction) {
|
||||||
get_drive().step(direction);
|
drive_->step(direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MachineBase::drive_via_did_set_data_density(void *driveVIA, int density) {
|
void MachineBase::drive_via_did_set_data_density(void *driveVIA, int density) {
|
||||||
|
@ -135,6 +135,7 @@ class MachineBase:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
CPU::MOS6502::Processor<MachineBase, false> m6502_;
|
CPU::MOS6502::Processor<MachineBase, false> m6502_;
|
||||||
|
std::shared_ptr<Storage::Disk::Drive> drive_;
|
||||||
|
|
||||||
uint8_t ram_[0x800];
|
uint8_t ram_[0x800];
|
||||||
uint8_t rom_[0x4000];
|
uint8_t rom_[0x4000];
|
||||||
|
Loading…
Reference in New Issue
Block a user