From 3245b9d3bac834814e6b4253c7b56cd63e6a023d Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 26 Sep 2019 22:57:33 +0200 Subject: [PATCH] Review comments fixed --- src/devices/bus/isa/mda.cpp | 54 +++++++++++++++++------------------ src/devices/bus/isa/mda.h | 1 + src/devices/video/mc6845.cpp | 1 - src/mame/machine/eispc_kb.cpp | 16 +++++------ src/mame/machine/eispc_kb.h | 2 +- 5 files changed, 36 insertions(+), 38 deletions(-) diff --git a/src/devices/bus/isa/mda.cpp b/src/devices/bus/isa/mda.cpp index d7f6625d75c..1f0cd0b6b11 100644 --- a/src/devices/bus/isa/mda.cpp +++ b/src/devices/bus/isa/mda.cpp @@ -96,7 +96,7 @@ static GFXDECODE_START( gfx_pcmda ) GFXDECODE_END -WRITE_LINE_MEMBER(isa8_mda_device::pc_cpu_line) +WRITE_LINE_MEMBER( isa8_mda_device::pc_cpu_line ) { m_isa->irq7_w(state); } @@ -453,7 +453,7 @@ WRITE8_MEMBER( isa8_mda_device::mode_control_w ) * 2-1 reserved * 0 horizontal drive enable */ -READ8_MEMBER( isa8_mda_device::status_r) +READ8_MEMBER( isa8_mda_device::status_r ) { // Faking pixel stream here m_pixel++; @@ -468,7 +468,7 @@ READ8_MEMBER( isa8_mda_device::status_r) * monochrome display adapter * *************************************************************************/ -WRITE8_MEMBER( isa8_mda_device::io_write) +WRITE8_MEMBER( isa8_mda_device::io_write ) { switch( offset ) { @@ -487,7 +487,7 @@ WRITE8_MEMBER( isa8_mda_device::io_write) } } -READ8_MEMBER( isa8_mda_device::io_read) +READ8_MEMBER( isa8_mda_device::io_read ) { int data = 0xff; switch( offset ) @@ -1125,15 +1125,15 @@ const tiny_rom_entry *isa8_epc_mda_device::device_rom_region() const //------------------------------------------------- isa8_epc_mda_device::isa8_epc_mda_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : - isa8_mda_device(mconfig, ISA8_EPC_MDA, tag, owner, clock) - , m_soft_chr_gen(nullptr) - , m_s1(*this, "S1") - , m_color_mode(0) - , m_mode_control2(0) - , m_screen(*this, EPC_MDA_SCREEN) - , m_io_monitor(*this, "MONITOR") - , m_chargen(*this, "chargen") - , m_installed(false) + isa8_mda_device(mconfig, ISA8_EPC_MDA, tag, owner, clock), + m_soft_chr_gen(nullptr), + m_s1(*this, "S1"), + m_color_mode(0), + m_mode_control2(0), + m_screen(*this, EPC_MDA_SCREEN), + m_io_monitor(*this, "MONITOR"), + m_chargen(*this, "chargen"), + m_installed(false) { } @@ -1164,6 +1164,7 @@ void isa8_epc_mda_device::device_start() m_videoram.resize(0x8000); set_isa_device(); m_installed = false; + m_hd6845s = subdevice(MC6845_NAME); } void isa8_epc_mda_device::device_reset() @@ -1204,19 +1205,18 @@ void isa8_epc_mda_device::device_reset() * Status Register 0x3ba 0x3da r CGA/MDA status reg (incompatible) * w EGA/VGA feature ccontrol reg (not used by this board) */ -WRITE8_MEMBER( isa8_epc_mda_device::io_write) +WRITE8_MEMBER(isa8_epc_mda_device::io_write ) { LOG("%s: %04x <- %02x\n", FUNCNAME, offset, data); - hd6845s_device *hd6845s = subdevice(MC6845_NAME); switch( offset ) { case 0x04: - //LOGSETUP(" - HD6845S address write\n"); - hd6845s->address_w( data ); + //LOGSETUP(" - HD6845S address write\n"); + m_hd6845s->address_w( data ); break; case 0x05: - //LOGSETUP(" - HD6845S register write\n"); - hd6845s->register_w( data ); + //LOGSETUP(" - HD6845S register write\n"); + m_hd6845s->register_w( data ); break; case 0x08: // Mode 1 reg LOGMODE(" - Mode register 1 write: %02x\n", data); @@ -1254,15 +1254,13 @@ WRITE8_MEMBER( isa8_epc_mda_device::io_write) break; default: LOG("EPC MDA: io_write at wrong offset:%02x\n", offset); - logerror("EPC MDA: io_write at wrong offset:%02x\n", offset); } } -READ8_MEMBER( isa8_epc_mda_device::io_read) +READ8_MEMBER( isa8_epc_mda_device::io_read ) { LOG("%s: %04x <- ???\n", FUNCNAME, offset); int data = 0xff; - hd6845s_device *hd6845s = subdevice(MC6845_NAME); switch( offset ) { case 0x04: @@ -1270,7 +1268,7 @@ READ8_MEMBER( isa8_epc_mda_device::io_read) break; case 0x05: LOGR(" - hd6845s register read\n"); - data = hd6845s->register_r(); + data = m_hd6845s->register_r(); break; case 0x08: // Mode 1 reg data = m_mode_control; @@ -1302,7 +1300,7 @@ inline int isa8_epc_mda_device::get_yres() return (m_vmode & VM_GRAPH) ? ( (m_vmode & VM_VER400) ? 400 : 200 ) : 400; } -MC6845_UPDATE_ROW( isa8_epc_mda_device::crtc_update_row ) +MC6845_UPDATE_ROW(isa8_epc_mda_device::crtc_update_row) { uint32_t *p = &bitmap.pix32(y); uint16_t chr_base = ra; @@ -1458,19 +1456,19 @@ MC6845_UPDATE_ROW( isa8_epc_mda_device::crtc_update_row ) // Port definitions //-------------------------------------------------------------------- static INPUT_PORTS_START( epc_mda ) - PORT_START("S1") + PORT_START( "S1" ) PORT_DIPNAME( 0x01, 0x00, "Color emulation") PORT_DIPLOCATION("S1:1") PORT_DIPSETTING( 0x00, "Disabled" ) PORT_DIPSETTING( 0x01, "Enabled" ) PORT_DIPUNUSED_DIPLOC(0x02, 0x02, "S1:2") - PORT_START("MONITOR") - PORT_CONFNAME( 0x01, 0x00, "Ericsson Monochrome HR Monitors") PORT_CHANGED_MEMBER(DEVICE_SELF, isa8_epc_mda_device, monitor_changed, 0) + PORT_START( "MONITOR" ) + PORT_CONFNAME( 0x01, 0x00, "Ericsson Monochrome HR Monitors") PORT_CHANGED_MEMBER( DEVICE_SELF, isa8_epc_mda_device, monitor_changed, 0 ) PORT_CONFSETTING( 0x00, "Amber 3111") PORT_CONFSETTING( 0x01, "B&W 3712/3715") INPUT_PORTS_END -INPUT_CHANGED_MEMBER(isa8_epc_mda_device::monitor_changed) +INPUT_CHANGED_MEMBER( isa8_epc_mda_device::monitor_changed ) { if ((m_io_monitor->read() & 1) == 1) { diff --git a/src/devices/bus/isa/mda.h b/src/devices/bus/isa/mda.h index 9b640fb3665..9959f3a6094 100644 --- a/src/devices/bus/isa/mda.h +++ b/src/devices/bus/isa/mda.h @@ -213,6 +213,7 @@ private: rgb_t m_3111_pal[4]; rgb_t m_371x_pal[4]; bool m_installed; + hd6845s_device *m_hd6845s; }; // device type definition diff --git a/src/devices/video/mc6845.cpp b/src/devices/video/mc6845.cpp index cef7b7d036e..4ce9ed843a3 100644 --- a/src/devices/video/mc6845.cpp +++ b/src/devices/video/mc6845.cpp @@ -1243,7 +1243,6 @@ void mc6845_device::device_start() save_item(NAME(m_line_address)); save_item(NAME(m_cursor_x)); save_item(NAME(m_has_valid_parameters)); - save_item(NAME(m_display_disabled_msg_shown)); } diff --git a/src/mame/machine/eispc_kb.cpp b/src/mame/machine/eispc_kb.cpp index cac16464e82..5f8a2e76e2f 100644 --- a/src/mame/machine/eispc_kb.cpp +++ b/src/mame/machine/eispc_kb.cpp @@ -260,25 +260,25 @@ eispc_keyboard_device::eispc_keyboard_device( INPUT_CHANGED_MEMBER( eispc_keyboard_device::key ) { - if (oldval && !newval) + if (oldval && !newval) { LOGUI("Key Pressed - name: %s field: %04x param: %04x oldval: %04x newval: %04x\n", field.name(), field.defvalue(), param, oldval, newval); int idx = *((int *)(¶m)); - if (idx >= sizeof(keys)) + if (idx >= ARRAY_LENGTH(m_keys)) logerror("Out of bounds access in keys array\n"); else - keys[idx] |= (uint16_t) field.defvalue(); + m_keys[idx] |= (uint16_t) field.defvalue(); } else if (newval && !oldval) { LOGUI("Key Released - name: %s field: %04x param: %04x oldval: %04x newval: %04x\n", field.name(), field.defvalue(), param, oldval, newval); int idx = *((int *)(¶m)); - if (idx >= sizeof(keys)) + if (idx >= ARRAY_LENGTH(m_keys)) logerror("Out of bounds access in keys array\n"); else - keys[idx] &= ~(uint16_t)field.defvalue(); + m_keys[idx] &= ~(uint16_t)field.defvalue(); } - for (int i = 0; i < 6; i++) LOGUI("%04x ", keys[i]); LOGUI("\n"); + for (int i = 0; i < 6; i++) LOGUI("%04x ", m_keys[i]); LOGUI("\n"); } WRITE_LINE_MEMBER(eispc_keyboard_device::rxd_w) @@ -315,7 +315,7 @@ void eispc_keyboard_device::device_reset() { LOGRST("KBD: Keyboard is in reset until host computer explicitly releases the reset line\n"); m_mcu->suspend(SUSPEND_REASON_RESET, 0); - for (auto & elem : keys) elem = 0; + for (auto & elem : m_keys) elem = 0; } @@ -351,7 +351,7 @@ void eispc_keyboard_device::device_add_mconfig(machine_config &config) { uint8_t data = 0; // Indicate what keys are pressed in selected column - for (int i = 0; i < 6; i++) data |= (keys[i] & m_col_select ? 1 << i : 0); + for (int i = 0; i < 6; i++) data |= (m_keys[i] & m_col_select ? 1 << i : 0); // Update txd bit data &= 0x3f; diff --git a/src/mame/machine/eispc_kb.h b/src/mame/machine/eispc_kb.h index 66547409a47..aec7ee2a170 100644 --- a/src/mame/machine/eispc_kb.h +++ b/src/mame/machine/eispc_kb.h @@ -36,7 +36,7 @@ protected: bool m_txd_high; // state of Tx output line bool m_hold; uint16_t m_col_select; - uint16_t keys[6]; + uint16_t m_keys[6]; uint8_t m_p1; void eispc_kb_mem(address_map &map);