summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/53c7xx.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/machine/53c7xx.cpp')
-rw-r--r--src/devices/machine/53c7xx.cpp59
1 files changed, 26 insertions, 33 deletions
diff --git a/src/devices/machine/53c7xx.cpp b/src/devices/machine/53c7xx.cpp
index 14f339c30f7..21fa52528be 100644
--- a/src/devices/machine/53c7xx.cpp
+++ b/src/devices/machine/53c7xx.cpp
@@ -23,10 +23,10 @@
// DEBUGGERY
//**************************************************************************
-#define LOG_UNHANDLED (1U << 0)
-#define LOG_HOST (1U << 1)
-#define LOG_STATE (1U << 2)
-#define LOG_SCRIPTS (1U << 3)
+#define LOG_UNHANDLED (1U << 1)
+#define LOG_HOST (1U << 2)
+#define LOG_STATE (1U << 3)
+#define LOG_SCRIPTS (1U << 4)
#define VERBOSE (0)
#include "logmacro.h"
@@ -87,14 +87,14 @@ DEFINE_DEVICE_TYPE(NCR53C7XX, ncr53c7xx_device, "ncr537xx", "NCR 53C7xx SCSI")
// ncr53c7xx_device - constructor/destructor
//-------------------------------------------------
-ncr53c7xx_device::ncr53c7xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
- : nscsi_device(mconfig, NCR53C7XX, tag, owner, clock),
- nscsi_slot_card_interface(mconfig, *this, DEVICE_SELF),
- device_execute_interface(mconfig, *this),
- m_icount(0),
- m_irq_handler(*this),
- m_host_write(*this),
- m_host_read(*this)
+ncr53c7xx_device::ncr53c7xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
+ nscsi_device(mconfig, NCR53C7XX, tag, owner, clock),
+ nscsi_slot_card_interface(mconfig, *this, DEVICE_SELF),
+ device_execute_interface(mconfig, *this),
+ m_icount(0),
+ m_irq_handler(*this),
+ m_host_write(*this),
+ m_host_read(*this, 0)
{
}
@@ -108,12 +108,7 @@ void ncr53c7xx_device::device_start()
// set our instruction counter
set_icountptr(m_icount);
- // resolve line callbacks
- m_irq_handler.resolve_safe();
- m_host_read.resolve_safe(0);
- m_host_write.resolve_safe();
-
- m_tm = timer_alloc(0);
+ m_tm = timer_alloc(FUNC(ncr53c7xx_device::step_timer), this);
// The SCRIPTS processor runs at ~2 MIPS so approximate this
set_unscaled_clock(2000000);
@@ -213,7 +208,7 @@ void ncr53c7xx_device::device_reset()
// read - Host read handler
//-------------------------------------------------
-READ32_MEMBER( ncr53c7xx_device::read )
+uint32_t ncr53c7xx_device::read(offs_t offset, uint32_t mem_mask)
{
LOGMASKED(LOG_HOST, "%s: REG R: [%x] (%08X)\n", machine().describe_context(), offset, mem_mask);
@@ -292,7 +287,8 @@ READ32_MEMBER( ncr53c7xx_device::read )
if (ACCESSING_BITS_0_7)
{
ret = m_dstat;
- m_dstat = 0;
+ // DFE isn't cleared on read
+ m_dstat &= DSTAT_DFE;
update_irqs();
}
if (ACCESSING_BITS_8_15)
@@ -456,7 +452,7 @@ READ32_MEMBER( ncr53c7xx_device::read )
// write - Host write handler
//-------------------------------------------------
-WRITE32_MEMBER( ncr53c7xx_device::write )
+void ncr53c7xx_device::write(offs_t offset, uint32_t data, uint32_t mem_mask)
{
LOGMASKED(LOG_HOST, "%s: REG W: [%x] (%08X) %x\n", offset, mem_mask, data, machine().describe_context());
@@ -756,11 +752,11 @@ void ncr53c7xx_device::recv_byte()
//-------------------------------------------------
-// device_timer - callback to step the SCSI
+// step_timer - callback to step the SCSI
// state machine
//-------------------------------------------------
-void ncr53c7xx_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
+TIMER_CALLBACK_MEMBER(ncr53c7xx_device::step_timer)
{
step(true);
}
@@ -1735,7 +1731,7 @@ void ncr53c7xx_device::tc_int()
// disassemble_scripts -
//-------------------------------------------------
-const char* ncr53c7xx_device::disassemble_scripts()
+std::string ncr53c7xx_device::disassemble_scripts()
{
static char const *const phases[] =
{
@@ -1749,14 +1745,13 @@ const char* ncr53c7xx_device::disassemble_scripts()
"Message In"
};
- static char buffer[64];
- char opstring[64];
+ std::string opstring;
switch ((m_dcmd >> 6) & 3)
{
case 0:
{
- sprintf(opstring, "BMOV: %s [%x] %d bytes\n", phases[m_dcmd & 7], m_dnad, m_dbc);
+ opstring = util::string_format("BMOV: %s [%x] %d bytes\n", phases[m_dcmd & 7], m_dnad, m_dbc);
break;
}
case 1:
@@ -1773,7 +1768,7 @@ const char* ncr53c7xx_device::disassemble_scripts()
"ILLEGAL",
};
- sprintf(opstring, "IO: %s (%x)\n", ops[(m_dcmd >> 3) & 7], m_dnad);
+ opstring = util::string_format("IO: %s (%x)\n", ops[(m_dcmd >> 3) & 7], m_dnad);
break;
}
case 2:
@@ -1790,17 +1785,15 @@ const char* ncr53c7xx_device::disassemble_scripts()
"ILLEGAL",
};
- sprintf(opstring, "TC: %s %c (%s) (%x)\n", ops[(m_dcmd >> 3) & 7], m_dbc & (1 << 19) ? 'T' : 'F', phases[m_dcmd & 7], m_dnad);
+ opstring = util::string_format("TC: %s %c (%s) (%x)\n", ops[(m_dcmd >> 3) & 7], m_dbc & (1 << 19) ? 'T' : 'F', phases[m_dcmd & 7], m_dnad);
break;
}
case 3:
{
- sprintf(opstring, "ILLEGAL");
+ opstring = "ILLEGAL";
break;
}
}
- sprintf(buffer, "SCRIPTS [%08x]: %s", m_dsp - 8, opstring);
-
- return buffer;
+ return util::string_format("SCRIPTS [%08x]: %s", m_dsp - 8, opstring);
}