From af4eafb892d99515ed0bb1fe2b670381b9db0d42 Mon Sep 17 00:00:00 2001 From: Wilbert Pol Date: Sat, 9 Feb 2013 12:50:29 +0000 Subject: [PATCH] (MESS) apollo.c: Some tagmap lookup reduction (nw) --- src/mess/drivers/apollo.c | 22 ++++++++++------------ src/mess/includes/apollo.h | 3 +++ 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/src/mess/drivers/apollo.c b/src/mess/drivers/apollo.c index 70f1efc7a74..cebfdc8c058 100644 --- a/src/mess/drivers/apollo.c +++ b/src/mess/drivers/apollo.c @@ -270,10 +270,10 @@ int apollo_instruction_hook(device_t *device, offs_t curpc) apollo bus error ***************************************************************************/ -static void apollo_bus_error(running_machine &machine) +void apollo_state::apollo_bus_error() { - machine.device(MAINCPU)->execute().set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); - machine.device(MAINCPU)->execute().set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, ASSERT_LINE); + m_maincpu->set_input_line(M68K_LINE_BUSERROR, CLEAR_LINE); apollo_csr_set_status_register(APOLLO_CSR_SR_CPU_TIMEOUT, APOLLO_CSR_SR_CPU_TIMEOUT); } @@ -282,7 +282,7 @@ IRQ_CALLBACK_MEMBER(apollo_state::apollo_irq_acknowledge) { int result = M68K_INT_ACK_AUTOVECTOR; - machine().device(MAINCPU)->execute().set_input_line(irqline, CLEAR_LINE); + m_maincpu->set_input_line(irqline, CLEAR_LINE); MLOG2(("apollo_irq_acknowledge: interrupt level=%d", irqline)); @@ -457,7 +457,7 @@ READ32_MEMBER(apollo_state::ram_with_parity_r){ if (apollo_csr_get_control_register() & APOLLO_CSR_CR_INTERRUPT_ENABLE) { // force parity error (if NMI is enabled) // cpu_set_input_line_and_vector(&space.device(), 7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); - machine().device(MAINCPU)->execute().set_input_line_and_vector(7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); + m_maincpu->set_input_line_and_vector(7, ASSERT_LINE, M68K_INT_ACK_AUTOVECTOR); } } @@ -533,7 +533,7 @@ READ32_MEMBER(apollo_state::apollo_unmapped_r) } /* unmapped; access causes a bus error */ - apollo_bus_error(machine()); + apollo_bus_error(); return 0xffffffff; } @@ -542,7 +542,7 @@ WRITE32_MEMBER(apollo_state::apollo_unmapped_w) SLOG(("unmapped memory dword write to %08x = %08x & %08x", offset * 4, data, mem_mask)); /* unmapped; access causes a bus error */ - apollo_bus_error(machine()); + apollo_bus_error(); } /*************************************************************************** @@ -1000,8 +1000,6 @@ ADDRESS_MAP_END void apollo_state::machine_reset() { - device_t *cpu = machine().device(MAINCPU); - //MLOG1(("machine_reset_dn3500")); MACHINE_RESET_CALL_MEMBER(apollo); @@ -1030,7 +1028,7 @@ void apollo_state::machine_reset() } } - m68k_set_instruction_hook(cpu, apollo_instruction_hook); + m68k_set_instruction_hook(m_maincpu, apollo_instruction_hook); } static void apollo_reset_instr_callback(device_t *device) @@ -1081,10 +1079,10 @@ DRIVER_INIT_MEMBER(apollo_state,dn3500) { // MLOG1(("driver_init_dn3500")); - machine().device(MAINCPU)->execute().set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(apollo_state::apollo_irq_acknowledge),this)); + m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(apollo_state::apollo_irq_acknowledge),this)); /* hook the RESET line, which resets a slew of other components */ - m68k_set_reset_callback(machine().device(MAINCPU), apollo_reset_instr_callback); + m68k_set_reset_callback(m_maincpu, apollo_reset_instr_callback); ram_base_address = DN3500_RAM_BASE; ram_end_address = DN3500_RAM_END; diff --git a/src/mess/includes/apollo.h b/src/mess/includes/apollo.h index b4ccc4b84e5..77e61c357eb 100644 --- a/src/mess/includes/apollo.h +++ b/src/mess/includes/apollo.h @@ -112,10 +112,12 @@ class apollo_state : public driver_device public: apollo_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), + m_maincpu(*this, MAINCPU), m_ctape(*this, APOLLO_CTAPE_TAG), m_messram_ptr(*this, "messram") { } + required_device m_maincpu; required_device m_ctape; device_t *dma8237_1; @@ -189,6 +191,7 @@ public: DECLARE_FLOPPY_FORMATS( floppy_formats ); IRQ_CALLBACK_MEMBER(apollo_irq_acknowledge); IRQ_CALLBACK_MEMBER(apollo_pic_acknowledge); + void apollo_bus_error(); }; MACHINE_CONFIG_EXTERN( apollo );