Eliminate some machine().firstcpu usage (nw)

This commit is contained in:
AJR 2018-01-02 08:38:21 -05:00
parent d016fe6c29
commit 7472812bf4
11 changed files with 31 additions and 10 deletions

View File

@ -272,8 +272,9 @@ int sony_read_status(device_t *device)
if (LOG_SONY_EXTRA)
{
printf("sony.status(): action=%x pc=0x%08x%s\n",
action, (int) device->machine().firstcpu->pc(), sony.floppy_enable ? "" : " (no drive enabled)");
device->logerror("%s sony.status(): action=%x%s\n",
device->machine().describe_context(),
action, sony.floppy_enable ? "" : " (no drive enabled)");
}
if ((! sony_enable2()) && sony.floppy_enable)
@ -471,7 +472,7 @@ void sony_set_lines(device_t *device,uint8_t lines)
{
//int action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2);
//printf("sony.set_lines: %02x, action now %d\n", lines&0xf, action);
//logerror("sony.set_lines: %02x, action now %d\n", lines&0xf, action);
}
/* have we just set LSTRB ? */
@ -513,7 +514,7 @@ void sony_set_sel_line(device_t *device,int sel)
{
//int action = ((sony.lines & (SONY_CA1 | SONY_CA0)) << 2) | (sony.sel_line << 1) | ((sony.lines & SONY_CA2) >> 2);
//printf("sony.set_sel_line: %d, action now %d\n", sony.sel_line, action);
//logerror("sony.set_sel_line: %d, action now %d\n", sony.sel_line, action);
}
if (LOG_SONY_EXTRA)

View File

@ -119,6 +119,7 @@ WRITE8_MEMBER(tmp68301_device::icr_w)
tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TMP68301, tag, owner, clock),
device_memory_interface(mconfig, *this),
m_cpu(*this, finder_base::DUMMY_TAG),
m_in_parallel_cb(*this),
m_out_parallel_cb(*this),
m_imr(0),
@ -227,7 +228,7 @@ TIMER_CALLBACK_MEMBER( tmp68301_device::timer_callback )
m_irq_vector[level] = IVNR & 0x00e0;
m_irq_vector[level] += 4+i;
machine().firstcpu->set_input_line(level,HOLD_LINE);
m_cpu->set_input_line(level,HOLD_LINE);
}
if (TCR & 0x0080) // N/1
@ -270,7 +271,7 @@ void tmp68301_device::update_timer( int i )
{
int scale = (TCR & 0x3c00)>>10; // P4..1
if (scale > 8) scale = 8;
duration = attotime::from_hz(machine().firstcpu->unscaled_clock()) * ((1 << scale) * max);
duration = attotime::from_hz(m_cpu->unscaled_clock()) * ((1 << scale) * max);
}
break;
}
@ -310,7 +311,7 @@ void tmp68301_device::update_irq_state(uint16_t cause)
m_irq_vector[level] = IVNR & 0x00e0;
m_irq_vector[level] += i;
machine().firstcpu->set_input_line(level,HOLD_LINE);
m_cpu->set_input_line(level,HOLD_LINE);
}
}
}
@ -349,7 +350,7 @@ void tmp68301_device::update_irq_serial(uint16_t cause, uint8_t type)
*/
m_irq_vector[level] += type;
machine().firstcpu->set_input_line(level,HOLD_LINE);
m_cpu->set_input_line(level,HOLD_LINE);
}
}
}

View File

@ -5,16 +5,23 @@
#pragma once
#include "cpu/m68000/m68000.h"
//**************************************************************************
// INTERFACE CONFIGURATION MACROS
//**************************************************************************
/* TODO: serial ports, frequency & hook it up with m68k */
// FIXME: M68000 ought to be a parent class, not an external object
#define MCFG_TMP68301_CPU(_tag) \
tmp68301_device::set_cpu_tag(*device, "^" _tag);
#define MCFG_TMP68301_IN_PARALLEL_CB(cb) \
devcb = &tmp68301_device::set_in_parallel_callback(*device, (DEVCB_##cb));
devcb = &tmp68301_device::set_in_parallel_callback(*device, (DEVCB_##cb));
#define MCFG_TMP68301_OUT_PARALLEL_CB(cb) \
devcb = &tmp68301_device::set_out_parallel_callback(*device, (DEVCB_##cb));
devcb = &tmp68301_device::set_out_parallel_callback(*device, (DEVCB_##cb));
//**************************************************************************
@ -29,6 +36,7 @@ class tmp68301_device : public device_t,
public:
tmp68301_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
static void set_cpu_tag(device_t &device, const char *tag) { downcast<tmp68301_device &>(device).m_cpu.set_tag(tag); }
template <class Object> static devcb_base &set_in_parallel_callback(device_t &device, Object &&cb) { return downcast<tmp68301_device &>(device).m_in_parallel_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> static devcb_base &set_out_parallel_callback(device_t &device, Object &&cb) { return downcast<tmp68301_device &>(device).m_out_parallel_cb.set_callback(std::forward<Object>(cb)); }
@ -82,6 +90,8 @@ private:
inline uint16_t read_word(offs_t address);
inline void write_word(offs_t address, uint16_t data);
required_device<m68000_base_device> m_cpu;
devcb_read16 m_in_parallel_cb;
devcb_write16 m_out_parallel_cb;

View File

@ -108,6 +108,7 @@ static MACHINE_CONFIG_START( bingowav )
MCFG_CPU_PROGRAM_MAP(bingowav_main_map)
MCFG_DEVICE_ADD("maintmp", TMP68301, 0) // wrong
MCFG_TMP68301_CPU("maincpu")
MCFG_DEVICE_ADD("mainioh", TE7750, 0)
MCFG_TE7750_IOS_CB(CONSTANT(5))

View File

@ -362,6 +362,7 @@ static MACHINE_CONFIG_START( csplayh5 )
MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", csplayh5_state, csplayh5_irq, "screen", 0, 1)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(csplayh5_state, tmp68301_parallel_port_w))
#if USE_H8

View File

@ -588,6 +588,7 @@ static MACHINE_CONFIG_START( joystand )
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_TMP68301_IN_PARALLEL_CB(READ16(joystand_state, eeprom_r))
MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(joystand_state, eeprom_w))

View File

@ -60,6 +60,7 @@ static MACHINE_CONFIG_START( k2000 )
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
MACHINE_CONFIG_END

View File

@ -696,6 +696,7 @@ static MACHINE_CONFIG_START( niyanpai )
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(niyanpai_state, tmp68301_parallel_port_w))

View File

@ -763,6 +763,7 @@ static MACHINE_CONFIG_START( realbrk )
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(realbrk_state,realbrk_flipscreen_w))
/* video hardware */

View File

@ -9134,6 +9134,7 @@ static MACHINE_CONFIG_START( kiwame )
/* lev 1-7 are the same. WARNING: the interrupt table is written to. */
MCFG_CPU_VBLANK_INT_DRIVER("screen", seta_state, irq1_line_hold)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_TMP68301_OUT_PARALLEL_CB(WRITE16(seta_state, kiwame_row_select_w))
MCFG_NVRAM_ADD_0FILL("nvram")

View File

@ -2510,6 +2510,7 @@ static MACHINE_CONFIG_START( seta2 )
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0)
MCFG_TMP68301_CPU("maincpu")
MCFG_WATCHDOG_ADD("watchdog")
@ -2786,6 +2787,7 @@ static MACHINE_CONFIG_START( namcostr )
MCFG_CPU_IRQ_ACKNOWLEDGE_DEVICE("tmp68301",tmp68301_device,irq_callback)
MCFG_DEVICE_ADD("tmp68301", TMP68301, 0) // does this have a ticket dispenser?
MCFG_TMP68301_CPU("maincpu")
// video hardware
MCFG_SCREEN_ADD("screen", RASTER)