From 818f14c86fe9a76d3c64c5d9fecea5ca88c1d0c5 Mon Sep 17 00:00:00 2001 From: AJR Date: Sun, 3 Jun 2018 13:57:18 -0400 Subject: [PATCH] pcw.cpp: Eliminate machine().device (nw) --- src/mame/drivers/pcw.cpp | 41 +++++++--------------------------------- src/mame/includes/pcw.h | 5 ++--- 2 files changed, 9 insertions(+), 37 deletions(-) diff --git a/src/mame/drivers/pcw.cpp b/src/mame/drivers/pcw.cpp index 67da35c8070..656f5fbefae 100644 --- a/src/mame/drivers/pcw.cpp +++ b/src/mame/drivers/pcw.cpp @@ -409,7 +409,6 @@ WRITE8_MEMBER(pcw_state::pcw_vdu_video_control_register_w) WRITE8_MEMBER(pcw_state::pcw_system_control_w) { - upd765a_device *fdc = machine().device("upd765"); LOG(("SYSTEM CONTROL: %d\n",data)); switch (data) @@ -495,14 +494,14 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) /* set fdc terminal count */ case 5: { - fdc->tc_w(true); + m_fdc->tc_w(true); } break; /* clear fdc terminal count */ case 6: { - fdc->tc_w(false); + m_fdc->tc_w(false); } break; @@ -522,10 +521,10 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) case 9: { floppy_image_device *floppy; - floppy = machine().device(":upd765:0")->get_device(); + floppy = m_floppy[0]->get_device(); if(floppy) floppy->mon_w(0); - floppy = machine().device(":upd765:1")->get_device(); + floppy = m_floppy[1]->get_device(); if(floppy) floppy->mon_w(0); } @@ -535,10 +534,10 @@ WRITE8_MEMBER(pcw_state::pcw_system_control_w) case 10: { floppy_image_device *floppy; - floppy = machine().device(":upd765:0")->get_device(); + floppy = m_floppy[0]->get_device(); if(floppy) floppy->mon_w(1); - floppy = machine().device(":upd765:1")->get_device(); + floppy = m_floppy[1]->get_device(); if(floppy) floppy->mon_w(1); } @@ -641,20 +640,6 @@ void pcw_state::pcw_printer_fire_pins(uint16_t pins) // m_printer_headpos++; } -WRITE8_MEMBER(pcw_state::pcw_printer_data_w) -{ - m_printer_data = data; - machine().device("printer_mcu")->upi41_master_w(space,0,data); - logerror("PRN [0xFC]: Sent command %02x\n",data); -} - -WRITE8_MEMBER(pcw_state::pcw_printer_command_w) -{ - m_printer_command = data; - machine().device("printer_mcu")->upi41_master_w(space,1,data); - logerror("PRN [0xFD]: Sent command %02x\n",data); -} - // print error type // should return 0xF8 if there are no errors // 0 = underrun @@ -662,10 +647,6 @@ WRITE8_MEMBER(pcw_state::pcw_printer_command_w) // 3 = bad command // 5 = print error // anything else = no printer -READ8_MEMBER(pcw_state::pcw_printer_data_r) -{ - return machine().device("printer_mcu")->upi41_master_r(space,0); -} // printer status // bit 7 - bail bar in @@ -676,10 +657,6 @@ READ8_MEMBER(pcw_state::pcw_printer_data_r) // bit 2 - paper is present // bit 1 - busy // bit 0 - controller fault -READ8_MEMBER(pcw_state::pcw_printer_status_r) -{ - return machine().device("printer_mcu")->upi41_master_r(space,1); -} /* MCU handlers */ /* I/O ports: (likely to be completely wrong...) @@ -960,8 +937,7 @@ void pcw_state::pcw_io(address_map &map) map(0x0f6, 0x0f6).w(this, FUNC(pcw_state::pcw_pointer_table_top_scan_w)); map(0x0f7, 0x0f7).w(this, FUNC(pcw_state::pcw_vdu_video_control_register_w)); map(0x0f8, 0x0f8).rw(this, FUNC(pcw_state::pcw_system_status_r), FUNC(pcw_state::pcw_system_control_w)); - map(0x0fc, 0x0fc).rw(this, FUNC(pcw_state::pcw_printer_data_r), FUNC(pcw_state::pcw_printer_data_w)); - map(0x0fd, 0x0fd).rw(this, FUNC(pcw_state::pcw_printer_status_r), FUNC(pcw_state::pcw_printer_command_w)); + map(0x0fc, 0x0fd).rw("printer_mcu", FUNC(i8041_device::upi41_master_r), FUNC(i8041_device::upi41_master_w)); } @@ -1020,9 +996,6 @@ void pcw_state::machine_reset() /* and hack our way past the MCU side of the boot process */ code[0x01] = 0x40; - m_printer_status = 0xff; - m_printer_command = 0xff; - m_printer_data = 0x00; m_printer_headpos = 0x00; // bring printer head to left margin m_printer_shift = 0; m_printer_shift_output = 0; diff --git a/src/mame/includes/pcw.h b/src/mame/includes/pcw.h index 5a288e79895..696de68c244 100644 --- a/src/mame/includes/pcw.h +++ b/src/mame/includes/pcw.h @@ -34,6 +34,7 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_fdc(*this, "upd765"), + m_floppy(*this, "upd765:%u", 0U), m_ram(*this, RAM_TAG), m_beeper(*this, "beeper"), m_screen(*this, "screen"), @@ -48,9 +49,6 @@ public: unsigned char m_bank_force; uint8_t m_timer_irq_flag; uint8_t m_nmi_flag; - uint8_t m_printer_command; - uint8_t m_printer_data; - uint8_t m_printer_status; int16_t m_printer_headpos; uint16_t m_kb_scan_row; uint8_t m_mcu_keyboard_data[16]; @@ -126,6 +124,7 @@ public: DECLARE_WRITE_LINE_MEMBER( pcw_fdc_interrupt ); required_device m_maincpu; required_device m_fdc; + required_device_array m_floppy; required_device m_ram; required_device m_beeper; required_device m_screen;