mirror of
https://github.com/holub/mame
synced 2025-04-25 09:50:04 +03:00
ssv.cpp: Add ADC0809 device to gdfs; clean up input-related variables (nw)
This commit is contained in:
parent
feb1a4297b
commit
d389a0d327
@ -250,20 +250,13 @@ TIMER_DEVICE_CALLBACK_MEMBER(ssv_state::interrupt)
|
||||
}
|
||||
}
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(ssv_state::gdfs_interrupt)
|
||||
WRITE_LINE_MEMBER(ssv_state::gdfs_adc_int_w)
|
||||
{
|
||||
int scanline = param;
|
||||
|
||||
if ((scanline % 64) == 0)
|
||||
if (state)
|
||||
{
|
||||
m_requested_int |= 1 << 6; // reads lightgun (4 times for 4 axis)
|
||||
update_irq_state();
|
||||
}
|
||||
else if(scanline == 240)
|
||||
{
|
||||
m_requested_int |= 1 << 3; // vblank
|
||||
update_irq_state();
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -452,7 +445,7 @@ void ssv_state::drifto94_map(address_map &map)
|
||||
|
||||
READ16_MEMBER(ssv_state::gdfs_eeprom_r)
|
||||
{
|
||||
return (((m_gdfs_lightgun_select & 1) ? 0 : 0xff) ^ m_io_gun[m_gdfs_lightgun_select]->read()) | (m_eeprom->do_read() << 8);
|
||||
return m_adc->data_r(space, 0) | (m_eeprom->do_read() << 8);
|
||||
}
|
||||
|
||||
WRITE16_MEMBER(ssv_state::gdfs_eeprom_w)
|
||||
@ -466,19 +459,17 @@ WRITE16_MEMBER(ssv_state::gdfs_eeprom_w)
|
||||
// data & 0x0001 ?
|
||||
|
||||
// latch the bit
|
||||
m_eeprom->di_write((data & 0x4000) >> 14);
|
||||
m_eeprom->di_write(BIT(data, 14));
|
||||
|
||||
// reset line asserted: reset.
|
||||
m_eeprom->cs_write((data & 0x1000) ? ASSERT_LINE : CLEAR_LINE );
|
||||
m_eeprom->cs_write(BIT(data, 12) ? ASSERT_LINE : CLEAR_LINE);
|
||||
|
||||
// clock line asserted: write latch or select next bit to read
|
||||
m_eeprom->clk_write((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE );
|
||||
m_eeprom->clk_write(BIT(data, 13) ? ASSERT_LINE : CLEAR_LINE);
|
||||
|
||||
if (!(m_gdfs_eeprom_old & 0x0800) && (data & 0x0800)) // rising clock
|
||||
m_gdfs_lightgun_select = (data & 0x0300) >> 8;
|
||||
m_adc->address_w(space, 0, (data & 0x0700) >> 8);
|
||||
m_adc->start_w(BIT(data, 11));
|
||||
}
|
||||
|
||||
COMBINE_DATA(&m_gdfs_eeprom_old);
|
||||
}
|
||||
|
||||
|
||||
@ -513,10 +504,10 @@ READ16_MEMBER(ssv_state::hypreact_input_r)
|
||||
{
|
||||
uint16_t input_sel = *m_input_sel;
|
||||
|
||||
if (input_sel & 0x0001) return m_io_key0->read();
|
||||
if (input_sel & 0x0002) return m_io_key1->read();
|
||||
if (input_sel & 0x0004) return m_io_key2->read();
|
||||
if (input_sel & 0x0008) return m_io_key3->read();
|
||||
if (input_sel & 0x0001) return m_io_key[0]->read();
|
||||
if (input_sel & 0x0002) return m_io_key[1]->read();
|
||||
if (input_sel & 0x0004) return m_io_key[2]->read();
|
||||
if (input_sel & 0x0008) return m_io_key[3]->read();
|
||||
logerror("CPU #0 PC %06X: unknown input read: %04X\n",m_maincpu->pc(),input_sel);
|
||||
return 0xffff;
|
||||
}
|
||||
@ -643,10 +634,10 @@ READ16_MEMBER(ssv_state::srmp4_input_r)
|
||||
{
|
||||
uint16_t input_sel = *m_input_sel;
|
||||
|
||||
if (input_sel & 0x0002) return m_io_key0->read();
|
||||
if (input_sel & 0x0004) return m_io_key1->read();
|
||||
if (input_sel & 0x0008) return m_io_key2->read();
|
||||
if (input_sel & 0x0010) return m_io_key3->read();
|
||||
if (input_sel & 0x0002) return m_io_key[0]->read();
|
||||
if (input_sel & 0x0004) return m_io_key[1]->read();
|
||||
if (input_sel & 0x0008) return m_io_key[2]->read();
|
||||
if (input_sel & 0x0010) return m_io_key[3]->read();
|
||||
logerror("CPU #0 PC %06X: unknown input read: %04X\n",m_maincpu->pc(),input_sel);
|
||||
return 0xffff;
|
||||
}
|
||||
@ -691,10 +682,10 @@ READ16_MEMBER(ssv_state::srmp7_input_r)
|
||||
{
|
||||
uint16_t input_sel = *m_input_sel;
|
||||
|
||||
if (input_sel & 0x0002) return m_io_key0->read();
|
||||
if (input_sel & 0x0004) return m_io_key1->read();
|
||||
if (input_sel & 0x0008) return m_io_key2->read();
|
||||
if (input_sel & 0x0010) return m_io_key3->read();
|
||||
if (input_sel & 0x0002) return m_io_key[0]->read();
|
||||
if (input_sel & 0x0004) return m_io_key[1]->read();
|
||||
if (input_sel & 0x0008) return m_io_key[2]->read();
|
||||
if (input_sel & 0x0010) return m_io_key[3]->read();
|
||||
logerror("CPU #0 PC %06X: unknown input read: %04X\n",m_maincpu->pc(),input_sel);
|
||||
return 0xffff;
|
||||
}
|
||||
@ -2541,8 +2532,8 @@ void ssv_state::init_st010()
|
||||
}
|
||||
|
||||
DRIVER_INIT_MEMBER(ssv_state,drifto94) { init(0); init_st010(); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,eaglshot) { init(0); init_eaglshot_banking(); save_item(NAME(m_trackball_select)); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,gdfs) { init(0); save_item(NAME(m_gdfs_lightgun_select)); save_item(NAME(m_gdfs_eeprom_old)); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,eaglshot) { init(0); init_eaglshot_banking(); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,gdfs) { init(0); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,hypreact) { init(0); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,hypreac2) { init(0); init_hypreac2_common(); }
|
||||
DRIVER_INIT_MEMBER(ssv_state,janjans1) { init(0); }
|
||||
@ -2635,10 +2626,17 @@ MACHINE_CONFIG_START(ssv_state::gdfs)
|
||||
MCFG_CPU_MODIFY("maincpu")
|
||||
MCFG_CPU_PROGRAM_MAP(gdfs_map)
|
||||
MCFG_TIMER_MODIFY("scantimer")
|
||||
MCFG_TIMER_DRIVER_CALLBACK(ssv_state, gdfs_interrupt)
|
||||
MCFG_TIMER_DRIVER_CALLBACK(ssv_state, interrupt)
|
||||
|
||||
MCFG_EEPROM_SERIAL_93C46_ADD("eeprom")
|
||||
|
||||
MCFG_DEVICE_ADD("adc", ADC0809, 1000000) // unknown clock
|
||||
MCFG_ADC0808_IN0_CB(IOPORT("GUNX1"))
|
||||
MCFG_ADC0808_IN1_CB(IOPORT("GUNY1"))
|
||||
MCFG_ADC0808_IN2_CB(IOPORT("GUNX2"))
|
||||
MCFG_ADC0808_IN3_CB(IOPORT("GUNY2"))
|
||||
MCFG_ADC0808_EOC_FF_CB(WRITELINE(ssv_state, gdfs_adc_int_w))
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_MODIFY("screen")
|
||||
MCFG_SCREEN_VISIBLE_AREA(0, (0xd5-0x2c)*2-1, 0, (0x102-0x12)-1)
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include "cpu/upd7725/upd7725.h"
|
||||
#include "video/st0020.h"
|
||||
#include "machine/adc0808.h"
|
||||
#include "machine/eepromser.h"
|
||||
#include "machine/timer.h"
|
||||
#include "machine/upd4701.h"
|
||||
@ -19,6 +20,7 @@ public:
|
||||
m_eeprom(*this, "eeprom"),
|
||||
m_dsp(*this, "dsp"),
|
||||
m_upd4701(*this, "upd4701"),
|
||||
m_adc(*this, "adc"),
|
||||
m_mainram(*this, "mainram"),
|
||||
m_spriteram(*this, "spriteram"),
|
||||
m_scroll(*this, "scroll"),
|
||||
@ -27,11 +29,7 @@ public:
|
||||
m_gdfs_tmapscroll(*this, "gdfs_tmapscroll"),
|
||||
m_gdfs_st0020(*this, "st0020_spr"),
|
||||
m_input_sel(*this, "input_sel"),
|
||||
m_io_gun(*this, {"GUNX1", "GUNY1", "GUNX2", "GUNY2"}),
|
||||
m_io_key0(*this, "KEY0"),
|
||||
m_io_key1(*this, "KEY1"),
|
||||
m_io_key2(*this, "KEY2"),
|
||||
m_io_key3(*this, "KEY3"),
|
||||
m_io_key(*this, "KEY%u", 0U),
|
||||
m_io_service(*this, "SERVICE"),
|
||||
m_io_paddle(*this, "PADDLE"),
|
||||
m_gfxdecode(*this, "gfxdecode"),
|
||||
@ -44,6 +42,7 @@ public:
|
||||
optional_device<eeprom_serial_93cxx_device> m_eeprom;
|
||||
optional_device<upd96050_device> m_dsp;
|
||||
optional_device<upd4701_device> m_upd4701;
|
||||
optional_device<adc0808_device> m_adc;
|
||||
|
||||
required_shared_ptr<uint16_t> m_mainram;
|
||||
required_shared_ptr<uint16_t> m_spriteram;
|
||||
@ -63,12 +62,9 @@ public:
|
||||
std::unique_ptr<uint16_t[]> m_eaglshot_gfxram;
|
||||
tilemap_t *m_gdfs_tmap;
|
||||
int m_interrupt_ultrax;
|
||||
int m_gdfs_lightgun_select;
|
||||
uint16_t m_sxyreact_serial;
|
||||
int m_sxyreact_dial;
|
||||
uint16_t m_gdfs_eeprom_old;
|
||||
uint32_t m_latches[8];
|
||||
uint8_t m_trackball_select;
|
||||
|
||||
DECLARE_WRITE16_MEMBER(irq_ack_w);
|
||||
DECLARE_WRITE16_MEMBER(irq_enable_w);
|
||||
@ -138,7 +134,7 @@ public:
|
||||
uint32_t screen_update_eaglshot(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
|
||||
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(interrupt);
|
||||
TIMER_DEVICE_CALLBACK_MEMBER(gdfs_interrupt);
|
||||
DECLARE_WRITE_LINE_MEMBER(gdfs_adc_int_w);
|
||||
void update_irq_state();
|
||||
IRQ_CALLBACK_MEMBER(irq_callback);
|
||||
|
||||
@ -196,11 +192,7 @@ public:
|
||||
void twineag2_map(address_map &map);
|
||||
void ultrax_map(address_map &map);
|
||||
protected:
|
||||
optional_ioport_array<4> m_io_gun;
|
||||
optional_ioport m_io_key0;
|
||||
optional_ioport m_io_key1;
|
||||
optional_ioport m_io_key2;
|
||||
optional_ioport m_io_key3;
|
||||
optional_ioport_array<4> m_io_key;
|
||||
optional_ioport m_io_service;
|
||||
optional_ioport m_io_paddle;
|
||||
required_device<gfxdecode_device> m_gfxdecode;
|
||||
|
Loading…
Reference in New Issue
Block a user