From 2f592263006e87964a7711ed6a18ec3783ec2549 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 7 Jan 2018 20:02:40 -0500 Subject: [PATCH] Fixes: DiskROM drive motor control, track_for_sectors' sides. --- Components/1770/1770.cpp | 3 ++- Machines/MSX/DiskROM.cpp | 13 ++++++++++--- .../DiskImage/Formats/Utility/ImplicitSectors.cpp | 2 +- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Components/1770/1770.cpp b/Components/1770/1770.cpp index d8c21c4e3..7071d1eb8 100644 --- a/Components/1770/1770.cpp +++ b/Components/1770/1770.cpp @@ -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(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; diff --git a/Machines/MSX/DiskROM.cpp b/Machines/MSX/DiskROM.cpp index 139002dbe..1af677d3e 100644 --- a/Machines/MSX/DiskROM.cpp +++ b/Machines/MSX/DiskROM.cpp @@ -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 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_); diff --git a/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp b/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp index 7b1dc1382..bf94f0c5f 100644 --- a/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp +++ b/Storage/Disk/DiskImage/Formats/Utility/ImplicitSectors.cpp @@ -28,7 +28,7 @@ std::shared_ptr 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;