1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-02-04 14:30:19 +00:00

Adds some guesses as to the EXDos expansion.

... with plenty left to do.
This commit is contained in:
Thomas Harte 2021-06-20 22:30:27 -04:00
parent 954386f1cc
commit b49cc407c6
3 changed files with 53 additions and 3 deletions

View File

@ -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<Storage::Disk::Disk> 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);
}

View File

@ -65,6 +65,7 @@ template <bool has_disk_controller> 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 <bool has_disk_controller> 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 <bool has_disk_controller> 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<const Target *>(target);
if(enterprise_target->dos != Target::DOS::None)
if(enterprise_target->dos == Target::DOS::None)
return new Enterprise::ConcreteMachine<false>(*enterprise_target, rom_fetcher);
else
return new Enterprise::ConcreteMachine<true>(*enterprise_target, rom_fetcher);

View File

@ -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 = "<group>"; };
4B051CAF267C1CA200CA44E8 /* Keyboard.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Keyboard.hpp; sourceTree = "<group>"; };
4B051CB2267D3FF800CA44E8 /* EnterpriseNickTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EnterpriseNickTests.mm; sourceTree = "<group>"; };
4B051CB42680158600CA44E8 /* EXDos.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = EXDos.cpp; sourceTree = "<group>"; };
4B051CB52680158600CA44E8 /* EXDos.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = EXDos.hpp; sourceTree = "<group>"; };
4B05401D219D1618001BF69C /* ScanTarget.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ScanTarget.cpp; sourceTree = "<group>"; };
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 */,