1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-02 20:30:00 +00:00

'Clock' the SCSI bus (i.e. make it aware of passing time).

This commit is contained in:
Thomas Harte 2022-08-30 16:40:25 -04:00
parent f50ce7f137
commit 7996fe6dab
4 changed files with 13 additions and 6 deletions

View File

@ -494,7 +494,10 @@ template <Analyser::Static::AppleII::Target::Model model> class ConcreteMachine:
if(has_scsi_card) {
// Install the SCSI card in slot 7, to one-up any connected Disk II.
install_card(7, new Apple::II::SCSICard(roms));
//
// Rounding the clock rate slightly shouldn't matter, but:
// TODO: be [slightly] more honest about clock rate.
install_card(7, new Apple::II::SCSICard(roms, int(master_clock / 14.0f)));
}
rom_ = std::move(roms.find(system)->second);

View File

@ -58,7 +58,7 @@ class Card {
no constraints, that want to be informed of every machine cycle, will receive
a call to perform_bus_operation every cycle and should use that for time keeping.
*/
virtual void run_for([[maybe_unused]] Cycles half_cycles, [[maybe_unused]] int stretches) {}
virtual void run_for([[maybe_unused]] Cycles cycles, [[maybe_unused]] int stretches) {}
/// Requests a flush of any pending audio or video output.
virtual void flush() {}

View File

@ -58,9 +58,9 @@ 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, int clock_rate) :
scsi_bus_(clock_rate),
ncr5380_(scsi_bus_, clock_rate),
storage_(scsi_bus_, 6)
{
// Grab a copy of the SCSI ROM.

View File

@ -27,12 +27,16 @@ namespace II {
class SCSICard: public Card {
public:
static ROM::Request rom_request();
SCSICard(ROM::Map &);
SCSICard(ROM::Map &, int clock_rate);
void perform_bus_operation(Select select, bool is_read, uint16_t address, uint8_t *value) final;
void set_storage_device(const std::shared_ptr<Storage::MassStorage::MassStorageDevice> &device);
void run_for([[maybe_unused]] Cycles cycles, [[maybe_unused]] int stretches) final {
scsi_bus_.run_for(cycles);
}
private:
uint8_t *ram_pointer_ = nullptr;
uint8_t *rom_pointer_ = nullptr;