summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2018-12-31 21:56:01 -0500
committer AJR <ajrhacker@users.noreply.github.com>2018-12-31 22:00:02 -0500
commitcdb2334e90a61ed178c17bd78d929590e8d1e33e (patch)
tree28d1f816709f3172b42c230d8c08b5ba57dd5a9f /src
parent2778aee105559fc8c47f993fb7926c1d98141f33 (diff)
ym2148: Flag framing errors; add error reset command; misc. small changes
Diffstat (limited to 'src')
-rw-r--r--src/devices/machine/ym2148.cpp81
-rw-r--r--src/devices/machine/ym2148.h5
2 files changed, 48 insertions, 38 deletions
diff --git a/src/devices/machine/ym2148.cpp b/src/devices/machine/ym2148.cpp
index f58d98b7536..10eb9c9e6c9 100644
--- a/src/devices/machine/ym2148.cpp
+++ b/src/devices/machine/ym2148.cpp
@@ -44,8 +44,9 @@ void ym2148_device::device_start()
m_port_read_handler.resolve_safe(0xff);
// Start a timer to trigger at clock / 8 / 16
+ const attotime rate = clocks_to_attotime(8 * 16);
m_timer = timer_alloc(0);
- m_timer->adjust(attotime::from_hz(m_clock / 8 / 16), 0, attotime::from_hz(m_clock / 8 / 16));
+ m_timer->adjust(rate, 0, rate);
}
@@ -71,12 +72,14 @@ void ym2148_device::receive_clock()
m_data_in = get_received_char();
+ if (is_receive_framing_error())
+ m_status |= STATUS_FRAMING_ERROR;
+
if (m_status & STATUS_RECEIVE_BUFFER_FULL)
- {
- // Overrun error
m_status |= STATUS_OVERRUN_ERROR;
- }
- m_status |= STATUS_RECEIVE_BUFFER_FULL;
+ else
+ m_status |= STATUS_RECEIVE_BUFFER_FULL;
+
update_irq();
}
}
@@ -144,16 +147,19 @@ READ8_MEMBER(ym2148_device::read)
{
switch (offset & 7)
{
- case 2: // External port read
- return m_port_read_handler();
+ case 2: // External port read
+ return m_port_read_handler();
- case 5: // Midi data read register
+ case 5: // Midi data read register
+ if (!machine().side_effects_disabled())
+ {
m_status &= ~STATUS_RECEIVE_BUFFER_FULL;
update_irq();
- return m_data_in;
+ }
+ return m_data_in;
- case 6: // Midi status register
- return m_status;
+ case 6: // Midi status register
+ return m_status;
}
return 0xff;
}
@@ -163,36 +169,39 @@ WRITE8_MEMBER(ym2148_device::write)
{
switch (offset & 7)
{
- case 2: // External port write
- m_port_write_handler(data);
- break;
+ case 2: // External port write
+ m_port_write_handler(data);
+ break;
- case 3: // IRQ vector
- m_irq_vector = data;
- break;
+ case 3: // IRQ vector
+ m_irq_vector = data;
+ break;
- case 4: // External IRQ vector
- m_external_irq_vector = data;
- break;
+ case 4: // External IRQ vector
+ m_external_irq_vector = data;
+ break;
- case 5: // Midi data write register
- m_data_out = data;
- m_status &= ~STATUS_TRANSMIT_READY;
- break;
+ case 5: // Midi data write register
+ m_data_out = data;
+ m_status &= ~STATUS_TRANSMIT_READY;
+ break;
- case 6: // Midi control register
- m_control = data;
+ case 6: // Midi control register
+ m_control = data;
- if (m_control & 0x80)
- {
- // Reset
- receive_clock();
- transmit_clock();
- m_irq_state = CLEAR_LINE;
- m_irq_handler(m_irq_state);
- }
- update_irq();
- break;
+ if (BIT(m_control, 4)) // Error reset
+ m_status &= ~(STATUS_FRAMING_ERROR | STATUS_OVERRUN_ERROR);
+
+ if (BIT(m_control, 7))
+ {
+ // Reset
+ receive_clock();
+ transmit_clock();
+ m_irq_state = CLEAR_LINE;
+ m_irq_handler(m_irq_state);
+ }
+ update_irq();
+ break;
}
}
diff --git a/src/devices/machine/ym2148.h b/src/devices/machine/ym2148.h
index ace9248054c..7f5f45d7066 100644
--- a/src/devices/machine/ym2148.h
+++ b/src/devices/machine/ym2148.h
@@ -66,8 +66,9 @@ private:
enum
{
STATUS_TRANSMIT_READY = 0x01,
- STATUS_RECEIVE_BUFFER_FULL = 0x2,
- STATUS_OVERRUN_ERROR = 0x20,
+ STATUS_RECEIVE_BUFFER_FULL = 0x02,
+ STATUS_OVERRUN_ERROR = 0x10,
+ STATUS_FRAMING_ERROR = 0x20,
CONTROL_TRANSMIT_ENABLE = 0x01,
CONTROL_TRANSMIT_IRQ_ENABLE = 0x02,
CONTROL_RECEIVE_ENABLE = 0x04,