From aaf23770a3350d3838bf323f54c7fe0a69a90e42 Mon Sep 17 00:00:00 2001 From: Dirk Best Date: Thu, 5 Aug 2021 11:00:31 +0200 Subject: z8536: Avoid magic numbers --- src/devices/machine/z8536.cpp | 16 ++++++++-------- src/devices/machine/z8536.h | 9 +++++++++ 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/devices/machine/z8536.cpp b/src/devices/machine/z8536.cpp index fe1a91ff631..6d4fe6825c5 100644 --- a/src/devices/machine/z8536.cpp +++ b/src/devices/machine/z8536.cpp @@ -1041,19 +1041,19 @@ u8 z8536_device::read(offs_t offset) { switch (offset & 0x03) { - case 0: + case EXT_PORT_C: data = read_register(PORT_C_DATA); break; - case 1: + case EXT_PORT_B: data = read_register(PORT_B_DATA); break; - case 2: + case EXT_PORT_A: data = read_register(PORT_A_DATA); break; - case 3: + case EXT_CONTROL: // state 0 or state 1: read data data = read_register(m_pointer); @@ -1107,19 +1107,19 @@ void z8536_device::write(offs_t offset, u8 data) { switch (offset & 0x03) { - case 0: + case EXT_PORT_C: write_register(PORT_C_DATA, data); break; - case 1: + case EXT_PORT_B: write_register(PORT_B_DATA, data); break; - case 2: + case EXT_PORT_A: write_register(PORT_A_DATA, data); break; - case 3: + case EXT_CONTROL: if (m_state0) { // state 0: write pointer diff --git a/src/devices/machine/z8536.h b/src/devices/machine/z8536.h index 487d9b771e0..e307ea09069 100644 --- a/src/devices/machine/z8536.h +++ b/src/devices/machine/z8536.h @@ -443,6 +443,15 @@ protected: virtual void z80daisy_irq_reti() override; private: + // direct external access to ports + enum + { + EXT_PORT_C = 0, + EXT_PORT_B, + EXT_PORT_A, + EXT_CONTROL + }; + // control state machine bool m_state0; u8 m_pointer; -- cgit v1.2.3