diff options
author | 2021-08-05 11:00:31 +0200 | |
---|---|---|
committer | 2021-08-05 11:01:04 +0200 | |
commit | aaf23770a3350d3838bf323f54c7fe0a69a90e42 (patch) | |
tree | 135deb94ea3e3f6c7e1c25f2aecdc7d0ec4a7f83 | |
parent | 4c1ab8885de73ad6127af0274e5345e6e9803f1c (diff) |
z8536: Avoid magic numbers
-rw-r--r-- | src/devices/machine/z8536.cpp | 16 | ||||
-rw-r--r-- | 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; |