From 9fde608c12eda1e7e4f2fed7815cc9b9e9c977ec Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Sat, 26 Jan 2013 21:55:32 +0000 Subject: [PATCH] (MESS) pcw16: Removed runtime tagmap lookups. (nw) --- src/mess/drivers/pcw16.c | 60 ++++++++++++--------------------------- src/mess/includes/pcw16.h | 32 ++++++++++++++++++++- 2 files changed, 49 insertions(+), 43 deletions(-) diff --git a/src/mess/drivers/pcw16.c b/src/mess/drivers/pcw16.c index 4c837d19efe..60a044490f0 100644 --- a/src/mess/drivers/pcw16.c +++ b/src/mess/drivers/pcw16.c @@ -87,23 +87,8 @@ TODO: epp/ecp modes in parallel port not supported yet so ui disabled */ -/* Core includes */ -#include "emu.h" -#include "cpu/z80/z80.h" #include "includes/pcw16.h" -/* Components */ -#include "machine/pc_lpt.h" /* PC-Parallel Port */ -#include "machine/pckeybrd.h" /* PC-AT keyboard */ -#include "machine/upd765.h" /* FDC superio */ -#include "machine/ins8250.h" /* pc com port */ -#include "sound/beep.h" /* pcw/pcw16 beeper */ -#include "machine/intelfsh.h" - -/* Devices */ -#include "formats/pc_dsk.h" -#include "machine/ram.h" - // interrupt counter /* controls which bank of 2mb address space is paged into memory */ @@ -124,11 +109,11 @@ void pcw16_state::pcw16_refresh_ints() /* any bits set excluding vsync */ if ((m_system_status & (~0x04))!=0) { - machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); + m_maincpu->set_input_line(0, HOLD_LINE); } else { - machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); + m_maincpu->set_input_line(0, CLEAR_LINE); } } @@ -163,25 +148,21 @@ UINT8 pcw16_state::read_bank_data(UINT8 type, UINT16 offset) { if(type & 0x80) // DRAM { - UINT8* RAM = machine().device(RAM_TAG)->pointer(); - return RAM[((type & 0x7f)*0x4000) + offset]; + return m_ram->pointer()[((type & 0x7f)*0x4000) + offset]; } else // ROM / Flash { if(type < 4) { - UINT8* ROM = memregion("maincpu")->base(); - return ROM[((type & 0x03)*0x4000)+offset+0x10000]; + return m_region_rom->base()[((type & 0x03)*0x4000)+offset+0x10000]; } if(type < 0x40) // first flash { - intel_e28f008sa_device* flash = machine().device("flash0"); - return flash->read(((type & 0x3f)*0x4000)+offset); + return m_flash0->read(((type & 0x3f)*0x4000)+offset); } else // second flash { - intel_e28f008sa_device* flash = machine().device("flash1"); - return flash->read(((type & 0x3f)*0x4000)+offset); + return m_flash1->read(((type & 0x3f)*0x4000)+offset); } } } @@ -190,8 +171,7 @@ void pcw16_state::write_bank_data(UINT8 type, UINT16 offset, UINT8 data) { if(type & 0x80) // DRAM { - UINT8* RAM = machine().device(RAM_TAG)->pointer(); - RAM[((type & 0x7f)*0x4000) + offset] = data; + m_ram->pointer()[((type & 0x7f)*0x4000) + offset] = data; } else // ROM / Flash { @@ -199,13 +179,11 @@ void pcw16_state::write_bank_data(UINT8 type, UINT16 offset, UINT8 data) return; // first four sectors are write protected if(type < 0x40) // first flash { - intel_e28f008sa_device* flash = machine().device("flash0"); - flash->write(((type & 0x3f)*0x4000)+offset,data); + m_flash0->write(((type & 0x3f)*0x4000)+offset,data); } else // second flash { - intel_e28f008sa_device* flash = machine().device("flash1"); - flash->write(((type & 0x3f)*0x4000)+offset,data); + m_flash1->write(((type & 0x3f)*0x4000)+offset,data); } } } @@ -556,7 +534,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(pcw16_state::pcw16_keyboard_timer_callback) } } // TODO: fix - subdevice("ns16550_2")->ri_w((machine().root_device().ioport("EXTRA")->read() & 0x040) ? 0 : 1); + m_uart2->ri_w((m_io_extra->read() & 0x040) ? 0 : 1); } @@ -763,7 +741,7 @@ void pcw16_state::trigger_fdc_int() { /* I'll pulse it because if I used hold-line I'm not sure it would clear - to be checked */ - machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); + m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); } } } @@ -809,7 +787,6 @@ READ8_MEMBER(pcw16_state::pcw16_timer_interrupt_counter_r) WRITE8_MEMBER(pcw16_state::pcw16_system_control_w) { - device_t *speaker = machine().device(BEEPER_TAG); //logerror("0x0f8: function: %d\n",data); /* lower 4 bits define function code */ @@ -851,28 +828,28 @@ WRITE8_MEMBER(pcw16_state::pcw16_system_control_w) /* set terminal count */ case 0x05: { - machine().device("fdc")->tc_w(true); + m_fdc->tc_w(true); } break; /* clear terminal count */ case 0x06: { - machine().device("fdc")->tc_w(false); + m_fdc->tc_w(false); } break; /* bleeper on */ case 0x0b: { - beep_set_state(speaker,1); + beep_set_state(m_speaker,1); } break; /* bleeper off */ case 0x0c: { - beep_set_state(speaker,0); + beep_set_state(m_speaker,0); } break; @@ -1006,7 +983,7 @@ void pcw16_state::machine_reset() /* initialise defaults */ m_fdc_int_code = 2; /* clear terminal count */ - machine().device("fdc")->tc_w(false); + m_fdc->tc_w(false); /* select first rom page */ m_banks[0] = 0; // pcw16_update_memory(machine); @@ -1032,8 +1009,7 @@ void pcw16_state::machine_start() m_system_status = 0; m_interrupt_counter = 0; - machine().device("fdc") - ->setup_intrq_cb(pc_fdc_superio_device::line_cb(FUNC(pcw16_state::fdc_interrupt), this)); + m_fdc->setup_intrq_cb(pc_fdc_superio_device::line_cb(FUNC(pcw16_state::fdc_interrupt), this)); /* initialise keyboard */ at_keyboard_init(machine(), AT_KEYBOARD_TYPE_AT); @@ -1126,4 +1102,4 @@ ROM_END /* YEAR NAME PARENT COMPAT MACHINE INPUT INIT COMPANY FULLNAME */ -COMP( 1995, pcw16, 0, 0, pcw16, pcw16, driver_device, 0, "Amstrad plc", "PCW16", GAME_NOT_WORKING ) +COMP( 1995, pcw16, 0, 0, pcw16, pcw16, driver_device, 0, "Amstrad plc", "PcW16", GAME_NOT_WORKING ) diff --git a/src/mess/includes/pcw16.h b/src/mess/includes/pcw16.h index 8804fedcf32..fa40ce35bf4 100644 --- a/src/mess/includes/pcw16.h +++ b/src/mess/includes/pcw16.h @@ -7,7 +7,17 @@ #ifndef PCW16_H_ #define PCW16_H_ +#include "emu.h" +#include "cpu/z80/z80.h" #include "machine/upd765.h" /* FDC superio */ +#include "machine/pc_lpt.h" /* PC-Parallel Port */ +#include "machine/pckeybrd.h" /* PC-AT keyboard */ +#include "machine/upd765.h" /* FDC superio */ +#include "machine/ins8250.h" /* pc com port */ +#include "sound/beep.h" /* pcw/pcw16 beeper */ +#include "machine/intelfsh.h" +#include "formats/pc_dsk.h" +#include "machine/ram.h" #define PCW16_BORDER_HEIGHT 8 #define PCW16_BORDER_WIDTH 8 @@ -23,7 +33,27 @@ class pcw16_state : public driver_device { public: pcw16_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag) { } + : driver_device(mconfig, type, tag), + m_maincpu(*this, "maincpu"), + m_flash0(*this, "flash0"), + m_flash1(*this, "flash1"), + m_fdc(*this, "fdc"), + m_uart2(*this, "ns16550_2"), + m_speaker(*this, BEEPER_TAG), + m_ram(*this, RAM_TAG), + m_region_rom(*this, "maincpu"), + m_io_extra(*this, "EXTRA") + { } + + required_device m_maincpu; + required_device m_flash0; + required_device m_flash1; + required_device m_fdc; + required_device m_uart2; + required_device m_speaker; + required_device m_ram; + required_memory_region m_region_rom; + required_ioport m_io_extra; unsigned long m_interrupt_counter; int m_banks[4];