From faec516a2c5ca0e894e426d5821d1aa033a1dce4 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 21 Aug 2019 23:22:58 -0400 Subject: [PATCH] Starts pushing towards figuring out a proper infrastructure for mass storage. --- Components/5380/ncr5380.hpp | 4 +- .../Clock Signal.xcodeproj/project.pbxproj | 56 ++++++++++++----- Storage/Disk/Disk.hpp | 3 + Storage/MassStorage/MassStorageDevice.cpp | 9 +++ Storage/MassStorage/MassStorageDevice.hpp | 61 +++++++++++++++++++ .../MassStorage/SCSI}/SCSI.cpp | 0 .../MassStorage/SCSI}/SCSI.hpp | 0 .../MassStorage/SCSI/Target.cpp | 4 +- .../MassStorage/SCSI/Target.hpp | 0 .../SCSI}/TargetImplementation.hpp | 0 10 files changed, 117 insertions(+), 20 deletions(-) create mode 100644 Storage/MassStorage/MassStorageDevice.cpp create mode 100644 Storage/MassStorage/MassStorageDevice.hpp rename {Components/5380 => Storage/MassStorage/SCSI}/SCSI.cpp (100%) rename {Components/5380 => Storage/MassStorage/SCSI}/SCSI.hpp (100%) rename Components/5380/DirectAccessDevice.cpp => Storage/MassStorage/SCSI/Target.cpp (92%) rename Components/5380/DirectAccessDevice.hpp => Storage/MassStorage/SCSI/Target.hpp (100%) rename {Components/5380 => Storage/MassStorage/SCSI}/TargetImplementation.hpp (100%) diff --git a/Components/5380/ncr5380.hpp b/Components/5380/ncr5380.hpp index fbdd7054c..e01901d5a 100644 --- a/Components/5380/ncr5380.hpp +++ b/Components/5380/ncr5380.hpp @@ -11,8 +11,8 @@ #include -#include "SCSI.hpp" -#include "DirectAccessDevice.hpp" +#include "../../Storage/MassStorage/SCSI/SCSI.hpp" +#include "../../Storage/MassStorage/SCSI/Target.hpp" #include "../../ClockReceiver/ClockReceiver.hpp" #include "../../ClockReceiver/ClockingHintSource.hpp" diff --git a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj index ca0b1184a..1f7d83ee1 100644 --- a/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj +++ b/OSBindings/Mac/Clock Signal.xcodeproj/project.pbxproj @@ -216,6 +216,11 @@ 4B69FB441C4D941400B5F0AA /* TapeUEF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B69FB421C4D941400B5F0AA /* TapeUEF.cpp */; }; 4B69FB461C4D950F00B5F0AA /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 4B69FB451C4D950F00B5F0AA /* libz.tbd */; }; 4B6A4C991F58F09E00E3F787 /* 6502Base.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6A4C951F58F09E00E3F787 /* 6502Base.cpp */; }; + 4B6AAEA4230E3E1D0078E864 /* MassStorageDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6AAEA2230E3E1D0078E864 /* MassStorageDevice.cpp */; }; + 4B6AAEAB230E40250078E864 /* SCSI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6AAEA7230E40250078E864 /* SCSI.cpp */; }; + 4B6AAEAC230E40250078E864 /* SCSI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6AAEA7230E40250078E864 /* SCSI.cpp */; }; + 4B6AAEAD230E40250078E864 /* Target.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6AAEA8230E40250078E864 /* Target.cpp */; }; + 4B6AAEAE230E40250078E864 /* Target.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6AAEA8230E40250078E864 /* Target.cpp */; }; 4B6ED2F0208E2F8A0047B343 /* WOZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6ED2EE208E2F8A0047B343 /* WOZ.cpp */; }; 4B6ED2F1208E2F8A0047B343 /* WOZ.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B6ED2EE208E2F8A0047B343 /* WOZ.cpp */; }; 4B7136861F78724F008B8ED9 /* Encoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B7136841F78724F008B8ED9 /* Encoder.cpp */; }; @@ -300,8 +305,6 @@ 4B89453D201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894516201967B4007DE474 /* StaticAnalyser.cpp */; }; 4B89453E201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894517201967B4007DE474 /* StaticAnalyser.cpp */; }; 4B89453F201967B4007DE474 /* StaticAnalyser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B894517201967B4007DE474 /* StaticAnalyser.cpp */; }; - 4B89BCFC23024BB500EA0782 /* SCSI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89BCFA23024BB500EA0782 /* SCSI.cpp */; }; - 4B89BCFD23024BB500EA0782 /* SCSI.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4B89BCFA23024BB500EA0782 /* SCSI.cpp */; }; 4B8FE21B1DA19D5F0090D3CE /* Atari2600Options.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2131DA19D5F0090D3CE /* Atari2600Options.xib */; }; 4B8FE21C1DA19D5F0090D3CE /* MachineDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2151DA19D5F0090D3CE /* MachineDocument.xib */; }; 4B8FE21D1DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4B8FE2171DA19D5F0090D3CE /* QuickLoadCompositeOptions.xib */; }; @@ -619,7 +622,6 @@ 4BB73EAC1B587A5100552FC2 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 4BB73EAA1B587A5100552FC2 /* MainMenu.xib */; }; 4BB73EB71B587A5100552FC2 /* AllSuiteATests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EB61B587A5100552FC2 /* AllSuiteATests.swift */; }; 4BB73EC21B587A5100552FC2 /* Clock_SignalUITests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4BB73EC11B587A5100552FC2 /* Clock_SignalUITests.swift */; }; - 4BB8F5272308E5A50015C2A6 /* DirectAccessDevice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BB8F5252308E5A50015C2A6 /* DirectAccessDevice.cpp */; }; 4BBB70A4202011C2002FE009 /* MultiMediaTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A3202011C2002FE009 /* MultiMediaTarget.cpp */; }; 4BBB70A5202011C2002FE009 /* MultiMediaTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A3202011C2002FE009 /* MultiMediaTarget.cpp */; }; 4BBB70A8202014E2002FE009 /* MultiCRTMachine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4BBB70A6202014E2002FE009 /* MultiCRTMachine.cpp */; }; @@ -958,6 +960,13 @@ 4B6A4C911F58F09E00E3F787 /* 6502AllRAM.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6502AllRAM.cpp; sourceTree = ""; }; 4B6A4C921F58F09E00E3F787 /* 6502AllRAM.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = 6502AllRAM.hpp; sourceTree = ""; }; 4B6A4C951F58F09E00E3F787 /* 6502Base.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = 6502Base.cpp; sourceTree = ""; }; + 4B6AAEA2230E3E1D0078E864 /* MassStorageDevice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MassStorageDevice.cpp; sourceTree = ""; }; + 4B6AAEA3230E3E1D0078E864 /* MassStorageDevice.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MassStorageDevice.hpp; sourceTree = ""; }; + 4B6AAEA6230E40250078E864 /* Target.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; + 4B6AAEA7230E40250078E864 /* SCSI.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SCSI.cpp; sourceTree = ""; }; + 4B6AAEA8230E40250078E864 /* Target.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Target.cpp; sourceTree = ""; }; + 4B6AAEA9230E40250078E864 /* SCSI.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = SCSI.hpp; sourceTree = ""; }; + 4B6AAEAA230E40250078E864 /* TargetImplementation.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TargetImplementation.hpp; sourceTree = ""; }; 4B6ED2EE208E2F8A0047B343 /* WOZ.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = WOZ.cpp; sourceTree = ""; }; 4B6ED2EF208E2F8A0047B343 /* WOZ.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = WOZ.hpp; sourceTree = ""; }; 4B7041271F92C26900735E45 /* JoystickMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = JoystickMachine.hpp; sourceTree = ""; }; @@ -1060,8 +1069,6 @@ 4B894516201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; 4B894517201967B4007DE474 /* StaticAnalyser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StaticAnalyser.cpp; sourceTree = ""; }; 4B894540201967D6007DE474 /* Machines.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Machines.hpp; sourceTree = ""; }; - 4B89BCFA23024BB500EA0782 /* SCSI.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = SCSI.cpp; sourceTree = ""; }; - 4B89BCFB23024BB500EA0782 /* SCSI.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = SCSI.hpp; sourceTree = ""; }; 4B8A7E85212F988200F2BBC6 /* DeferredQueue.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DeferredQueue.hpp; sourceTree = ""; }; 4B8D287E1F77207100645199 /* TrackSerialiser.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TrackSerialiser.hpp; sourceTree = ""; }; 4B8E4ECD1DCE483D003716C3 /* KeyboardMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = KeyboardMachine.hpp; sourceTree = ""; }; @@ -1408,8 +1415,6 @@ 4BB73EC11B587A5100552FC2 /* Clock_SignalUITests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clock_SignalUITests.swift; sourceTree = ""; }; 4BB73EC31B587A5100552FC2 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 4BB73ECF1B587A6700552FC2 /* Clock Signal.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "Clock Signal.entitlements"; sourceTree = ""; }; - 4BB8F5252308E5A50015C2A6 /* DirectAccessDevice.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = DirectAccessDevice.cpp; sourceTree = ""; }; - 4BB8F5262308E5A50015C2A6 /* DirectAccessDevice.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DirectAccessDevice.hpp; sourceTree = ""; }; 4BBB709C2020109C002FE009 /* DynamicMachine.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = DynamicMachine.hpp; sourceTree = ""; }; 4BBB70A2202011C2002FE009 /* MultiMediaTarget.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = MultiMediaTarget.hpp; sourceTree = ""; }; 4BBB70A3202011C2002FE009 /* MultiMediaTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MultiMediaTarget.cpp; sourceTree = ""; }; @@ -1501,7 +1506,6 @@ 4BE3231520532AA7006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; 4BE3231620532BED006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; 4BE3231720532CC0006EF799 /* Target.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = Target.hpp; sourceTree = ""; }; - 4BE64626230B939B00C36C50 /* TargetImplementation.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = TargetImplementation.hpp; sourceTree = ""; }; 4BE76CF822641ED300ACD6FA /* QLTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = QLTests.mm; sourceTree = ""; }; 4BE7C9161E3D397100A5496D /* TIA.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TIA.cpp; sourceTree = ""; }; 4BE7C9171E3D397100A5496D /* TIA.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = TIA.hpp; sourceTree = ""; }; @@ -2183,6 +2187,7 @@ 4BEE0A691D72496600532C7B /* Cartridge */, 4B8805F81DCFF6CD003085B1 /* Data */, 4BAB62AA1D3272D200DF5BA0 /* Disk */, + 4B6AAEA1230E3E1D0078E864 /* MassStorage */, 4B69FB3A1C4D908A00B5F0AA /* Tape */, ); name = Storage; @@ -2246,6 +2251,28 @@ path = Implementation; sourceTree = ""; }; + 4B6AAEA1230E3E1D0078E864 /* MassStorage */ = { + isa = PBXGroup; + children = ( + 4B6AAEA2230E3E1D0078E864 /* MassStorageDevice.cpp */, + 4B6AAEA3230E3E1D0078E864 /* MassStorageDevice.hpp */, + 4B6AAEA5230E40250078E864 /* SCSI */, + ); + path = MassStorage; + sourceTree = ""; + }; + 4B6AAEA5230E40250078E864 /* SCSI */ = { + isa = PBXGroup; + children = ( + 4B6AAEA8230E40250078E864 /* Target.cpp */, + 4B6AAEA7230E40250078E864 /* SCSI.cpp */, + 4B6AAEA6230E40250078E864 /* Target.hpp */, + 4B6AAEA9230E40250078E864 /* SCSI.hpp */, + 4B6AAEAA230E40250078E864 /* TargetImplementation.hpp */, + ); + path = SCSI; + sourceTree = ""; + }; 4B7136831F78724F008B8ED9 /* MFM */ = { isa = PBXGroup; children = ( @@ -3335,11 +3362,6 @@ children = ( 4BDACBEA22FFA5D20045EF7E /* ncr5380.cpp */, 4BDACBEB22FFA5D20045EF7E /* ncr5380.hpp */, - 4B89BCFA23024BB500EA0782 /* SCSI.cpp */, - 4B89BCFB23024BB500EA0782 /* SCSI.hpp */, - 4BB8F5252308E5A50015C2A6 /* DirectAccessDevice.cpp */, - 4BB8F5262308E5A50015C2A6 /* DirectAccessDevice.hpp */, - 4BE64626230B939B00C36C50 /* TargetImplementation.hpp */, ); path = 5380; sourceTree = ""; @@ -3965,6 +3987,7 @@ 4B8318B322D3E540006DB630 /* Audio.cpp in Sources */, 4B055AAE1FAE85FD0060FFFF /* TrackSerialiser.cpp in Sources */, 4B89452B201967B4007DE474 /* File.cpp in Sources */, + 4B6AAEAC230E40250078E864 /* SCSI.cpp in Sources */, 4B055A981FAE85C50060FFFF /* Drive.cpp in Sources */, 4BD424E62193B5830097291A /* Shader.cpp in Sources */, 4B4B1A3D200198CA00A0F866 /* KonamiSCC.cpp in Sources */, @@ -3982,6 +4005,7 @@ 4B055AEE1FAE9BBF0060FFFF /* Keyboard.cpp in Sources */, 4B055AED1FAE9BA20060FFFF /* Z80Storage.cpp in Sources */, 4B1B88BC202E2EC100B67DFF /* MultiKeyboardMachine.cpp in Sources */, + 4B6AAEAE230E40250078E864 /* Target.cpp in Sources */, 4BF437EF209D0F7E008CBD6B /* SegmentParser.cpp in Sources */, 4B055AD11FAE9B030060FFFF /* Video.cpp in Sources */, 4BB4BFBA22A4372F0069048D /* StaticAnalyser.cpp in Sources */, @@ -4050,7 +4074,6 @@ 4B8318B822D3E566006DB630 /* IWM.cpp in Sources */, 4B0333B02094081A0050B93D /* AppleDSK.cpp in Sources */, 4B894535201967B4007DE474 /* AddressMapper.cpp in Sources */, - 4B89BCFD23024BB500EA0782 /* SCSI.cpp in Sources */, 4B055AD41FAE9B0B0060FFFF /* Oric.cpp in Sources */, 4B055A921FAE85B50060FFFF /* PRG.cpp in Sources */, 4B055AAF1FAE85FD0060FFFF /* UnformattedTrack.cpp in Sources */, @@ -4085,6 +4108,7 @@ 4B7A90E52041097C008514A2 /* ColecoVision.cpp in Sources */, 4B2BFC5F1D613E0200BA3AA9 /* TapePRG.cpp in Sources */, 4BC9DF4F1D04691600F44158 /* 6560.cpp in Sources */, + 4B6AAEAB230E40250078E864 /* SCSI.cpp in Sources */, 4B59199C1DAC6C46005BB85C /* OricTAP.cpp in Sources */, 4B9378E422A199C600973513 /* Audio.cpp in Sources */, 4B89451E201967B4007DE474 /* Tape.cpp in Sources */, @@ -4094,6 +4118,7 @@ 4B0E04EA1FC9E5DA00F43484 /* CAS.cpp in Sources */, 4B7A90ED20410A85008514A2 /* StaticAnalyser.cpp in Sources */, 4B58601E1F806AB200AEE2E3 /* MFMSectorDump.cpp in Sources */, + 4B6AAEAD230E40250078E864 /* Target.cpp in Sources */, 4B448E841F1C4C480009ABD6 /* PulseQueuedTape.cpp in Sources */, 4B0E61071FF34737002A9DBD /* MSX.cpp in Sources */, 4B4518A01F75FD1C00926311 /* CPCDSK.cpp in Sources */, @@ -4133,6 +4158,7 @@ 4B0333AF2094081A0050B93D /* AppleDSK.cpp in Sources */, 4B894518201967B4007DE474 /* ConfidenceCounter.cpp in Sources */, 4BCE005A227CFFCA000CA200 /* Macintosh.cpp in Sources */, + 4B6AAEA4230E3E1D0078E864 /* MassStorageDevice.cpp in Sources */, 4B89452E201967B4007DE474 /* StaticAnalyser.cpp in Sources */, 4BD5D2682199148100DDF17D /* ScanTargetGLSLFragments.cpp in Sources */, 4B38F3481F2EC11D00D9235D /* AmstradCPC.cpp in Sources */, @@ -4150,7 +4176,6 @@ 4BCE0060227D39AB000CA200 /* Video.cpp in Sources */, 4B4518A51F75FD1C00926311 /* SSD.cpp in Sources */, 4B55CE5F1C3B7D960093A61B /* MachineDocument.swift in Sources */, - 4BB8F5272308E5A50015C2A6 /* DirectAccessDevice.cpp in Sources */, 4B2B3A4C1F9B8FA70062DABF /* MemoryFuzzer.cpp in Sources */, 4B7913CC1DFCD80E00175A82 /* Video.cpp in Sources */, 4BDA00E622E699B000AC3CD0 /* CSMachine.mm in Sources */, @@ -4209,7 +4234,6 @@ 4B894528201967B4007DE474 /* Disk.cpp in Sources */, 4BBB70A4202011C2002FE009 /* MultiMediaTarget.cpp in Sources */, 4B89453A201967B4007DE474 /* StaticAnalyser.cpp in Sources */, - 4B89BCFC23024BB500EA0782 /* SCSI.cpp in Sources */, 4BB697CB1D4B6D3E00248BDF /* TimedEventLoop.cpp in Sources */, 4BDACBEC22FFA5D20045EF7E /* ncr5380.cpp in Sources */, 4B54C0C21F8D91CD0050900F /* Keyboard.cpp in Sources */, diff --git a/Storage/Disk/Disk.hpp b/Storage/Disk/Disk.hpp index 98c65926e..b85db192b 100644 --- a/Storage/Disk/Disk.hpp +++ b/Storage/Disk/Disk.hpp @@ -21,6 +21,9 @@ namespace Storage { namespace Disk { +/*! + Models a flopy disk. +*/ class Disk { public: virtual ~Disk() {} diff --git a/Storage/MassStorage/MassStorageDevice.cpp b/Storage/MassStorage/MassStorageDevice.cpp new file mode 100644 index 000000000..97964f16c --- /dev/null +++ b/Storage/MassStorage/MassStorageDevice.cpp @@ -0,0 +1,9 @@ +// +// MassStorageDevice.cpp +// Clock Signal +// +// Created by Thomas Harte on 21/08/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#include "MassStorageDevice.hpp" diff --git a/Storage/MassStorage/MassStorageDevice.hpp b/Storage/MassStorage/MassStorageDevice.hpp new file mode 100644 index 000000000..567711c80 --- /dev/null +++ b/Storage/MassStorage/MassStorageDevice.hpp @@ -0,0 +1,61 @@ +// +// MassStorageDevice.hpp +// Clock Signal +// +// Created by Thomas Harte on 21/08/2019. +// Copyright © 2019 Thomas Harte. All rights reserved. +// + +#ifndef MassStorageDevice_hpp +#define MassStorageDevice_hpp + +#include +#include +#include + +namespace Storage { +namespace MassStorage { + +/*! + A mass storage device is usually: + + * large; + * fixed; and + * part of a class with a very wide array of potential speeds and timings. + + Within this emulator, mass storage devices don't attempt to emulate + any specific medium, they just offer block-based access to a + linearly-addressed store. +*/ +class MassStorageDevice { + public: + virtual ~MassStorageDevice() {} + + /*! + @returns The size of each individual block. + */ + virtual size_t get_block_size() = 0; + + /*! + Block addresses run from 0 to n. The total number of blocks, n, + therefore provides the range of valid addresses. + + @returns The total number of blocks on the device. + */ + virtual size_t get_number_of_blocks() = 0; + + /*! + @returns The current contents of the block at @c address. + */ + virtual std::vector get_block(size_t address) = 0; + + /*! + Sets new contents for the block at @c address. + */ + virtual void set_block(size_t address, const std::vector &) {} +}; + +} +} + +#endif /* MassStorageDevice_hpp */ diff --git a/Components/5380/SCSI.cpp b/Storage/MassStorage/SCSI/SCSI.cpp similarity index 100% rename from Components/5380/SCSI.cpp rename to Storage/MassStorage/SCSI/SCSI.cpp diff --git a/Components/5380/SCSI.hpp b/Storage/MassStorage/SCSI/SCSI.hpp similarity index 100% rename from Components/5380/SCSI.hpp rename to Storage/MassStorage/SCSI/SCSI.hpp diff --git a/Components/5380/DirectAccessDevice.cpp b/Storage/MassStorage/SCSI/Target.cpp similarity index 92% rename from Components/5380/DirectAccessDevice.cpp rename to Storage/MassStorage/SCSI/Target.cpp index 9d52ea719..0b97a5ccd 100644 --- a/Components/5380/DirectAccessDevice.cpp +++ b/Storage/MassStorage/SCSI/Target.cpp @@ -1,12 +1,12 @@ // -// DirectAccessDevice.cpp +// Target.cpp // Clock Signal // // Created by Thomas Harte on 17/08/2019. // Copyright © 2019 Thomas Harte. All rights reserved. // -#include "DirectAccessDevice.hpp" +#include "Target.hpp" using namespace SCSI::Target; diff --git a/Components/5380/DirectAccessDevice.hpp b/Storage/MassStorage/SCSI/Target.hpp similarity index 100% rename from Components/5380/DirectAccessDevice.hpp rename to Storage/MassStorage/SCSI/Target.hpp diff --git a/Components/5380/TargetImplementation.hpp b/Storage/MassStorage/SCSI/TargetImplementation.hpp similarity index 100% rename from Components/5380/TargetImplementation.hpp rename to Storage/MassStorage/SCSI/TargetImplementation.hpp