From 6bbd1270ee80e4f831e7b6dbc6a573973cfc545b Mon Sep 17 00:00:00 2001 From: Patrick Mackinlay Date: Wed, 23 Jan 2019 17:10:52 +0700 Subject: ncr5390: better command length logic (nw) --- src/devices/machine/ncr5390.cpp | 13 ++++--------- src/devices/machine/ncr5390.h | 1 - 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/devices/machine/ncr5390.cpp b/src/devices/machine/ncr5390.cpp index d3918df1e30..774c61a5a32 100644 --- a/src/devices/machine/ncr5390.cpp +++ b/src/devices/machine/ncr5390.cpp @@ -430,8 +430,8 @@ void ncr5390_device::step(bool timeout) break; } - // "with atn" variants have a message byte before the command descriptor - command_length = (c == CD_SELECT) ? derive_msg_size(fifo[0]) : 1; + command_length = fifo_pos + tcounter; + logerror("command_length %d\n", command_length); state = DISC_SEL_ARBITRATION; step(false); break; @@ -465,7 +465,6 @@ void ncr5390_device::step(bool timeout) seq = 1; function_bus_complete(); } else { - command_length = derive_msg_size(fifo[0]); state = DISC_SEL_WAIT_REQ; } break; @@ -850,6 +849,8 @@ void ncr5390_device::start_command() // clear transfer count zero flag when counter is reloaded status &= ~S_TC0; } + else + tcounter = 0; switch(c) { case CM_NOP: @@ -973,12 +974,6 @@ bool ncr5390_device::check_valid_command(uint8_t cmd) return false; } -int ncr5390_device::derive_msg_size(uint8_t msg_id) -{ - const static int sizes[8] = { 6, 10, 6, 6, 6, 12, 6, 10 }; - return sizes[msg_id >> 5]; -} - void ncr5390_device::arbitrate() { state = (state & STATE_MASK) | (ARB_COMPLETE << SUB_SHIFT); diff --git a/src/devices/machine/ncr5390.h b/src/devices/machine/ncr5390.h index 1c9c6721fd1..1d52a712628 100644 --- a/src/devices/machine/ncr5390.h +++ b/src/devices/machine/ncr5390.h @@ -212,7 +212,6 @@ protected: void start_command(); void step(bool timeout); virtual bool check_valid_command(uint8_t cmd); - int derive_msg_size(uint8_t msg_id); void function_complete(); void function_bus_complete(); void bus_complete(); -- cgit v1.2.3