mirror of
https://github.com/holub/mame
synced 2025-04-19 23:12:11 +03:00
-spg2xx: Fix up ADC support. fordrace now polls all six ADC channels. [Ryan Holtz]
This commit is contained in:
parent
d3b6eab150
commit
2cb2934f94
@ -182,6 +182,8 @@ void spg2xx_device::configure_spg_io(spg2xx_io_device* io)
|
||||
io->portc_out().set(FUNC(spg2xx_device::portc_w));
|
||||
io->adc_in<0>().set(FUNC(spg2xx_device::adc_r<0>));
|
||||
io->adc_in<1>().set(FUNC(spg2xx_device::adc_r<1>));
|
||||
io->adc_in<2>().set(FUNC(spg2xx_device::adc_r<2>));
|
||||
io->adc_in<3>().set(FUNC(spg2xx_device::adc_r<3>));
|
||||
io->i2c_w().set(FUNC(spg2xx_device::eepromx_w));
|
||||
io->i2c_r().set(FUNC(spg2xx_device::eepromx_r));
|
||||
io->uart_tx().set(FUNC(spg2xx_device::uart_tx_w));
|
||||
|
@ -31,7 +31,7 @@ DEFINE_DEVICE_TYPE(SPG28X_IO, spg28x_io_device, "spg28x_io", "SPG280-series Syst
|
||||
#define LOG_IO (LOG_IO_READS | LOG_IO_WRITES | LOG_IRQS | LOG_GPIO | LOG_UART | LOG_I2C | LOG_TIMERS | LOG_EXTINT | LOG_UNKNOWN_IO | LOG_SPI | LOG_ADC)
|
||||
#define LOG_ALL (LOG_IO | LOG_VLINES | LOG_SEGMENT | LOG_WATCHDOG | LOG_FIQ | LOG_SIO | LOG_EXT_MEM | LOG_ADC)
|
||||
|
||||
#define VERBOSE (LOG_ADC)
|
||||
#define VERBOSE (0)
|
||||
#include "logmacro.h"
|
||||
|
||||
|
||||
@ -1104,7 +1104,14 @@ WRITE16_MEMBER(spg2xx_io_device::io_w)
|
||||
check_irqs(changed);
|
||||
}
|
||||
}
|
||||
else if (!BIT(old_ctrl, 12) && BIT(m_io_regs[REG_ADC_CTRL], 12))
|
||||
|
||||
if (BIT(data, 13))
|
||||
{
|
||||
m_io_regs[REG_ADC_CTRL] &= ~0x2000;
|
||||
check_irqs(0x2000);
|
||||
}
|
||||
|
||||
if (!BIT(old_ctrl, 12) && BIT(m_io_regs[REG_ADC_CTRL], 12))
|
||||
{
|
||||
m_io_regs[REG_ADC_CTRL] &= ~0x3000;
|
||||
const uint32_t adc_clocks = 16 << ((m_io_regs[REG_ADC_CTRL] >> 2) & 3);
|
||||
@ -1652,7 +1659,7 @@ void spg2xx_io_device::check_irqs(const uint16_t changed)
|
||||
|
||||
if (changed & 0x6100) // UART, SPI, SIO, I2C, ADC IRQ
|
||||
{
|
||||
LOGMASKED(LOG_UART | LOG_SIO | LOG_SPI | LOG_I2C, "%ssserting IRQ3 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x6100) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100), changed);
|
||||
LOGMASKED(LOG_UART | LOG_SIO | LOG_SPI | LOG_I2C | LOG_ADC, "%ssserting IRQ3 (%04x, %04x)\n", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x6100) ? "A" : "Dea", (IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x2100), changed);
|
||||
m_uart_adc_irq_cb((IO_IRQ_ENABLE & IO_IRQ_STATUS & 0x6100) ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,7 @@ public:
|
||||
auto portb_in() { return m_portb_in.bind(); }
|
||||
auto portc_in() { return m_portc_in.bind(); }
|
||||
|
||||
template <size_t Line> auto adc_in() { printf("Binding %d\n", (int)Line); return m_adc_in[Line].bind(); }
|
||||
template <size_t Line> auto adc_in() { return m_adc_in[Line].bind(); }
|
||||
|
||||
auto i2c_w() { return m_i2c_w.bind(); }
|
||||
auto i2c_r() { return m_i2c_r.bind(); }
|
||||
@ -51,6 +51,8 @@ public:
|
||||
|
||||
auto write_fiq_vector_callback() { return m_fiq_vector_w.bind(); };
|
||||
|
||||
template <size_t Line> uint16_t adc_r() { return m_adc_in[Line](); }
|
||||
|
||||
protected:
|
||||
spg2xx_io_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, const uint32_t sprite_limit)
|
||||
: spg2xx_io_device(mconfig, type, tag, owner, clock)
|
||||
|
@ -1014,7 +1014,7 @@ void spg2xx_game_fordrace_state::fordrace(machine_config &config)
|
||||
m_maincpu->porta_in().set(FUNC(spg2xx_game_fordrace_state::base_porta_r));
|
||||
m_maincpu->portb_in().set(FUNC(spg2xx_game_fordrace_state::base_portb_r));
|
||||
m_maincpu->portc_in().set(FUNC(spg2xx_game_fordrace_state::base_portc_r));
|
||||
|
||||
|
||||
// these do something in test mode, but in game the ADC interrupt is never generated?
|
||||
m_maincpu->adc_in<0>().set_ioport("AD0"); // pedals
|
||||
m_maincpu->adc_in<1>().set_ioport("AD1"); // steering
|
||||
@ -1053,7 +1053,7 @@ void spg2xx_game_senspeed_state::senspeed(machine_config &config)
|
||||
/*
|
||||
ATMLH806
|
||||
02B 1
|
||||
A7J4565E
|
||||
A7J4565E
|
||||
*/
|
||||
I2C_24C01(config, "i2cmem", 0); // saves 0x80 bytes, but loading fails?
|
||||
}
|
||||
|
@ -168,10 +168,10 @@ static INPUT_PORTS_START( jak_sith_i2c )
|
||||
PORT_BIT( 0xfff6, IP_ACTIVE_HIGH, IPT_UNUSED )
|
||||
|
||||
PORT_START("JOYX")
|
||||
PORT_BIT(0x1fff, 0x0800, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x0000,0x1fff)
|
||||
PORT_BIT(0x0fff, 0x0800, IPT_AD_STICK_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x0000,0x0fff)
|
||||
|
||||
PORT_START("JOYY")
|
||||
PORT_BIT(0x1fff, 0x0800, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x0000,0x1fff)
|
||||
PORT_BIT(0x0fff, 0x0800, IPT_AD_STICK_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(100) PORT_MINMAX(0x0000,0x0fff)
|
||||
INPUT_PORTS_END
|
||||
|
||||
static INPUT_PORTS_START( jak_pooh )
|
||||
@ -531,7 +531,9 @@ void jakks_gkr_state::jakks_gkr_sw_i2c(machine_config &config)
|
||||
jakks_gkr_i2c(config);
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &jakks_gkr_state::mem_map_1m);
|
||||
m_maincpu->adc_in<0>().set(FUNC(jakks_gkr_state::joy_x_read));
|
||||
m_maincpu->adc_in<1>().set(FUNC(jakks_gkr_state::joy_x_read));
|
||||
m_maincpu->adc_in<2>().set(FUNC(jakks_gkr_state::joy_y_read));
|
||||
m_maincpu->adc_in<3>().set(FUNC(jakks_gkr_state::joy_y_read));
|
||||
SOFTWARE_LIST(config, "jakks_gamekey_sw").set_original("jakks_gamekey_sw");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user