diff --git a/src/mame/drivers/20pacgal.c b/src/mame/drivers/20pacgal.c index e6870a343e3..f3451693c73 100644 --- a/src/mame/drivers/20pacgal.c +++ b/src/mame/drivers/20pacgal.c @@ -339,8 +339,6 @@ INPUT_PORTS_END void _20pacgal_state::machine_start() { - m_eeprom = machine().device("eeprom"); - save_item(NAME(m_game_selected)); save_item(NAME(m_ram_48000)); save_item(NAME(m_irq_mask)); diff --git a/src/mame/drivers/cave.c b/src/mame/drivers/cave.c index 3f44ad84df3..4b687e01715 100644 --- a/src/mame/drivers/cave.c +++ b/src/mame/drivers/cave.c @@ -287,7 +287,6 @@ WRITE8_MEMBER(cave_state::soundlatch_ack_w) WRITE16_MEMBER(cave_state::cave_eeprom_msb_w) { - device_t *device = machine().device("eeprom"); if (data & ~0xfe00) logerror("%s: Unknown EEPROM bit written %04X\n", machine().describe_context(), data); @@ -299,14 +298,13 @@ WRITE16_MEMBER(cave_state::cave_eeprom_msb_w) coin_counter_w(machine(), 0, data & 0x1000); // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x0800); + m_eeprom->write_bit(data & 0x0800); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); } } @@ -318,24 +316,21 @@ WRITE16_MEMBER(cave_state::sailormn_eeprom_msb_w) WRITE16_MEMBER(cave_state::hotdogst_eeprom_msb_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_8_15) // even address { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x0800); + m_eeprom->write_bit(data & 0x0800); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x0400) ? CLEAR_LINE: ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x0400) ? CLEAR_LINE: ASSERT_LINE); } } WRITE16_MEMBER(cave_state::cave_eeprom_lsb_w) { - device_t *device = machine().device("eeprom"); if (data & ~0x00ef) logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data); @@ -347,14 +342,13 @@ WRITE16_MEMBER(cave_state::cave_eeprom_lsb_w) coin_counter_w(machine(), 0, data & 0x0001); // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x80); + m_eeprom->write_bit(data & 0x80); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); } } @@ -372,7 +366,6 @@ WRITE16_MEMBER(cave_state::gaia_coin_lsb_w) - Writing 0xcf00 shouldn't send a 1 bit to the eeprom */ WRITE16_MEMBER(cave_state::metmqstr_eeprom_msb_w) { - device_t *device = machine().device("eeprom"); if (data & ~0xff00) logerror("%s: Unknown EEPROM bit written %04X\n", machine().describe_context(), data); @@ -384,14 +377,13 @@ WRITE16_MEMBER(cave_state::metmqstr_eeprom_msb_w) if (~data & 0x0100) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x0800); + m_eeprom->write_bit(data & 0x0800); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x0400) ? ASSERT_LINE : CLEAR_LINE); } } } @@ -672,7 +664,6 @@ WRITE16_MEMBER(cave_state::korokoro_leds_w) WRITE16_MEMBER(cave_state::korokoro_eeprom_msb_w) { - device_t *device = machine().device("eeprom"); if (data & ~0x7000) { logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data); @@ -685,14 +676,13 @@ WRITE16_MEMBER(cave_state::korokoro_eeprom_msb_w) m_hopper = data & 0x0100; // ??? // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x4000); + m_eeprom->write_bit(data & 0x4000); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x1000) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x1000) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE); } } @@ -800,9 +790,7 @@ ADDRESS_MAP_END READ16_MEMBER(cave_state::pwrinst2_eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return ~8 + ((eeprom->read_bit() & 1) ? 8 : 0); + return ~8 + ((m_eeprom->read_bit() & 1) ? 8 : 0); } INLINE void vctrl_w(address_space &space, offs_t offset, UINT16 data, UINT16 mem_mask, int GFX) @@ -899,21 +887,19 @@ ADDRESS_MAP_END WRITE16_MEMBER(cave_state::tjumpman_eeprom_lsb_w) { - device_t *device = machine().device("eeprom"); if (data & ~0x0038) logerror("%s: Unknown EEPROM bit written %04X\n",machine().describe_context(),data); if (ACCESSING_BITS_0_7) // odd address { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x0020); + m_eeprom->write_bit(data & 0x0020); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x0008) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x0008) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x0010) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x0010) ? ASSERT_LINE : CLEAR_LINE); } } diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index 897a2ee85e8..40107b199ae 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -457,19 +457,15 @@ WRITE32_MEMBER(dragngun_state::dragngun_lightgun_w) READ32_MEMBER(deco32_state::dragngun_eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return 0xfffffffe | eeprom->read_bit(); + return 0xfffffffe | m_eeprom->read_bit(); } WRITE32_MEMBER(deco32_state::dragngun_eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((data & 0x2) ? ASSERT_LINE : CLEAR_LINE); - eeprom->write_bit(data & 0x1); - eeprom->set_cs_line((data & 0x4) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x2) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit(data & 0x1); + m_eeprom->set_cs_line((data & 0x4) ? CLEAR_LINE : ASSERT_LINE); return; } logerror("%s:Write control 1 %08x %08x\n",machine().describe_context(),offset,data); diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index c054fad8bd0..ddcc10e1cef 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -182,14 +182,12 @@ READ32_MEMBER(deco_mlc_state::mlc_scanline_r) WRITE32_MEMBER(deco_mlc_state::avengrs_eprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_8_15) { UINT8 ebyte=(data>>8)&0xff; // if (ebyte&0x80) { - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((ebyte & 0x2) ? ASSERT_LINE : CLEAR_LINE); - eeprom->write_bit(ebyte & 0x1); - eeprom->set_cs_line((ebyte & 0x4) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((ebyte & 0x2) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit(ebyte & 0x1); + m_eeprom->set_cs_line((ebyte & 0x4) ? CLEAR_LINE : ASSERT_LINE); // } } else if (ACCESSING_BITS_0_7) { diff --git a/src/mame/drivers/fortecar.c b/src/mame/drivers/fortecar.c index c581d798d96..b50c63a8948 100644 --- a/src/mame/drivers/fortecar.c +++ b/src/mame/drivers/fortecar.c @@ -331,7 +331,8 @@ public: fortecar_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), - m_vram(*this, "vram"){ } + m_vram(*this, "vram"), + m_eeprom(*this, "eeprom"){ } required_device m_maincpu; required_shared_ptr m_vram; @@ -344,6 +345,7 @@ public: virtual void video_start(); virtual void palette_init(); UINT32 screen_update_fortecar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + required_device m_eeprom; }; @@ -432,7 +434,6 @@ R = 82 Ohms Pull Down. WRITE8_MEMBER(fortecar_state::ppi0_portc_w) { - device_t *device = machine().device("eeprom"); /* NM93CS56N Serial EEPROM @@ -441,18 +442,15 @@ CK PPI_PC1 DIN PPI_PC2 DOUT PPI_PC4 */ - eeprom_device *eeprom = downcast(device); - eeprom->write_bit((data & 0x04) >> 2); - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); - eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit((data & 0x04) >> 2); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE); } READ8_MEMBER(fortecar_state::ppi0_portc_r) { - device_t *device = machine().device("eeprom"); // popmessage("%s",machine().describe_context()); - eeprom_device *eeprom = downcast(device); - return ((eeprom->read_bit()<<4) & 0x10); + return ((m_eeprom->read_bit()<<4) & 0x10); } static I8255A_INTERFACE( ppi8255_intf ) diff --git a/src/mame/drivers/gaelco3d.c b/src/mame/drivers/gaelco3d.c index 00b2f4f6ee9..45d64955628 100644 --- a/src/mame/drivers/gaelco3d.c +++ b/src/mame/drivers/gaelco3d.c @@ -282,7 +282,6 @@ WRITE32_MEMBER(gaelco3d_state::irq_ack32_w) READ16_MEMBER(gaelco3d_state::eeprom_data_r) { - device_t *device = machine().device("eeprom"); UINT32 result = 0xffff; if (ACCESSING_BITS_0_7) @@ -293,8 +292,7 @@ READ16_MEMBER(gaelco3d_state::eeprom_data_r) result |= gaelco_serial_status_r(machine().device("serial"), space, 0); } - eeprom_device *eeprom = downcast(device); - if (eeprom->read_bit()) + if (m_eeprom->read_bit()) result ^= 0x0004; if (LOG) logerror("eeprom_data_r(%02X)\n", result); @@ -321,11 +319,9 @@ READ32_MEMBER(gaelco3d_state::eeprom_data32_r) WRITE16_MEMBER(gaelco3d_state::eeprom_data_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); + m_eeprom->write_bit(data & 0x01); } else if (mem_mask != 0xffff) logerror("write mask: %08x data %08x\n", mem_mask, data); @@ -334,22 +330,18 @@ WRITE16_MEMBER(gaelco3d_state::eeprom_data_w) WRITE16_MEMBER(gaelco3d_state::eeprom_clock_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); } } WRITE16_MEMBER(gaelco3d_state::eeprom_cs_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); } } diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c index 13b541f046a..1fc91f86cc3 100644 --- a/src/mame/drivers/galpani2.c +++ b/src/mame/drivers/galpani2.c @@ -35,26 +35,22 @@ To Do: READ16_MEMBER(galpani2_state::galpani2_eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return (m_eeprom_word & ~1) | (eeprom->read_bit() & 1); + return (m_eeprom_word & ~1) | (m_eeprom->read_bit() & 1); } WRITE16_MEMBER(galpani2_state::galpani2_eeprom_w) { - device_t *device = machine().device("eeprom"); COMBINE_DATA( &m_eeprom_word ); if ( ACCESSING_BITS_0_7 ) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x02); + m_eeprom->write_bit(data & 0x02); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x08) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line((data & 0x08) ? CLEAR_LINE : ASSERT_LINE ); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/jclub2.c b/src/mame/drivers/jclub2.c index 30cf4dabf5a..7585e94683a 100644 --- a/src/mame/drivers/jclub2.c +++ b/src/mame/drivers/jclub2.c @@ -112,7 +112,8 @@ public: m_tmapscroll2(*this, "tmapscroll2"), m_spriteram(*this, "spriteram"), m_gdfs_st0020(*this, "st0020_spr"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } virtual void machine_start() { @@ -130,6 +131,7 @@ public: optional_shared_ptr m_spriteram; optional_device m_gdfs_st0020; required_device m_maincpu; + required_device m_eeprom; DECLARE_WRITE32_MEMBER(darkhors_tmapram_w); DECLARE_WRITE32_MEMBER(darkhors_tmapram2_w); DECLARE_WRITE32_MEMBER(paletteram32_xBBBBBGGGGGRRRRR_dword_w); @@ -286,21 +288,19 @@ UINT32 darkhors_state::screen_update_darkhors(screen_device &screen, bitmap_ind1 WRITE32_MEMBER(darkhors_state::darkhors_eeprom_w) { - device_t *device = machine().device("eeprom"); if (data & ~0xff000000) logerror("%s: Unknown EEPROM bit written %08X\n",machine().describe_context(),data); if ( ACCESSING_BITS_24_31 ) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x04000000); + m_eeprom->write_bit(data & 0x04000000); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x01000000) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line((data & 0x01000000) ? CLEAR_LINE : ASSERT_LINE ); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c index 0cd31abd26b..ea6de291f01 100644 --- a/src/mame/drivers/konamigv.c +++ b/src/mame/drivers/konamigv.c @@ -136,7 +136,8 @@ public: konamigv_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_am53cf96(*this, "scsi:am53cf96"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_device m_am53cf96; @@ -174,17 +175,16 @@ public: void scsi_dma_read( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); void scsi_dma_write( UINT32 *p_n_psxram, UINT32 n_address, INT32 n_size ); required_device m_maincpu; + required_device m_eeprom; }; /* EEPROM handlers */ WRITE32_MEMBER(konamigv_state::eeprom_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->write_bit((data&0x01) ? 1 : 0); - eeprom->set_clock_line((data&0x04) ? ASSERT_LINE : CLEAR_LINE); - eeprom->set_cs_line((data&0x02) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->write_bit((data&0x01) ? 1 : 0); + m_eeprom->set_clock_line((data&0x04) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_cs_line((data&0x02) ? CLEAR_LINE : ASSERT_LINE); } WRITE32_MEMBER(konamigv_state::mb89371_w) diff --git a/src/mame/drivers/metro.c b/src/mame/drivers/metro.c index d14fab71087..69acec9071a 100644 --- a/src/mame/drivers/metro.c +++ b/src/mame/drivers/metro.c @@ -1208,26 +1208,21 @@ READ16_MEMBER(metro_state::gakusai_input_r) READ16_MEMBER(metro_state::gakusai_eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return eeprom->read_bit() & 1; + return m_eeprom->read_bit() & 1; } WRITE16_MEMBER(metro_state::gakusai_eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - // latch the bit - eeprom->write_bit(BIT(data, 0)); + m_eeprom->write_bit(BIT(data, 0)); // reset line asserted: reset. - eeprom->set_cs_line(BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line(BIT(data, 2) ? CLEAR_LINE : ASSERT_LINE ); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line(BIT(data, 1) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line(BIT(data, 1) ? ASSERT_LINE : CLEAR_LINE ); } } @@ -1310,38 +1305,32 @@ ADDRESS_MAP_END READ16_MEMBER(metro_state::dokyusp_eeprom_r) { - device_t *device = machine().device("eeprom"); // clock line asserted: write latch or select next bit to read - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line(CLEAR_LINE); - eeprom->set_clock_line(ASSERT_LINE); + m_eeprom->set_clock_line(CLEAR_LINE); + m_eeprom->set_clock_line(ASSERT_LINE); - return eeprom->read_bit() & 1; + return m_eeprom->read_bit() & 1; } WRITE16_MEMBER(metro_state::dokyusp_eeprom_bit_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(BIT(data, 0)); + m_eeprom->write_bit(BIT(data, 0)); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line(CLEAR_LINE); - eeprom->set_clock_line(ASSERT_LINE); + m_eeprom->set_clock_line(CLEAR_LINE); + m_eeprom->set_clock_line(ASSERT_LINE); } } WRITE16_MEMBER(metro_state::dokyusp_eeprom_reset_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { // reset line asserted: reset. - eeprom_device *eeprom = downcast(device); - eeprom->set_cs_line(BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line(BIT(data, 0) ? CLEAR_LINE : ASSERT_LINE); } } diff --git a/src/mame/drivers/midas.c b/src/mame/drivers/midas.c index 055073d1fdc..a63bbbef9cb 100644 --- a/src/mame/drivers/midas.c +++ b/src/mame/drivers/midas.c @@ -63,7 +63,8 @@ public: midas_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_gfxregs(*this, "gfxregs"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } UINT16 *m_gfxram; required_shared_ptr m_gfxregs; @@ -83,6 +84,7 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(livequiz_irqhandler); required_device m_maincpu; + required_device m_eeprom; }; @@ -212,18 +214,16 @@ UINT32 midas_state::screen_update_midas(screen_device &screen, bitmap_ind16 &bit WRITE16_MEMBER(midas_state::midas_eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x04); + m_eeprom->write_bit(data & 0x04); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE ); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/mitchell.c b/src/mame/drivers/mitchell.c index 64e2f42c3b3..efb6f24fc8a 100644 --- a/src/mame/drivers/mitchell.c +++ b/src/mame/drivers/mitchell.c @@ -106,23 +106,17 @@ READ8_MEMBER(mitchell_state::pang_port5_r) WRITE8_MEMBER(mitchell_state::eeprom_cs_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->set_cs_line(data ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line(data ? CLEAR_LINE : ASSERT_LINE); } WRITE8_MEMBER(mitchell_state::eeprom_clock_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line(data ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line(data ? CLEAR_LINE : ASSERT_LINE); } WRITE8_MEMBER(mitchell_state::eeprom_serial_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data); + m_eeprom->write_bit(data); } diff --git a/src/mame/drivers/plygonet.c b/src/mame/drivers/plygonet.c index f315bb536d3..d7ab6d248b4 100644 --- a/src/mame/drivers/plygonet.c +++ b/src/mame/drivers/plygonet.c @@ -103,11 +103,9 @@ static const eeprom_interface eeprom_intf = READ32_MEMBER(polygonet_state::polygonet_eeprom_r) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_15) { - eeprom_device *eeprom = downcast(device); - return 0x0200 | (eeprom->read_bit() << 8); + return 0x0200 | (m_eeprom->read_bit() << 8); } else { diff --git a/src/mame/drivers/pntnpuzl.c b/src/mame/drivers/pntnpuzl.c index 7f0ae17eb84..71b394922a9 100644 --- a/src/mame/drivers/pntnpuzl.c +++ b/src/mame/drivers/pntnpuzl.c @@ -131,10 +131,11 @@ class pntnpuzl_state : public driver_device public: pntnpuzl_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this,"maincpu") + m_maincpu(*this,"maincpu"), + m_eeprom(*this, "eeprom") { } - UINT16 m_eeprom; + UINT16 m_eeprom_data; UINT16 m_pntpzl_200000; UINT16 m_serial; UINT16 m_serial_out; @@ -153,6 +154,7 @@ public: DECLARE_READ16_MEMBER(pntnpuzl_eeprom_r); DECLARE_WRITE16_MEMBER(pntnpuzl_eeprom_w); DECLARE_DRIVER_INIT(pip); + required_device m_eeprom; }; @@ -170,25 +172,21 @@ static const eeprom_interface eeprom_intf = READ16_MEMBER(pntnpuzl_state::pntnpuzl_eeprom_r) { - device_t *device = machine().device("eeprom"); /* bit 11 is EEPROM data */ - eeprom_device *eeprom = downcast(device); - return (m_eeprom & 0xf4ff) | (eeprom->read_bit()<<11) | (ioport("IN1")->read() & 0x0300); + return (m_eeprom_data & 0xf4ff) | (m_eeprom->read_bit()<<11) | (ioport("IN1")->read() & 0x0300); } WRITE16_MEMBER(pntnpuzl_state::pntnpuzl_eeprom_w) { - device_t *device = machine().device("eeprom"); - m_eeprom = data; + m_eeprom_data = data; /* bit 12 is data */ /* bit 13 is clock (active high) */ /* bit 14 is cs (active high) */ - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x1000); - eeprom->set_cs_line((data & 0x4000) ? CLEAR_LINE : ASSERT_LINE); - eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit(data & 0x1000); + m_eeprom->set_cs_line((data & 0x4000) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE); } diff --git a/src/mame/drivers/psikyo4.c b/src/mame/drivers/psikyo4.c index 1b46889f61d..38e98750ce0 100644 --- a/src/mame/drivers/psikyo4.c +++ b/src/mame/drivers/psikyo4.c @@ -165,13 +165,11 @@ static const eeprom_interface eeprom_interface_93C56 = WRITE32_MEMBER(psikyo4_state::ps4_eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_16_31) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit((data & 0x00200000) ? 1 : 0); - eeprom->set_cs_line((data & 0x00800000) ? CLEAR_LINE : ASSERT_LINE); - eeprom->set_clock_line((data & 0x00400000) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit((data & 0x00200000) ? 1 : 0); + m_eeprom->set_cs_line((data & 0x00800000) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x00400000) ? ASSERT_LINE : CLEAR_LINE); return; } diff --git a/src/mame/drivers/psikyosh.c b/src/mame/drivers/psikyosh.c index 88339118cdf..91ba34666f2 100644 --- a/src/mame/drivers/psikyosh.c +++ b/src/mame/drivers/psikyosh.c @@ -321,13 +321,11 @@ static const eeprom_interface eeprom_interface_93C56 = WRITE32_MEMBER(psikyosh_state::psh_eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_24_31) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit((data & 0x20000000) ? 1 : 0); - eeprom->set_cs_line((data & 0x80000000) ? CLEAR_LINE : ASSERT_LINE); - eeprom->set_clock_line((data & 0x40000000) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit((data & 0x20000000) ? 1 : 0); + m_eeprom->set_cs_line((data & 0x80000000) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x40000000) ? ASSERT_LINE : CLEAR_LINE); return; } diff --git a/src/mame/drivers/pzletime.c b/src/mame/drivers/pzletime.c index 95aaf060f41..eb1eaaf2369 100644 --- a/src/mame/drivers/pzletime.c +++ b/src/mame/drivers/pzletime.c @@ -31,7 +31,8 @@ public: m_txt_videoram(*this, "txt_videoram"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), - m_oki(*this, "oki") { } + m_oki(*this, "oki"), + m_eeprom(*this, "eeprom") { } /* memory pointers */ required_shared_ptr m_video_regs; @@ -64,6 +65,7 @@ public: UINT32 screen_update_pzletime(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; required_device m_oki; + required_device m_eeprom; }; @@ -167,13 +169,11 @@ WRITE16_MEMBER(pzletime_state::txt_videoram_w) WRITE16_MEMBER(pzletime_state::eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); - eeprom->set_cs_line((data & 0x02) ? CLEAR_LINE : ASSERT_LINE ); - eeprom->set_clock_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->write_bit(data & 0x01); + m_eeprom->set_cs_line((data & 0x02) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_clock_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/r2dx_v33.c b/src/mame/drivers/r2dx_v33.c index c2d99399c6a..66bdbc2516b 100644 --- a/src/mame/drivers/r2dx_v33.c +++ b/src/mame/drivers/r2dx_v33.c @@ -35,7 +35,8 @@ public: m_md_vram(*this, "md_vram"), m_fg_vram(*this, "fg_vram"), m_tx_vram(*this, "tx_vram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_spriteram; DECLARE_WRITE16_MEMBER(rdx_bg_vram_w); @@ -74,6 +75,7 @@ public: INTERRUPT_GEN_MEMBER(rdx_v33_interrupt); void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect,int pri); required_device m_maincpu; + optional_device m_eeprom; }; @@ -270,13 +272,11 @@ UINT32 r2dx_v33_state::screen_update_rdx_v33(screen_device &screen, bitmap_ind16 WRITE16_MEMBER(r2dx_v33_state::rdx_v33_eeprom_w) { - device_t *device = machine().device("eeprom"); if (ACCESSING_BITS_0_7) { - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); - eeprom->write_bit(data & 0x20); - eeprom->set_cs_line((data & 0x08) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit(data & 0x20); + m_eeprom->set_cs_line((data & 0x08) ? CLEAR_LINE : ASSERT_LINE); if (data&0xc7) logerror("eeprom_w extra bits used %04x\n",data); } diff --git a/src/mame/drivers/rabbit.c b/src/mame/drivers/rabbit.c index c17233a69f6..d03cdbffeee 100644 --- a/src/mame/drivers/rabbit.c +++ b/src/mame/drivers/rabbit.c @@ -100,7 +100,8 @@ public: m_spriteregs(*this, "spriteregs"), m_blitterregs(*this, "blitterregs"), m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_viewregs0; required_shared_ptr m_viewregs6; @@ -147,6 +148,7 @@ public: void rabbit_drawtilemap( bitmap_ind16 &bitmap, const rectangle &cliprect, int whichtilemap ); void rabbit_do_blit(); required_device m_maincpu; + required_device m_eeprom; }; @@ -671,20 +673,18 @@ WRITE32_MEMBER(rabbit_state::rabbit_blitter_w) WRITE32_MEMBER(rabbit_state::rabbit_eeprom_write) { - device_t *device = machine().device("eeprom"); // don't disturb the EEPROM if we're not actually writing to it // (in particular, data & 0x100 here with mask = ffff00ff looks to be the watchdog) if (mem_mask == 0xff000000) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01000000); + m_eeprom->write_bit(data & 0x01000000); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x04000000) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line((data & 0x04000000) ? CLEAR_LINE : ASSERT_LINE ); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/rbmk.c b/src/mame/drivers/rbmk.c index 7af1c06c8be..2a673c6bac9 100644 --- a/src/mame/drivers/rbmk.c +++ b/src/mame/drivers/rbmk.c @@ -65,7 +65,8 @@ public: m_gms_vidram2(*this, "gms_vidram2"), m_gms_vidram(*this, "gms_vidram"), m_maincpu(*this, "maincpu"), - m_mcu(*this, "mcu") { } + m_mcu(*this, "mcu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_gms_vidram2; required_shared_ptr m_gms_vidram; @@ -84,6 +85,7 @@ public: INTERRUPT_GEN_MEMBER(mcu_irq); required_device m_maincpu; required_device m_mcu; + required_device m_eeprom; }; @@ -108,15 +110,13 @@ WRITE16_MEMBER(rbmk_state::gms_write3) WRITE16_MEMBER(rbmk_state::eeprom_w) { - device_t *device = machine().device("eeprom"); //bad ? if( ACCESSING_BITS_0_7 ) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x04); - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE:ASSERT_LINE ); + m_eeprom->write_bit(data & 0x04); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE:ASSERT_LINE ); - eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/seibuspi.c b/src/mame/drivers/seibuspi.c index 7352513f6dd..eb55092517e 100644 --- a/src/mame/drivers/seibuspi.c +++ b/src/mame/drivers/seibuspi.c @@ -866,17 +866,15 @@ READ32_MEMBER(seibuspi_state::spi_unknown_r) WRITE32_MEMBER(seibuspi_state::eeprom_w) { - device_t *device = machine().device("eeprom"); okim6295_device *oki2 = machine().device("oki2"); // tile banks if( ACCESSING_BITS_16_23 ) { rf2_set_layer_banks(data >> 16); - eeprom_device *eeprom = downcast(device); - eeprom->write_bit((data & 0x800000) ? 1 : 0); - eeprom->set_clock_line((data & 0x400000) ? ASSERT_LINE : CLEAR_LINE); - eeprom->set_cs_line((data & 0x200000) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->write_bit((data & 0x800000) ? 1 : 0); + m_eeprom->set_clock_line((data & 0x400000) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_cs_line((data & 0x200000) ? CLEAR_LINE : ASSERT_LINE); } // oki banking @@ -1101,11 +1099,9 @@ WRITE_LINE_MEMBER(seibuspi_state::irqhandler) WRITE32_MEMBER(seibuspi_state::sys386f2_eeprom_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->write_bit((data & 0x80) ? 1 : 0); - eeprom->set_clock_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); - eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->write_bit((data & 0x80) ? 1 : 0); + m_eeprom->set_clock_line((data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); } static const ymf271_interface ymf271_config = diff --git a/src/mame/drivers/seta2.c b/src/mame/drivers/seta2.c index 01f9c5bc233..5f860676b0d 100644 --- a/src/mame/drivers/seta2.c +++ b/src/mame/drivers/seta2.c @@ -182,18 +182,14 @@ ADDRESS_MAP_END READ16_MEMBER(seta2_state::gundamex_eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return ((eeprom->read_bit() & 1)) << 3; + return ((m_eeprom->read_bit() & 1)) << 3; } WRITE16_MEMBER(seta2_state::gundamex_eeprom_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((data & 0x2) ? ASSERT_LINE : CLEAR_LINE); - eeprom->write_bit(data & 0x1); - eeprom->set_cs_line((data & 0x4) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_clock_line((data & 0x2) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit(data & 0x1); + m_eeprom->set_cs_line((data & 0x4) ? CLEAR_LINE : ASSERT_LINE); } static ADDRESS_MAP_START( gundamex_map, AS_PROGRAM, 16, seta2_state ) diff --git a/src/mame/drivers/sigmab98.c b/src/mame/drivers/sigmab98.c index f3fb8e77f58..32facc430d0 100644 --- a/src/mame/drivers/sigmab98.c +++ b/src/mame/drivers/sigmab98.c @@ -103,11 +103,13 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this,"maincpu"), m_spriteram(*this, "spriteram"), - m_nvram(*this, "nvram"){ } + m_nvram(*this, "nvram"), + m_eeprom(*this, "eeprom"){ } required_device m_maincpu; optional_shared_ptr m_spriteram; required_shared_ptr m_nvram; + required_device m_eeprom; UINT8 m_reg; UINT8 m_rombank; @@ -443,17 +445,15 @@ void sigmab98_state::show_outputs() // Port c0 WRITE8_MEMBER(sigmab98_state::eeprom_w) { - device_t *device = machine().device("eeprom"); // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x40); + m_eeprom->write_bit(data & 0x40); // reset line asserted: reset. // if ((m_c0 ^ data) & 0x20) - eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); m_c0 = data; //show_outputs(state); @@ -644,23 +644,19 @@ READ8_MEMBER(sigmab98_state::animalc_rambank_r) READ8_MEMBER(sigmab98_state::sammymdl_eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return eeprom->read_bit() ? 0x80 : 0; + return m_eeprom->read_bit() ? 0x80 : 0; } WRITE8_MEMBER(sigmab98_state::sammymdl_eeprom_w) { - device_t *device = machine().device("eeprom"); // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x40); + m_eeprom->write_bit(data & 0x40); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x20) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x10) ? ASSERT_LINE : CLEAR_LINE); if (data & 0x8f) logerror("%s: unknown eeeprom bits written %02x\n", machine().describe_context(), data); diff --git a/src/mame/drivers/spool99.c b/src/mame/drivers/spool99.c index 99a1a89cb73..58c6d9c0016 100644 --- a/src/mame/drivers/spool99.c +++ b/src/mame/drivers/spool99.c @@ -102,7 +102,8 @@ public: m_main(*this, "mainram"), m_vram(*this, "vram"), m_cram(*this, "cram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_main; required_shared_ptr m_vram; @@ -120,6 +121,7 @@ public: virtual void video_start(); UINT32 screen_update_spool99(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); required_device m_maincpu; + required_device m_eeprom; }; TILE_GET_INFO_MEMBER(spool99_state::get_spool99_tile_info) @@ -194,26 +196,20 @@ READ8_MEMBER(spool99_state::spool99_io_r) WRITE8_MEMBER(spool99_state::eeprom_resetline_w) { - device_t *device = machine().device("eeprom"); // reset line asserted: reset. - eeprom_device *eeprom = downcast(device); - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE ); } WRITE8_MEMBER(spool99_state::eeprom_clockline_w) { - device_t *device = machine().device("eeprom"); // clock line asserted: write latch or select next bit to read - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE ); } WRITE8_MEMBER(spool99_state::eeprom_dataline_w) { - device_t *device = machine().device("eeprom"); // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); + m_eeprom->write_bit(data & 0x01); } static ADDRESS_MAP_START( spool99_map, AS_PROGRAM, 8, spool99_state ) diff --git a/src/mame/drivers/stlforce.c b/src/mame/drivers/stlforce.c index 494323a5215..5ced05a6b02 100644 --- a/src/mame/drivers/stlforce.c +++ b/src/mame/drivers/stlforce.c @@ -76,13 +76,11 @@ TO DO : WRITE16_MEMBER(stlforce_state::eeprom_w) { - device_t *device = machine().device("eeprom"); if( ACCESSING_BITS_0_7 ) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); - eeprom->set_cs_line((data & 0x02) ? CLEAR_LINE : ASSERT_LINE ); - eeprom->set_clock_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->write_bit(data & 0x01); + m_eeprom->set_cs_line((data & 0x02) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_clock_line((data & 0x04) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/tecmosys.c b/src/mame/drivers/tecmosys.c index c92e6d186e4..460aa93483e 100644 --- a/src/mame/drivers/tecmosys.c +++ b/src/mame/drivers/tecmosys.c @@ -269,20 +269,16 @@ READ16_MEMBER(tecmosys_state::unk880000_r) READ16_MEMBER(tecmosys_state::eeprom_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return ((eeprom->read_bit() & 0x01) << 11); + return ((m_eeprom->read_bit() & 0x01) << 11); } WRITE16_MEMBER(tecmosys_state::eeprom_w) { - device_t *device = machine().device("eeprom"); if ( ACCESSING_BITS_8_15 ) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x0800); - eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE ); - eeprom->set_clock_line((data & 0x0400) ? CLEAR_LINE: ASSERT_LINE ); + m_eeprom->write_bit(data & 0x0800); + m_eeprom->set_cs_line((data & 0x0200) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_clock_line((data & 0x0400) ? CLEAR_LINE: ASSERT_LINE ); } } diff --git a/src/mame/drivers/tmmjprd.c b/src/mame/drivers/tmmjprd.c index c21913225fe..5479af49f42 100644 --- a/src/mame/drivers/tmmjprd.c +++ b/src/mame/drivers/tmmjprd.c @@ -42,7 +42,8 @@ public: m_tilemap_regs(*this, "tilemap_regs"), m_spriteregs(*this, "spriteregs"), m_spriteram(*this, "spriteram") , - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr_array m_tilemap_regs; required_shared_ptr m_spriteregs; @@ -77,6 +78,7 @@ public: void ttmjprd_draw_tilemap(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32*tileram, UINT32*tileregs, UINT8*rom ); void tmmjprd_do_blit(); required_device m_maincpu; + required_device m_eeprom; }; @@ -499,7 +501,6 @@ WRITE32_MEMBER(tmmjprd_state::tmmjprd_blitter_w) WRITE32_MEMBER(tmmjprd_state::tmmjprd_eeprom_write) { - device_t *device = machine().device("eeprom"); // don't disturb the EEPROM if we're not actually writing to it // (in particular, data & 0x100 here with mask = ffff00ff looks to be the watchdog) if (mem_mask == 0x000000ff) @@ -508,14 +509,13 @@ WRITE32_MEMBER(tmmjprd_state::tmmjprd_eeprom_write) if (mem_mask == 0xff000000) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01000000); + m_eeprom->write_bit(data & 0x01000000); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x04000000) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_cs_line((data & 0x04000000) ? CLEAR_LINE : ASSERT_LINE ); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/unico.c b/src/mame/drivers/unico.c index 262afba82a6..c7795bd359a 100644 --- a/src/mame/drivers/unico.c +++ b/src/mame/drivers/unico.c @@ -198,21 +198,19 @@ WRITE32_MEMBER(unico_state::zeropnt2_leds_w) WRITE32_MEMBER(unico_state::zeropnt2_eeprom_w) { - device_t *device = machine().device("eeprom"); if (data & ~0xfe00000) logerror("%s - Unknown EEPROM bit written %04X\n",machine().describe_context(),data); if ( ACCESSING_BITS_24_31 ) { // latch the bit - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x04000000); + m_eeprom->write_bit(data & 0x04000000); // reset line asserted: reset. - eeprom->set_cs_line((data & 0x01000000) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x01000000) ? CLEAR_LINE : ASSERT_LINE); // clock line asserted: write latch or select next bit to read - eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->set_clock_line((data & 0x02000000) ? ASSERT_LINE : CLEAR_LINE ); } } diff --git a/src/mame/drivers/vamphalf.c b/src/mame/drivers/vamphalf.c index d21963fcccf..676025d9e50 100644 --- a/src/mame/drivers/vamphalf.c +++ b/src/mame/drivers/vamphalf.c @@ -79,7 +79,8 @@ public: m_wram32(*this,"wram32"), m_maincpu(*this, "maincpu"), m_oki(*this, "oki"), - m_oki2(*this, "oki_2") { + m_oki2(*this, "oki_2"), + m_eeprom(*this, "eeprom") { m_has_extra_gfx = 0; } @@ -171,15 +172,14 @@ public: required_device m_maincpu; optional_device m_oki; optional_device m_oki2; + required_device m_eeprom; }; READ16_MEMBER(vamphalf_state::eeprom_r) { - device_t *device = machine().device("eeprom"); if(offset) { - eeprom_device *eeprom = downcast(device); - return eeprom->read_bit(); + return m_eeprom->read_bit(); } else return 0; @@ -187,20 +187,16 @@ READ16_MEMBER(vamphalf_state::eeprom_r) READ32_MEMBER(vamphalf_state::eeprom32_r) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - return eeprom->read_bit(); + return m_eeprom->read_bit(); } WRITE16_MEMBER(vamphalf_state::eeprom_w) { - device_t *device = machine().device("eeprom"); if(offset) { - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); - eeprom->set_cs_line((data & 0x04) ? CLEAR_LINE : ASSERT_LINE ); - eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->write_bit(data & 0x01); + m_eeprom->set_cs_line((data & 0x04) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); // data & 8? } @@ -208,20 +204,16 @@ WRITE16_MEMBER(vamphalf_state::eeprom_w) WRITE32_MEMBER(vamphalf_state::eeprom32_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); - eeprom->set_cs_line((data & 0x04) ? CLEAR_LINE : ASSERT_LINE ); - eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->write_bit(data & 0x01); + m_eeprom->set_cs_line((data & 0x04) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_clock_line((data & 0x02) ? ASSERT_LINE : CLEAR_LINE ); } WRITE32_MEMBER(vamphalf_state::finalgdr_eeprom_w) { - device_t *device = machine().device("eeprom"); - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x4000); - eeprom->set_cs_line((data & 0x1000) ? CLEAR_LINE : ASSERT_LINE ); - eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE ); + m_eeprom->write_bit(data & 0x4000); + m_eeprom->set_cs_line((data & 0x1000) ? CLEAR_LINE : ASSERT_LINE ); + m_eeprom->set_clock_line((data & 0x2000) ? ASSERT_LINE : CLEAR_LINE ); } WRITE16_MEMBER(vamphalf_state::flipscreen_w) diff --git a/src/mame/drivers/wheelfir.c b/src/mame/drivers/wheelfir.c index 5d4ed5f0c51..e74a3a578fb 100644 --- a/src/mame/drivers/wheelfir.c +++ b/src/mame/drivers/wheelfir.c @@ -766,7 +766,6 @@ void wheelfir_state::machine_reset() void wheelfir_state::machine_start() { m_screen = machine().device("screen"); - m_eeprom = machine().device("eeprom"); m_zoom_table = auto_alloc_array(machine(), INT32, ZOOM_TABLE_SIZE); m_blitter_data = auto_alloc_array(machine(), UINT16, 16); diff --git a/src/mame/drivers/xorworld.c b/src/mame/drivers/xorworld.c index 937f04fd9ca..54eb1f239db 100644 --- a/src/mame/drivers/xorworld.c +++ b/src/mame/drivers/xorworld.c @@ -46,26 +46,20 @@ EEPROM chip: 93C46 WRITE16_MEMBER(xorworld_state::eeprom_chip_select_w) { - device_t *device = machine().device("eeprom"); /* bit 0 is CS (active low) */ - eeprom_device *eeprom = downcast(device); - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); } WRITE16_MEMBER(xorworld_state::eeprom_serial_clock_w) { - device_t *device = machine().device("eeprom"); /* bit 0 is SK (active high) */ - eeprom_device *eeprom = downcast(device); - eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); } WRITE16_MEMBER(xorworld_state::eeprom_data_w) { - device_t *device = machine().device("eeprom"); /* bit 0 is EEPROM data (DIN) */ - eeprom_device *eeprom = downcast(device); - eeprom->write_bit(data & 0x01); + m_eeprom->write_bit(data & 0x01); } WRITE16_MEMBER(xorworld_state::xorworld_irq2_ack_w) diff --git a/src/mame/includes/20pacgal.h b/src/mame/includes/20pacgal.h index 0b0c5e37677..1abda74271c 100644 --- a/src/mame/includes/20pacgal.h +++ b/src/mame/includes/20pacgal.h @@ -5,7 +5,7 @@ driver by Nicola Salmoria ***************************************************************************/ - +#include "machine/eeprom.h" class _20pacgal_state : public driver_device { @@ -17,7 +17,8 @@ public: m_stars_seed(*this, "stars_seed"), m_stars_ctrl(*this, "stars_ctrl"), m_flip(*this, "flip"), - m_maincpu(*this, "maincpu"){ } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } /* memory pointers */ required_shared_ptr m_video_ram; @@ -31,7 +32,7 @@ public: /* devices */ required_device m_maincpu; - device_t *m_eeprom; + required_device m_eeprom; /* memory */ UINT8 m_sprite_gfx_ram[0x2000]; diff --git a/src/mame/includes/8080bw.h b/src/mame/includes/8080bw.h index 7f1c67c6c8b..913da517719 100644 --- a/src/mame/includes/8080bw.h +++ b/src/mame/includes/8080bw.h @@ -25,7 +25,7 @@ public: optional_device m_schaser_effect_555_timer; optional_device m_claybust_gun_on; optional_device m_discrete; - required_device m_speaker; + optional_device m_speaker; /* misc game specific */ diff --git a/src/mame/includes/cave.h b/src/mame/includes/cave.h index 36d6ce7a664..3617fd325ed 100644 --- a/src/mame/includes/cave.h +++ b/src/mame/includes/cave.h @@ -3,6 +3,7 @@ Cave hardware ***************************************************************************/ +#include "machine/eeprom.h" struct sprite_cave { @@ -35,7 +36,8 @@ public: m_mirror_ram(*this, "mirror_ram"), m_maincpu(*this, "maincpu"), m_audiocpu(*this, "audiocpu"), - m_int_timer(*this, "int_timer") { } + m_int_timer(*this, "int_timer"), + m_eeprom(*this, "eeprom") { } /* memory pointers */ required_shared_ptr m_videoregs; @@ -210,4 +212,5 @@ public: void sailormn_tilebank_w(int bank); DECLARE_WRITE_LINE_MEMBER(irqhandler); DECLARE_WRITE_LINE_MEMBER(sound_irq_gen); + optional_device m_eeprom; }; diff --git a/src/mame/includes/deco32.h b/src/mame/includes/deco32.h index d97aedd2f3b..293db72bb42 100644 --- a/src/mame/includes/deco32.h +++ b/src/mame/includes/deco32.h @@ -1,6 +1,7 @@ #include "audio/decobsmt.h" #include "video/bufsprite.h" #include "video/decospr.h" +#include "machine/eeprom.h" class deco32_state : public driver_device { @@ -19,7 +20,8 @@ public: m_ace_ram(*this, "ace_ram"), m_sprgen(*this, "spritegen"), m_sprgen1(*this, "spritegen1"), - m_sprgen2(*this, "spritegen2") + m_sprgen2(*this, "spritegen2"), + m_eeprom(*this, "eeprom") { } required_device m_maincpu; @@ -37,6 +39,8 @@ public: optional_device m_sprgen; optional_device m_sprgen1; optional_device m_sprgen2; + + optional_device m_eeprom; int m_raster_enable; timer_device *m_raster_irq_timer; diff --git a/src/mame/includes/deco_mlc.h b/src/mame/includes/deco_mlc.h index a43ac5b0b16..ed11808b3f2 100644 --- a/src/mame/includes/deco_mlc.h +++ b/src/mame/includes/deco_mlc.h @@ -1,3 +1,5 @@ +#include "machine/eeprom.h" + class deco_mlc_state : public driver_device { public: @@ -7,7 +9,8 @@ public: m_irq_ram(*this, "irq_ram"), m_mlc_clip_ram(*this, "mlc_clip_ram"), m_mlc_vram(*this, "mlc_vram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_mlc_ram; required_shared_ptr m_irq_ram; @@ -60,4 +63,5 @@ public: void draw_sprites( const rectangle &cliprect, int scanline, UINT32* dest); void descramble_sound( ); required_device m_maincpu; + required_device m_eeprom; }; diff --git a/src/mame/includes/gaelco2.h b/src/mame/includes/gaelco2.h index bee52dce8a8..720cd38ddf1 100644 --- a/src/mame/includes/gaelco2.h +++ b/src/mame/includes/gaelco2.h @@ -1,5 +1,6 @@ #include "cpu/m68000/m68000.h" #include "video/bufsprite.h" +#include "machine/eeprom.h" class gaelco2_state : public driver_device { @@ -9,12 +10,14 @@ public: m_maincpu(*this,"maincpu"), m_spriteram(*this,"spriteram"), m_vregs(*this, "vregs"), - m_snowboar_protection(*this, "snowboar_prot"){ } + m_snowboar_protection(*this, "snowboar_prot"), + m_eeprom(*this, "eeprom"){ } required_device m_maincpu; required_device m_spriteram; required_shared_ptr m_vregs; optional_shared_ptr m_snowboar_protection; + optional_device m_eeprom; int m_clr_gun_int; UINT8 m_analog_ports[2]; diff --git a/src/mame/includes/gaelco3d.h b/src/mame/includes/gaelco3d.h index b1da9fa0bbf..e3ee590ceb1 100644 --- a/src/mame/includes/gaelco3d.h +++ b/src/mame/includes/gaelco3d.h @@ -8,6 +8,7 @@ #include "sound/dmadac.h" #include "video/polynew.h" +#include "machine/eeprom.h" #define SOUND_CHANNELS 4 @@ -57,7 +58,8 @@ public: m_tms_comm_base(*this,"tms_comm_base",0), m_adsp_control_regs(*this,"adsp_regs"), m_adsp_fastram_base(*this,"adsp_fastram") , - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_adsp_ram_base; required_shared_ptr m_m68k_ram_base; @@ -122,4 +124,5 @@ public: TIMER_DEVICE_CALLBACK_MEMBER(adsp_autobuffer_irq); void gaelco3d_render(screen_device &screen); required_device m_maincpu; + required_device m_eeprom; }; diff --git a/src/mame/includes/galpani2.h b/src/mame/includes/galpani2.h index 7c2f7ea5d2d..bf53af2a4e3 100644 --- a/src/mame/includes/galpani2.h +++ b/src/mame/includes/galpani2.h @@ -1,5 +1,6 @@ #include "video/kaneko_spr.h" #include "sound/okim6295.h" +#include "machine/eeprom.h" class galpani2_state : public driver_device { @@ -18,7 +19,8 @@ public: m_subcpu(*this,"sub"), m_kaneko_spr(*this, "kan_spr"), m_spriteram(*this, "spriteram"), - m_oki2(*this, "oki2") + m_oki2(*this, "oki2"), + m_eeprom(*this, "eeprom") { } required_shared_ptr_array m_bg8; @@ -69,4 +71,5 @@ public: DECLARE_WRITE16_MEMBER( galpani2_bg15_w ); required_device m_oki2; + required_device m_eeprom; }; diff --git a/src/mame/includes/leland.h b/src/mame/includes/leland.h index e756397abcc..6f11a81f330 100644 --- a/src/mame/includes/leland.h +++ b/src/mame/includes/leland.h @@ -5,6 +5,7 @@ *************************************************************************/ #include "devlegcy.h" +#include "machine/eeprom.h" #define LELAND_BATTERY_RAM_SIZE 0x4000 #define ATAXX_EXTRA_TRAM_SIZE 0x800 @@ -24,10 +25,12 @@ public: leland_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_master(*this, "master"), - m_slave(*this, "slave") { } + m_slave(*this, "slave"), + m_eeprom(*this, "eeprom") { } required_device m_master; required_device m_slave; + required_device m_eeprom; UINT8 m_dac_control; UINT8 *m_alleymas_kludge_mem; diff --git a/src/mame/includes/metro.h b/src/mame/includes/metro.h index 1d3df441248..5d5b9634303 100644 --- a/src/mame/includes/metro.h +++ b/src/mame/includes/metro.h @@ -7,6 +7,7 @@ #include "sound/okim6295.h" #include "sound/2151intf.h" #include "video/konicdev.h" +#include "machine/eeprom.h" class metro_state : public driver_device { @@ -33,7 +34,8 @@ public: m_videoregs(*this, "videoregs"), m_screenctrl(*this, "screenctrl"), m_input_sel(*this, "input_sel"), - m_k053936_ram(*this, "k053936_ram") + m_k053936_ram(*this, "k053936_ram"), + m_eeprom(*this, "eeprom") { } /* devices */ @@ -60,6 +62,8 @@ public: optional_shared_ptr m_screenctrl; optional_shared_ptr m_input_sel; optional_shared_ptr m_k053936_ram; + + optional_device m_eeprom; int m_flip_screen; diff --git a/src/mame/includes/mitchell.h b/src/mame/includes/mitchell.h index 3974ed3f9a1..d7526968802 100644 --- a/src/mame/includes/mitchell.h +++ b/src/mame/includes/mitchell.h @@ -6,6 +6,7 @@ #include "sound/okim6295.h" #include "machine/nvram.h" +#include "machine/eeprom.h" class mitchell_state : public driver_device { @@ -17,7 +18,8 @@ public: m_oki(*this, "oki") , m_nvram(*this, "nvram"), m_colorram(*this, "colorram"), - m_videoram(*this, "videoram"){ } + m_videoram(*this, "videoram"), + m_eeprom(*this, "eeprom"){ } /* devices */ required_device m_maincpu; @@ -27,6 +29,8 @@ public: /* memory pointers */ required_shared_ptr m_colorram; required_shared_ptr m_videoram; + + optional_device m_eeprom; /* video-related */ tilemap_t *m_bg_tilemap; diff --git a/src/mame/includes/plygonet.h b/src/mame/includes/plygonet.h index b9b49def4bc..5fbe187f6d8 100644 --- a/src/mame/includes/plygonet.h +++ b/src/mame/includes/plygonet.h @@ -1,3 +1,5 @@ +#include "machine/eeprom.h" + static const UINT16 dsp56k_bank00_size = 0x1000; static const UINT16 dsp56k_bank01_size = 0x1000; static const UINT16 dsp56k_bank02_size = 0x4000; @@ -13,7 +15,8 @@ public: m_dsp56k_p_mirror(*this, "dsp56k_p_mirror"), m_dsp56k_p_8000(*this, "dsp56k_p_8000"), m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu") { } + m_soundcpu(*this, "soundcpu"), + m_eeprom(*this, "eeprom") { } /* 68k-side shared ram */ required_shared_ptr m_shared_ram; @@ -80,4 +83,5 @@ public: void reset_sound_region(); required_device m_maincpu; required_device m_soundcpu; + required_device m_eeprom; }; diff --git a/src/mame/includes/psikyo4.h b/src/mame/includes/psikyo4.h index 3ca866ba10f..7216678b581 100644 --- a/src/mame/includes/psikyo4.h +++ b/src/mame/includes/psikyo4.h @@ -5,7 +5,7 @@ *************************************************************************/ #define MASTER_CLOCK 57272700 // main oscillator frequency - +#include "machine/eeprom.h" class psikyo4_state : public driver_device { @@ -19,7 +19,8 @@ public: m_paletteram(*this, "paletteram"), m_io_select(*this, "io_select"), m_ram(*this, "ram"), - m_maincpu(*this, "maincpu"){ } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom"){ } /* memory pointers */ required_shared_ptr m_spriteram; @@ -36,6 +37,8 @@ public: /* devices */ required_device m_maincpu; + required_device m_eeprom; + DECLARE_WRITE32_MEMBER(ps4_paletteram32_RRRRRRRRGGGGGGGGBBBBBBBBxxxxxxxx_dword_w); DECLARE_WRITE32_MEMBER(ps4_bgpen_1_dword_w); DECLARE_WRITE32_MEMBER(ps4_bgpen_2_dword_w); diff --git a/src/mame/includes/psikyosh.h b/src/mame/includes/psikyosh.h index 641fe2c93c6..f01c1cc5bb9 100644 --- a/src/mame/includes/psikyosh.h +++ b/src/mame/includes/psikyosh.h @@ -1,4 +1,5 @@ #include "video/bufsprite.h" +#include "machine/eeprom.h" #define MASTER_CLOCK 57272700 // main oscillator frequency @@ -28,7 +29,8 @@ public: m_zoomram(*this, "zoomram"), m_vidregs(*this, "vidregs"), m_ram(*this, "ram"), - m_maincpu(*this, "maincpu"){ } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom"){ } /* memory pointers */ required_device m_spriteram; @@ -47,6 +49,7 @@ public: /* devices */ required_device m_maincpu; + required_device m_eeprom; DECLARE_WRITE32_MEMBER(psikyosh_irqctrl_w); DECLARE_WRITE32_MEMBER(paletteram32_RRRRRRRRGGGGGGGGBBBBBBBBxxxxxxxx_dword_w); diff --git a/src/mame/includes/seibuspi.h b/src/mame/includes/seibuspi.h index 2f2583cfd09..e5f4d3e0be1 100644 --- a/src/mame/includes/seibuspi.h +++ b/src/mame/includes/seibuspi.h @@ -1,4 +1,5 @@ #include "machine/intelfsh.h" +#include "machine/eeprom.h" #define FIFO_SIZE 512 @@ -10,7 +11,8 @@ public: m_spi_scrollram(*this, "spi_scrollram"), m_spimainram(*this, "spimainram"), m_maincpu(*this, "maincpu"), - m_soundcpu(*this, "soundcpu") { } + m_soundcpu(*this, "soundcpu"), + m_eeprom(*this, "eeprom") { } optional_shared_ptr m_spi_scrollram; required_shared_ptr m_spimainram; @@ -135,6 +137,7 @@ public: DECLARE_WRITE_LINE_MEMBER(irqhandler); required_device m_maincpu; optional_device m_soundcpu; + required_device m_eeprom; }; /*----------- defined in machine/spisprit.c -----------*/ void seibuspi_sprite_decrypt(UINT8 *src, int romsize); diff --git a/src/mame/includes/seta2.h b/src/mame/includes/seta2.h index 778e5c9144e..73bfd46561c 100644 --- a/src/mame/includes/seta2.h +++ b/src/mame/includes/seta2.h @@ -1,4 +1,5 @@ #include "sound/okim9810.h" +#include "machine/eeprom.h" class seta2_state : public driver_device { @@ -12,7 +13,8 @@ public: m_coldfire_regs(*this, "coldfire_regs"), m_funcube_outputs(*this, "funcube_outputs"), m_funcube_leds(*this, "funcube_leds"), - m_oki(*this, "oki"){ } + m_oki(*this, "oki"), + m_eeprom(*this, "eeprom"){ } required_device m_maincpu; optional_shared_ptr m_nvram; @@ -81,4 +83,5 @@ public: void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); void funcube_debug_outputs(); optional_device m_oki; + optional_device m_eeprom; }; diff --git a/src/mame/includes/stlforce.h b/src/mame/includes/stlforce.h index 75768b21728..253f0e18522 100644 --- a/src/mame/includes/stlforce.h +++ b/src/mame/includes/stlforce.h @@ -1,4 +1,5 @@ #include "sound/okim6295.h" +#include "machine/eeprom.h" class stlforce_state : public driver_device { @@ -15,7 +16,8 @@ public: m_vidattrram(*this, "vidattrram"), m_spriteram(*this, "spriteram"), m_maincpu(*this, "maincpu"), - m_oki(*this, "oki") { } + m_oki(*this, "oki"), + m_eeprom(*this, "eeprom") { } tilemap_t *m_bg_tilemap; tilemap_t *m_mlow_tilemap; @@ -51,4 +53,5 @@ public: void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); required_device m_maincpu; required_device m_oki; + required_device m_eeprom; }; diff --git a/src/mame/includes/tecmosys.h b/src/mame/includes/tecmosys.h index ba069c2a6aa..4f204b22800 100644 --- a/src/mame/includes/tecmosys.h +++ b/src/mame/includes/tecmosys.h @@ -3,6 +3,7 @@ tecmosys protection simulation ***************************************************************************/ +#include "machine/eeprom.h" class tecmosys_state : public driver_device { @@ -24,7 +25,8 @@ public: m_c80000regs(*this, "c80000regs"), m_880000regs(*this, "880000regs"), m_maincpu(*this, "maincpu"), - m_audiocpu(*this, "audiocpu") { } + m_audiocpu(*this, "audiocpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_spriteram; required_shared_ptr m_tilemap_paletteram16; @@ -92,4 +94,5 @@ public: DECLARE_WRITE_LINE_MEMBER(sound_irq); required_device m_maincpu; required_device m_audiocpu; + required_device m_eeprom; }; diff --git a/src/mame/includes/unico.h b/src/mame/includes/unico.h index 1c896159766..a9a41b93df2 100644 --- a/src/mame/includes/unico.h +++ b/src/mame/includes/unico.h @@ -1,4 +1,5 @@ #include "sound/okim6295.h" +#include "machine/eeprom.h" class unico_state : public driver_device { @@ -11,7 +12,8 @@ public: m_scroll32(*this, "scroll32"), m_spriteram(*this, "spriteram", 0), m_maincpu(*this, "maincpu"), - m_oki(*this, "oki") { } + m_oki(*this, "oki"), + m_eeprom(*this, "eeprom") { } optional_shared_ptr m_vram; optional_shared_ptr m_scroll; @@ -50,4 +52,5 @@ public: void zeropnt2_draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect); required_device m_maincpu; optional_device m_oki; + optional_device m_eeprom; }; diff --git a/src/mame/includes/xorworld.h b/src/mame/includes/xorworld.h index 837779b2f6e..8308250740b 100644 --- a/src/mame/includes/xorworld.h +++ b/src/mame/includes/xorworld.h @@ -1,3 +1,5 @@ +#include "machine/eeprom.h" + class xorworld_state : public driver_device { public: @@ -5,7 +7,8 @@ public: : driver_device(mconfig, type, tag), m_videoram(*this, "videoram"), m_spriteram(*this, "spriteram"), - m_maincpu(*this, "maincpu") { } + m_maincpu(*this, "maincpu"), + m_eeprom(*this, "eeprom") { } required_shared_ptr m_videoram; tilemap_t *m_bg_tilemap; @@ -23,4 +26,5 @@ public: UINT32 screen_update_xorworld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect ); required_device m_maincpu; + required_device m_eeprom; }; diff --git a/src/mame/machine/gaelco2.c b/src/mame/machine/gaelco2.c index ba6422626d6..b01cf2bf2ff 100644 --- a/src/mame/machine/gaelco2.c +++ b/src/mame/machine/gaelco2.c @@ -263,22 +263,19 @@ WRITE16_MEMBER(gaelco2_state::wrally2_adc_cs) WRITE16_MEMBER(gaelco2_state::gaelco2_eeprom_cs_w) { /* bit 0 is CS (active low) */ - eeprom_device *eeprom = downcast(machine().device("eeprom")); - eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); + m_eeprom->set_cs_line((data & 0x01) ? CLEAR_LINE : ASSERT_LINE); } WRITE16_MEMBER(gaelco2_state::gaelco2_eeprom_sk_w) { /* bit 0 is SK (active high) */ - eeprom_device *eeprom = downcast(machine().device("eeprom")); - eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_clock_line((data & 0x01) ? ASSERT_LINE : CLEAR_LINE); } WRITE16_MEMBER(gaelco2_state::gaelco2_eeprom_data_w) { /* bit 0 is EEPROM data (DIN) */ - eeprom_device *eeprom = downcast(machine().device("eeprom")); - eeprom->write_bit(data & 0x01); + m_eeprom->write_bit(data & 0x01); } /*************************************************************************** diff --git a/src/mame/machine/leland.c b/src/mame/machine/leland.c index 0b82d82ca80..b8c2b8c2a22 100644 --- a/src/mame/machine/leland.c +++ b/src/mame/machine/leland.c @@ -820,10 +820,9 @@ WRITE8_MEMBER(leland_state::ataxx_eeprom_w) { if (LOG_EEPROM) logerror("%s:EE write %d%d%d\n", machine().describe_context(), (data >> 6) & 1, (data >> 5) & 1, (data >> 4) & 1); - eeprom_device *eeprom = downcast(machine().device("eeprom")); - eeprom->write_bit ((data & 0x10) >> 4); - eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); - eeprom->set_cs_line ((~data & 0x40) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->write_bit ((data & 0x10) >> 4); + m_eeprom->set_clock_line((data & 0x20) ? ASSERT_LINE : CLEAR_LINE); + m_eeprom->set_cs_line ((~data & 0x40) ? ASSERT_LINE : CLEAR_LINE); }