8bit handlers are more appropriate here. nw.

This commit is contained in:
etabeta78 2016-04-14 07:55:32 +02:00
parent bf9ef09474
commit 013440849c
7 changed files with 56 additions and 61 deletions

View File

@ -77,9 +77,9 @@ void neogeo_control_port_device::device_start()
}
UINT16 neogeo_control_port_device::read_ctrl()
UINT8 neogeo_control_port_device::read_ctrl()
{
UINT16 data = 0;
UINT8 data = 0;
if (m_device)
data |= m_device->read_ctrl();
return data;

View File

@ -29,7 +29,7 @@ public:
device_neogeo_control_port_interface(const machine_config &mconfig, device_t &device);
virtual ~device_neogeo_control_port_interface();
virtual UINT16 read_ctrl() { return 0xffff; };
virtual UINT8 read_ctrl() { return 0xff; };
virtual UINT8 read_start_sel() { return 0xff; };
virtual void write_ctrlsel(UINT8 data) { };
@ -47,10 +47,10 @@ public:
neogeo_control_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
virtual ~neogeo_control_port_device();
UINT16 read_ctrl();
UINT8 read_ctrl();
UINT8 read_start_sel();
void write_ctrlsel(UINT8 data);
DECLARE_READ16_MEMBER( ctrl_r ) { return read_ctrl(); }
DECLARE_READ8_MEMBER( ctrl_r ) { return read_ctrl(); }
protected:
// device-level overrides

View File

@ -17,15 +17,14 @@ const device_type NEOGEO_JOYSTICK = &device_creator<neogeo_joystick_device>;
static INPUT_PORTS_START( neogeo_joy )
PORT_START("JOY")
PORT_BIT( 0x00ff, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_START("START_SELECT")
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START )
@ -83,7 +82,7 @@ void neogeo_joystick_device::device_reset()
// read_ctrl
//-------------------------------------------------
UINT16 neogeo_joystick_device::read_ctrl()
UINT8 neogeo_joystick_device::read_ctrl()
{
return m_joy->read();
}

View File

@ -37,7 +37,7 @@ protected:
virtual void device_reset() override;
// device_intv_control_port_interface overrides
virtual UINT16 read_ctrl() override;
virtual UINT8 read_ctrl() override;
virtual UINT8 read_start_sel() override;
private:
@ -64,7 +64,7 @@ protected:
virtual void device_reset() override;
// device_intv_control_port_interface overrides
virtual UINT16 read_ctrl() override;
virtual UINT8 read_ctrl() override;
private:
required_ioport m_joy;

View File

@ -17,49 +17,45 @@ const device_type NEOGEO_MJCTRL = &device_creator<neogeo_mjctrl_device>;
static INPUT_PORTS_START( neogeo_joy )
PORT_START("MJ.0")
PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_A )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_B )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_C )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_D )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_E )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_F )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_G )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_A )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_B )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_C )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_D )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_E )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_F )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_G )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("MJ.1")
PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_H )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_I )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_J )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_K )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_L )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_MAHJONG_M )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_MAHJONG_N )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON6 )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_H )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_I )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_J )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_K )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_L )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_MAHJONG_M )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_MAHJONG_N )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON6 )
// is this actually connected?
PORT_START("MJ.2")
PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON3 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON4 )
PORT_START("MJ.3")
PORT_BIT( 0x00ff, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_BIT( 0x0100, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
PORT_BIT( 0x0200, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
PORT_BIT( 0x0400, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
PORT_BIT( 0x0800, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
PORT_BIT( 0x1000, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
PORT_BIT( 0x2000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x4000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x8000, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_MAHJONG_PON )
PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_MAHJONG_CHI )
PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_MAHJONG_KAN )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_MAHJONG_RON )
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_MAHJONG_REACH )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
PORT_START("START_SELECT")
PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_START )
@ -119,13 +115,13 @@ void neogeo_mjctrl_device::device_reset()
// read_ctrl
//-------------------------------------------------
UINT16 neogeo_mjctrl_device::read_ctrl()
UINT8 neogeo_mjctrl_device::read_ctrl()
{
UINT16 res = 0;
UINT8 res = 0;
switch (m_ctrl_sel)
{
default:
case 0x00: res = 0xffff; break;
case 0x00: res = 0xff; break;
case 0x09: res = m_mjpanel[0]->read(); break;
case 0x12: res = m_mjpanel[1]->read(); break;
case 0x1b: res = m_mjpanel[2]->read(); break;

View File

@ -37,7 +37,7 @@ protected:
virtual void device_reset() override;
// device_intv_control_port_interface overrides
virtual UINT16 read_ctrl() override;
virtual UINT8 read_ctrl() override;
virtual UINT8 read_start_sel() override;
virtual void write_ctrlsel(UINT8 data) override;

View File

@ -242,9 +242,9 @@ static ADDRESS_MAP_START( aes_main_map, AS_PROGRAM, 16, ng_aes_state )
/* some games have protection devices in the 0x200000 region, it appears to map to cart space, not surprising, the ROM is read here too */
//AM_RANGE(0x200000, 0x2fffff) AM_ROMBANK("cartridge")
//AM_RANGE(0x2ffff0, 0x2fffff) AM_WRITE(main_cpu_bank_select_w)
AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_DEVREAD("ctrl1", neogeo_control_port_device, ctrl_r)
AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_DEVREAD8("ctrl1", neogeo_control_port_device, ctrl_r, 0xff00)
AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00)
AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_DEVREAD("ctrl2", neogeo_control_port_device, ctrl_r)
AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_DEVREAD8("ctrl2", neogeo_control_port_device, ctrl_r, 0xff00)
AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r)
AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r)
AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff)
@ -1227,9 +1227,9 @@ static ADDRESS_MAP_START( neocd_main_map, AS_PROGRAM, 16, ngcd_state )
AM_RANGE(0x000000, 0x00007f) AM_READ(banked_vectors_r)
AM_RANGE(0x000000, 0x1fffff) AM_RAM AM_REGION("maincpu", 0x00000)
AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_DEVREAD("ctrl1", neogeo_control_port_device, ctrl_r)
AM_RANGE(0x300000, 0x300001) AM_MIRROR(0x01fffe) AM_DEVREAD8("ctrl1", neogeo_control_port_device, ctrl_r, 0xff00)
AM_RANGE(0x320000, 0x320001) AM_MIRROR(0x01fffe) AM_READ_PORT("AUDIO") AM_WRITE8(audio_command_w, 0xff00)
AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_DEVREAD("ctrl2", neogeo_control_port_device, ctrl_r)
AM_RANGE(0x340000, 0x340001) AM_MIRROR(0x01fffe) AM_DEVREAD8("ctrl1", neogeo_control_port_device, ctrl_r, 0xff00)
AM_RANGE(0x360000, 0x37ffff) AM_READ(neogeo_unmapped_r)
AM_RANGE(0x380000, 0x380001) AM_MIRROR(0x01fffe) AM_READ(aes_in2_r)
AM_RANGE(0x380000, 0x38007f) AM_MIRROR(0x01ff80) AM_WRITE8(io_control_w, 0x00ff)