From 4df2a29a1f55801a8b14c356c66977c5e757a76b Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 24 Aug 2022 15:23:50 -0400 Subject: [PATCH] Add storage to the bus. --- Machines/Apple/AppleII/AppleII.cpp | 2 +- Machines/Apple/AppleII/SCSICard.cpp | 10 +++++++--- Machines/Apple/AppleII/SCSICard.hpp | 8 +++++--- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/Machines/Apple/AppleII/AppleII.cpp b/Machines/Apple/AppleII/AppleII.cpp index df92f6bbc..7a1b5fb68 100644 --- a/Machines/Apple/AppleII/AppleII.cpp +++ b/Machines/Apple/AppleII/AppleII.cpp @@ -903,7 +903,7 @@ template class ConcreteMachine: if(!media.mass_storage_devices.empty()) { auto scsi = scsi_card(); - if(scsi) scsi->set_volume(media.mass_storage_devices[0]); + if(scsi) scsi->set_storage_device(media.mass_storage_devices[0]); } return true; diff --git a/Machines/Apple/AppleII/SCSICard.cpp b/Machines/Apple/AppleII/SCSICard.cpp index e860a29f8..62b73cd9a 100644 --- a/Machines/Apple/AppleII/SCSICard.cpp +++ b/Machines/Apple/AppleII/SCSICard.cpp @@ -58,7 +58,11 @@ ROM::Request SCSICard::rom_request() { } // TODO: accept and supply real clock rate. -SCSICard::SCSICard(ROM::Map &map) : scsi_bus_(1), ncr5380_(scsi_bus_, 1) { +SCSICard::SCSICard(ROM::Map &map) : + scsi_bus_(1), + ncr5380_(scsi_bus_, 1), + storage_(scsi_bus_, 6) +{ // Grab a copy of the SCSI ROM. const auto rom = map.find(ROM::Name::AppleIISCSICard); if(rom == map.end()) { @@ -132,6 +136,6 @@ void SCSICard::perform_bus_operation(Select select, bool is_read, uint16_t addre } } -void SCSICard::set_volume(const std::shared_ptr &volume) { - (void)volume; +void SCSICard::set_storage_device(const std::shared_ptr &device) { + storage_->set_storage(device); } diff --git a/Machines/Apple/AppleII/SCSICard.hpp b/Machines/Apple/AppleII/SCSICard.hpp index cba414868..d00627db4 100644 --- a/Machines/Apple/AppleII/SCSICard.hpp +++ b/Machines/Apple/AppleII/SCSICard.hpp @@ -13,6 +13,9 @@ #include "../../ROMMachine.hpp" #include "../../../Components/5380/ncr5380.hpp" + +#include "../../../Storage/MassStorage/SCSI/SCSI.hpp" +#include "../../../Storage/MassStorage/SCSI/DirectAccessDevice.hpp" #include "../../../Storage/MassStorage/MassStorageDevice.hpp" #include @@ -28,7 +31,7 @@ class SCSICard: public Card { void perform_bus_operation(Select select, bool is_read, uint16_t address, uint8_t *value) final; - void set_volume(const std::shared_ptr &volume); + void set_storage_device(const std::shared_ptr &device); private: uint8_t *ram_pointer_ = nullptr; @@ -39,8 +42,7 @@ class SCSICard: public Card { SCSI::Bus scsi_bus_; NCR::NCR5380::NCR5380 ncr5380_; - - // TODO: the rest of this. + SCSI::Target::Target storage_; }; }