From b49cc407c6730ac9af4f012e34a80fef3b760beb Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Sun, 20 Jun 2021 22:30:27 -0400 Subject: [PATCH] Adds some guesses as to the EXDos expansion. ... with plenty left to do. --- Machines/Enterprise/EXDos.cpp | 31 +++++++++++++++++-- Machines/Enterprise/Enterprise.cpp | 17 +++++++++- .../Clock Signal.xcodeproj/project.pbxproj | 8 +++++ 3 files changed, 53 insertions(+), 3 deletions(-) diff --git a/Machines/Enterprise/EXDos.cpp b/Machines/Enterprise/EXDos.cpp index 15d315df4..cec9c34e9 100644 --- a/Machines/Enterprise/EXDos.cpp +++ b/Machines/Enterprise/EXDos.cpp @@ -11,20 +11,47 @@ using namespace Enterprise; EXDos::EXDos() : WD1770(P1770) { -// emplace_drives(2, 8000000, 300, 2); + emplace_drives(4, 8000000, 300, 2); set_control_register(0x00); } void EXDos::set_disk(std::shared_ptr disk, size_t drive) { + get_drive(drive).set_disk(disk); } void EXDos::set_control_register(uint8_t control) { + printf("Control: %02x\n", control); + last_control_ = control; + + // Set side. + const int head = (control >> 4) & 1; + for(size_t c = 0; c < 4; c++) { + get_drive(c).set_head(head); + } + + // Select drive. + // TODO: should potentially be drives, plural. + set_drive(0); + for(int c = 1; c < 4; c++) { + if(control & (1 << c)) { + set_drive(c); + } + } + + // TODO: seems like bit 6 might be connected to the drive's RDY line? + + // TODO: does part of this register select double/single density mode? + // Probably either bit 5 or bit 7 of the control register? + set_is_double_density(true); } uint8_t EXDos::get_control_register() { - return last_control_; + return last_control_ | (get_drive().get_is_ready() ? 0x40 : 0x00); } void EXDos::set_motor_on(bool on) { + // TODO: this status should transfer if the selected drive changes. But the same goes for + // writing state, so plenty of work to do in general here. + get_drive().set_motor_on(on); } diff --git a/Machines/Enterprise/Enterprise.cpp b/Machines/Enterprise/Enterprise.cpp index e29baf8fc..cd5dd6188 100644 --- a/Machines/Enterprise/Enterprise.cpp +++ b/Machines/Enterprise/Enterprise.cpp @@ -65,6 +65,7 @@ template class ConcreteMachine: public CPU::Z80::BusHandler, public Machine, public MachineTypes::MappedKeyboardMachine, + public MachineTypes::MediaTarget, public MachineTypes::ScanProducer, public MachineTypes::TimedMachine { public: @@ -190,6 +191,9 @@ template class ConcreteMachine: page<1>(0x00); page<2>(0x00); page<3>(0x00); + + // Pass on any media. + insert_media(target.media); } // MARK: - Z80::BusHandler. @@ -410,6 +414,17 @@ template class ConcreteMachine: key_lines_.fill(0xff); } + // MARK: - MediaTarget + bool insert_media(const Analyser::Static::Media &media) final { + if constexpr (has_disk_controller) { + if(!media.disks.empty()) { + exdos_.set_disk(media.disks.front(), 0); + } + } + + return true; + } + // MARK: - Interrupts enum class Interrupt: uint8_t { Nick = 0x20 @@ -442,7 +457,7 @@ Machine *Machine::Enterprise(const Analyser::Static::Target *target, const ROMMa using Target = Analyser::Static::Enterprise::Target; const Target *const enterprise_target = dynamic_cast(target); - if(enterprise_target->dos != Target::DOS::None) + if(enterprise_target->dos == Target::DOS::None) return new Enterprise::ConcreteMachine(*enterprise_target, rom_fetcher); else return new Enterprise::ConcreteMachine(*enterprise_target, rom_fetcher); diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 127657d64..c55e0ded8 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -26,6 +26,8 @@ 4B051CB0267C1CA200CA44E8 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CAE267C1CA200CA44E8 /* Keyboard.cpp */; }; 4B051CB1267C1CA200CA44E8 /* Keyboard.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CAE267C1CA200CA44E8 /* Keyboard.cpp */; }; 4B051CB3267D3FF800CA44E8 /* EnterpriseNickTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CB2267D3FF800CA44E8 /* EnterpriseNickTests.mm */; }; + 4B051CB62680158600CA44E8 /* EXDos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CB42680158600CA44E8 /* EXDos.cpp */; }; + 4B051CB72680158600CA44E8 /* EXDos.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B051CB42680158600CA44E8 /* EXDos.cpp */; }; 4B05401E219D1618001BF69C /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B05401D219D1618001BF69C /* ScanTarget.cpp */; }; 4B05401F219D1618001BF69C /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B05401D219D1618001BF69C /* ScanTarget.cpp */; }; 4B055A7A1FAE78A00060FFFF /* SDL2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B055A771FAE78210060FFFF /* SDL2.framework */; }; @@ -1047,6 +1049,8 @@ 4B051CAE267C1CA200CA44E8 /* Keyboard.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Keyboard.cpp; sourceTree = ""; }; 4B051CAF267C1CA200CA44E8 /* Keyboard.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Keyboard.hpp; sourceTree = ""; }; 4B051CB2267D3FF800CA44E8 /* EnterpriseNickTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EnterpriseNickTests.mm; sourceTree = ""; }; + 4B051CB42680158600CA44E8 /* EXDos.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EXDos.cpp; sourceTree = ""; }; + 4B051CB52680158600CA44E8 /* EXDos.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = EXDos.hpp; sourceTree = ""; }; 4B05401D219D1618001BF69C /* ScanTarget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScanTarget.cpp; sourceTree = ""; }; 4B055A6A1FAE763F0060FFFF /* Clock Signal Kiosk */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "Clock Signal Kiosk"; sourceTree = BUILT_PRODUCTS_DIR; }; 4B055A771FAE78210060FFFF /* SDL2.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SDL2.framework; path = ../../../../Library/Frameworks/SDL2.framework; sourceTree = SOURCE_ROOT; }; @@ -2113,9 +2117,11 @@ isa = PBXGroup; children = ( 4B051CA12676F52200CA44E8 /* Enterprise.cpp */, + 4B051CB42680158600CA44E8 /* EXDos.cpp */, 4B051CAE267C1CA200CA44E8 /* Keyboard.cpp */, 4B051CAA26783E2000CA44E8 /* Nick.cpp */, 4B051CA02676F52200CA44E8 /* Enterprise.hpp */, + 4B051CB52680158600CA44E8 /* EXDos.hpp */, 4B051CAF267C1CA200CA44E8 /* Keyboard.hpp */, 4B051CAB26783E2000CA44E8 /* Nick.hpp */, ); @@ -5295,6 +5301,7 @@ 4BC131712346DE5000E4FF3D /* StaticAnalyser.cpp in Sources */, 4B055ACA1FAE9AFB0060FFFF /* Vic20.cpp in Sources */, 4BE21200253FC80900435408 /* StaticAnalyser.cpp in Sources */, + 4B051CB72680158600CA44E8 /* EXDos.cpp in Sources */, 4B8318B222D3E53C006DB630 /* Video.cpp in Sources */, 4B055ABC1FAE86170060FFFF /* ZX8081.cpp in Sources */, 4B055AC91FAE9AFB0060FFFF /* Keyboard.cpp in Sources */, @@ -5601,6 +5608,7 @@ 4BFDD78C1F7F2DB4008579B9 /* ImplicitSectors.cpp in Sources */, 4B894526201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BEE0A6F1D72496600532C7B /* Cartridge.cpp in Sources */, + 4B051CB62680158600CA44E8 /* EXDos.cpp in Sources */, 4B8805FB1DCFF807003085B1 /* Oric.cpp in Sources */, 4B6ED2F0208E2F8A0047B343 /* WOZ.cpp in Sources */, 4B15A9FC208249BB005E6C8D /* StaticAnalyser.cpp in Sources */,