diff options
author | AJR <ajrhacker@users.noreply.github.com> | 2022-01-03 19:33:23 -0500 |
---|---|---|
committer | AJR <ajrhacker@users.noreply.github.com> | 2022-01-03 19:33:23 -0500 |
commit | e78197debeeb322dccd1afa67c06e34db5338582 (patch) | |
tree | a6e687dd60e2d2e2761e45a591cc4b9fab8b2c06 | |
parent | 9ff2622a6d5d608d3ce417bfe7c82ae34169e578 (diff) |
zx.cpp: Small cleanup
-rw-r--r-- | src/mame/includes/zx.h | 19 | ||||
-rw-r--r-- | src/mame/machine/zx.cpp | 76 |
2 files changed, 15 insertions, 80 deletions
diff --git a/src/mame/includes/zx.h b/src/mame/includes/zx.h index 408b2744bf9..e3d9f8ab34e 100644 --- a/src/mame/includes/zx.h +++ b/src/mame/includes/zx.h @@ -18,6 +18,7 @@ #include "emupal.h" #include "screen.h" +#include "softlist_dev.h" #include "formats/tzx_cas.h" #include "formats/zx81_p.h" @@ -35,14 +36,7 @@ public: m_speaker(*this, "speaker"), m_region_maincpu(*this, "maincpu"), m_region_gfx1(*this, "gfx1"), - m_io_row0(*this, "ROW0"), - m_io_row1(*this, "ROW1"), - m_io_row2(*this, "ROW2"), - m_io_row3(*this, "ROW3"), - m_io_row4(*this, "ROW4"), - m_io_row5(*this, "ROW5"), - m_io_row6(*this, "ROW6"), - m_io_row7(*this, "ROW7"), + m_io_row(*this, "ROW%u", 0U), m_io_config(*this, "CONFIG"), m_screen(*this, "screen") { } @@ -98,14 +92,7 @@ private: optional_device<speaker_sound_device> m_speaker; required_memory_region m_region_maincpu; optional_memory_region m_region_gfx1; - required_ioport m_io_row0; - required_ioport m_io_row1; - required_ioport m_io_row2; - required_ioport m_io_row3; - required_ioport m_io_row4; - required_ioport m_io_row5; - required_ioport m_io_row6; - required_ioport m_io_row7; + required_ioport_array<8> m_io_row; optional_ioport m_io_config; required_device<screen_device> m_screen; diff --git a/src/mame/machine/zx.cpp b/src/mame/machine/zx.cpp index 3f95ecbf971..cd00c2673b8 100644 --- a/src/mame/machine/zx.cpp +++ b/src/mame/machine/zx.cpp @@ -119,22 +119,9 @@ uint8_t zx_state::zx80_io_r(offs_t offset) if (!(offset & 0x01)) { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); + for (int i = 0; i < 8; i++) + if (!BIT(offset, i + 8)) + data &= m_io_row[i]->read(); if (!m_io_config->read()) data &= ~0x40; @@ -163,22 +150,9 @@ uint8_t zx_state::zx81_io_r(offs_t offset) if (!(offset & 0x01)) { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); + for (int i = 0; i < 8; i++) + if (!BIT(offset, i + 8)) + data &= m_io_row[i]->read(); if (!m_io_config->read()) data &= ~0x40; @@ -217,22 +191,9 @@ uint8_t zx_state::pc8300_io_r(offs_t offset) else if (offs == 0xfe) { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); + for (int i = 0; i < 8; i++) + if (!BIT(offset, i + 8)) + data &= m_io_row[i]->read(); m_cassette->output(+1.0); if(m_cassette_cur_level <= 0) @@ -267,22 +228,9 @@ uint8_t zx_state::pow3000_io_r(offs_t offset) else if (offs == 0xfe) { - if ((offset & 0x0100) == 0) - data &= m_io_row0->read(); - if ((offset & 0x0200) == 0) - data &= m_io_row1->read(); - if ((offset & 0x0400) == 0) - data &= m_io_row2->read(); - if ((offset & 0x0800) == 0) - data &= m_io_row3->read(); - if ((offset & 0x1000) == 0) - data &= m_io_row4->read(); - if ((offset & 0x2000) == 0) - data &= m_io_row5->read(); - if ((offset & 0x4000) == 0) - data &= m_io_row6->read(); - if ((offset & 0x8000) == 0) - data &= m_io_row7->read(); + for (int i = 0; i < 8; i++) + if (!BIT(offset, i + 8)) + data &= m_io_row[i]->read(); m_cassette->output(+1.0); if(m_cassette_cur_level <= 0) |