summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ryan Holtz <ryan.holtz@arrowheadgs.com>2020-06-11 20:38:45 +0200
committer Ryan Holtz <ryan.holtz@arrowheadgs.com>2020-06-11 20:39:15 +0200
commitbd606bd055e05062a5b707c810465f65e989870d (patch)
treeed238489ceee06c90466955c787e49ea019369f9
parentcdb5ca42c689e4f58e27124c14a4b0fd5a9d05ea (diff)
-spg2xx_io: Better ADC behavior when reading converted data. [Ryan Holtz]
-rw-r--r--src/devices/machine/spg2xx_io.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/devices/machine/spg2xx_io.cpp b/src/devices/machine/spg2xx_io.cpp
index fc0d162240b..dc642ab6aa2 100644
--- a/src/devices/machine/spg2xx_io.cpp
+++ b/src/devices/machine/spg2xx_io.cpp
@@ -456,7 +456,6 @@ READ16_MEMBER(spg2xx_io_device::io_r)
case REG_ADC_DATA:
{
- m_io_regs[REG_ADC_DATA] = 0;
const uint16_t old = IO_IRQ_STATUS;
IO_IRQ_STATUS &= ~0x2000;
const uint16_t changed = (old & IO_IRQ_ENABLE) ^ (IO_IRQ_STATUS & IO_IRQ_ENABLE);
@@ -1116,11 +1115,13 @@ WRITE16_MEMBER(spg2xx_io_device::io_w)
m_io_regs[REG_ADC_CTRL] &= ~0x3000;
const uint32_t adc_clocks = 16 << ((m_io_regs[REG_ADC_CTRL] >> 2) & 3);
m_adc_timer[channel]->adjust(attotime::from_ticks(adc_clocks, 27000000));
+ m_io_regs[REG_ADC_DATA] &= ~0x8000;
}
// Req_Auto_8K
if (BIT(data, 10))
{
+ m_io_regs[REG_ADC_DATA] &= ~0x8000;
m_adc_timer[channel]->adjust(attotime::from_hz(8000), 0, attotime::from_hz(8000));
}
}
@@ -1752,7 +1753,7 @@ void spg2xx_io_device::do_gpio(uint32_t offset, bool write)
void spg2xx_io_device::do_adc_capture(int channel)
{
- m_io_regs[REG_ADC_DATA] = m_adc_in[channel]() & 0x0fff;
+ m_io_regs[REG_ADC_DATA] = (m_adc_in[channel]() & 0x0fff) | 0x8000;
if (BIT(m_io_regs[REG_ADC_DATA], 11))
{
//m_io_regs[REG_ADC_DATA] |= 0xf000;