modernization of some CUSTOM_INPUT's part 4 (no whatsnew)

This commit is contained in:
Miodrag Milanovic 2012-04-09 13:23:05 +00:00
parent d1bd5be055
commit 90d9f9ca06
11 changed files with 48 additions and 47 deletions

View File

@ -226,7 +226,7 @@ static INPUT_PORTS_START( sicv )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in1_control_r, NULL)
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in1_control_r, NULL)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_START("IN2")
@ -241,7 +241,7 @@ static INPUT_PORTS_START( sicv )
PORT_DIPSETTING( 0x00, "1500" )
/* SW1:5,6,7: In OFF, PL2 can have no control of joystick, going auto left/right and other problems like no laser gun.
Be sure these are always ON */
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in2_control_r, NULL) PORT_DIPLOCATION("SW1:5,6,7") /* Labeled as "FACTORY" */
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in2_control_r, NULL) PORT_DIPLOCATION("SW1:5,6,7") /* Labeled as "FACTORY" */
PORT_DIPNAME( 0x80, 0x00, "Coin Info" ) PORT_DIPLOCATION("SW1:8")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
@ -1623,7 +1623,7 @@ static INPUT_PORTS_START( yosakdon )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNKNOWN )
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in1_control_r, NULL)
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in1_control_r, NULL)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("IN1")
@ -1638,7 +1638,7 @@ static INPUT_PORTS_START( yosakdon )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Unknown ) )
PORT_DIPSETTING( 0x08, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in2_control_r, NULL)
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in2_control_r, NULL)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
/* Dummy controls port, P1 */

View File

@ -167,7 +167,7 @@ static INPUT_PORTS_START( common )
PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith_state, eolith_speedup_getvblank, NULL)
PORT_BIT( 0x00003f80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_SERVICE_NO_TOGGLE( 0x00008000, IP_ACTIVE_LOW )
@ -205,7 +205,7 @@ static INPUT_PORTS_START( ironfort )
PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith_state, eolith_speedup_getvblank, NULL)
PORT_BIT( 0x00003f80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00008000, IP_ACTIVE_LOW, IPT_UNUSED )
@ -388,7 +388,7 @@ static INPUT_PORTS_START( stealsee )
PORT_BIT( 0x00000008, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x00000020, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(stealsee_speedup_getvblank, NULL)
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith_state, stealsee_speedup_getvblank, NULL)
PORT_BIT( 0x00003f80, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x00004000, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_SERVICE_NO_TOGGLE( 0x00008000, IP_ACTIVE_LOW )

View File

@ -12,15 +12,17 @@
#include "emu.h"
#include "cpu/e132xs/e132xs.h"
#include "machine/eeprom.h"
#include "sound/okim6295.h"
#include "includes/eolith.h"
#include "includes/eolithsp.h"
class eolith16_state : public driver_device
class eolith16_state : public eolith_state
{
public:
eolith16_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) { }
: eolith_state(mconfig, type, tag) { }
UINT16 *m_vram;
int m_vbuffer;
@ -89,7 +91,7 @@ ADDRESS_MAP_END
static INPUT_PORTS_START( eolith16 )
PORT_START("SPECIAL")
PORT_BIT( 0x0010, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_READ_LINE_DEVICE_MEMBER("eeprom", eeprom_device, read_bit)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
PORT_BIT( 0x0080, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, eolith16_state, eolith_speedup_getvblank, NULL)
PORT_BIT( 0xff6f, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_START("SYSTEM")

View File

@ -98,25 +98,23 @@ TIMER_DEVICE_CALLBACK( eolith_speedup )
}
}
CUSTOM_INPUT( eolith_speedup_getvblank )
CUSTOM_INPUT_MEMBER(eolith_state::eolith_speedup_getvblank)
{
// printf("%s:eolith speedup_read data %02x\n",field.machine().describe_context(), eolith_vblank);
// printf("%s:eolith speedup_read data %02x\n",machine().describe_context(), eolith_vblank);
return (field.machine().primary_screen->vpos() >= 240);
return (machine().primary_screen->vpos() >= 240);
}
// StealSee doesn't use interrupts, just the vblank
CUSTOM_INPUT( stealsee_speedup_getvblank )
CUSTOM_INPUT_MEMBER(eolith_state::stealsee_speedup_getvblank)
{
eolith_state *state = field.machine().driver_data<eolith_state>();
int pc = cpu_get_pc(state->m_maincpu);
int pc = cpu_get_pc(m_maincpu);
if (pc==0x400081ec)
if(!eolith_vblank)
device_eat_cycles(state->m_maincpu, 500);
device_eat_cycles(m_maincpu, 500);
return (field.machine().primary_screen->vpos() >= 240);
return (machine().primary_screen->vpos() >= 240);
}

View File

@ -2481,27 +2481,26 @@ static INPUT_PORTS_START( scobras )
INPUT_PORTS_END
static CUSTOM_INPUT( moonwar_dial_r )
CUSTOM_INPUT_MEMBER(galaxian_state::moonwar_dial_r)
{
galaxian_state *state = field.machine().driver_data<galaxian_state>();
static const char *const dialname[2] = { "P1_DIAL", "P2_DIAL" };
int p = (~state->m_moonwar_port_select >> 4) & 1;
int p = (~m_moonwar_port_select >> 4) & 1;
// see http://www.cityofberwyn.com/schematics/stern/MoonWar_opto.tiff for schematic
// I.e. a 74ls161 counts from 0 to 15 which is the absolute number of bars passed on the quadrature
signed char dialread = input_port_read(field.machine(), dialname[p]);
signed char dialread = input_port_read(machine(), dialname[p]);
UINT8 ret;
if (dialread < 0) state->m_direction[p] = 0x00;
else if (dialread > 0) state->m_direction[p] = 0x10;
if (dialread < 0) m_direction[p] = 0x00;
else if (dialread > 0) m_direction[p] = 0x10;
state->m_counter_74ls161[p] += abs(dialread);
state->m_counter_74ls161[p] &= 0xf;
m_counter_74ls161[p] += abs(dialread);
m_counter_74ls161[p] &= 0xf;
ret = state->m_counter_74ls161[p] | state->m_direction[p];
//fprintf(stderr, "dialread1: %02x, counter_74ls161: %02x, spinner ret is %02x\n", dialread, state->m_counter_74ls161[p], ret);
ret = m_counter_74ls161[p] | m_direction[p];
//fprintf(stderr, "dialread1: %02x, counter_74ls161: %02x, spinner ret is %02x\n", dialread, m_counter_74ls161[p], ret);
return ret;
}
@ -2509,7 +2508,7 @@ static CUSTOM_INPUT( moonwar_dial_r )
/* verified from Z80 code */
static INPUT_PORTS_START( moonwar )
PORT_START("IN0")
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(moonwar_dial_r, (void *)0)
PORT_BIT( 0x1f, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, galaxian_state, moonwar_dial_r, (void *)0)
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_COCKTAIL // cocktail: p2 shield
PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN1 )

View File

@ -2590,23 +2590,23 @@ CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in0_control_r)
}
CUSTOM_INPUT( invaders_in1_control_r )
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in1_control_r)
{
return input_port_read(field.machine(), INVADERS_P1_CONTROL_PORT_TAG);
return input_port_read(machine(), INVADERS_P1_CONTROL_PORT_TAG);
}
CUSTOM_INPUT( invaders_in2_control_r )
CUSTOM_INPUT_MEMBER(mw8080bw_state::invaders_in2_control_r)
{
UINT32 ret;
/* upright PCB : P1 controls
cocktail PCB: P2 controls */
if (invaders_is_cabinet_cocktail(field.machine()))
ret = input_port_read(field.machine(), INVADERS_P2_CONTROL_PORT_TAG);
if (invaders_is_cabinet_cocktail(machine()))
ret = input_port_read(machine(), INVADERS_P2_CONTROL_PORT_TAG);
else
ret = input_port_read(field.machine(), INVADERS_P1_CONTROL_PORT_TAG);
ret = input_port_read(machine(), INVADERS_P1_CONTROL_PORT_TAG);
return ret;
}
@ -2648,7 +2648,7 @@ static INPUT_PORTS_START( invaders )
PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_START2 )
PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_START1 )
PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in1_control_r, NULL)
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in1_control_r, NULL)
PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_UNUSED )
PORT_START("IN2")
@ -2661,7 +2661,7 @@ static INPUT_PORTS_START( invaders )
PORT_DIPNAME( 0x08, 0x00, DEF_STR( Bonus_Life ) ) PORT_DIPLOCATION("SW:2")
PORT_DIPSETTING( 0x08, "1000" )
PORT_DIPSETTING( 0x00, "1500" )
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(invaders_in2_control_r, NULL)
PORT_BIT( 0x70, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mw8080bw_state,invaders_in2_control_r, NULL)
PORT_DIPNAME( 0x80, 0x00, "Display Coinage" ) PORT_DIPLOCATION("SW:1")
PORT_DIPSETTING( 0x80, DEF_STR( Off ) )
PORT_DIPSETTING( 0x00, DEF_STR( On ) )

View File

@ -15,14 +15,15 @@
#include "emu.h"
#include "cpu/e132xs/e132xs.h"
#include "machine/at28c16.h"
#include "includes/eolith.h"
#include "includes/eolithsp.h"
class vegaeo_state : public driver_device
class vegaeo_state : public eolith_state
{
public:
vegaeo_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag) { }
: eolith_state(mconfig, type, tag) { }
UINT32 *m_vega_vram;
UINT8 m_vega_vbuffer;
@ -117,7 +118,7 @@ static INPUT_PORTS_START( crazywar )
PORT_BIT( 0x00000008, IP_ACTIVE_LOW, IPT_START2 )
PORT_BIT( 0x00000010, IP_ACTIVE_LOW, IPT_SERVICE1 )
PORT_SERVICE_NO_TOGGLE( 0x00000020, IP_ACTIVE_LOW )
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM(eolith_speedup_getvblank, NULL)
PORT_BIT( 0x00000040, IP_ACTIVE_LOW, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, vegaeo_state, eolith_speedup_getvblank, NULL)
PORT_BIT( 0x00000080, IP_ACTIVE_LOW, IPT_UNUSED )
PORT_BIT( 0xffffff00, IP_ACTIVE_LOW, IPT_UNUSED )

View File

@ -17,6 +17,8 @@ public:
DECLARE_READ32_MEMBER(hidctch3_pen2_r);
DECLARE_WRITE32_MEMBER(eolith_vram_w);
DECLARE_READ32_MEMBER(eolith_vram_r);
DECLARE_CUSTOM_INPUT_MEMBER(eolith_speedup_getvblank);
DECLARE_CUSTOM_INPUT_MEMBER(stealsee_speedup_getvblank);
};

View File

@ -3,6 +3,5 @@
void eolith_speedup_read(address_space *space);
void init_eolith_speedup(running_machine &machine);
TIMER_DEVICE_CALLBACK( eolith_speedup );
CUSTOM_INPUT( eolith_speedup_getvblank );
CUSTOM_INPUT( stealsee_speedup_getvblank );

View File

@ -95,6 +95,7 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(azurian_port_r);
DECLARE_CUSTOM_INPUT_MEMBER(kingball_muxbit_r);
DECLARE_CUSTOM_INPUT_MEMBER(kingball_noise_r);
DECLARE_CUSTOM_INPUT_MEMBER(moonwar_dial_r);
};

View File

@ -103,8 +103,10 @@ public:
DECLARE_CUSTOM_INPUT_MEMBER(invaders_coin_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_sw6_sw7_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_sw5_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in0_control_r);
DECLARE_CUSTOM_INPUT_MEMBER(blueshrk_coin_input_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in0_control_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in1_control_r);
DECLARE_CUSTOM_INPUT_MEMBER(invaders_in2_control_r);
};
@ -152,9 +154,6 @@ extern const char layout_invaders[];
UINT8 tornbase_get_cabinet_type(running_machine &machine);
CUSTOM_INPUT( invaders_in1_control_r );
CUSTOM_INPUT( invaders_in2_control_r );
int invaders_is_cabinet_cocktail(running_machine &machine);