mirror of
https://github.com/holub/mame
synced 2025-04-16 13:34:55 +03:00
midvunit: Use ADC0844 device
This commit is contained in:
parent
faeedc757c
commit
e0321d67e6
@ -48,11 +48,8 @@ Known to exist but not dumped:
|
||||
|
||||
void midvunit_state::machine_start()
|
||||
{
|
||||
m_adc_ready_timer = timer_alloc(TIMER_ADC_READY);
|
||||
|
||||
save_item(NAME(m_cmos_protected));
|
||||
save_item(NAME(m_control_data));
|
||||
save_item(NAME(m_adc_data));
|
||||
save_item(NAME(m_adc_shift));
|
||||
save_item(NAME(m_last_port0));
|
||||
save_item(NAME(m_shifter_state));
|
||||
@ -126,30 +123,20 @@ READ32_MEMBER(midvunit_state::port0_r)
|
||||
*
|
||||
*************************************/
|
||||
|
||||
READ32_MEMBER(midvunit_state::midvunit_adc_r)
|
||||
READ32_MEMBER( midvunit_state::adc_r )
|
||||
{
|
||||
if (!(m_control_data & 0x40))
|
||||
{
|
||||
m_maincpu->set_input_line(3, CLEAR_LINE);
|
||||
return m_adc_data << m_adc_shift;
|
||||
}
|
||||
return m_adc->read(space, 0) << m_adc_shift;
|
||||
else
|
||||
logerror("adc_r without enabling reads!\n");
|
||||
|
||||
return 0xffffffff;
|
||||
}
|
||||
|
||||
|
||||
WRITE32_MEMBER(midvunit_state::midvunit_adc_w)
|
||||
WRITE32_MEMBER( midvunit_state::adc_w )
|
||||
{
|
||||
if (!(m_control_data & 0x20))
|
||||
{
|
||||
int which = (data >> m_adc_shift) - 4;
|
||||
if (which < 0 || which > 2)
|
||||
logerror("adc_w: unexpected which = %02X\n", which + 4);
|
||||
else
|
||||
m_adc_data = m_adc_ports[which].read_safe(0);
|
||||
m_adc_ready_timer->adjust(attotime::from_msec(1));
|
||||
}
|
||||
m_adc->write(space, 0, data >> m_adc_shift);
|
||||
else
|
||||
logerror("adc_w without enabling writes!\n");
|
||||
}
|
||||
@ -608,7 +595,7 @@ static ADDRESS_MAP_START( midvunit_map, AS_PROGRAM, 32, midvunit_state )
|
||||
// AM_RANGE(0x991050, 0x991050) AM_READONLY // seems to be another port
|
||||
AM_RANGE(0x991060, 0x991060) AM_READ(port0_r)
|
||||
AM_RANGE(0x992000, 0x992000) AM_READ_PORT("992000")
|
||||
AM_RANGE(0x993000, 0x993000) AM_READWRITE(midvunit_adc_r, midvunit_adc_w)
|
||||
AM_RANGE(0x993000, 0x993000) AM_READWRITE(adc_r, adc_w)
|
||||
AM_RANGE(0x994000, 0x994000) AM_WRITE(midvunit_control_w)
|
||||
AM_RANGE(0x995000, 0x995000) AM_READWRITE(midvunit_wheel_board_r, midvunit_wheel_board_w)
|
||||
AM_RANGE(0x995020, 0x995020) AM_WRITE(midvunit_cmos_protect_w)
|
||||
@ -1161,6 +1148,11 @@ static MACHINE_CONFIG_START( midvcommon )
|
||||
MCFG_SCREEN_UPDATE_DRIVER(midvunit_state, screen_update_midvunit)
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_ADC0844_ADD("adc")
|
||||
MCFG_ADC0844_INTR_CB(INPUTLINE("maincpu", 3))
|
||||
MCFG_ADC0844_CH1_CB(IOPORT("WHEEL"))
|
||||
MCFG_ADC0844_CH2_CB(IOPORT("ACCEL"))
|
||||
MCFG_ADC0844_CH3_CB(IOPORT("BRAKE"))
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
|
||||
@ -1201,6 +1193,8 @@ static MACHINE_CONFIG_DERIVED( midvplus, midvcommon )
|
||||
MCFG_MIDWAY_IOASIC_UPPER(452) /* no alternates */
|
||||
MCFG_MIDWAY_IOASIC_YEAR_OFFS(94)
|
||||
|
||||
MCFG_DEVICE_REMOVE("adc")
|
||||
|
||||
/* sound hardware */
|
||||
MCFG_DEVICE_ADD("dcs", DCS2_AUDIO_2115, 0)
|
||||
MCFG_DCS2_AUDIO_DRAM_IN_MB(2)
|
||||
@ -1927,9 +1921,6 @@ DRIVER_INIT_MEMBER(midvunit_state,wargods)
|
||||
{
|
||||
uint8_t default_nvram[256];
|
||||
|
||||
/* initialize the subsystems */
|
||||
m_adc_shift = 16;
|
||||
|
||||
/* we need proper VRAM */
|
||||
memset(default_nvram, 0xff, sizeof(default_nvram));
|
||||
default_nvram[0x0e] = default_nvram[0x2e] = 0x67;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "machine/midwayic.h"
|
||||
#include "machine/timer.h"
|
||||
#include "machine/watchdog.h"
|
||||
#include "machine/adc0844.h"
|
||||
#include "screen.h"
|
||||
|
||||
#define MIDVUNIT_VIDEO_CLOCK 33000000
|
||||
@ -46,7 +47,6 @@ class midvunit_state : public driver_device
|
||||
public:
|
||||
enum
|
||||
{
|
||||
TIMER_ADC_READY,
|
||||
TIMER_SCANLINE
|
||||
};
|
||||
|
||||
@ -59,11 +59,11 @@ public:
|
||||
m_midvplus_misc(*this, "midvplus_misc"),
|
||||
m_videoram(*this, "videoram", 32),
|
||||
m_textureram(*this, "textureram") ,
|
||||
m_adc_ports(*this, {"WHEEL", "ACCEL", "BRAKE"}),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_watchdog(*this, "watchdog"),
|
||||
m_screen(*this, "screen"),
|
||||
m_palette(*this, "palette"),
|
||||
m_adc(*this, "adc"),
|
||||
m_midway_serial_pic(*this, "serial_pic"),
|
||||
m_midway_serial_pic2(*this, "serial_pic2"),
|
||||
m_midway_ioasic(*this, "ioasic"),
|
||||
@ -78,11 +78,8 @@ public:
|
||||
required_shared_ptr<uint16_t> m_videoram;
|
||||
required_shared_ptr<uint32_t> m_textureram;
|
||||
|
||||
optional_ioport_array<3> m_adc_ports;
|
||||
|
||||
uint8_t m_cmos_protected;
|
||||
uint16_t m_control_data;
|
||||
uint8_t m_adc_data;
|
||||
uint8_t m_adc_shift;
|
||||
uint16_t m_last_port0;
|
||||
uint8_t m_shifter_state;
|
||||
@ -97,7 +94,6 @@ public:
|
||||
uint16_t m_page_control;
|
||||
uint8_t m_video_changed;
|
||||
emu_timer *m_scanline_timer;
|
||||
emu_timer *m_adc_ready_timer;
|
||||
std::unique_ptr<midvunit_renderer> m_poly;
|
||||
uint8_t m_galil_input_index;
|
||||
uint8_t m_galil_input_length;
|
||||
@ -120,8 +116,8 @@ public:
|
||||
DECLARE_WRITE32_MEMBER(midvunit_textureram_w);
|
||||
DECLARE_READ32_MEMBER(midvunit_textureram_r);
|
||||
DECLARE_READ32_MEMBER(port0_r);
|
||||
DECLARE_READ32_MEMBER(midvunit_adc_r);
|
||||
DECLARE_WRITE32_MEMBER(midvunit_adc_w);
|
||||
DECLARE_READ32_MEMBER(adc_r);
|
||||
DECLARE_WRITE32_MEMBER(adc_w);
|
||||
DECLARE_WRITE32_MEMBER(midvunit_cmos_protect_w);
|
||||
DECLARE_WRITE32_MEMBER(midvunit_cmos_w);
|
||||
DECLARE_READ32_MEMBER(midvunit_cmos_r);
|
||||
@ -163,6 +159,7 @@ public:
|
||||
required_device<watchdog_timer_device> m_watchdog;
|
||||
required_device<screen_device> m_screen;
|
||||
required_device<palette_device> m_palette;
|
||||
optional_device<adc0844_device> m_adc;
|
||||
optional_device<midway_serial_pic_device> m_midway_serial_pic;
|
||||
optional_device<midway_serial_pic2_device> m_midway_serial_pic2;
|
||||
optional_device<midway_ioasic_device> m_midway_ioasic;
|
||||
|
@ -40,9 +40,6 @@ void midvunit_state::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_ADC_READY:
|
||||
m_maincpu->set_input_line(3, ASSERT_LINE);
|
||||
break;
|
||||
case TIMER_SCANLINE:
|
||||
scanline_timer_cb(ptr, param);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user