1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-22 12:33:29 +00:00

Fixes: DiskROM drive motor control, track_for_sectors' sides.

This commit is contained in:
Thomas Harte 2018-01-07 20:02:40 -05:00
parent 793ef68206
commit 2f59226300
3 changed files with 13 additions and 5 deletions

View File

@ -180,6 +180,7 @@ void WD1770::posit_event(int new_event_type) {
resume_point_ = 0;
update_status([] (Status &status) {
status.type = Status::One;
status.data_request = false;
});
} else {
if(!(interesting_event_mask_ & static_cast<int>(new_event_type))) return;
@ -475,7 +476,7 @@ void WD1770::posit_event(int new_event_type) {
sector_++;
goto test_type2_write_protection;
}
printf("Read sector %d\n", sector_);
printf("Finished reading sector %d\n", sector_);
goto wait_for_command;
}
goto type2_check_crc;

View File

@ -25,12 +25,18 @@ void DiskROM::write(uint16_t address, uint8_t value) {
selected_head_ = value & 1;
if(drives_[0]) drives_[0]->set_head(selected_head_);
if(drives_[1]) drives_[1]->set_head(selected_head_);
printf("HEAD: %d\n", selected_head_);
break;
case 0x7ffd:
case 0x7ffd: {
selected_drive_ = value & 1;
set_drive(drives_[selected_drive_]);
set_motor_on(!!(value & 0x80));
break;
bool drive_motor = !!(value & 0x80);
if(drives_[0]) drives_[0]->set_motor_on(drive_motor);
if(drives_[1]) drives_[1]->set_motor_on(drive_motor);
printf("DRIVE: %d\n", selected_head_);
printf("MOTOR ON: %s\n", (value & 0x80) ? "on" : "off");
} break;
}
}
@ -51,6 +57,7 @@ void DiskROM::run_for(HalfCycles half_cycles) {
}
void DiskROM::set_disk(std::shared_ptr<Storage::Disk::Disk> disk, int drive) {
printf("Disk to %d\n", drive);
if(!drives_[drive]) {
drives_[drive].reset(new Storage::Disk::Drive(8000000, 300, 2));
drives_[drive]->set_head(selected_head_);

View File

@ -28,7 +28,7 @@ std::shared_ptr<Track> Storage::Disk::track_for_sectors(uint8_t *const source, u
Storage::Encodings::MFM::Sector &new_sector = sectors.back();
new_sector.address.track = track;
new_sector.address.side = size;
new_sector.address.side = side;
new_sector.address.sector = first_sector;
first_sector++;
new_sector.size = size;