From bb7059a9e12f76d314dc5de8e456d0f10f1d8c95 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 20 Nov 2025 12:41:41 -0500 Subject: [PATCH] KEEPSAKE. --- Machines/Enterprise/EXOSCodes.hpp | 142 ++++++++++++++++++ Machines/Enterprise/Enterprise.cpp | 14 ++ Machines/Enterprise/HostFSHandler.cpp | 21 +++ Machines/Enterprise/HostFSHandler.hpp | 23 +++ .../Clock Signal.xcodeproj/project.pbxproj | 21 +++ 5 files changed, 221 insertions(+) create mode 100644 Machines/Enterprise/EXOSCodes.hpp create mode 100644 Machines/Enterprise/HostFSHandler.cpp create mode 100644 Machines/Enterprise/HostFSHandler.hpp diff --git a/Machines/Enterprise/EXOSCodes.hpp b/Machines/Enterprise/EXOSCodes.hpp new file mode 100644 index 000000000..bddb7b1b4 --- /dev/null +++ b/Machines/Enterprise/EXOSCodes.hpp @@ -0,0 +1,142 @@ +// +// EXOSCodes.hpp +// Clock Signal +// +// Created by Thomas Harte on 20/11/2025. +// Copyright © 2025 Thomas Harte. All rights reserved. +// + +#pragma once + +// Various EXOS codes, transcribed from EXOS20_technical_information.pdf via archive.org, +// which appears to be a compilation of original documentation so page numbers below +// refer to the page within the PDF. Numbers printed on the in-document pages are inconsistent. + +namespace Enterprise::EXOS { + +// Page 67. +enum class Function: uint8_t { + ResetSystem = 0, // RESET + OpenChannel = 1, // OPEN + CreateChannel = 2, // CREAT + CloseChannel = 3, // CLOSE + DestroyChannel = 4, // DEST + ReadCharacter = 5, // RDCH + ReadBlock = 6, // RDBLK + WriteCharacter = 7, // WRCH + WriteBlock = 8, // WRBLK + ReadStatus = 9, // RSTAT + SetChannelStatus = 10, // SSTAT + SpecialFunction = 11, // SFUNC + + SetReadToggleEXOSVariable = 16, // EVAR + CaptureChannel = 17, // CAPT + RedirectChannel = 18, // REDIR + SetDefaultDevice = 19, // DDEV + ReturnSystemStatus = 20, // SYSS + LinkDevices = 21, // LINK + ReadEXOSBoundary = 22, // READB + SetUSERBoundary = 23, // SETB, + AllocateSegment = 24, // ALLOC, + FreeSegment = 25, // FREE + LocateROMs = 26, // ROMS + AllocateChannelBuffer = 27, // BUFF + ReturnErrorMessage = 28, // ERRMSG +}; + +// Pages 68–70. +enum class Error: uint8_t { + // + // General errors returned by the EXOS kernel. + // + InvalidFunctionCode = 0xff, // IFUNC + FunctionCallNotAllowed = 0xfe, // ILLFN + InvalidFunctionName = 0xfd, // INAME + InsufficientStack = 0xfc, // STACK + ChannelIllegalOrDoesNotExist = 0xfb, // ICHAN + DeviceDoesNotExist = 0xfa, // NODEV + ChannelAlreadyExists = 0xf9, // CHANX + NoAllocateBufferCallMade = 0xf8, // NOBUF + BadAllocateBufferParameters = 0xf7, // BADAL + InsufficientRAMForBuffer = 0xf6, // NORAM + InsufficientVideoRAM = 0xf5, // NOVID + NoFreeSegments = 0xf4, // NOSEG + InvalidSegment = 0xf3, // ISEG + InvalidUserBoundary = 0xf2, // IBOUN + InvalidEXOSVariableNumber = 0xf1, // IVAR + InvalidDesviceDescriptorType = 0xf0, // IDESC + + // + // General errors returned by various devices. + // + InvalidSpecialFunctionCode = 0xef, // ISPEC + AttemptToOpenSecondChannel = 0xee, // 2NDCH + FunctionNotSupported = 0xed, // NOFN + InvalidEscapeCharacter = 0xec, // ESC + StopKeyPressed = 0xeb, // STOP + + // + // File related errors. + // + FileDoesNotExist = 0xea, // NOFIL + FileAlreadyExists = 0xe9, // EXFIL + FileAlreadyOpen = 0xe8, // FOPEN + EndOfFileMetInRead = 0xe7, // EOF + FileIsTooBig = 0xe6, // FSIZE + InvalidFilePointerValue = 0xe5, // FPTR + ProtectionViolation = 0xe4, // PROT + + // + // Keyboard errors. + // + InvalidFunctionKeyNumber = 0xe3, // KFKEY + RunOutOfFunctionKeySpace = 0xe2, // KFSPC + + // + // Sound errors. + // + EnvelopeInvalidOrTooBig = 0xe1, // SENV + NotEnoughRoomToDefineEnvelope = 0xe0, // SENDBF + EnvelopeStorageRequestedTooSmall = 0xdf, // SENFLO + SoundQueueFull = 0xde, // SQFUL + + // + // Video errors. + // + InvalidRowNumberToScroll = 0xdd, // VROW + AttemptToMoveCursorOffPage = 0xdc, // VCURS + InvalidColourPassedToINKOrPAPER = 0xdb, // VCOLR + InvalidXOrYSizeToOPEN = 0xda, // VSIZE + InvalidVideoModeToOPEN = 0xd9, // VMODE + BadParameterToDISPLAY = 0xdb, // VDISP, and officially 'naff' rather than 'bad' + NotEnoughRowsInPageToDISPLAY = 0xd7, // VDSP2 + AttemptToMoveBeamOffPage = 0xd6, // VBEAM + LineStyleTooBig = 0xd5, // VLSTY + LineModeTooBig = 0xd4, // VLMOD + CantDisplayCharacterOrGraphic = 0xd3, // VCHAR + + // + // Serial errors. + // + InvalidBaudRate = 0xd2, // BAUD + + // + // Editor errors. + // + InvalidVideoPageForOPEN = 0xd1, // EVID + TroubleInCommunicatingWithKeyboard = 0xd0, // EKEY + InvalidCoordinatesForPosition = 0xcf, // ECURS + + // + // Cassette errors. + // + CRCErrorFromCassetteDriver = 0xce, // CCRC + + // + // Network errors + // + SerialDeviceOpenCannotUseNetwork = 0xcd, // SEROP + ADDR_NETNotSetUp = 0xcc, // NOADR +}; + +} diff --git a/Machines/Enterprise/Enterprise.cpp b/Machines/Enterprise/Enterprise.cpp index 85ca98be6..d8cd883ec 100644 --- a/Machines/Enterprise/Enterprise.cpp +++ b/Machines/Enterprise/Enterprise.cpp @@ -10,6 +10,7 @@ #include "Dave.hpp" #include "EXDos.hpp" +#include "HostFSHandler.hpp" #include "Keyboard.hpp" #include "Nick.hpp" @@ -23,6 +24,8 @@ #include "Outputs/Speaker/Implementation/LowpassSpeaker.hpp" #include "Processors/Z80/Z80.hpp" +#include + namespace { using Logger = Log::Logger; } @@ -584,6 +587,7 @@ public: private: // MARK: - Memory layout + std::array ram_{}; std::array exos_; std::array basic_; @@ -669,6 +673,7 @@ private: bool is_video_[4]{}; // MARK: - ScanProducer + void set_scan_target(Outputs::Display::ScanTarget *const scan_target) override { nick_.last_valid()->set_scan_target(scan_target); } @@ -779,9 +784,17 @@ private: } // MARK: - EXDos card. + EXDos exdos_; + // MARK: - Host FS. + + HostFSHandler host_fs_; + std::unordered_set trap_locations_; + bool test_host_fs_traps_ = false; + // MARK: - Activity Source + void set_activity_observer([[maybe_unused]] Activity::Observer *const observer) final { if constexpr (has_disk_controller) { exdos_.set_activity_observer(observer); @@ -789,6 +802,7 @@ private: } // MARK: - Configuration options. + std::unique_ptr get_options() const final { auto options = std::make_unique(Configurable::OptionsType::UserFriendly); options->output = get_video_signal_configurable(); diff --git a/Machines/Enterprise/HostFSHandler.cpp b/Machines/Enterprise/HostFSHandler.cpp new file mode 100644 index 000000000..c3ed12358 --- /dev/null +++ b/Machines/Enterprise/HostFSHandler.cpp @@ -0,0 +1,21 @@ +// +// HostFSHandler.cpp +// Clock Signal +// +// Created by Thomas Harte on 20/11/2025. +// Copyright © 2025 Thomas Harte. All rights reserved. +// + +#include "HostFSHandler.hpp" +#include "EXOSCodes.hpp" + +using namespace Enterprise; + +HostFSHandler::HostFSHandler(uint8_t *ram) : ram_(ram) {} + +void HostFSHandler::perform(uint8_t function, uint8_t &a, uint16_t &bc, uint16_t &de) { + (void)function; + (void)a; + (void)bc; + (void)de; +} diff --git a/Machines/Enterprise/HostFSHandler.hpp b/Machines/Enterprise/HostFSHandler.hpp new file mode 100644 index 000000000..affec6ac3 --- /dev/null +++ b/Machines/Enterprise/HostFSHandler.hpp @@ -0,0 +1,23 @@ +// +// HostFSHandler.hpp +// Clock Signal +// +// Created by Thomas Harte on 20/11/2025. +// Copyright © 2025 Thomas Harte. All rights reserved. +// + +#pragma once + +#include + +namespace Enterprise { + +struct HostFSHandler { + HostFSHandler(uint8_t *ram); + void perform(uint8_t function, uint8_t &a, uint16_t &bc, uint16_t &de); + +private: + uint8_t *ram_; +}; + +}; diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index 6697271b9..da8842f5c 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -1148,9 +1148,15 @@ 4BCE0060227D39AB000CA200 /* Video.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE005E227D39AB000CA200 /* Video.cpp */; }; 4BCE1DF125D4C3FA00AE7A2B /* Bus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE1DEF25D4C3FA00AE7A2B /* Bus.cpp */; }; 4BCE1DF225D4C3FA00AE7A2B /* Bus.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCE1DEF25D4C3FA00AE7A2B /* Bus.cpp */; }; +<<<<<<< Updated upstream 4BCF1ACF2ECE759000109999 /* FileBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1ACD2ECE759000109999 /* FileBundle.cpp */; }; 4BCF1AD02ECE759000109999 /* FileBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1ACD2ECE759000109999 /* FileBundle.cpp */; }; 4BCF1AD12ECE759000109999 /* FileBundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1ACD2ECE759000109999 /* FileBundle.cpp */; }; +======= + 4BCF1AD52ECF884100109999 /* HostFSHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1AD42ECF884100109999 /* HostFSHandler.cpp */; }; + 4BCF1AD62ECF884100109999 /* HostFSHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1AD42ECF884100109999 /* HostFSHandler.cpp */; }; + 4BCF1AD72ECF884100109999 /* HostFSHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1AD42ECF884100109999 /* HostFSHandler.cpp */; }; +>>>>>>> Stashed changes 4BCF1FA41DADC3DD0039D2E7 /* Oric.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */; }; 4BD0FBC3233706A200148981 /* CSApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = 4BD0FBC2233706A200148981 /* CSApplication.m */; }; 4BD191F52191180E0042E144 /* ScanTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BD191F22191180E0042E144 /* ScanTarget.cpp */; }; @@ -2429,8 +2435,14 @@ 4BCE005F227D39AB000CA200 /* Video.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Video.hpp; sourceTree = ""; }; 4BCE1DEF25D4C3FA00AE7A2B /* Bus.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Bus.cpp; sourceTree = ""; }; 4BCE1DF025D4C3FA00AE7A2B /* Bus.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Bus.hpp; sourceTree = ""; }; +<<<<<<< Updated upstream 4BCF1ACC2ECE759000109999 /* FileBundle.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = FileBundle.hpp; sourceTree = ""; }; 4BCF1ACD2ECE759000109999 /* FileBundle.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = FileBundle.cpp; sourceTree = ""; }; +======= + 4BCF1AD22ECF743500109999 /* EXOSCodes.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = EXOSCodes.hpp; sourceTree = ""; }; + 4BCF1AD32ECF884100109999 /* HostFSHandler.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = HostFSHandler.hpp; sourceTree = ""; }; + 4BCF1AD42ECF884100109999 /* HostFSHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = HostFSHandler.cpp; sourceTree = ""; }; +>>>>>>> Stashed changes 4BCF1FA21DADC3DD0039D2E7 /* Oric.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Oric.cpp; sourceTree = ""; }; 4BCF1FA31DADC3DD0039D2E7 /* Oric.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Oric.hpp; sourceTree = ""; }; 4BD060A51FE49D3C006E14BE /* Speaker.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Speaker.hpp; sourceTree = ""; }; @@ -2706,12 +2718,18 @@ 4BFEA2ED2682A7B900EBF94C /* Dave.cpp */, 4B051CA12676F52200CA44E8 /* Enterprise.cpp */, 4B051CB42680158600CA44E8 /* EXDos.cpp */, + 4BCF1AD42ECF884100109999 /* HostFSHandler.cpp */, 4B051CAE267C1CA200CA44E8 /* Keyboard.cpp */, 4B051CAA26783E2000CA44E8 /* Nick.cpp */, 4BFEA2EE2682A7B900EBF94C /* Dave.hpp */, 4B051CA02676F52200CA44E8 /* Enterprise.hpp */, 4B051CB52680158600CA44E8 /* EXDos.hpp */, +<<<<<<< Updated upstream 4B3583DB2DB965FA00A24128 /* HostFS.hpp */, +======= + 4BCF1AD22ECF743500109999 /* EXOSCodes.hpp */, + 4BCF1AD32ECF884100109999 /* HostFSHandler.hpp */, +>>>>>>> Stashed changes 4B051CAF267C1CA200CA44E8 /* Keyboard.hpp */, 4B051CAB26783E2000CA44E8 /* Nick.hpp */, ); @@ -6357,6 +6375,7 @@ 4B055AC41FAE9AE80060FFFF /* Keyboard.cpp in Sources */, 4B8DF506254E3C9D00F3433C /* ADB.cpp in Sources */, 4B055A941FAE85B50060FFFF /* CommodoreROM.cpp in Sources */, + 4BCF1AD72ECF884100109999 /* HostFSHandler.cpp in Sources */, 4BBB70A5202011C2002FE009 /* MultiMediaTarget.cpp in Sources */, 4B8318BC22D3E588006DB630 /* DisplayMetrics.cpp in Sources */, 4BEDA40E25B2844B000C2DBD /* Decoder.cpp in Sources */, @@ -6450,6 +6469,7 @@ 4B1082C42C1F5E7D00B07C5D /* CSL.cpp in Sources */, 4B0ACC3023775819008902D0 /* TIASound.cpp in Sources */, 4B7136861F78724F008B8ED9 /* Encoder.cpp in Sources */, + 4BCF1AD62ECF884100109999 /* HostFSHandler.cpp in Sources */, 4B0E04EA1FC9E5DA00F43484 /* CAS.cpp in Sources */, 4B7A90ED20410A85008514A2 /* StaticAnalyser.cpp in Sources */, 4B58601E1F806AB200AEE2E3 /* MFMSectorDump.cpp in Sources */, @@ -6879,6 +6899,7 @@ 4BCF1AD02ECE759000109999 /* FileBundle.cpp in Sources */, 4B06AAF72C64606E0034D014 /* DiskII.cpp in Sources */, 4B778EFB23A5EB7E0000D260 /* HFE.cpp in Sources */, + 4BCF1AD52ECF884100109999 /* HostFSHandler.cpp in Sources */, 4BC751B21D157E61006C31D9 /* 6522Tests.swift in Sources */, 4B0DA67D282DCDF300C12F17 /* Instruction.cpp in Sources */, 4B06AAE12C645F8B0034D014 /* Video.cpp in Sources */,