Remove first_screen from namco51 device, nw

This commit is contained in:
mooglyguy 2018-03-10 06:00:18 +01:00
parent b688161290
commit ccba7735df
4 changed files with 23 additions and 11 deletions

View File

@ -1582,6 +1582,7 @@ MACHINE_CONFIG_START(bosco_state::bosco)
MCFG_NAMCO_50XX_ADD("50xx_1", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_50XX_ADD("50xx_2", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_SCREEN("screen")
MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0L"))
MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H"))
MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("IN1L"))
@ -1678,6 +1679,7 @@ MACHINE_CONFIG_START(galaga_state::galaga)
MCFG_DEVCB_CHAIN_OUTPUT(INPUTLINE("sub2", INPUT_LINE_RESET)) MCFG_DEVCB_INVERT
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_SCREEN("screen")
MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0L"))
MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H"))
MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("IN1L"))
@ -1786,6 +1788,7 @@ MACHINE_CONFIG_START(xevious_state::xevious)
MCFG_NAMCO_50XX_ADD("50xx", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_SCREEN("screen")
MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0L"))
MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H"))
MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("IN1L"))
@ -1893,6 +1896,7 @@ MACHINE_CONFIG_START(digdug_state::digdug)
// Q5-Q7 also used (see below)
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/6/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_SCREEN("screen")
MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0L"))
MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0H"))
MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("IN1L"))

View File

@ -862,6 +862,7 @@ MACHINE_CONFIG_START(polepos_state::polepos)
MCFG_CPU_PROGRAM_MAP(z8002_map_2)
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_SCREEN("screen")
MCFG_NAMCO_51XX_INPUT_0_CB(IOPORT("IN0")) MCFG_DEVCB_MASK(0x0f)
MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4)
MCFG_NAMCO_51XX_INPUT_2_CB(IOPORT("DSWB")) MCFG_DEVCB_MASK(0x0f)
@ -996,6 +997,7 @@ MACHINE_CONFIG_START(polepos_state::topracern)
/* doesn't exist on the bootleg, but required for now or the game only boots in test mode!
they probably simulate some of the logic */
MCFG_NAMCO_51XX_ADD("51xx", MASTER_CLOCK/8/2) /* 1.536 MHz */
MCFG_NAMCO_51XX_SCREEN("screen")
MCFG_NAMCO_51XX_INPUT_1_CB(IOPORT("IN0")) MCFG_DEVCB_RSHIFT(4)
MCFG_NAMCO_06XX_ADD("06xx", MASTER_CLOCK/8/64)

View File

@ -235,7 +235,8 @@ READ8_MEMBER( namco_51xx_device::read )
if (m_mode == 1)
{
int on = (machine().first_screen()->frame_number() & 0x10) >> 4;
// HACK: Just a way of deriving the lamp blink rate. Unclear if this is verified on actual hardware.
int on = (m_screen->frame_number() & 0x10) >> 4;
if (m_credits >= 2)
WRITE_PORT(0,0x0c | 3*on); // lamps
@ -329,15 +330,16 @@ ROM_END
DEFINE_DEVICE_TYPE(NAMCO_51XX, namco_51xx_device, "namco51", "Namco 51xx")
namco_51xx_device::namco_51xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, NAMCO_51XX, tag, owner, clock),
m_cpu(*this, "mcu"),
m_in{ { *this }, { *this }, { *this }, { *this } },
m_out{ { *this }, { *this } },
m_lastcoins(0),
m_lastbuttons(0),
m_mode(0),
m_coincred_mode(0),
m_remap_joy(0)
: device_t(mconfig, NAMCO_51XX, tag, owner, clock)
, m_cpu(*this, "mcu")
, m_screen(*this, finder_base::DUMMY_TAG)
, m_in{ { *this }, { *this }, { *this }, { *this } }
, m_out{ { *this }, { *this } }
, m_lastcoins(0)
, m_lastbuttons(0)
, m_mode(0)
, m_coincred_mode(0)
, m_remap_joy(0)
{
}

View File

@ -11,6 +11,9 @@
#define MCFG_NAMCO_51XX_ADD(_tag, _clock) \
MCFG_DEVICE_ADD(_tag, NAMCO_51XX, _clock)
#define MCFG_NAMCO_51XX_SCREEN(screen_tag) \
downcast<namco_51xx_device &>(*device).set_screen_tag(("^" screen_tag));
#define MCFG_NAMCO_51XX_INPUT_0_CB(_devcb) \
devcb = &downcast<namco_51xx_device &>(*device).set_input_callback<0>(DEVCB_##_devcb);
@ -34,8 +37,8 @@ class namco_51xx_device : public device_t
public:
namco_51xx_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_screen_tag(const char *tag) { m_screen.set_tag(tag); }
template <unsigned N, class Object> devcb_base &set_input_callback(Object &&cb) { return m_in[N].set_callback(std::forward<Object>(cb)); }
template <unsigned N, class Object> devcb_base &set_output_callback(Object &&cb) { return m_out[N].set_callback(std::forward<Object>(cb)); }
DECLARE_WRITE8_MEMBER( write );
@ -51,6 +54,7 @@ protected:
private:
// internal state
required_device<mb88_cpu_device> m_cpu;
required_device<screen_device> m_screen;
devcb_read8 m_in[4];
devcb_write8 m_out[2];