From 58281520d31ac074970fc26d34f4574403ad53f6 Mon Sep 17 00:00:00 2001 From: Maxim Poliakovski Date: Wed, 1 Nov 2023 16:16:58 +0100 Subject: [PATCH] Implement writes to SCSI Pseudo-DMA register. --- devices/common/scsi/sc53c94.cpp | 15 +++++++++++++++ devices/common/scsi/sc53c94.h | 1 + devices/ioctrl/amic.cpp | 5 ++++- 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/devices/common/scsi/sc53c94.cpp b/devices/common/scsi/sc53c94.cpp index 2375167..4feebae 100644 --- a/devices/common/scsi/sc53c94.cpp +++ b/devices/common/scsi/sc53c94.cpp @@ -190,6 +190,21 @@ uint16_t Sc53C94::pseudo_dma_read() return data_word; } +void Sc53C94::pseudo_dma_write(uint16_t data) { + this->fifo_push((data >> 8) & 0xFFU); + this->fifo_push(data & 0xFFU); + + // update DMA status + if (this->is_dma_cmd) { + this->xfer_count -= 2; + if (!this->xfer_count) { + this->status |= STAT_TC; // signal zero transfer count + //this->cur_state = SeqState::XFER_END; + this->sequencer(); + } + } +} + void Sc53C94::update_command_reg(uint8_t cmd) { if (this->on_reset && (cmd & 0x7F) != CMD_NOP) { diff --git a/devices/common/scsi/sc53c94.h b/devices/common/scsi/sc53c94.h index 3f1a93c..38d4251 100644 --- a/devices/common/scsi/sc53c94.h +++ b/devices/common/scsi/sc53c94.h @@ -164,6 +164,7 @@ public: uint8_t read(uint8_t reg_offset); void write(uint8_t reg_offset, uint8_t value); uint16_t pseudo_dma_read(); + void pseudo_dma_write(uint16_t data); // real DMA control void real_dma_xfer(int direction); diff --git a/devices/ioctrl/amic.cpp b/devices/ioctrl/amic.cpp index 4de4d61..d0da4f2 100644 --- a/devices/ioctrl/amic.cpp +++ b/devices/ioctrl/amic.cpp @@ -223,7 +223,10 @@ void AMIC::write(uint32_t rgn_start, uint32_t offset, uint32_t value, int size) this->mace->write((offset >> 4) & 0x1F, value); return; case 0x10: - this->scsi->write((offset >> 4) & 0xF, value); + if (offset & 0x100) + this->scsi->pseudo_dma_write(value); + else + this->scsi->write((offset >> 4) & 0xF, value); return; case 0x14: // Sound registers switch(offset) {