summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/ti99/peb/scsicard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/ti99/peb/scsicard.cpp')
-rw-r--r--src/devices/bus/ti99/peb/scsicard.cpp68
1 files changed, 37 insertions, 31 deletions
diff --git a/src/devices/bus/ti99/peb/scsicard.cpp b/src/devices/bus/ti99/peb/scsicard.cpp
index e84d5911f8e..4ffe141aeb7 100644
--- a/src/devices/bus/ti99/peb/scsicard.cpp
+++ b/src/devices/bus/ti99/peb/scsicard.cpp
@@ -112,22 +112,24 @@
Thanks to Don O'Neil of WHT for providing the required schematics, ROM dumps,
and documentation
+ TODO: Enable block DMA. The only other driver using eop is lbpc.
+
*****************************************************************************/
#include "emu.h"
#include "scsicard.h"
#include "bus/nscsi/devices.h"
-#define LOG_WARN (1U<<1)
-#define LOG_CRU (1U<<2)
-#define LOG_EPROM (1U<<3)
-#define LOG_RAM (1U<<4)
-#define LOG_CONTR (1U<<5)
-#define LOG_CB (1U<<6)
-#define LOG_READY (1U<<7)
-#define LOG_DMA (1U<<8)
+#define LOG_WARN (1U << 1)
+#define LOG_CRU (1U << 2)
+#define LOG_EPROM (1U << 3)
+#define LOG_RAM (1U << 4)
+#define LOG_CONTR (1U << 5)
+#define LOG_CB (1U << 6)
+#define LOG_READY (1U << 7)
+#define LOG_DMA (1U << 8)
-#define VERBOSE ( LOG_GENERAL | LOG_WARN )
+#define VERBOSE (LOG_GENERAL | LOG_WARN)
#include "logmacro.h"
@@ -260,12 +262,12 @@ void whtech_scsi_card_device::readz(offs_t offset, uint8_t *value)
if ((m_address & 0x0010)==0x0000)
{
int reg = (m_address >> 1)&0x07;
+
// If we are in DMA mode, reading from register 6 means DMA read
- if ((m_controller->read(2) & 0x02) && (reg == 6))
+ if (m_drq && (reg == 6))
{
- LOGMASKED(LOG_DMA, "CTR: DMA in (%s)\n", machine().describe_context());
*value = m_controller->dma_r();
- LOGMASKED(LOG_DMA, "CTR: DMA -> %02x\n", *value);
+ LOGMASKED(LOG_DMA, "CTR: DMA in [%d] -> %02x (%s)\n", m_dmacount++, *value, machine().describe_context());
}
else
{
@@ -304,9 +306,9 @@ void whtech_scsi_card_device::write(offs_t offset, uint8_t data)
int reg = (m_address >> 1)&0x07;
// If we are in DMA mode, writing to register 0 means DMA write
- if ((m_controller->read(2) & 0x02) && (reg == 0))
+ if (m_drq && (reg == 0))
{
- LOGMASKED(LOG_DMA, "CTR: DMA out <- %02x (%s)\n", data, machine().describe_context());
+ LOGMASKED(LOG_DMA, "CTR: DMA out <- %02x [%d] (%s)\n", data, m_dmacount++, machine().describe_context());
m_controller->dma_w(data);
}
else
@@ -338,7 +340,7 @@ void whtech_scsi_card_device::cruwrite(offs_t offset, uint8_t data)
/*
Callbacks for the controller chip.
*/
-WRITE_LINE_MEMBER( whtech_scsi_card_device::drq_w )
+void whtech_scsi_card_device::drq_w(int state)
{
LOGMASKED(LOG_CB, "DRQ pin from controller = %d\n", state);
bool drq = (state==ASSERT_LINE);
@@ -350,7 +352,7 @@ WRITE_LINE_MEMBER( whtech_scsi_card_device::drq_w )
operate_ready_line();
}
-WRITE_LINE_MEMBER( whtech_scsi_card_device::irq_w )
+void whtech_scsi_card_device::irq_w(int state)
{
LOGMASKED(LOG_CB, "IRQ pin from controller = %d\n", state);
bool irq = (state==ASSERT_LINE);
@@ -362,13 +364,19 @@ WRITE_LINE_MEMBER( whtech_scsi_card_device::irq_w )
operate_ready_line();
}
+void whtech_scsi_card_device::signal_scsi_eop(int state)
+{
+ m_controller->eop_w(state);
+}
+
void whtech_scsi_card_device::device_add_mconfig(machine_config &config)
{
// RAM circuit
RAM(config, BUFFER).set_default_size("32K").set_default_value(0);
// PLD circuit
- WHTSCSI_PLD(config, PLD_TAG, 0);
+ WHTSCSI_PLD(config, m_pld, 0);
+ m_pld->set_board(this);
// SCSI bus
NSCSI_BUS(config, m_scsibus);
@@ -608,36 +616,37 @@ void whtscsi_pld_device::cruwrite(offs_t offset, uint8_t data)
int crubase = m_board->get_sw1();
if ((offset & 0xff00)==crubase)
{
- LOGMASKED(LOG_CRU, "CRU %04x <- %d (%s)\n", offset & 0xffff, data, machine().describe_context());
+ // LOGMASKED(LOG_CRU, "CRU %04x <- %d (%s)\n", offset & 0xffff, data, machine().describe_context());
int bit = (offset >> 1) & 0x1f;
switch (bit)
{
case 0: // card activation
- LOGMASKED(LOG_CRU, "DSR %s\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "DSR %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_selected = (data != 0);
break;
case 1: // SRAM shadow
- LOGMASKED(LOG_CRU, "SRAM shadow %s\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "SRAM shadow %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_sram_shadow = (data != 0);
break;
case 2: // DMA lock enable
- LOGMASKED(LOG_CRU, "DMA lock %s\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "DMA lock %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_dma_lock = (data != 0);
+ m_board->m_dmacount = 0;
break;
case 3: // SCSI EOP
- // signal_scsi_eop(data != 0);
- LOGMASKED(LOG_CRU, "SCSI EOP %s\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "SCSI EOP %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
+ m_board->signal_scsi_eop((data != 0)? ASSERT_LINE : CLEAR_LINE);
break;
case 4:
- LOGMASKED(LOG_CRU, "Word transfer %s\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "Word transfer %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_word_transfer = (data != 0);
break;
case 5:
- LOGMASKED(LOG_CRU, "Bank swap %s\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "Bank swap %s (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
m_bank_swapped = (data != 0);
break;
case 6:
- LOGMASKED(LOG_CRU, "Block mode %s (not implemented)\n", (data!=0)? "on" : "off");
+ LOGMASKED(LOG_CRU, "Block mode %s (not implemented) (%s)\n", (data!=0)? "on" : "off", machine().describe_context());
break;
case 8:
case 9:
@@ -646,6 +655,7 @@ void whtscsi_pld_device::cruwrite(offs_t offset, uint8_t data)
m_eprom_bank = m_eprom_bank | (1<<(bit-8));
else
m_eprom_bank = m_eprom_bank & ~(1<<(bit-8));
+ LOGMASKED(LOG_CRU, "Set EPROM bank %d (%s)\n", m_eprom_bank, machine().describe_context());
break;
case 12:
case 13:
@@ -654,6 +664,7 @@ void whtscsi_pld_device::cruwrite(offs_t offset, uint8_t data)
m_sram_bank = m_sram_bank | (1<<(bit-12));
else
m_sram_bank = m_sram_bank & ~(1<<(bit-12));
+ LOGMASKED(LOG_CRU, "Set SRAM bank %d (%s)\n", m_sram_bank, machine().describe_context());
break;
default:
break;
@@ -685,9 +696,4 @@ void whtscsi_pld_device::update_line_states(int address, bool drq, bool irq)
m_readyout = (irq || !m_dma_lock)? true : drq;
}
-void whtscsi_pld_device::device_config_complete()
-{
- m_board = static_cast<whtech_scsi_card_device*>(owner());
-}
-
} // end namespace bus::ti99::peb