summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Ryan Holtz <therealmogminer@gmail.com>2018-05-21 22:19:38 +0200
committer Ryan Holtz <therealmogminer@gmail.com>2018-05-21 22:20:05 +0200
commita55f0df6263f1396789c155fb9c9017ab337b366 (patch)
treef0eb0fc5cc2d9e1ca2f32b928085e60f99af78f7
parent7629ebb831d6ec436e5ad6ac4ba3c783203d8fe8 (diff)
voodoo: Use device finders instead of machine().device (nw)
-rw-r--r--src/devices/video/voodoo.cpp50
-rw-r--r--src/devices/video/voodoo.h44
-rw-r--r--src/mame/audio/dcs.cpp7
-rw-r--r--src/mame/audio/dcs.h8
-rw-r--r--src/mame/audio/williams.h3
-rw-r--r--src/mame/drivers/atlantis.cpp2
-rw-r--r--src/mame/drivers/gticlub.cpp45
-rw-r--r--src/mame/drivers/hornet.cpp39
-rw-r--r--src/mame/drivers/midvunit.cpp11
-rw-r--r--src/mame/drivers/nwk-tr.cpp47
-rw-r--r--src/mame/drivers/seattle.cpp4
-rw-r--r--src/mame/drivers/vegas.cpp44
-rw-r--r--src/mame/drivers/williams.cpp10
-rw-r--r--src/mame/drivers/zr107.cpp6
-rw-r--r--src/mame/includes/midtunit.h2
-rw-r--r--src/mame/includes/midvunit.h24
-rw-r--r--src/mame/includes/williams.h18
-rw-r--r--src/mame/machine/konppc.cpp45
-rw-r--r--src/mame/machine/midtunit.cpp10
-rw-r--r--src/mame/machine/midwayic.cpp20
-rw-r--r--src/mame/machine/midwayic.h4
21 files changed, 209 insertions, 234 deletions
diff --git a/src/devices/video/voodoo.cpp b/src/devices/video/voodoo.cpp
index 2d36beb3972..f96db6b10be 100644
--- a/src/devices/video/voodoo.cpp
+++ b/src/devices/video/voodoo.cpp
@@ -821,10 +821,10 @@ void voodoo_device::swap_buffers(voodoo_device *vd)
{
int count;
- if (LOG_VBLANK_SWAP) vd->logerror("--- swap_buffers @ %d\n", vd->screen->vpos());
+ if (LOG_VBLANK_SWAP) vd->logerror("--- swap_buffers @ %d\n", vd->m_screen->vpos());
/* force a partial update */
- vd->screen->update_partial(vd->screen->vpos());
+ vd->m_screen->update_partial(vd->m_screen->vpos());
vd->fbi.video_changed = true;
/* keep a history of swap intervals */
@@ -880,7 +880,7 @@ void voodoo_device::swap_buffers(voodoo_device *vd)
/* update the statistics (debug) */
if (vd->stats.display)
{
- const rectangle &visible_area = vd->screen->visible_area();
+ const rectangle &visible_area = vd->m_screen->visible_area();
int screen_area = visible_area.width() * visible_area.height();
char *statsptr = vd->stats.buffer;
int pixelcount;
@@ -934,11 +934,11 @@ void voodoo_device::swap_buffers(voodoo_device *vd)
void voodoo_device::adjust_vblank_timer()
{
- attotime vblank_period = screen->time_until_pos(fbi.vsyncstart);
+ attotime vblank_period = m_screen->time_until_pos(fbi.vsyncstart);
if (LOG_VBLANK_SWAP) logerror("adjust_vblank_timer: period: %s\n", vblank_period.as_string());
/* if zero, adjust to next frame, otherwise we may get stuck in an infinite loop */
if (vblank_period == attotime::zero)
- vblank_period = screen->frame_period();
+ vblank_period = m_screen->frame_period();
fbi.vsync_start_timer->adjust(vblank_period);
}
@@ -997,7 +997,7 @@ TIMER_CALLBACK_MEMBER( voodoo_device::vblank_callback )
swap_buffers(this);
/* set a timer for the next off state */
- fbi.vsync_stop_timer->adjust(screen->time_until_pos(fbi.vsyncstop));
+ fbi.vsync_stop_timer->adjust(m_screen->time_until_pos(fbi.vsyncstop));
@@ -2151,7 +2151,7 @@ void voodoo_device::stall_cpu(int state, attotime current_time)
if (!m_stall.isnull())
m_stall(true);
else
- cpu->spin_until_trigger(trigger);
+ m_cpu->spin_until_trigger(trigger);
/* set a timer to clear the stall */
pci.continue_timer->adjust(pci.op_end_time - current_time);
@@ -2564,7 +2564,7 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
if (vd->reg[hSync].u != 0 && vd->reg[vSync].u != 0 && vd->reg[videoDimensions].u != 0)
{
int hvis, vvis, htotal, vtotal, hbp, vbp;
- attoseconds_t refresh = vd->screen->frame_period().attoseconds();
+ attoseconds_t refresh = vd->m_screen->frame_period().attoseconds();
attoseconds_t stdperiod, medperiod, vgaperiod;
attoseconds_t stddiff, meddiff, vgadiff;
rectangle visarea;
@@ -2615,17 +2615,17 @@ int32_t voodoo_device::register_w(voodoo_device *vd, offs_t offset, uint32_t dat
/* configure the screen based on which one matches the closest */
if (stddiff < meddiff && stddiff < vgadiff)
{
- vd->screen->configure(htotal, vtotal, visarea, stdperiod);
+ vd->m_screen->configure(htotal, vtotal, visarea, stdperiod);
osd_printf_debug("Standard resolution, %f Hz\n", ATTOSECONDS_TO_HZ(stdperiod));
}
else if (meddiff < vgadiff)
{
- vd->screen->configure(htotal, vtotal, visarea, medperiod);
+ vd->m_screen->configure(htotal, vtotal, visarea, medperiod);
osd_printf_debug("Medium resolution, %f Hz\n", ATTOSECONDS_TO_HZ(medperiod));
}
else
{
- vd->screen->configure(htotal, vtotal, visarea, vgaperiod);
+ vd->m_screen->configure(htotal, vtotal, visarea, vgaperiod);
osd_printf_debug("VGA resolution, %f Hz\n", ATTOSECONDS_TO_HZ(vgaperiod));
}
@@ -3939,7 +3939,7 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset)
/* bit 31 is not used */
/* eat some cycles since people like polling here */
- if (EAT_CYCLES) vd->cpu->eat_cycles(1000);
+ if (EAT_CYCLES) vd->m_cpu->eat_cycles(1000);
break;
/* bit 2 of the initEnable register maps this to dacRead */
@@ -3951,21 +3951,21 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset)
/* return the current visible scanline */
case vRetrace:
/* eat some cycles since people like polling here */
- if (EAT_CYCLES) vd->cpu->eat_cycles(10);
+ if (EAT_CYCLES) vd->m_cpu->eat_cycles(10);
// Return 0 if vblank is active
if (vd->fbi.vblank) {
result = 0;
}
else {
// Want screen position from vblank off
- result = vd->screen->vpos();
+ result = vd->m_screen->vpos();
}
break;
/* return visible horizontal and vertical positions. Read by the Vegas startup sequence */
case hvRetrace:
/* eat some cycles since people like polling here */
- if (EAT_CYCLES) vd->cpu->eat_cycles(10);
+ if (EAT_CYCLES) vd->m_cpu->eat_cycles(10);
//result = 0x200 << 16; /* should be between 0x7b and 0x267 */
//result |= 0x80; /* should be between 0x17 and 0x103 */
// Return 0 if vblank is active
@@ -3974,10 +3974,10 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset)
}
else {
// Want screen position from vblank off
- result = vd->screen->vpos();
+ result = vd->m_screen->vpos();
}
// Hpos
- result |= vd->screen->hpos() << 16;
+ result |= vd->m_screen->hpos() << 16;
break;
/* cmdFifo -- Voodoo2 only */
@@ -3985,7 +3985,7 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset)
result = vd->fbi.cmdfifo[0].rdptr;
/* eat some cycles since people like polling here */
- if (EAT_CYCLES) vd->cpu->eat_cycles(1000);
+ if (EAT_CYCLES) vd->m_cpu->eat_cycles(1000);
break;
case cmdFifoAMin:
@@ -4023,7 +4023,7 @@ uint32_t voodoo_device::register_r(voodoo_device *vd, offs_t offset)
/* don't log multiple identical status reads from the same address */
if (regnum == vdstatus)
{
- offs_t pc = vd->cpu->pc();
+ offs_t pc = vd->m_cpu->pc();
if (pc == vd->last_status_pc && result == vd->last_status_value)
logit = false;
vd->last_status_pc = pc;
@@ -4987,7 +4987,7 @@ WRITE32_MEMBER( voodoo_banshee_device::banshee_io_w )
htotal, vtotal, vstart, vstop, width, height, 1.0 / frame_period);
if (htotal > 0 && vtotal > 0) {
rectangle visarea(0, width - 1, 0, height - 1);
- screen->configure(htotal, vtotal, visarea, DOUBLE_TO_ATTOSECONDS(frame_period));
+ m_screen->configure(htotal, vtotal, visarea, DOUBLE_TO_ATTOSECONDS(frame_period));
// Set the vsync start and stop
fbi.vsyncstart = vstart;
@@ -5047,8 +5047,6 @@ void voodoo_device::device_start()
int val;
/* validate configuration */
- assert(m_screen != nullptr);
- assert(m_cputag != nullptr);
assert(m_fbmem > 0);
/* copy config data */
@@ -5137,10 +5135,6 @@ void voodoo_device::device_start()
break;
index++;
}
- screen = machine().device<screen_device>(m_screen);
- assert_always(screen != nullptr, "Unable to find screen attached to voodoo");
- cpu = machine().device<cpu_device>(m_cputag);
- assert_always(cpu != nullptr, "Unable to find CPU attached to voodoo");
if (m_tmumem1 != 0)
tmu_config |= 0xc0; // two TMUs
@@ -5868,11 +5862,11 @@ voodoo_device::voodoo_device(const machine_config &mconfig, device_type type, co
, m_fbmem(0)
, m_tmumem0(0)
, m_tmumem1(0)
- , m_screen(nullptr)
- , m_cputag(nullptr)
, m_vblank(*this)
, m_stall(*this)
, m_pciint(*this)
+ , m_screen(*this, finder_base::DUMMY_TAG)
+ , m_cpu(*this, finder_base::DUMMY_TAG)
, vd_type(vdt)
{
}
diff --git a/src/devices/video/voodoo.h b/src/devices/video/voodoo.h
index a25508a4b6e..0d874a61bb4 100644
--- a/src/devices/video/voodoo.h
+++ b/src/devices/video/voodoo.h
@@ -13,9 +13,9 @@
#pragma once
-
#include "video/polylgcy.h"
#include "video/rgbutil.h"
+#include "screen.h"
/*************************************
@@ -1468,8 +1468,8 @@ public:
void set_fbmem(int value) { m_fbmem = value; }
void set_tmumem(int value1, int value2) { m_tmumem0 = value1; m_tmumem1 = value2; }
- void set_screen_tag(const char *tag) { m_screen = tag; }
- void set_cpu_tag(const char *tag) { m_cputag = tag; }
+ void set_screen_tag(const char *tag) { m_screen.set_tag(tag); }
+ void set_cpu_tag(const char *tag) { m_cpu.set_tag(tag); }
template <class Object> devcb_base &set_vblank_callback(Object &&cb) { return m_vblank.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_stall_callback(Object &&cb) { return m_stall.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_pciint_callback(Object &&cb) { return m_pciint.set_callback(std::forward<Object>(cb)); }
@@ -1477,15 +1477,13 @@ public:
DECLARE_READ32_MEMBER( voodoo_r );
DECLARE_WRITE32_MEMBER( voodoo_w );
- uint8_t m_fbmem;
- uint8_t m_tmumem0;
- uint8_t m_tmumem1;
- const char * m_screen;
- const char * m_cputag;
- devcb_write_line m_vblank;
- devcb_write_line m_stall;
+ uint8_t m_fbmem;
+ uint8_t m_tmumem0;
+ uint8_t m_tmumem1;
+ devcb_write_line m_vblank;
+ devcb_write_line m_stall;
// This is for internally generated PCI interrupts in Voodoo3
- devcb_write_line m_pciint;
+ devcb_write_line m_pciint;
TIMER_CALLBACK_MEMBER( vblank_off_callback );
TIMER_CALLBACK_MEMBER( stall_cpu_callback );
@@ -1873,20 +1871,20 @@ protected:
// FIXME: this stuff should not be public
public:
- uint8_t index; /* index of board */
- screen_device *screen; /* the screen we are acting on */
- cpu_device *cpu; /* the CPU we interact with */
- const uint8_t vd_type; /* type of system */
- uint8_t chipmask; /* mask for which chips are available */
- uint32_t freq; /* operating frequency */
+ uint8_t index; /* index of board */
+ optional_device<screen_device> m_screen; /* the screen we are acting on */
+ optional_device<cpu_device> m_cpu; /* the CPU we interact with */
+ const uint8_t vd_type; /* type of system */
+ uint8_t chipmask; /* mask for which chips are available */
+ uint32_t freq; /* operating frequency */
attoseconds_t attoseconds_per_cycle; /* attoseconds per cycle */
- uint32_t extra_cycles; /* extra cycles not yet accounted for */
+ uint32_t extra_cycles; /* extra cycles not yet accounted for */
int trigger; /* trigger used for stalling */
voodoo_reg reg[0x400]; /* raw registers */
- const uint8_t * regaccess; /* register access array */
- const char *const * regnames; /* register names array */
- uint8_t alt_regmap; /* enable alternate register map? */
+ const uint8_t * regaccess; /* register access array */
+ const char *const * regnames; /* register names array */
+ uint8_t alt_regmap; /* enable alternate register map? */
pci_state pci; /* PCI state */
dac_state dac; /* DAC state */
@@ -1902,14 +1900,14 @@ public:
voodoo_stats stats; /* internal statistics */
offs_t last_status_pc; /* PC of last status description (for logging) */
- uint32_t last_status_value; /* value of last status read (for logging) */
+ uint32_t last_status_value; /* value of last status read (for logging) */
int next_rasterizer; /* next rasterizer index */
raster_info rasterizer[MAX_RASTERIZERS]; /* array of rasterizers */
raster_info * raster_hash[RASTER_HASH_SIZE]; /* hash table of rasterizers */
bool send_config;
- uint32_t tmu_config;
+ uint32_t tmu_config;
};
diff --git a/src/mame/audio/dcs.cpp b/src/mame/audio/dcs.cpp
index 667e83bdee6..073310c110a 100644
--- a/src/mame/audio/dcs.cpp
+++ b/src/mame/audio/dcs.cpp
@@ -1379,7 +1379,7 @@ WRITE32_MEMBER( dcs_audio_device::dsio_idma_data_w )
}
if (dsio.start_on_next_write && --dsio.start_on_next_write == 0)
{
- logerror("%08X: Starting DSIO CPU\n", machine().device<cpu_device>("maincpu")->pc());
+ logerror("%s: Starting DSIO CPU\n", machine().describe_context());
m_cpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
}
// Restore internal/external mapping
@@ -1631,9 +1631,8 @@ void dcs_audio_device::ack_w()
uint16_t dcs_audio_device::data_r()
{
- // If the cpu is reading empty data it is probably polling so eat some cyles
if IS_OUTPUT_EMPTY()
- machine().device<cpu_device>("maincpu")->eat_cycles(4444);
+ return m_output_data;
/* data is actually only 8 bit (read from d8-d15, which is d0-d7 from the data access instructions POV) on early dcs, but goes 16 on later (seattle) */
if (m_last_output_full && !m_output_full_cb.isnull())
@@ -1681,7 +1680,7 @@ READ16_MEMBER( dcs_audio_device::output_control_r )
int dcs_audio_device::data2_r()
{
if (LOG_DCS_IO)
- logerror("%08X dcs:data2_r = %04X\n", machine().device<cpu_device>("maincpu")->pc(), m_output_control);
+ logerror("%s: dcs:data2_r = %04X\n", machine().describe_context(), m_output_control);
return m_output_control;
}
diff --git a/src/mame/audio/dcs.h b/src/mame/audio/dcs.h
index 66423fe73be..bd5f3931831 100644
--- a/src/mame/audio/dcs.h
+++ b/src/mame/audio/dcs.h
@@ -128,6 +128,12 @@ public:
void dsio_io_map(address_map &map);
void dsio_program_map(address_map &map);
void dsio_rambank_map(address_map &map);
+
+ uint8_t get_rev() { return m_rev; } // TODO(RH): This can be done better, and shouldn't be necessary.
+ cpu_device *get_cpu() { return m_cpu; } // TODO(RH): Same.
+
+ enum { REV_DCS1, REV_DCS1P5, REV_DCS2, REV_DSIO, REV_DENV };
+
protected:
// construction/destruction
dcs_audio_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, int rev);
@@ -137,8 +143,6 @@ protected:
virtual void device_reset() override;
void add_mconfig_dcs(machine_config &config);
- // Formerly DCS1=1 DCS1P5=15 DCS2=2 DSIO=3 DENV=4
- enum { REV_DCS1, REV_DCS1P5, REV_DCS2, REV_DSIO, REV_DENV };
static constexpr const char *const denver_regname[4] =
{ "SDRC_ROM", "SDRC_IO", "RAM_PAGE", "VER/FIFO_RESET" };
diff --git a/src/mame/audio/williams.h b/src/mame/audio/williams.h
index 5a46b2b9853..2f75d3da043 100644
--- a/src/mame/audio/williams.h
+++ b/src/mame/audio/williams.h
@@ -150,6 +150,9 @@ public:
void williams_adpcm_map(address_map &map);
void williams_adpcm_oki_map(address_map &map);
+
+ mc6809e_device *get_cpu() { return m_cpu; }
+
protected:
// timer IDs
enum
diff --git a/src/mame/drivers/atlantis.cpp b/src/mame/drivers/atlantis.cpp
index dff8501d8e8..0fb54abbdfa 100644
--- a/src/mame/drivers/atlantis.cpp
+++ b/src/mame/drivers/atlantis.cpp
@@ -342,7 +342,7 @@ READ8_MEMBER(atlantis_state::cmos_r)
uint8_t result = m_rtc->read(space, offset);
// Initial RTC check expects reads to the RTC to take some time
if (offset == 0x7ff9)
- machine().device<cpu_device>("maincpu")->eat_cycles(30);
+ m_maincpu->eat_cycles(30);
if (LOG_RTC || ((offset >= 0x7ff0) && (offset != 0x7ff9)))
logerror("%s:RTC read from offset %04X = %08X\n", machine().describe_context(), offset, result);
return result;
diff --git a/src/mame/drivers/gticlub.cpp b/src/mame/drivers/gticlub.cpp
index 73693e9a718..4e050214235 100644
--- a/src/mame/drivers/gticlub.cpp
+++ b/src/mame/drivers/gticlub.cpp
@@ -259,6 +259,9 @@ public:
m_k001006_2(*this, "k001006_2"),
m_k001604_1(*this, "k001604_1"),
m_k001604_2(*this, "k001604_2"),
+ m_lscreen(*this, "lscreen"),
+ m_rscreen(*this, "rscreen"),
+ m_voodoo(*this, "voodoo%u", 0U),
m_work_ram(*this, "work_ram"),
m_generic_paletteram_32(*this, "paletteram"),
m_analog0(*this, "AN0"),
@@ -287,6 +290,9 @@ public:
optional_device<k001006_device> m_k001006_2;
optional_device<k001604_device> m_k001604_1;
optional_device<k001604_device> m_k001604_2;
+ optional_device<screen_device> m_lscreen;
+ optional_device<screen_device> m_rscreen;
+ optional_device_array<voodoo_device, 2> m_voodoo;
required_shared_ptr<uint32_t> m_work_ram;
required_shared_ptr<uint32_t> m_generic_paletteram_32;
@@ -327,7 +333,8 @@ public:
ADC1038_INPUT_CB(adc1038_input_callback);
uint32_t screen_update_gticlub(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_hangplt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_lscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void thunderh(machine_config &config);
void hangplt(machine_config &config);
@@ -920,36 +927,34 @@ uint32_t gticlub_state::screen_update_gticlub(screen_device &screen, bitmap_rgb3
return 0;
}
-uint32_t gticlub_state::screen_update_hangplt(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t gticlub_state::screen_update_lscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->pen(0), cliprect);
- if (strcmp(screen.tag(), ":lscreen") == 0)
- {
- voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0");
-
- // m_k001604_1->draw_back_layer(bitmap, cliprect);
-
- voodoo->voodoo_update(bitmap, cliprect);
+// m_k001604_1->draw_back_layer(bitmap, cliprect);
+ m_voodoo[0]->voodoo_update(bitmap, cliprect);
+ m_k001604_1->draw_front_layer(screen, bitmap, cliprect);
- m_k001604_1->draw_front_layer(screen, bitmap, cliprect);
- }
- else if (strcmp(screen.tag(), ":rscreen") == 0)
- {
- voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1");
+ draw_7segment_led(bitmap, 3, 3, m_gticlub_led_reg[0]);
+ draw_7segment_led(bitmap, 9, 3, m_gticlub_led_reg[1]);
- // m_k001604_2->draw_back_layer(bitmap, cliprect);
+ return 0;
+}
- voodoo->voodoo_update(bitmap, cliprect);
+uint32_t gticlub_state::screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ bitmap.fill(m_palette->pen(0), cliprect);
- m_k001604_2->draw_front_layer(screen, bitmap, cliprect);
- }
+// m_k001604_2->draw_back_layer(bitmap, cliprect);
+ m_voodoo[1]->voodoo_update(bitmap, cliprect);
+ m_k001604_2->draw_front_layer(screen, bitmap, cliprect);
draw_7segment_led(bitmap, 3, 3, m_gticlub_led_reg[0]);
draw_7segment_led(bitmap, 9, 3, m_gticlub_led_reg[1]);
return 0;
}
+
MACHINE_CONFIG_START(gticlub_state::gticlub)
/* basic machine hardware */
@@ -1117,13 +1122,13 @@ MACHINE_CONFIG_START(gticlub_state::hangplt)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
- MCFG_SCREEN_UPDATE_DRIVER(gticlub_state, screen_update_hangplt)
+ MCFG_SCREEN_UPDATE_DRIVER(gticlub_state, screen_update_lscreen)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
- MCFG_SCREEN_UPDATE_DRIVER(gticlub_state, screen_update_hangplt)
+ MCFG_SCREEN_UPDATE_DRIVER(gticlub_state, screen_update_rscreen)
MCFG_DEVICE_ADD("k001604_1", K001604, 0)
MCFG_K001604_LAYER_SIZE(0)
diff --git a/src/mame/drivers/hornet.cpp b/src/mame/drivers/hornet.cpp
index 1cf07b8ddc6..1cb63fc53a6 100644
--- a/src/mame/drivers/hornet.cpp
+++ b/src/mame/drivers/hornet.cpp
@@ -344,10 +344,11 @@ public:
m_dsp(*this, "dsp"),
m_dsp2(*this, "dsp2"),
m_k037122_1(*this, "k037122_1"),
- m_k037122_2(*this, "k037122_2" ),
+ m_k037122_2(*this, "k037122_2"),
m_adc12138(*this, "adc12138"),
m_konppc(*this, "konppc"),
m_lan_eeprom(*this, "lan_eeprom"),
+ m_voodoo(*this, "voodoo%u", 0U),
m_in0(*this, "IN0"),
m_in1(*this, "IN1"),
m_in2(*this, "IN2"),
@@ -378,6 +379,7 @@ public:
required_device<adc12138_device> m_adc12138;
required_device<konppc_device> m_konppc;
optional_device<eeprom_serial_93cxx_device> m_lan_eeprom;
+ optional_device_array<voodoo_device, 2> m_voodoo;
required_ioport m_in0, m_in1, m_in2, m_dsw;
optional_ioport m_eepromout, m_analog1, m_analog2;
optional_region_ptr<uint8_t> m_user3_ptr;
@@ -431,8 +433,8 @@ public:
virtual void machine_start() override;
virtual void machine_reset() override;
DECLARE_MACHINE_RESET(hornet_2board);
- uint32_t screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
- uint32_t screen_update_hornet_2board(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
TIMER_CALLBACK_MEMBER(sound_irq);
int jvs_encode_data(uint8_t *in, int length);
int jvs_decode_data(uint8_t *in, uint8_t *out, int length);
@@ -498,11 +500,9 @@ WRITE_LINE_MEMBER(hornet_state::voodoo_vblank_1)
{
}
-uint32_t hornet_state::screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t hornet_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- voodoo_device* voodoo = (voodoo_device*)machine().device("voodoo0");
-
- voodoo->voodoo_update(bitmap, cliprect);
+ m_voodoo[0]->voodoo_update(bitmap, cliprect);
m_k037122_1->tile_draw(screen, bitmap, cliprect);
@@ -511,24 +511,11 @@ uint32_t hornet_state::screen_update_hornet(screen_device &screen, bitmap_rgb32
return 0;
}
-uint32_t hornet_state::screen_update_hornet_2board(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t hornet_state::screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
- if (strcmp(screen.tag(), ":lscreen") == 0)
- {
- voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0");
- voodoo->voodoo_update(bitmap, cliprect);
-
- /* TODO: tilemaps per screen */
- m_k037122_1->tile_draw(screen, bitmap, cliprect);
- }
- else if (strcmp(screen.tag(), ":rscreen") == 0)
- {
- voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1");
- voodoo->voodoo_update(bitmap, cliprect);
+ m_voodoo[1]->voodoo_update(bitmap, cliprect);
- /* TODO: tilemaps per screen */
- m_k037122_2->tile_draw(screen, bitmap, cliprect);
- }
+ m_k037122_2->tile_draw(screen, bitmap, cliprect);
draw_7segment_led(bitmap, 3, 3, m_led_reg0);
draw_7segment_led(bitmap, 9, 3, m_led_reg1);
@@ -1055,7 +1042,7 @@ MACHINE_CONFIG_START(hornet_state::hornet)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(64*8, 48*8)
MCFG_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 48*8-1)
- MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update_hornet)
+ MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update)
MCFG_PALETTE_ADD("palette", 65536)
@@ -1126,13 +1113,13 @@ MACHINE_CONFIG_START(hornet_state::hornet_2board)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
- MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update_hornet_2board)
+ MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
- MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update_hornet_2board)
+ MCFG_SCREEN_UPDATE_DRIVER(hornet_state, screen_update_rscreen)
MCFG_DEVICE_REMOVE("konppc")
MCFG_DEVICE_ADD("konppc", KONPPC, 0)
diff --git a/src/mame/drivers/midvunit.cpp b/src/mame/drivers/midvunit.cpp
index 2db42128d86..160aaf06d17 100644
--- a/src/mame/drivers/midvunit.cpp
+++ b/src/mame/drivers/midvunit.cpp
@@ -31,7 +31,6 @@ Known to exist but not dumped:
#include "cpu/tms32031/tms32031.h"
#include "cpu/adsp2100/adsp2100.h"
#include "audio/dcs.h"
-#include "machine/ataintf.h"
#include "machine/nvram.h"
#include "includes/midvunit.h"
#include "crusnusa.lh"
@@ -69,9 +68,6 @@ void midvunit_state::machine_reset()
memcpy(m_ram_base, memregion("user1")->base(), 0x20000*4);
m_maincpu->reset();
-
- m_timer[0] = machine().device<timer_device>("timer0");
- m_timer[1] = machine().device<timer_device>("timer1");
}
@@ -83,10 +79,7 @@ MACHINE_RESET_MEMBER(midvunit_state,midvplus)
memcpy(m_ram_base, memregion("user1")->base(), 0x20000*4);
m_maincpu->reset();
- m_timer[0] = machine().device<timer_device>("timer0");
- m_timer[1] = machine().device<timer_device>("timer1");
-
- machine().device("ata")->reset();
+ m_ata->reset();
}
@@ -1878,7 +1871,7 @@ void midvunit_state::init_wargods()
default_nvram[0x12] = default_nvram[0x32] = 0xaf;
default_nvram[0x17] = default_nvram[0x37] = 0xd8;
default_nvram[0x18] = default_nvram[0x38] = 0xe7;
- machine().device<midway_ioasic_device>("ioasic")->set_default_nvram(default_nvram);
+ m_midway_ioasic->set_default_nvram(default_nvram);
/* speedups */
m_maincpu->space(AS_PROGRAM).install_read_handler(0x2f4c, 0x2f4c, read32_delegate(FUNC(midvunit_state::generic_speedup_r),this));
diff --git a/src/mame/drivers/nwk-tr.cpp b/src/mame/drivers/nwk-tr.cpp
index 79e029f3073..84a759bcada 100644
--- a/src/mame/drivers/nwk-tr.cpp
+++ b/src/mame/drivers/nwk-tr.cpp
@@ -277,6 +277,7 @@ public:
m_k001604(*this, "k001604"),
m_konppc(*this, "konppc"),
m_adc12138(*this, "adc12138"),
+ m_voodoo(*this, "voodoo%u", 0U),
m_in0(*this, "IN0"),
m_in1(*this, "IN1"),
m_in2(*this, "IN2"),
@@ -303,6 +304,7 @@ public:
required_device<k001604_device> m_k001604;
required_device<konppc_device> m_konppc;
required_device<adc12138_device> m_adc12138;
+ required_device_array<voodoo_device, 2> m_voodoo;
required_ioport m_in0, m_in1, m_in2, m_dsw, m_analog1, m_analog2, m_analog3, m_analog4, m_analog5;
required_device<palette_device> m_palette;
required_shared_ptr<uint32_t> m_generic_paletteram_32;
@@ -335,7 +337,8 @@ public:
void init_nwktr();
virtual void machine_start() override;
virtual void machine_reset() override;
- uint32_t screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_lscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
+ uint32_t screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
void lanc2_init();
void thrilld(machine_config &config);
@@ -365,32 +368,32 @@ WRITE_LINE_MEMBER(nwktr_state::voodoo_vblank_1)
}
-uint32_t nwktr_state::screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+uint32_t nwktr_state::screen_update_lscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
{
bitmap.fill(m_palette->pen(0), cliprect);
- if (strcmp(screen.tag(), ":lscreen") == 0)
- {
- voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo0");
+ m_voodoo[0]->voodoo_update(bitmap, cliprect);
- voodoo->voodoo_update(bitmap, cliprect);
+ const rectangle &visarea = screen.visible_area();
+ const rectangle tilemap_rect(visarea.min_x, visarea.max_x, visarea.min_y + 16, visarea.max_y);
- const rectangle &visarea = screen.visible_area();
- const rectangle tilemap_rect(visarea.min_x, visarea.max_x, visarea.min_y + 16, visarea.max_y);
+ m_k001604->draw_front_layer(screen, bitmap, tilemap_rect);
- m_k001604->draw_front_layer(screen, bitmap, tilemap_rect);
- }
- else if (strcmp(screen.tag(), ":rscreen") == 0)
- {
- voodoo_device *voodoo = (voodoo_device*)machine().device("voodoo1");
+ draw_7segment_led(bitmap, 3, 3, m_led_reg0);
+ draw_7segment_led(bitmap, 9, 3, m_led_reg1);
+ return 0;
+}
- voodoo->voodoo_update(bitmap, cliprect);
+uint32_t nwktr_state::screen_update_rscreen(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
+{
+ bitmap.fill(m_palette->pen(0), cliprect);
- const rectangle &visarea = screen.visible_area();
- const rectangle tilemap_rect(visarea.min_x, visarea.max_x, visarea.min_y + 16, visarea.max_y);
+ m_voodoo[1]->voodoo_update(bitmap, cliprect);
- m_k001604->draw_front_layer(screen, bitmap, tilemap_rect);
- }
+ const rectangle &visarea = screen.visible_area();
+ const rectangle tilemap_rect(visarea.min_x, visarea.max_x, visarea.min_y + 16, visarea.max_y);
+
+ m_k001604->draw_front_layer(screen, bitmap, tilemap_rect);
draw_7segment_led(bitmap, 3, 3, m_led_reg0);
draw_7segment_led(bitmap, 9, 3, m_led_reg1);
@@ -871,13 +874,13 @@ MACHINE_CONFIG_START(nwktr_state::nwktr)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
- MCFG_SCREEN_UPDATE_DRIVER(nwktr_state, screen_update_nwktr)
+ MCFG_SCREEN_UPDATE_DRIVER(nwktr_state, screen_update_lscreen)
MCFG_SCREEN_ADD("rscreen", RASTER)
MCFG_SCREEN_REFRESH_RATE(60)
MCFG_SCREEN_SIZE(512, 384)
MCFG_SCREEN_VISIBLE_AREA(0, 511, 0, 383)
- MCFG_SCREEN_UPDATE_DRIVER(nwktr_state, screen_update_nwktr)
+ MCFG_SCREEN_UPDATE_DRIVER(nwktr_state, screen_update_rscreen)
MCFG_PALETTE_ADD("palette", 65536)
@@ -919,8 +922,8 @@ MACHINE_CONFIG_END
void nwktr_state::init_nwktr()
{
- machine().device<konppc_device>("konppc")->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
- machine().device<konppc_device>("konppc")->set_cgboard_texture_bank(0, "bank6", memregion("user5")->base());
+ m_konppc->set_cgboard_texture_bank(0, "bank5", memregion("user5")->base());
+ m_konppc->set_cgboard_texture_bank(0, "bank6", memregion("user5")->base());
m_sharc0_dataram = std::make_unique<uint32_t[]>(0x100000 / 4);
m_sharc1_dataram = std::make_unique<uint32_t[]>(0x100000 / 4);
diff --git a/src/mame/drivers/seattle.cpp b/src/mame/drivers/seattle.cpp
index bad520f2672..1b796553a45 100644
--- a/src/mame/drivers/seattle.cpp
+++ b/src/mame/drivers/seattle.cpp
@@ -451,12 +451,12 @@ void seattle_state::machine_reset()
m_wheel_offset = 0;
m_wheel_calibrated = false;
/* reset either the DCS2 board or the CAGE board */
- if (machine().device("dcs") != nullptr)
+ if (m_dcs != nullptr)
{
m_dcs->reset_w(1);
m_dcs->reset_w(0);
}
- else if (machine().device("cage") != nullptr)
+ else if (m_cage != nullptr)
{
m_cage->control_w(0);
m_cage->control_w(3);
diff --git a/src/mame/drivers/vegas.cpp b/src/mame/drivers/vegas.cpp
index e84967388db..7be98d2a06b 100644
--- a/src/mame/drivers/vegas.cpp
+++ b/src/mame/drivers/vegas.cpp
@@ -453,23 +453,6 @@ public:
void vegas_state::machine_start()
{
- /* identify our sound board */
- if (machine().device("dcs:dsio") != nullptr) {
- m_dcs_idma_cs = 6;
- if (LOG_SIO)
- logerror("Found dsio\n");
- }
- else if (machine().device("dcs:denver") != nullptr) {
- m_dcs_idma_cs = 7;
- if (LOG_SIO)
- logerror("Found denver\n");
- }
- else {
- m_dcs_idma_cs = 0;
- if (LOG_SIO)
- logerror("Did not find dcs2 sound board\n");
- }
-
/* set the fastest DRC options, but strict verification */
m_maincpu->mips3drc_set_options(MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY + MIPS3DRC_FLUSH_PC);
@@ -488,18 +471,31 @@ void vegas_state::machine_start()
save_item(NAME(m_keypad_select));
save_item(NAME(m_gear));
save_item(NAME(m_wheel_calibrated));
+
+ /* identify our sound board */
+ if (m_dcs->get_rev() == dcs_audio_device::REV_DSIO) {
+ m_dcs_idma_cs = 6;
+ if (LOG_SIO)
+ logerror("Found dsio\n");
+ }
+ else if (m_dcs->get_rev() == dcs_audio_device::REV_DENV) {
+ m_dcs_idma_cs = 7;
+ if (LOG_SIO)
+ logerror("Found denver\n");
+ }
+ else {
+ m_dcs_idma_cs = 0;
+ if (LOG_SIO)
+ logerror("Did not find dcs2 sound board\n");
+ }
}
void vegas_state::machine_reset()
{
+ m_dcs->reset_w(1);
+ m_dcs->reset_w(0);
- /* reset the DCS system if we have one */
- if (machine().device("dcs") != nullptr)
- {
- m_dcs->reset_w(1);
- m_dcs->reset_w(0);
- }
// Clear CPU IO registers
memset(m_cpuio_data, 0, ARRAY_LENGTH(m_cpuio_data));
// Clear SIO registers
@@ -582,7 +578,7 @@ READ32_MEMBER( vegas_state::timekeeper_r )
result = (result & ~0xff000000) | (m_timekeeper->read(space, offset * 4 + 3, 0xff) << 24);
if (offset * 4 >= 0x7ff0) {
// Initial RTC check expects reads to the RTC to take some time
- machine().device<cpu_device>("maincpu")->eat_cycles(30);
+ m_maincpu->eat_cycles(30);
if (LOG_TIMEKEEPER) logerror("%s: timekeeper_r(%04X & %08X) = %08X\n", machine().describe_context(), offset * 4, mem_mask, result);
}
return result;
diff --git a/src/mame/drivers/williams.cpp b/src/mame/drivers/williams.cpp
index 085bad25a8c..b29fd82dbe7 100644
--- a/src/mame/drivers/williams.cpp
+++ b/src/mame/drivers/williams.cpp
@@ -1571,7 +1571,7 @@ MACHINE_CONFIG_START(williams_state::williams_muxed)
MACHINE_CONFIG_END
-MACHINE_CONFIG_START(williams_state::spdball)
+MACHINE_CONFIG_START(spdball_state::spdball)
williams(config);
/* basic machine hardware */
@@ -3214,14 +3214,12 @@ void blaster_state::init_blaster()
}
-void williams_state::init_spdball()
+void spdball_state::driver_init()
{
- pia6821_device *pia_3 = machine().device<pia6821_device>("pia_3");
-
CONFIGURE_BLITTER(WILLIAMS_BLITTER_SC1, 0xc000);
/* add a third PIA */
- m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc808, 0xc80b, read8_delegate(FUNC(pia6821_device::read), pia_3), write8_delegate(FUNC(pia6821_device::write), pia_3));
+ m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0xc808, 0xc80b, read8_delegate(FUNC(pia6821_device::read), (pia6821_device*)m_pia_3), write8_delegate(FUNC(pia6821_device::write), (pia6821_device*)m_pia_3));
/* install extra input handlers */
m_maincpu->space(AS_PROGRAM).install_read_port(0xc800, 0xc800, "AN0");
@@ -3351,7 +3349,7 @@ GAME( 1983, blaster, 0, blaster, blaster, blaster_state, init
GAME( 1983, blastero, blaster, blaster, blaster, blaster_state, init_blaster, ROT0, "Williams / Vid Kidz", "Blaster (location test)", MACHINE_SUPPORTS_SAVE )
GAME( 1983, blasterkit, blaster, blastkit, blastkit, blaster_state, init_blaster, ROT0, "Williams / Vid Kidz", "Blaster (conversion kit)", MACHINE_SUPPORTS_SAVE ) // mono sound
-GAME( 1985, spdball, 0, spdball, spdball, williams_state, init_spdball, ROT0, "Williams", "Speed Ball - Contest at Neonworld (prototype)", MACHINE_SUPPORTS_SAVE )
+GAME( 1985, spdball, 0, spdball, spdball, spdball_state, driver_init, ROT0, "Williams", "Speed Ball - Contest at Neonworld (prototype)", MACHINE_SUPPORTS_SAVE )
GAME( 1985, alienar, 0, williams_muxed, alienar, williams_state, init_alienar, ROT0, "Duncan Brown", "Alien Arena", MACHINE_SUPPORTS_SAVE )
GAME( 1985, alienaru, alienar, williams_muxed, alienar, williams_state, init_alienaru, ROT0, "Duncan Brown", "Alien Arena (Stargate upgrade)", MACHINE_SUPPORTS_SAVE )
diff --git a/src/mame/drivers/zr107.cpp b/src/mame/drivers/zr107.cpp
index 9d6f79f5e8a..77315e36ec2 100644
--- a/src/mame/drivers/zr107.cpp
+++ b/src/mame/drivers/zr107.cpp
@@ -287,15 +287,13 @@ uint32_t zr107_state::screen_update_jetwave(screen_device &screen, bitmap_rgb32
bitmap.fill(m_palette->pen(0), cliprect);
m_k001604->draw_back_layer(bitmap, cliprect);
-
m_k001005->draw(bitmap, cliprect);
-
m_k001604->draw_front_layer(screen, bitmap, cliprect);
draw_7segment_led(bitmap, 3, 3, m_led_reg0);
draw_7segment_led(bitmap, 9, 3, m_led_reg1);
- machine().device<adsp21062_device>("dsp")->set_flag_input(1, ASSERT_LINE);
+ m_dsp->set_flag_input(1, ASSERT_LINE);
return 0;
}
@@ -340,7 +338,7 @@ uint32_t zr107_state::screen_update_zr107(screen_device &screen, bitmap_rgb32 &b
draw_7segment_led(bitmap, 3, 3, m_led_reg0);
draw_7segment_led(bitmap, 9, 3, m_led_reg1);
- machine().device<adsp21062_device>("dsp")->set_flag_input(1, ASSERT_LINE);
+ m_dsp->set_flag_input(1, ASSERT_LINE);
return 0;
}
diff --git a/src/mame/includes/midtunit.h b/src/mame/includes/midtunit.h
index 1726a072c16..e6203e21f0b 100644
--- a/src/mame/includes/midtunit.h
+++ b/src/mame/includes/midtunit.h
@@ -27,7 +27,7 @@ public:
m_palette(*this, "palette"),
m_dcs(*this, "dcs"),
m_cvsd_sound(*this, "cvsd"),
- m_adpcm_sound(*this, "adpcm") ,
+ m_adpcm_sound(*this, "adpcm"),
m_nvram(*this, "nvram"),
m_gfxrom(*this, "gfxrom") { }
diff --git a/src/mame/includes/midvunit.h b/src/mame/includes/midvunit.h
index c03eb47030a..8d3996060ff 100644
--- a/src/mame/includes/midvunit.h
+++ b/src/mame/includes/midvunit.h
@@ -6,12 +6,13 @@
**************************************************************************/
-#include "video/poly.h"
#include "audio/dcs.h"
+#include "machine/adc0844.h"
+#include "machine/ataintf.h"
#include "machine/midwayic.h"
#include "machine/timer.h"
#include "machine/watchdog.h"
-#include "machine/adc0844.h"
+#include "video/poly.h"
#include "screen.h"
#define MIDVUNIT_VIDEO_CLOCK 33000000
@@ -52,13 +53,13 @@ public:
midvunit_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
- m_nvram(*this, "nvram"),
- m_ram_base(*this, "ram_base"),
- m_fastram_base(*this, "fastram_base"),
- m_tms32031_control(*this, "32031_control"),
- m_midvplus_misc(*this, "midvplus_misc"),
- m_videoram(*this, "videoram", 32),
- m_textureram(*this, "textureram") ,
+ m_nvram(*this, "nvram"),
+ m_ram_base(*this, "ram_base"),
+ m_fastram_base(*this, "fastram_base"),
+ m_tms32031_control(*this, "32031_control"),
+ m_midvplus_misc(*this, "midvplus_misc"),
+ m_videoram(*this, "videoram", 32),
+ m_textureram(*this, "textureram") ,
m_maincpu(*this, "maincpu"),
m_watchdog(*this, "watchdog"),
m_screen(*this, "screen"),
@@ -67,6 +68,8 @@ public:
m_midway_serial_pic(*this, "serial_pic"),
m_midway_serial_pic2(*this, "serial_pic2"),
m_midway_ioasic(*this, "ioasic"),
+ m_ata(*this, "ata"),
+ m_timer(*this, "timer%u", 0U),
m_dcs(*this, "dcs"),
m_generic_paletteram_32(*this, "paletteram"),
m_optional_drivers(*this, "lamp%u", 0U),
@@ -85,7 +88,6 @@ public:
uint8_t m_adc_shift;
uint16_t m_last_port0;
uint8_t m_shifter_state;
- timer_device *m_timer[2];
double m_timer_rate;
uint16_t m_bit_index;
int m_lastval;
@@ -166,6 +168,8 @@ public:
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;
+ optional_device<ata_interface_device> m_ata; // TODO(RH): This is horrible and midvplus should be split into its own device_driver that derives from midvunit.
+ required_device_array<timer_device, 2> m_timer;
required_device<dcs_audio_device> m_dcs;
required_shared_ptr<uint32_t> m_generic_paletteram_32;
output_finder<8> m_optional_drivers;
diff --git a/src/mame/includes/williams.h b/src/mame/includes/williams.h
index 0440a80209b..2de918ed9ed 100644
--- a/src/mame/includes/williams.h
+++ b/src/mame/includes/williams.h
@@ -80,7 +80,6 @@ public:
void init_lottofun();
void init_alienaru();
void init_defndjeu();
- void init_spdball();
void init_splat();
void init_joust();
void init_alienar();
@@ -127,7 +126,6 @@ public:
void defender(machine_config &config);
void sinistar(machine_config &config);
void lottofun(machine_config &config);
- void spdball(machine_config &config);
void williams(machine_config &config);
void williams_muxed(machine_config &config);
void jin(machine_config &config);
@@ -139,6 +137,22 @@ public:
void williams_map(address_map &map);
};
+class spdball_state : public williams_state
+{
+public:
+ spdball_state(const machine_config &mconfig, device_type type, const char *tag)
+ : williams_state(mconfig, type, tag)
+ , m_pia_3(*this, "pia_3")
+ {
+ }
+
+ void driver_init() override;
+
+ void spdball(machine_config &config);
+
+protected:
+ required_device<pia6821_device> m_pia_3;
+};
class blaster_state : public williams_state
{
diff --git a/src/mame/machine/konppc.cpp b/src/mame/machine/konppc.cpp
index abede9970fb..b1047a87d2a 100644
--- a/src/mame/machine/konppc.cpp
+++ b/src/mame/machine/konppc.cpp
@@ -125,12 +125,12 @@ READ32_MEMBER( konppc_device::cgboard_dsp_comm_r_ppc )
WRITE32_MEMBER( konppc_device::cgboard_dsp_comm_w_ppc )
{
- cpu_device &dsp = *m_dsp[cgboard_id];
// osd_printf_debug("%s dsp_cmd_w: (board %d) %08X, %08X, %08X\n", machine().describe_context().c_str(), cgboard_id, data, offset, mem_mask);
if (cgboard_id < MAX_CG_BOARDS)
{
- if (offset == 0)
+ cpu_device &dsp = *m_dsp[cgboard_id];
+ if (offset == 0)
{
if (ACCESSING_BITS_24_31)
{
@@ -221,22 +221,18 @@ void konppc_device::dsp_comm_sharc_w(address_space &space, int board, int offset
case CGBOARD_TYPE_NWKTR:
case CGBOARD_TYPE_HANGPLT:
{
- const char *dsptag = (board == 0) ? "dsp" : "dsp2";
- adsp21062_device *device = machine().device<adsp21062_device>(dsptag);
-
if (offset == 1)
{
nwk_device_sel[board] = data;
if (data & 0x01 || data & 0x10)
{
- device->set_flag_input(1, ASSERT_LINE);
+ m_dsp[board]->set_flag_input(1, ASSERT_LINE);
}
if (texture_bank[board] != nullptr)
{
int offset = (data & 0x08) ? 1 : 0;
-
machine().root_device().membank(texture_bank[board])->set_entry(offset);
}
}
@@ -336,29 +332,25 @@ WRITE32_MEMBER( konppc_device::cgboard_1_shared_sharc_w )
uint32_t konppc_device::nwk_fifo_r(address_space &space, int board)
{
- const char *dsptag = (board == 0) ? "dsp" : "dsp2";
- adsp21062_device *device = machine().device<adsp21062_device>(dsptag);
- uint32_t data;
-
if (nwk_fifo_read_ptr[board] < nwk_fifo_half_full_r)
{
- device->set_flag_input(1, CLEAR_LINE);
+ m_dsp[board]->set_flag_input(1, CLEAR_LINE);
}
else
{
- device->set_flag_input(1, ASSERT_LINE);
+ m_dsp[board]->set_flag_input(1, ASSERT_LINE);
}
if (nwk_fifo_read_ptr[board] < nwk_fifo_full)
{
- device->set_flag_input(2, ASSERT_LINE);
+ m_dsp[board]->set_flag_input(2, ASSERT_LINE);
}
else
{
- device->set_flag_input(2, CLEAR_LINE);
+ m_dsp[board]->set_flag_input(2, CLEAR_LINE);
}
- data = nwk_fifo[board][nwk_fifo_read_ptr[board]];
+ uint32_t data = nwk_fifo[board][nwk_fifo_read_ptr[board]];
nwk_fifo_read_ptr[board]++;
nwk_fifo_read_ptr[board] &= nwk_fifo_mask;
@@ -367,19 +359,16 @@ uint32_t konppc_device::nwk_fifo_r(address_space &space, int board)
void konppc_device::nwk_fifo_w(int board, uint32_t data)
{
- const char *dsptag = (board == 0) ? "dsp" : "dsp2";
- adsp21062_device *device = machine().device<adsp21062_device>(dsptag);
-
if (nwk_fifo_write_ptr[board] < nwk_fifo_half_full_w)
{
- device->set_flag_input(1, ASSERT_LINE);
+ m_dsp[board]->set_flag_input(1, ASSERT_LINE);
}
else
{
- device->set_flag_input(1, CLEAR_LINE);
+ m_dsp[board]->set_flag_input(1, CLEAR_LINE);
}
- device->set_flag_input(2, ASSERT_LINE);
+ m_dsp[board]->set_flag_input(2, ASSERT_LINE);
nwk_fifo[board][nwk_fifo_write_ptr[board]] = data;
nwk_fifo_write_ptr[board]++;
@@ -392,32 +381,28 @@ void konppc_device::nwk_fifo_w(int board, uint32_t data)
READ32_MEMBER( konppc_device::K033906_0_r )
{
- k033906_device *k033906_1 = machine().device<k033906_device>("k033906_1");
if (nwk_device_sel[0] & 0x01)
return nwk_fifo_r(space, 0);
else
- return k033906_1->read(space, offset, mem_mask);
+ return m_k033906[0]->read(space, offset, mem_mask);
}
WRITE32_MEMBER( konppc_device::K033906_0_w )
{
- k033906_device *k033906_1 = machine().device<k033906_device>("k033906_1");
- k033906_1->write(space, offset, data, mem_mask);
+ m_k033906[0]->write(space, offset, data, mem_mask);
}
READ32_MEMBER( konppc_device::K033906_1_r )
{
- k033906_device *k033906_2 = machine().device<k033906_device>("k033906_2");
if (nwk_device_sel[1] & 0x01)
return nwk_fifo_r(space, 1);
else
- return k033906_2->read(space, offset, mem_mask);
+ return m_k033906[1]->read(space, offset, mem_mask);
}
WRITE32_MEMBER( konppc_device::K033906_1_w)
{
- k033906_device *k033906_2 = machine().device<k033906_device>("k033906_2");
- k033906_2->write(space, offset, data, mem_mask);
+ m_k033906[1]->write(space, offset, data, mem_mask);
}
/*****************************************************************************/
diff --git a/src/mame/machine/midtunit.cpp b/src/mame/machine/midtunit.cpp
index 23cfb4130d2..f04a957c62f 100644
--- a/src/mame/machine/midtunit.cpp
+++ b/src/mame/machine/midtunit.cpp
@@ -386,7 +386,7 @@ void midtunit_state::init_mktunit()
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b00000, 0x1b6ffff, read16_delegate(FUNC(midtunit_state::mk_prot_r),this), write16_delegate(FUNC(midtunit_state::mk_prot_w),this));
/* sound chip protection (hidden RAM) */
- machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(0xfb9c, 0xfbc6);
+ m_adpcm_sound->get_cpu()->space(AS_PROGRAM).install_ram(0xfb9c, 0xfbc6);
}
void midtunit_state::init_mkturbo()
@@ -417,9 +417,9 @@ void midtunit_state::init_nbajam_common(int te_protection)
/* sound chip protection (hidden RAM) */
if (!te_protection)
- machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(0xfbaa, 0xfbd4);
+ m_adpcm_sound->get_cpu()->space(AS_PROGRAM).install_ram(0xfbaa, 0xfbd4);
else
- machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_ram(0xfbec, 0xfc16);
+ m_adpcm_sound->get_cpu()->space(AS_PROGRAM).install_ram(0xfbec, 0xfc16);
}
void midtunit_state::init_nbajam()
@@ -444,8 +444,8 @@ void midtunit_state::init_jdreddp()
m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x1b00000, 0x1bfffff, read16_delegate(FUNC(midtunit_state::jdredd_prot_r),this), write16_delegate(FUNC(midtunit_state::jdredd_prot_w),this));
/* sound chip protection (hidden RAM) */
- machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_read_bank(0xfbcf, 0xfbf9, "bank7");
- machine().device("adpcm:cpu")->memory().space(AS_PROGRAM).install_write_bank(0xfbcf, 0xfbf9, "bank9");
+ m_adpcm_sound->get_cpu()->space(AS_PROGRAM).install_read_bank(0xfbcf, 0xfbf9, "bank7");
+ m_adpcm_sound->get_cpu()->space(AS_PROGRAM).install_write_bank(0xfbcf, 0xfbf9, "bank9");
membank("adpcm:bank9")->set_base(auto_alloc_array(machine(), uint8_t, 0x80));
}
diff --git a/src/mame/machine/midwayic.cpp b/src/mame/machine/midwayic.cpp
index a75933ad455..d95b6f78975 100644
--- a/src/mame/machine/midwayic.cpp
+++ b/src/mame/machine/midwayic.cpp
@@ -662,8 +662,8 @@ midway_ioasic_device::midway_ioasic_device(const machine_config &mconfig, const
m_fifo_out(0),
m_fifo_bytes(0),
m_fifo_force_buffer_empty_pc(0),
- m_cage(nullptr),
- m_dcs(nullptr)
+ m_cage(*this, "cage"),
+ m_dcs(*this, "dcs")
{
memset(m_fifo,0,sizeof(m_fifo));
memset(m_reg,0,sizeof(m_reg));
@@ -692,19 +692,13 @@ void midway_ioasic_device::device_start()
ioasic_register_state();
- /* do we have a DCS2 sound chip connected? (most likely) */
- m_dcs = machine().device<dcs_audio_device>("dcs");
+ /* do we have a DCS2 sound chip connected? */
m_has_dcs = (m_dcs != nullptr);
- m_cage = machine().device<atari_cage_device>("cage");
m_has_cage = (m_cage != nullptr);
if (m_has_dcs)
{
- m_dcs_cpu = m_dcs->subdevice<cpu_device>("dcs2");
- if (m_dcs_cpu == nullptr)
- m_dcs_cpu = m_dcs->subdevice<cpu_device>("dsio");
- if (m_dcs_cpu == nullptr)
- m_dcs_cpu = m_dcs->subdevice<cpu_device>("denver");
+ m_dcs_cpu = m_dcs->get_cpu();
}
m_shuffle_map = &shuffle_maps[m_shuffle_type][0];
@@ -987,7 +981,7 @@ READ32_MEMBER( midway_ioasic_device::read )
case IOASIC_UARTIN:
m_reg[offset] &= ~0x1000;
if (result & 0x1000)
- logerror("%06X:ioasic_r(%d) = %08X\n", machine().device<cpu_device>("maincpu")->pc(), offset, result);
+ logerror("%s: ioasic_r(%d) = %08X\n", machine().describe_context(), offset, result);
// Add lf
if ((result & 0xff)==0x0d)
m_reg[offset] = 0x300a;
@@ -1104,7 +1098,7 @@ WRITE32_MEMBER( midway_ioasic_device::write )
break;
case IOASIC_UARTCONTROL:
- logerror("%08X IOASIC uart control = %04X INTCTRL=%04x\n", machine().device<cpu_device>("maincpu")->pc(), data, m_reg[IOASIC_INTCTL]);
+ logerror("%s: IOASIC uart control = %04X INTCTRL=%04x\n", machine().describe_context(), data, m_reg[IOASIC_INTCTL]);
break;
case IOASIC_UARTOUT:
@@ -1128,7 +1122,7 @@ WRITE32_MEMBER( midway_ioasic_device::write )
case IOASIC_SOUNDCTL:
if (LOG_IOASIC)
- logerror("%08X write IOASIC_SOUNDCTL=%04x\n", machine().device<cpu_device>("maincpu")->pc(), data);
+ logerror("%s: write IOASIC_SOUNDCTL=%04x\n", machine().describe_context(), data);
/* sound reset? */
if (m_has_dcs)
{
diff --git a/src/mame/machine/midwayic.h b/src/mame/machine/midwayic.h
index cdf2448ed93..2f468b0e7b6 100644
--- a/src/mame/machine/midwayic.h
+++ b/src/mame/machine/midwayic.h
@@ -215,8 +215,8 @@ private:
uint16_t m_fifo_bytes;
offs_t m_fifo_force_buffer_empty_pc;
- atari_cage_device *m_cage;
- dcs_audio_device *m_dcs;
+ optional_device<atari_cage_device> m_cage;
+ optional_device<dcs_audio_device> m_dcs;
};