From fb9b32e32f14fb923b91e7a7a8fd5cac6becd730 Mon Sep 17 00:00:00 2001 From: AJR Date: Fri, 1 Jun 2018 15:39:08 -0400 Subject: sis85c496: Eliminate unnecessary use of machine().device and CPU tag hardcoding (nw) --- src/devices/machine/sis85c496.cpp | 32 +++++++++++++++++++++++--------- src/devices/machine/sis85c496.h | 5 +++-- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/src/devices/machine/sis85c496.cpp b/src/devices/machine/sis85c496.cpp index bda7b4f87b6..3f904bd598d 100644 --- a/src/devices/machine/sis85c496.cpp +++ b/src/devices/machine/sis85c496.cpp @@ -88,7 +88,7 @@ MACHINE_CONFIG_START(sis85c496_host_device::device_add_mconfig) MCFG_I8237_OUT_DACK_3_CB(WRITELINE(*this, sis85c496_host_device, pc_dack7_w)) MCFG_DEVICE_ADD("pic8259_master", PIC8259, 0) - MCFG_PIC8259_OUT_INT_CB(INPUTLINE(":maincpu", 0)) + MCFG_PIC8259_OUT_INT_CB(WRITELINE(*this, sis85c496_host_device, cpu_int_w)) MCFG_PIC8259_IN_SP_CB(VCC) MCFG_PIC8259_CASCADE_ACK_CB(READ8(*this, sis85c496_host_device, get_slave_ack)) @@ -97,8 +97,8 @@ MACHINE_CONFIG_START(sis85c496_host_device::device_add_mconfig) MCFG_PIC8259_IN_SP_CB(GND) MCFG_DEVICE_ADD("keybc", AT_KEYBOARD_CONTROLLER, XTAL(12'000'000)) - MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(INPUTLINE(":maincpu", INPUT_LINE_RESET)) - MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(INPUTLINE(":maincpu", INPUT_LINE_A20)) + MCFG_AT_KEYBOARD_CONTROLLER_SYSTEM_RESET_CB(WRITELINE(*this, sis85c496_host_device, cpu_reset_w)) + MCFG_AT_KEYBOARD_CONTROLLER_GATE_A20_CB(WRITELINE(*this, sis85c496_host_device, cpu_a20_w)) MCFG_AT_KEYBOARD_CONTROLLER_INPUT_BUFFER_FULL_CB(WRITELINE("pic8259_master", pic8259_device, ir1_w)) MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_CLOCK_CB(WRITELINE("pc_kbdc", pc_kbdc_device, clock_write_from_mb)) MCFG_AT_KEYBOARD_CONTROLLER_KEYBOARD_DATA_CB(WRITELINE("pc_kbdc", pc_kbdc_device, data_write_from_mb)) @@ -120,7 +120,7 @@ MACHINE_CONFIG_END sis85c496_host_device::sis85c496_host_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : pci_host_device(mconfig, SIS85C496, tag, owner, clock), - m_maincpu(*this, ":maincpu"), + m_maincpu(*this, finder_base::DUMMY_TAG), m_pic8259_master(*this, "pic8259_master"), m_pic8259_slave(*this, "pic8259_slave"), m_dma8237_1(*this, "dma8237_1"), @@ -134,9 +134,9 @@ sis85c496_host_device::sis85c496_host_device(const machine_config &mconfig, cons { } -void sis85c496_host_device::set_cpu_tag(const char *_cpu_tag) +void sis85c496_host_device::set_cpu_tag(const char *cpu_tag) { - cpu_tag = _cpu_tag; + m_maincpu.set_tag(cpu_tag); } void sis85c496_host_device::set_ram_size(int _ram_size) @@ -148,9 +148,8 @@ void sis85c496_host_device::device_start() { pci_host_device::device_start(); - cpu = machine().device(cpu_tag); - memory_space = &cpu->space(AS_PROGRAM); - io_space = &cpu->space(AS_IO); + memory_space = &m_maincpu->space(AS_PROGRAM); + io_space = &m_maincpu->space(AS_IO); memory_window_start = 0; memory_window_end = 0xffffffff; @@ -583,6 +582,21 @@ WRITE8_MEMBER( sis85c496_host_device::write_rtc ) } } +WRITE_LINE_MEMBER(sis85c496_host_device::cpu_int_w) +{ + m_maincpu->set_input_line(0, state); +} + +WRITE_LINE_MEMBER(sis85c496_host_device::cpu_a20_w) +{ + m_maincpu->set_input_line(INPUT_LINE_A20, state); +} + +WRITE_LINE_MEMBER(sis85c496_host_device::cpu_reset_w) +{ + m_maincpu->set_input_line(INPUT_LINE_RESET, state); +} + /* after decompress to shadow RAM: diff --git a/src/devices/machine/sis85c496.h b/src/devices/machine/sis85c496.h index f5c0061a789..9de0499792c 100644 --- a/src/devices/machine/sis85c496.h +++ b/src/devices/machine/sis85c496.h @@ -78,9 +78,7 @@ private: uint8_t m_channel_check; uint8_t m_nmi_enabled; - const char *cpu_tag; int ram_size; - cpu_device *cpu; std::vector ram; uint32_t m_mailbox; uint8_t m_bios_config, m_dram_config, m_isa_decoder; @@ -148,6 +146,9 @@ private: DECLARE_WRITE8_MEMBER(pc_dma_write_byte); DECLARE_READ8_MEMBER(pc_dma_read_word); DECLARE_WRITE8_MEMBER(pc_dma_write_word); + DECLARE_WRITE_LINE_MEMBER(cpu_int_w); + DECLARE_WRITE_LINE_MEMBER(cpu_a20_w); + DECLARE_WRITE_LINE_MEMBER(cpu_reset_w); }; DECLARE_DEVICE_TYPE(SIS85C496, sis85c496_host_device) -- cgit v1.2.3