From ea5d2a6f4a6762b0332d8cb78069b1de32a220ed Mon Sep 17 00:00:00 2001 From: mooglyguy Date: Sat, 9 Jun 2018 10:10:12 +0200 Subject: apc: Reducing tag lookups --- src/mame/drivers/apc.cpp | 76 +++++++++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 33 deletions(-) diff --git a/src/mame/drivers/apc.cpp b/src/mame/drivers/apc.cpp index 8a368519237..4fa42e45eb6 100644 --- a/src/mame/drivers/apc.cpp +++ b/src/mame/drivers/apc.cpp @@ -75,37 +75,47 @@ public: apc_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), - m_screen(*this, "screen"), m_hgdc1(*this, "upd7220_chr"), m_hgdc2(*this, "upd7220_btm"), m_rtc(*this, "upd1990a"), + m_cmos(*this, "cmos"), m_i8259_m(*this, "pic8259_master"), m_i8259_s(*this, "pic8259_slave"), m_fdc(*this, "upd765"), + m_fdc_connector(*this, "upd765:%u", 0U), m_dmac(*this, "i8237"), m_pit(*this, "pit8253"), + m_speaker(*this, "mono"), + m_sound(*this, "upd1771c"), m_video_ram_1(*this, "video_ram_1"), m_video_ram_2(*this, "video_ram_2"), + m_screen(*this, "screen"), + m_gfxdecode(*this, "gfxdecode"), m_palette(*this, "palette") { } // devices required_device m_maincpu; - required_device m_screen; required_device m_hgdc1; required_device m_hgdc2; required_device m_rtc; + required_device m_cmos; required_device m_i8259_m; required_device m_i8259_s; required_device m_fdc; + required_device_array m_fdc_connector; required_device m_dmac; required_device m_pit; uint8_t *m_char_rom; uint8_t *m_aux_pcg; + required_device m_speaker; + required_device m_sound; + required_shared_ptr m_video_ram_1; required_shared_ptr m_video_ram_2; - + required_device m_screen; + required_device m_gfxdecode; required_device m_palette; // screen updates @@ -350,7 +360,7 @@ READ8_MEMBER(apc_state::apc_kbd_r) switch(offset & 3) { - case 0: res = m_keyb.data; machine().device("pic8259_master")->ir4_w(0); break; // according to the source, reading there acks the irq + case 0: res = m_keyb.data; m_i8259_m->ir4_w(0); break; // according to the source, reading there acks the irq case 1: res = m_keyb.status; break; case 2: res = m_keyb.sig; break; // bit 0: CTRL bit 1: function key (or reversed) case 3: res = ioport("KEY_MOD")->read() & 0xff; break; // sh @@ -418,7 +428,7 @@ WRITE8_MEMBER(apc_state::apc_irq_ack_w) ---x CRT */ if(data & 4) - machine().device("pic8259_master")->ir3_w(0); + m_i8259_m->ir3_w(0); if(data & ~4) logerror("IRQ ACK %02x\n",data); @@ -498,7 +508,7 @@ void apc_state::apc_io(address_map &map) // 0x5a APU data (Arithmetic Processing Unit!) // 0x5b, Power Off // 0x5e APU status/command - map(0x60, 0x60).rw("upd1771c", FUNC(upd1771c_device::read), FUNC(upd1771c_device::write)); + map(0x60, 0x60).rw(m_sound, FUNC(upd1771c_device::read), FUNC(upd1771c_device::write)); // AM_RANGE(0x68, 0x6f) i8255 , ODA printer port (A: status (R) B: data (W) C: command (W)) // 0x70, 0x76 AM_DEVREADWRITE8("upd7220_btm", upd7220_device, read, write, 0x00ff) // 0x71, 0x77 IDA Controller @@ -513,7 +523,7 @@ INPUT_CHANGED_MEMBER(apc_state::key_stroke) { m_keyb.data = (uint8_t)(uintptr_t)(param) & 0xff; //m_keyb.status &= ~1; - machine().device("pic8259_master")->ir4_w(1); + m_i8259_m->ir4_w(1); } if(oldval && !newval) @@ -796,12 +806,12 @@ GFXDECODE_END void apc_state::upd7220_1_map(address_map &map) { - map(0x00000, 0x3ffff).ram().share("video_ram_1"); + map(0x00000, 0x3ffff).ram().share(m_video_ram_1); } void apc_state::upd7220_2_map(address_map &map) { - map(0x00000, 0x3ffff).ram().share("video_ram_2"); + map(0x00000, 0x3ffff).ram().share(m_video_ram_2); } /* @@ -833,7 +843,7 @@ ir7 APU READ8_MEMBER(apc_state::get_slave_ack) { if (offset==7) { // IRQ = 7 - return machine().device( "pic8259_slave" )->acknowledge(); + return m_i8259_s->acknowledge(); } return 0x00; } @@ -924,27 +934,27 @@ static void apc_floppies(device_slot_interface &device) MACHINE_CONFIG_START(apc_state::apc) /* basic machine hardware */ - MCFG_DEVICE_ADD("maincpu",I8086,MAIN_CLOCK) + MCFG_DEVICE_ADD(m_maincpu,I8086,MAIN_CLOCK) MCFG_DEVICE_PROGRAM_MAP(apc_map) MCFG_DEVICE_IO_MAP(apc_io) MCFG_DEVICE_IRQ_ACKNOWLEDGE_DEVICE("pic8259_master", pic8259_device, inta_cb) - MCFG_DEVICE_ADD("pit8253", PIT8253, 0) + MCFG_DEVICE_ADD(m_pit, PIT8253, 0) MCFG_PIT8253_CLK0(MAIN_CLOCK) /* heartbeat IRQ */ - MCFG_PIT8253_OUT0_HANDLER(WRITELINE("pic8259_master", pic8259_device, ir3_w)) + MCFG_PIT8253_OUT0_HANDLER(WRITELINE(m_i8259_m, pic8259_device, ir3_w)) MCFG_PIT8253_CLK1(MAIN_CLOCK) /* Memory Refresh */ MCFG_PIT8253_CLK2(MAIN_CLOCK) /* RS-232c */ - MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE("maincpu", 0)) + MCFG_DEVICE_ADD(m_i8259_m, PIC8259, 0) + MCFG_PIC8259_OUT_INT_CB(INPUTLINE(m_maincpu, 0)) MCFG_PIC8259_IN_SP_CB(VCC) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, apc_state, get_slave_ack)) - MCFG_DEVICE_ADD("pic8259_slave", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(WRITELINE("pic8259_master", pic8259_device, ir7_w)) // TODO: check ir7_w + MCFG_DEVICE_ADD(m_i8259_s, PIC8259, 0) + MCFG_PIC8259_OUT_INT_CB(WRITELINE(m_i8259_m, pic8259_device, ir7_w)) // TODO: check ir7_w MCFG_PIC8259_IN_SP_CB(GND) - MCFG_DEVICE_ADD("i8237", AM9517A, MAIN_CLOCK) + MCFG_DEVICE_ADD(m_dmac, AM9517A, MAIN_CLOCK) MCFG_I8237_OUT_HREQ_CB(WRITELINE(*this, apc_state, apc_dma_hrq_changed)) MCFG_I8237_OUT_EOP_CB(WRITELINE(*this, apc_state, apc_tc_w)) MCFG_I8237_IN_MEMR_CB(READ8(*this, apc_state, apc_dma_read_byte)) @@ -956,40 +966,40 @@ MACHINE_CONFIG_START(apc_state::apc) MCFG_I8237_OUT_DACK_2_CB(WRITELINE(*this, apc_state, apc_dack2_w)) MCFG_I8237_OUT_DACK_3_CB(WRITELINE(*this, apc_state, apc_dack3_w)) - MCFG_NVRAM_ADD_1FILL("cmos") - MCFG_UPD1990A_ADD("upd1990a", XTAL(32'768), NOOP, NOOP) + MCFG_NVRAM_ADD_1FILL(m_cmos) + MCFG_UPD1990A_ADD(m_rtc, XTAL(32'768), NOOP, NOOP) - MCFG_UPD765A_ADD("upd765", true, true) - MCFG_UPD765_INTRQ_CALLBACK(WRITELINE("pic8259_slave", pic8259_device, ir4_w)) - MCFG_UPD765_DRQ_CALLBACK(WRITELINE("i8237", am9517a_device, dreq1_w)) - MCFG_FLOPPY_DRIVE_ADD("upd765:0", apc_floppies, "8", apc_floppy_formats) - MCFG_FLOPPY_DRIVE_ADD("upd765:1", apc_floppies, "8", apc_floppy_formats) + MCFG_UPD765A_ADD(m_fdc, true, true) + MCFG_UPD765_INTRQ_CALLBACK(WRITELINE(m_i8259_s, pic8259_device, ir4_w)) + MCFG_UPD765_DRQ_CALLBACK(WRITELINE(m_dmac, am9517a_device, dreq1_w)) + MCFG_FLOPPY_DRIVE_ADD(m_fdc_connector[0], apc_floppies, "8", apc_floppy_formats) + MCFG_FLOPPY_DRIVE_ADD(m_fdc_connector[1], apc_floppies, "8", apc_floppy_formats) MCFG_SOFTWARE_LIST_ADD("disk_list","apc") /* video hardware */ - MCFG_SCREEN_ADD("screen", RASTER) + MCFG_SCREEN_ADD(m_screen, RASTER) MCFG_SCREEN_REFRESH_RATE(60) MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) MCFG_SCREEN_UPDATE_DRIVER(apc_state, screen_update) MCFG_SCREEN_SIZE(640, 494) MCFG_SCREEN_VISIBLE_AREA(0*8, 640-1, 0*8, 494-1) - MCFG_PALETTE_ADD_3BIT_BRG("palette") + MCFG_PALETTE_ADD_3BIT_BRG(m_palette) - MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_apc) + MCFG_DEVICE_ADD(m_gfxdecode, GFXDECODE, m_palette, gfx_apc) - MCFG_DEVICE_ADD("upd7220_chr", UPD7220, 3579545) // unk clock + MCFG_DEVICE_ADD(m_hgdc1, UPD7220, 3579545) // unk clock MCFG_DEVICE_ADDRESS_MAP(0, upd7220_1_map) MCFG_UPD7220_DRAW_TEXT_CALLBACK_OWNER(apc_state, hgdc_draw_text) - MCFG_DEVICE_ADD("upd7220_btm", UPD7220, 3579545) // unk clock + MCFG_DEVICE_ADD(m_hgdc2, UPD7220, 3579545) // unk clock MCFG_DEVICE_ADDRESS_MAP(0, upd7220_2_map) MCFG_UPD7220_DISPLAY_PIXELS_CALLBACK_OWNER(apc_state, hgdc_display_pixels) /* sound hardware */ - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD( "upd1771c", UPD1771C, MAIN_CLOCK ) //uPD1771C-006 - MCFG_SOUND_ROUTE( ALL_OUTPUTS, "mono", 1.00 ) + SPEAKER(config, m_speaker).front_center(); + MCFG_DEVICE_ADD(m_sound, UPD1771C, MAIN_CLOCK) //uPD1771C-006 + MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00) MACHINE_CONFIG_END -- cgit v1.2.3