From cc7fbd926efbf38134d08c2fa606e19c7d6f6bba Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Fri, 22 Jun 2018 16:34:11 +0200 Subject: agat, ec184x, enmirage, jpmimpact, jpmmps, jpms80: Removed machine().device, nw --- src/mame/drivers/agat.cpp | 17 ++++++----------- src/mame/drivers/ec184x.cpp | 39 ++++++++++++++++++++------------------- src/mame/drivers/enmirage.cpp | 6 ++++-- src/mame/drivers/jpmimpct.cpp | 3 +-- src/mame/drivers/jpmmps.cpp | 9 ++++----- src/mame/drivers/jpms80.cpp | 9 ++++----- src/mame/includes/jpmimpct.h | 3 +++ src/mame/video/agat7.cpp | 10 +++++++++- src/mame/video/agat7.h | 32 ++++++++++++++++++++------------ 9 files changed, 71 insertions(+), 57 deletions(-) diff --git a/src/mame/drivers/agat.cpp b/src/mame/drivers/agat.cpp index 7323102695c..b52b54fc231 100644 --- a/src/mame/drivers/agat.cpp +++ b/src/mame/drivers/agat.cpp @@ -320,11 +320,6 @@ void agat7_state::machine_start() save_item(NAME(m_an2)); save_item(NAME(m_an3)); save_item(NAME(m_anykeydown)); - - // setup video pointers - m_video->m_ram_dev = machine().device(RAM_TAG); - m_video->m_char_ptr = memregion("gfx1")->base(); - m_video->m_char_size = memregion("gfx1")->bytes(); } void agat7_state::machine_reset() @@ -1083,15 +1078,15 @@ static void agat7_cards(device_slot_interface &device) } MACHINE_CONFIG_START(agat7_state::agat7) - MCFG_DEVICE_ADD("maincpu", M6502, XTAL(14'300'000) / 14) + MCFG_DEVICE_ADD(m_maincpu, M6502, XTAL(14'300'000) / 14) MCFG_DEVICE_PROGRAM_MAP(agat7_map) MCFG_DEVICE_VBLANK_INT_DRIVER(A7_VIDEO_TAG ":a7screen", agat7_state, agat_vblank) MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", agat7_state, timer_irq, A7_VIDEO_TAG ":a7screen", 0, 1) - MCFG_DEVICE_ADD(A7_VIDEO_TAG, AGAT7VIDEO, 0) + MCFG_DEVICE_ADD(m_video, AGAT7VIDEO, RAM_TAG, "gfx1") - MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_ADD(m_ram) MCFG_RAM_DEFAULT_SIZE("32K") // MCFG_RAM_EXTRA_OPTIONS("64K,128K") MCFG_RAM_DEFAULT_VALUE(0x00) @@ -1102,14 +1097,14 @@ MACHINE_CONFIG_START(agat7_state::agat7) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) /* /INH banking */ - MCFG_DEVICE_ADD(A7_UPPERBANK_TAG, ADDRESS_MAP_BANK, 0) + MCFG_DEVICE_ADD(m_upperbank, ADDRESS_MAP_BANK, 0) MCFG_DEVICE_PROGRAM_MAP(inhbank_map) MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE) MCFG_ADDRESS_MAP_BANK_DATA_WIDTH(8) MCFG_ADDRESS_MAP_BANK_STRIDE(0x3000) /* keyboard controller -- XXX must be replaced */ - MCFG_DEVICE_ADD(A7_KBDC_TAG, AY3600, 0) + MCFG_DEVICE_ADD(m_ay3600, AY3600, 0) MCFG_AY3600_MATRIX_X0(IOPORT("X0")) MCFG_AY3600_MATRIX_X1(IOPORT("X1")) MCFG_AY3600_MATRIX_X2(IOPORT("X2")) @@ -1142,7 +1137,7 @@ MACHINE_CONFIG_START(agat7_state::agat7) A2BUS_SLOT(config, "sl5", m_a2bus, agat7_cards, nullptr); A2BUS_SLOT(config, "sl6", m_a2bus, agat7_cards, "a7ram"); - MCFG_CASSETTE_ADD(A7_CASSETTE_TAG) + MCFG_CASSETTE_ADD(m_cassette) MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED) MACHINE_CONFIG_END diff --git a/src/mame/drivers/ec184x.cpp b/src/mame/drivers/ec184x.cpp index a2eed7a6ff7..59eb98941ac 100644 --- a/src/mame/drivers/ec184x.cpp +++ b/src/mame/drivers/ec184x.cpp @@ -39,30 +39,35 @@ public: ec184x_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") + , m_ram(*this, RAM_TAG) { } - required_device m_maincpu; + void ec1841(machine_config &config); + void ec1847(machine_config &config); + void ec1840(machine_config &config); - DECLARE_MACHINE_RESET(ec1841); void init_ec1841(); - struct - { - uint8_t enable[4]; - int boards; - } m_memory; - +protected: + DECLARE_MACHINE_RESET(ec1841); DECLARE_READ8_MEMBER(memboard_r); DECLARE_WRITE8_MEMBER(memboard_w); - void ec1841(machine_config &config); - void ec1847(machine_config &config); - void ec1840(machine_config &config); + void ec1840_io(address_map &map); void ec1840_map(address_map &map); void ec1841_io(address_map &map); void ec1841_map(address_map &map); void ec1847_io(address_map &map); void ec1847_map(address_map &map); + + required_device m_maincpu; + required_device m_ram; + + struct + { + uint8_t enable[4]; + int boards; + } m_memory; }; /* @@ -101,10 +106,7 @@ READ8_MEMBER(ec184x_state::memboard_r) WRITE8_MEMBER(ec184x_state::memboard_w) { address_space &program = m_maincpu->space(AS_PROGRAM); - ram_device *m_ram = machine().device(RAM_TAG); - uint8_t current; - - current = m_memory.enable[offset]; + uint8_t current = m_memory.enable[offset]; DBG_LOG(1, "ec1841_memboard", ("W (%d of %d) <- %02X (%02X)\n", offset + 1, m_memory.boards, data, current)); @@ -153,7 +155,6 @@ WRITE8_MEMBER(ec184x_state::memboard_w) void ec184x_state::init_ec1841() { address_space &program = m_maincpu->space(AS_PROGRAM); - ram_device *m_ram = machine().device(RAM_TAG); m_memory.boards = m_ram->size() / EC1841_MEMBOARD_SIZE; if (m_memory.boards > 4) m_memory.boards = 4; @@ -243,7 +244,7 @@ MACHINE_CONFIG_START(ec184x_state::ec1840) MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) - MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_ADD(m_ram) MCFG_RAM_DEFAULT_SIZE("512K") MACHINE_CONFIG_END @@ -269,7 +270,7 @@ MACHINE_CONFIG_START(ec184x_state::ec1841) MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_EC_1841) - MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_ADD(m_ram) MCFG_RAM_DEFAULT_SIZE("640K") MCFG_RAM_EXTRA_OPTIONS("512K,1024K,1576K,2048K") MACHINE_CONFIG_END @@ -293,7 +294,7 @@ MACHINE_CONFIG_START(ec184x_state::ec1847) MCFG_PC_KBDC_SLOT_ADD("mb:pc_kbdc", "kbd", pc_xt_keyboards, STR_KBD_KEYTRONIC_PC3270) - MCFG_RAM_ADD(RAM_TAG) + MCFG_RAM_ADD(m_ram) MCFG_RAM_DEFAULT_SIZE("640K") MACHINE_CONFIG_END diff --git a/src/mame/drivers/enmirage.cpp b/src/mame/drivers/enmirage.cpp index 9afc899ffed..ba646de66b0 100644 --- a/src/mame/drivers/enmirage.cpp +++ b/src/mame/drivers/enmirage.cpp @@ -61,6 +61,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_fdc(*this, "wd1772"), + m_floppy_connector(*this, "wd1772:0"), m_via(*this, "via6522"), m_digits(*this, "digit%u", 0U) { @@ -77,6 +78,7 @@ public: void mirage(machine_config &config); void mirage_map(address_map &map); + protected: virtual void machine_reset() override; virtual void machine_start() override { m_digits.resolve(); } @@ -84,6 +86,7 @@ protected: required_device m_maincpu; required_device m_fdc; + required_device m_floppy_connector; required_device m_via; int last_sndram_bank; @@ -257,8 +260,7 @@ ROM_END void enmirage_state::init_mirage() { - floppy_connector *con = machine().device("wd1772:0"); - floppy_image_device *floppy = con ? con->get_device() : nullptr; + floppy_image_device *floppy = m_floppy_connector ? m_floppy_connector->get_device() : nullptr; if (floppy) { m_fdc->set_floppy(floppy); diff --git a/src/mame/drivers/jpmimpct.cpp b/src/mame/drivers/jpmimpct.cpp index 61e1a5e0143..125ac80b51a 100644 --- a/src/mame/drivers/jpmimpct.cpp +++ b/src/mame/drivers/jpmimpct.cpp @@ -259,8 +259,7 @@ READ16_MEMBER(jpmimpct_state::duart_1_r) case 0xe: { attotime rate = attotime::from_hz(MC68681_1_CLOCK) * (16 * duart_1.CT); - timer_device *duart_timer = machine().device("duart_1_timer"); - duart_timer->adjust(rate, 0, rate); + m_duart_1_timer->adjust(rate, 0, rate); break; } case 0xf: diff --git a/src/mame/drivers/jpmmps.cpp b/src/mame/drivers/jpmmps.cpp index cf40f035371..c89465a1275 100644 --- a/src/mame/drivers/jpmmps.cpp +++ b/src/mame/drivers/jpmmps.cpp @@ -156,7 +156,7 @@ public: protected: // devices - required_device m_maincpu; + required_device m_maincpu; required_device m_psg; required_device m_meters; public: @@ -239,15 +239,14 @@ WRITE8_MEMBER(jpmmps_state::jpmmps_ic22_portc_w) void jpmmps_state::machine_reset() { // Disable auto wait state generation by raising the READY line on reset - tms9995_device* cpu = static_cast(machine().device("maincpu")); - cpu->ready_line(ASSERT_LINE); - cpu->reset_line(ASSERT_LINE); + m_maincpu->ready_line(ASSERT_LINE); + m_maincpu->reset_line(ASSERT_LINE); } MACHINE_CONFIG_START(jpmmps_state::jpmmps) // CPU TMS9995, standard variant; no line connections - MCFG_TMS99xx_ADD("maincpu", TMS9995, MAIN_CLOCK, jpmmps_map, jpmmps_io_map) + MCFG_TMS99xx_ADD(m_maincpu, TMS9995, MAIN_CLOCK, jpmmps_map, jpmmps_io_map) MCFG_DEVICE_ADD("mainlatch", LS259, 0) // IC10 MCFG_ADDRESSABLE_LATCH_Q0_OUT_CB(NOOP) // watchdog diff --git a/src/mame/drivers/jpms80.cpp b/src/mame/drivers/jpms80.cpp index ff93036d3ae..6fd0f20d8b7 100644 --- a/src/mame/drivers/jpms80.cpp +++ b/src/mame/drivers/jpms80.cpp @@ -67,7 +67,7 @@ public: protected: // devices - required_device m_maincpu; + required_device m_maincpu; public: void init_jpms80(); }; @@ -126,14 +126,13 @@ INPUT_PORTS_END void jpms80_state::machine_reset() { // Disable auto wait state generation by raising the READY line on reset - tms9995_device* cpu = static_cast(machine().device("maincpu")); - cpu->ready_line(ASSERT_LINE); - cpu->reset_line(ASSERT_LINE); + m_maincpu->ready_line(ASSERT_LINE); + m_maincpu->reset_line(ASSERT_LINE); } MACHINE_CONFIG_START(jpms80_state::jpms80) // CPU TMS9995, standard variant; no line connections - MCFG_TMS99xx_ADD("maincpu", TMS9995, MAIN_CLOCK, jpms80_map, jpms80_io_map) + MCFG_TMS99xx_ADD(m_maincpu, TMS9995, MAIN_CLOCK, jpms80_map, jpms80_io_map) SPEAKER(config, "mono").front_center(); MCFG_DEVICE_ADD("outlatch0", LS259, 0) // I/O IC5 diff --git a/src/mame/includes/jpmimpct.h b/src/mame/includes/jpmimpct.h index bc03b547ed8..df062f1f4a1 100644 --- a/src/mame/includes/jpmimpct.h +++ b/src/mame/includes/jpmimpct.h @@ -63,6 +63,7 @@ class jpmimpct_state : public driver_device public: jpmimpct_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) + , m_duart_1_timer(*this, "duart_1_timer") , m_vfd(*this, "vfd") , m_vram(*this, "vram") , m_maincpu(*this, "maincpu") @@ -144,6 +145,8 @@ private: struct bt477_t m_bt477; void jpm_draw_lamps(int data, int lamp_strobe); void update_irqs(); + + required_device m_duart_1_timer; optional_device m_vfd; optional_shared_ptr m_vram; required_device m_maincpu; diff --git a/src/mame/video/agat7.cpp b/src/mame/video/agat7.cpp index c05ba271414..da54f00fdde 100644 --- a/src/mame/video/agat7.cpp +++ b/src/mame/video/agat7.cpp @@ -56,7 +56,12 @@ MACHINE_CONFIG_END agat7video_device::agat7video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, AGAT7VIDEO, tag, owner, clock), - m_palette(*this, "a7palette") + m_ram_dev(*this, finder_base::DUMMY_TAG), + m_palette(*this, "a7palette"), + m_char_region(*this, finder_base::DUMMY_TAG), + m_char_ptr(nullptr), + m_char_size(0), + m_start_address(0) { } @@ -67,6 +72,9 @@ agat7video_device::agat7video_device(const machine_config &mconfig, const char * void agat7video_device::device_start() { + m_char_ptr = m_char_region->base(); + m_char_size = m_char_region->bytes(); + // save_item(NAME(m_video_mode)); save_item(NAME(m_start_address)); } diff --git a/src/mame/video/agat7.h b/src/mame/video/agat7.h index 796f9fca5b4..6e1cd58a02d 100644 --- a/src/mame/video/agat7.h +++ b/src/mame/video/agat7.h @@ -24,16 +24,19 @@ class agat7video_device : public device_t { public: - // construction/destruction + template + agat7video_device(const machine_config &mconfig, const char *tag, device_t *owner, T &&ram_tag, U &&char_tag) + : agat7video_device(mconfig, tag, owner, (uint32_t)0) + { + m_ram_dev.set_tag(std::forward(ram_tag)); + m_char_region.set_tag(std::forward(char_tag)); + } + agat7video_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); - ram_device *m_ram_dev; - uint8_t *m_char_ptr; - int m_char_size; - protected: virtual void device_start() override; virtual void device_reset() override; @@ -48,6 +51,18 @@ protected: private: void do_io(int offset); + void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); + + uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); + + DECLARE_PALETTE_INIT(agat7); + + required_device m_ram_dev; + required_device m_palette; + required_memory_region m_char_region; + + uint8_t *m_char_ptr; + int m_char_size; uint32_t m_start_address; enum { TEXT_LORES = 0, @@ -57,13 +72,6 @@ private: GRAPHICS_MONO } m_video_mode; - void plot_text_character(bitmap_ind16 &bitmap, int xpos, int ypos, int xscale, uint32_t code, const uint8_t *textgfx_data, uint32_t textgfx_datalen, int fg, int bg); - - uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); - - DECLARE_PALETTE_INIT(agat7); - - required_device m_palette; }; // device type definition -- cgit v1.2.3