From 6010c971a111733c750be4a625b932648979c5ec Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Tue, 23 Aug 2022 15:11:56 -0400 Subject: [PATCH] Provide a volume to the SCSI card if one is received. --- Machines/Apple/AppleII/AppleII.cpp | 21 ++++++++++++++++++--- Machines/Apple/AppleII/SCSICard.cpp | 4 ++++ Machines/Apple/AppleII/SCSICard.hpp | 4 ++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Machines/Apple/AppleII/AppleII.cpp b/Machines/Apple/AppleII/AppleII.cpp index a447e88c7..df92f6bbc 100644 --- a/Machines/Apple/AppleII/AppleII.cpp +++ b/Machines/Apple/AppleII/AppleII.cpp @@ -31,6 +31,10 @@ #include "../../../ClockReceiver/ForceInline.hpp" #include "../../../Configurable/StandardOptions.hpp" +#include "../../../Storage/MassStorage/SCSI/SCSI.hpp" +#include "../../../Storage/MassStorage/SCSI/DirectAccessDevice.hpp" +#include "../../../Storage/MassStorage/Encodings/MacintoshVolume.hpp" + #include #include #include @@ -102,12 +106,13 @@ template class ConcreteMachine: Cycles cycles_since_audio_update_; // MARK: - Cards - std::array, 9> cards_; // The final slot is a sentinel. + static constexpr size_t NoActiveCard = 7; // There is no 'card 0' in internal numbering. + size_t active_card_ = NoActiveCard; + + std::array, 8> cards_; // The final slot is a sentinel for 'no active card'. Cycles cycles_since_card_update_; std::vector every_cycle_cards_; std::vector just_in_time_cards_; - static constexpr size_t NoActiveCard = 8; - size_t active_card_ = NoActiveCard; int stretched_cycles_since_card_update_ = 0; @@ -147,6 +152,10 @@ template class ConcreteMachine: return dynamic_cast(cards_[5].get()); } + Apple::II::SCSICard *scsi_card() { + return dynamic_cast(cards_[6].get()); + } + // MARK: - Memory Map. /* @@ -891,6 +900,12 @@ template class ConcreteMachine: auto diskii = diskii_card(); if(diskii) diskii->set_disk(media.disks[0], 0); } + + if(!media.mass_storage_devices.empty()) { + auto scsi = scsi_card(); + if(scsi) scsi->set_volume(media.mass_storage_devices[0]); + } + return true; } diff --git a/Machines/Apple/AppleII/SCSICard.cpp b/Machines/Apple/AppleII/SCSICard.cpp index 24b8d8fed..e860a29f8 100644 --- a/Machines/Apple/AppleII/SCSICard.cpp +++ b/Machines/Apple/AppleII/SCSICard.cpp @@ -131,3 +131,7 @@ void SCSICard::perform_bus_operation(Select select, bool is_read, uint16_t addre break; } } + +void SCSICard::set_volume(const std::shared_ptr &volume) { + (void)volume; +} diff --git a/Machines/Apple/AppleII/SCSICard.hpp b/Machines/Apple/AppleII/SCSICard.hpp index 2d45ebf02..cba414868 100644 --- a/Machines/Apple/AppleII/SCSICard.hpp +++ b/Machines/Apple/AppleII/SCSICard.hpp @@ -13,8 +13,10 @@ #include "../../ROMMachine.hpp" #include "../../../Components/5380/ncr5380.hpp" +#include "../../../Storage/MassStorage/MassStorageDevice.hpp" #include +#include namespace Apple { namespace II { @@ -26,6 +28,8 @@ 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); + private: uint8_t *ram_pointer_ = nullptr; uint8_t *rom_pointer_ = nullptr;