h89/sigmsoft_sound.cpp: Minor cleanup of code. (#13130)

This commit is contained in:
Mark Garlanger 2024-12-29 07:24:54 -06:00 committed by GitHub
parent 2ef5834731
commit f1a3fee3fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -59,7 +59,7 @@ private:
required_ioport m_joystick1, m_joystick2;
required_ioport m_config;
u8 port_selection;
u8 m_port_selection;
};
//**************************************************************************
@ -74,18 +74,18 @@ static INPUT_PORTS_START( sigma_sound )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_START("joystick_p2")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_PLAYER(2)
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_PLAYER(2)
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_PLAYER(2)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
PORT_START("CONFIG")
PORT_CONFNAME(0x03, 0x01, "Port selection")
PORT_CONFSETTING( 0x00, "Disabled")
PORT_CONFSETTING( 0x01, "AUX - 320 Octal (0xD0)")
PORT_CONFSETTING( 0x02, "MODEM - 330 Octal (0xD8)")
PORT_CONFSETTING( 0x03, "LP - 340 Octal (0xE0)")
PORT_CONFNAME( 0x03, 0x01, "Port selection" )
PORT_CONFSETTING( 0x00, "Disabled" )
PORT_CONFSETTING( 0x01, "AUX - 320 Octal (0xD0)" )
PORT_CONFSETTING( 0x02, "MODEM - 330 Octal (0xD8)" )
PORT_CONFSETTING( 0x03, "LP - 340 Octal (0xE0)" )
INPUT_PORTS_END
@ -101,8 +101,7 @@ h89bus_sigmasoft_snd_device::h89bus_sigmasoft_snd_device(const machine_config &m
void h89bus_sigmasoft_snd_device::write(u8 select_lines, u8 reg, u8 val)
{
// we respond to the SER0 decode
if (!(select_lines & port_selection))
if (!(select_lines & m_port_selection))
{
return;
}
@ -111,20 +110,20 @@ void h89bus_sigmasoft_snd_device::write(u8 select_lines, u8 reg, u8 val)
switch (reg)
{
case 0:
m_ay8910->data_w(val);
break;
case 1:
m_ay8910->address_w(val);
break;
default:
LOGERR("%s: unexpected port write: %d - 0x%02x]n", FUNCNAME, reg, val);
case 0:
m_ay8910->data_w(val);
break;
case 1:
m_ay8910->address_w(val);
break;
default:
LOGERR("%s: unexpected port write: %d - 0x%02x\n", FUNCNAME, reg, val);
}
}
u8 h89bus_sigmasoft_snd_device::read(u8 select_lines, u8 reg)
{
if (!(select_lines & port_selection))
if (!(select_lines & m_port_selection))
{
return 0;
}
@ -133,14 +132,14 @@ u8 h89bus_sigmasoft_snd_device::read(u8 select_lines, u8 reg)
switch (reg)
{
case 0:
value = m_ay8910->data_r();
break;
case 1:
value = this->read_joystick();
break;
default:
LOGERR("%s: unexpected port read: %d\n", FUNCNAME, reg);
case 0:
value = m_ay8910->data_r();
break;
case 1:
value = this->read_joystick();
break;
default:
LOGERR("%s: unexpected port read: %d\n", FUNCNAME, reg);
}
LOGFUNC("%s: reg: %d val: %d\n", FUNCNAME, reg, value);
@ -169,7 +168,7 @@ u8 h89bus_sigmasoft_snd_device::read_joystick()
u8 joy1 = m_joystick1->read();
u8 joy2 = m_joystick2->read();
return this->transform_joystick_input(joy1) << 4 & this->transform_joystick_input(joy2);
return (this->transform_joystick_input(joy1) << 4) | this->transform_joystick_input(joy2);
}
void h89bus_sigmasoft_snd_device::device_start()
@ -180,20 +179,19 @@ void h89bus_sigmasoft_snd_device::device_reset()
{
ioport_value const config(m_config->read());
switch (config & 0x03)
{
case 0x00:
port_selection = 0;
m_port_selection = 0;
break;
case 0x01:
port_selection = h89bus_device::H89_SER0;
m_port_selection = h89bus_device::H89_SER0;
break;
case 0x02:
port_selection = h89bus_device::H89_SER1;
m_port_selection = h89bus_device::H89_SER1;
break;
case 0x03:
port_selection = h89bus_device::H89_LP;
m_port_selection = h89bus_device::H89_LP;
break;
}
}