summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-02-16 16:27:51 -0500
committer AJR <ajrhacker@users.noreply.github.com>2019-02-16 16:28:21 -0500
commit72213467f115db92e06262d6a17371cff246ad0e (patch)
tree39caca414a00165b684dc9722dc31a53b4de1150
parent8e3a8fd4a33f23f222c58dce406375f8c715c311 (diff)
apple2: Slight code cleanup (nw)
Note that the 0x3f mask formerly used instead of 0x7f for one case was spurious.
-rw-r--r--src/mame/drivers/apple2.cpp27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/mame/drivers/apple2.cpp b/src/mame/drivers/apple2.cpp
index 7e0b4bea203..f01df1d4176 100644
--- a/src/mame/drivers/apple2.cpp
+++ b/src/mame/drivers/apple2.cpp
@@ -626,41 +626,42 @@ READ8_MEMBER(apple2_state::switches_r)
READ8_MEMBER(apple2_state::flags_r)
{
+ uint8_t busdata = read_floatingbus() & 0x7f;
+
// Y output of 74LS251 at H14 read as D7
switch (offset)
{
case 0: // cassette in
- return (m_cassette->input() > 0.0 ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return (m_cassette->input() > 0.0 ? 0x80 : 0) | busdata;
case 1: // button 0
- return ((m_joybuttons->read() & 0x10) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return (BIT(m_joybuttons->read(), 4) ? 0x80 : 0) | busdata;
case 2: // button 1
- return ((m_joybuttons->read() & 0x20) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return (BIT(m_joybuttons->read(), 5) ? 0x80 : 0) | busdata;
case 3: // button 2
// check if SHIFT key mod configured
- if (m_sysconfig->read() & 0x04)
- {
- return (((m_joybuttons->read() & 0x40) || (m_kbspecial->read() & 0x06)) ? 0x80 : 0) | (read_floatingbus() & 0x3f);
- }
- return ((m_joybuttons->read() & 0x40) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ if (BIT(m_sysconfig->read(), 2))
+ return ((BIT(m_joybuttons->read(), 6) || (m_kbspecial->read() & 0x06) != 0) ? 0x80 : 0) | busdata;
+ else
+ return (BIT(m_joybuttons->read(), 6) ? 0x80 : 0) | busdata;
case 4: // joy 1 X axis
- return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return ((machine().time().as_double() < m_joystick_x1_time) ? 0x80 : 0) | busdata;
case 5: // joy 1 Y axis
- return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return ((machine().time().as_double() < m_joystick_y1_time) ? 0x80 : 0) | busdata;
case 6: // joy 2 X axis
- return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return ((machine().time().as_double() < m_joystick_x2_time) ? 0x80 : 0) | busdata;
case 7: // joy 2 Y axis
- return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | (read_floatingbus() & 0x7f);
+ return ((machine().time().as_double() < m_joystick_y2_time) ? 0x80 : 0) | busdata;
}
// this is never reached
- return 0;
+ return busdata;
}
READ8_MEMBER(apple2_state::controller_strobe_r)