summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Zsolt Vasvari <zsoltvas@mamedev.org>2008-03-03 05:17:57 +0000
committer Zsolt Vasvari <zsoltvas@mamedev.org>2008-03-03 05:17:57 +0000
commit34b3ab9841df976415b9f94366d3506076c8e90c (patch)
tree67a3519e3c5a25bc99e7ac8c6f32ad194cee567f
parent62466dd08f6c56a02f2c4ed67048fcd7da68acc3 (diff)
Added running_machine* to the CUSTOM_INPUT callback - updated drivers to use it
-rw-r--r--src/emu/inptport.c2
-rw-r--r--src/emu/inptport.h4
-rw-r--r--src/mame/audio/jedi.c2
-rw-r--r--src/mame/drivers/stactics.c6
-rw-r--r--src/mame/drivers/vicdual.c78
-rw-r--r--src/mame/includes/stactics.h4
-rw-r--r--src/mame/video/stactics.c40
7 files changed, 29 insertions, 107 deletions
diff --git a/src/emu/inptport.c b/src/emu/inptport.c
index 88052d23120..1168997e8e8 100644
--- a/src/emu/inptport.c
+++ b/src/emu/inptport.c
@@ -3449,7 +3449,7 @@ UINT32 readinputport(int port)
/* replace the bits with bits from the custom routine */
input_port_entry *port = custom->port;
portinfo->digital &= ~port->mask;
- portinfo->digital |= ((*port->custom)(port->custom_param) << custom->shift) & port->mask;
+ portinfo->digital |= ((*port->custom)(Machine, port->custom_param) << custom->shift) & port->mask;
}
/* compute the current result: default value XOR the digital, merged with the analog */
diff --git a/src/emu/inptport.h b/src/emu/inptport.h
index b71fab797cf..eee620b8b15 100644
--- a/src/emu/inptport.h
+++ b/src/emu/inptport.h
@@ -40,7 +40,7 @@
/* macro for a custom callback functions (PORT_CUSTOM) */
-#define CUSTOM_INPUT(name) UINT32 name(void *param)
+#define CUSTOM_INPUT(name) UINT32 name(running_machine *machine, void *param)
/* macro for port changed callback functions (PORT_CHANGED) */
#define INPUT_CHANGED(name) void name(running_machine *machine, void *param, UINT32 oldval, UINT32 newval)
@@ -501,7 +501,7 @@ typedef struct _input_port_init_params input_port_init_params;
/* a custom input port callback function */
-typedef UINT32 (*input_port_custom_func)(void *param);
+typedef UINT32 (*input_port_custom_func)(running_machine *machine, void *param);
typedef void (*input_port_changed_func)(running_machine *machine, void *param, UINT32 oldval, UINT32 newval);
diff --git a/src/mame/audio/jedi.c b/src/mame/audio/jedi.c
index 4380363822f..b653c8f49f3 100644
--- a/src/mame/audio/jedi.c
+++ b/src/mame/audio/jedi.c
@@ -104,7 +104,7 @@ static READ8_HANDLER( audio_latch_r )
CUSTOM_INPUT( jedi_audio_comm_stat_r )
{
- jedi_state *state = Machine->driver_data;
+ jedi_state *state = machine->driver_data;
return *state->audio_comm_stat >> 6;
}
diff --git a/src/mame/drivers/stactics.c b/src/mame/drivers/stactics.c
index 08806f5827c..ae28d6af00a 100644
--- a/src/mame/drivers/stactics.c
+++ b/src/mame/drivers/stactics.c
@@ -55,7 +55,7 @@ Verify Color PROM resistor values (Last 8 colors)
static CUSTOM_INPUT( get_motor_not_ready )
{
- stactics_state *state = Machine->driver_data;
+ stactics_state *state = machine->driver_data;
/* if the motor is self-centering, but not centered yet */
return ((*state->motor_on & 0x01) == 0) &&
@@ -130,7 +130,7 @@ static void move_motor(stactics_state *state)
static CUSTOM_INPUT( get_rng )
{
/* this is a 555 timer, but cannot read one of the resistor values */
- return mame_rand(Machine) & 0x07;
+ return mame_rand(machine) & 0x07;
}
@@ -249,7 +249,7 @@ static INPUT_PORTS_START( stactics )
PORT_START /* IN2 */
PORT_BIT (0x07, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(get_rng, 0)
- PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_vblank_count_d3, 0)
+ PORT_BIT (0x08, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM(stactics_get_frame_count_d3, 0)
PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_COIN1 )
PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_COIN2 )
PORT_DIPNAME( 0x40, 0x40, DEF_STR( Free_Play ) )
diff --git a/src/mame/drivers/vicdual.c b/src/mame/drivers/vicdual.c
index 738263a4be9..7976e3957cf 100644
--- a/src/mame/drivers/vicdual.c
+++ b/src/mame/drivers/vicdual.c
@@ -93,7 +93,7 @@ static CUSTOM_INPUT( vicdual_read_coin_status )
coin_counter_w(0, 1);
coin_counter_w(0, 0);
- cpunum_set_input_line(Machine, 0, INPUT_LINE_RESET, PULSE_LINE);
+ cpunum_set_input_line(machine, 0, INPUT_LINE_RESET, PULSE_LINE);
/* simulate the coin switch being closed for a while */
timer_set(double_to_attotime(4 * attotime_to_double(video_screen_get_frame_period(0))), NULL, 0, clear_coin_status);
@@ -136,9 +136,7 @@ static int get_vcounter(void)
/* the vertical synch counter gets incremented at the end of HSYNC,
compensate for this */
if (video_screen_get_hpos(0) >= VICDUAL_HSEND)
- {
vcounter = (vcounter + 1) % VICDUAL_VTOTAL;
- }
return vcounter;
}
@@ -158,7 +156,7 @@ static CUSTOM_INPUT( vicdual_get_vblank_comp )
static CUSTOM_INPUT( vicdual_get_composite_blank_comp )
{
- return (vicdual_get_vblank_comp(0) && !video_screen_get_hblank(0));
+ return (vicdual_get_vblank_comp(machine, 0) && !video_screen_get_hblank(0));
}
@@ -174,7 +172,6 @@ static CUSTOM_INPUT( vicdual_get_timer_value )
if (!timer_started)
{
timer_started = 1;
-
timer_pulse(TIMER_HALF_PERIOD, NULL, 0, vicdual_timer_callback);
}
@@ -193,9 +190,7 @@ static CUSTOM_INPUT( vicdual_get_timer_value )
int vicdual_is_cabinet_color(void)
{
- UINT32 input = readinputportbytag(COLOR_BW_PORT_TAG);
-
- return (input == 0);
+ return (readinputportbytag(COLOR_BW_PORT_TAG) == 0);
}
@@ -220,8 +215,7 @@ static UINT8 *vicdual_characterram;
static WRITE8_HANDLER( vicdual_videoram_w )
{
- video_screen_update_partial(0, video_screen_get_vpos(0));
-
+ video_screen_update_now(0);
vicdual_videoram[offset] = data;
}
@@ -234,7 +228,7 @@ UINT8 vicdual_videoram_r(offs_t offset)
static WRITE8_HANDLER( vicdual_characterram_w )
{
- video_screen_update_partial(0, video_screen_get_vpos(0));
+ video_screen_update_now(0);
vicdual_characterram[offset] = data;
}
@@ -278,7 +272,6 @@ static READ8_HANDLER( depthch_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x08) ret = input_port_1_r(0);
return ret;
@@ -288,7 +281,6 @@ static READ8_HANDLER( depthch_io_r )
static WRITE8_HANDLER( depthch_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x04) depthch_audio_w(0, data);
}
@@ -362,7 +354,6 @@ static READ8_HANDLER( safari_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x08) ret = input_port_1_r(0);
return ret;
@@ -372,7 +363,6 @@ static READ8_HANDLER( safari_io_r )
static WRITE8_HANDLER( safari_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) /* safari_audio_w(0, data) */;
}
@@ -448,7 +438,6 @@ static READ8_HANDLER( frogs_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x08) ret = input_port_1_r(0);
return ret;
@@ -458,7 +447,6 @@ static READ8_HANDLER( frogs_io_r )
static WRITE8_HANDLER( frogs_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) frogs_audio_w(0, data);
}
@@ -558,7 +546,6 @@ static READ8_HANDLER( headon_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x08) ret = input_port_1_r(0);
return ret;
@@ -570,9 +557,7 @@ static READ8_HANDLER( sspaceat_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x04) ret = input_port_1_r(0);
-
if (offset & 0x08) ret = input_port_2_r(0);
return ret;
@@ -582,9 +567,7 @@ static READ8_HANDLER( sspaceat_io_r )
static WRITE8_HANDLER( headon_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) headon_audio_w(0, data);
-
if (offset & 0x04) /* vicdual_palette_bank_w(0, data) */; /* not written to */
}
@@ -763,13 +746,9 @@ static READ8_HANDLER( headon2_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x02) /* schematics show this as in input port, but never read from */
-
if (offset & 0x04) ret = input_port_1_r(0);
-
if (offset & 0x08) ret = input_port_2_r(0);
-
if (offset & 0x12) logerror("********* Read from port %x\n", offset);
return ret;
@@ -779,15 +758,10 @@ static READ8_HANDLER( headon2_io_r )
static WRITE8_HANDLER( headon2_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) headon_audio_w(0, data);
-
if (offset & 0x04) vicdual_palette_bank_w(0, data);
-
if (offset & 0x08) ;/* schematics show this as going into a shifer circuit, but never written to */
-
if (offset & 0x10) ;/* schematics show this as going to an edge connector, but never written to */
-
if (offset & 0x18) logerror("********* Write to port %x\n", offset);
}
@@ -795,9 +769,7 @@ static WRITE8_HANDLER( headon2_io_w )
static WRITE8_HANDLER( digger_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) /* digger_audio_1_w(0, data) */;
-
if (offset & 0x04)
{
vicdual_palette_bank_w(0, data & 0x03);
@@ -805,9 +777,7 @@ static WRITE8_HANDLER( digger_io_w )
}
if (offset & 0x08) ;/* schematics show this as going into a shifer circuit, but never written to */
-
if (offset & 0x10) ;/* schematics show this as going to an edge connector, but never written to */
-
if (offset & 0x18) logerror("********* Write to port %x\n", offset);
}
@@ -994,11 +964,8 @@ MACHINE_DRIVER_END
static WRITE8_HANDLER( invho2_io_w )
{
if (offset & 0x01) invho2_audio_w(0, data);
-
if (offset & 0x02) invinco_audio_w(0, data);
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -1006,11 +973,8 @@ static WRITE8_HANDLER( invho2_io_w )
static WRITE8_HANDLER( invds_io_w )
{
if (offset & 0x01) invinco_audio_w(0, data);
-
if (offset & 0x02) /* deepscan_audio_w(0, data) */;
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -1018,11 +982,8 @@ static WRITE8_HANDLER( invds_io_w )
static WRITE8_HANDLER( sspacaho_io_w )
{
if (offset & 0x01) invho2_audio_w(0, data);
-
if (offset & 0x02) /* sspaceatt_audio_w(0, data) */;
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -1030,9 +991,7 @@ static WRITE8_HANDLER( sspacaho_io_w )
static WRITE8_HANDLER( tranqgun_io_w )
{
if (offset & 0x01) /* tranqgun_audio_w(0, data) */;
-
if (offset & 0x02) vicdual_palette_bank_w(0, data);
-
if (offset & 0x08) assert_coin_status();
}
@@ -1040,11 +999,8 @@ static WRITE8_HANDLER( tranqgun_io_w )
static WRITE8_HANDLER( spacetrk_io_w )
{
if (offset & 0x01) /* spacetrk_audio_w(0, data) */;
-
if (offset & 0x02) /* spacetrk_audio_w(0, data) */;
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -1052,11 +1008,8 @@ static WRITE8_HANDLER( spacetrk_io_w )
static WRITE8_HANDLER( carnival_io_w )
{
if (offset & 0x01) carnival_audio_1_w(0, data);
-
if (offset & 0x02) carnival_audio_2_w(0, data);
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -1064,9 +1017,7 @@ static WRITE8_HANDLER( carnival_io_w )
static WRITE8_HANDLER( brdrline_io_w )
{
if (offset & 0x01) /* brdrline_audio_w(0, data) */;
-
if (offset & 0x02) vicdual_palette_bank_w(0, data);
-
if (offset & 0x08) assert_coin_status();
}
@@ -1074,11 +1025,8 @@ static WRITE8_HANDLER( brdrline_io_w )
static WRITE8_HANDLER( pulsar_io_w )
{
if (offset & 0x01) pulsar_audio_1_w(0, data);
-
if (offset & 0x02) pulsar_audio_2_w(0, data);
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -1100,11 +1048,8 @@ static WRITE8_HANDLER( heiankyo_io_w )
static WRITE8_HANDLER( alphaho_io_w )
{
if (offset & 0x01) /* headon_audio_w(0, data) */;
-
if (offset & 0x02) /* alphaf_audio_w(0, data) */;
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -2035,13 +1980,9 @@ static CUSTOM_INPUT( samurai_protection_r )
UINT32 answer = 0;
if (samurai_protection_data == 0xab)
- {
answer = 0x02;
- }
else if (samurai_protection_data == 0x1d)
- {
answer = 0x0c;
- }
return (answer >> offset) & 0x01;
}
@@ -2050,9 +1991,7 @@ static CUSTOM_INPUT( samurai_protection_r )
static WRITE8_HANDLER( samurai_io_w )
{
if (offset & 0x02) /* samurai_audio_w(0, data) */;
-
if (offset & 0x08) assert_coin_status();
-
if (offset & 0x40) vicdual_palette_bank_w(0, data);
}
@@ -2161,7 +2100,6 @@ static READ8_HANDLER( nsub_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x08) ret = input_port_1_r(0);
return ret;
@@ -2171,9 +2109,7 @@ static READ8_HANDLER( nsub_io_r )
static WRITE8_HANDLER( nsub_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) /* nsub_audio_w(0, data) */;
-
if (offset & 0x04) vicdual_palette_bank_w(0, data);
}
@@ -2259,9 +2195,7 @@ static READ8_HANDLER( invinco_io_r )
UINT8 ret = 0;
if (offset & 0x01) ret = input_port_0_r(0);
-
if (offset & 0x02) ret = input_port_1_r(0);
-
if (offset & 0x08) ret = input_port_2_r(0);
return ret;
@@ -2271,9 +2205,7 @@ static READ8_HANDLER( invinco_io_r )
static WRITE8_HANDLER( invinco_io_w )
{
if (offset & 0x01) assert_coin_status();
-
if (offset & 0x02) invinco_audio_w(0, data);
-
if (offset & 0x04) vicdual_palette_bank_w(0, data);
}
diff --git a/src/mame/includes/stactics.h b/src/mame/includes/stactics.h
index b4413d00751..66d8612ffb2 100644
--- a/src/mame/includes/stactics.h
+++ b/src/mame/includes/stactics.h
@@ -27,7 +27,7 @@ struct _stactics_state
UINT8 y_scroll_d;
UINT8 y_scroll_e;
UINT8 y_scroll_f;
- UINT8 vblank_count;
+ UINT8 frame_count;
UINT8 shot_standby;
UINT8 shot_arrive;
UINT16 beam_state;
@@ -45,7 +45,7 @@ WRITE8_HANDLER( stactics_scroll_ram_w );
WRITE8_HANDLER( stactics_speed_latch_w );
WRITE8_HANDLER( stactics_shot_trigger_w );
WRITE8_HANDLER( stactics_shot_flag_clear_w );
-CUSTOM_INPUT( stactics_get_vblank_count_d3 );
+CUSTOM_INPUT( stactics_get_frame_count_d3 );
CUSTOM_INPUT( stactics_get_shot_standby );
CUSTOM_INPUT( stactics_get_not_shot_arrive );
diff --git a/src/mame/video/stactics.c b/src/mame/video/stactics.c
index be9f37bbb56..d735d1cb67c 100644
--- a/src/mame/video/stactics.c
+++ b/src/mame/video/stactics.c
@@ -94,38 +94,30 @@ WRITE8_HANDLER( stactics_scroll_ram_w )
{
stactics_state *state = Machine->driver_data;
- switch (offset >> 8)
+ if (data & 0x01)
{
- case 4: // Page D
- if (data & 0x01)
- state->y_scroll_d = offset & 0xff;
- break;
-
- case 5: // Page E
- if (data & 0x01)
- state->y_scroll_e = offset & 0xff;
- break;
-
- case 6: // Page F
- if (data & 0x01)
- state->y_scroll_f = offset & 0xff;
- break;
- }
+ switch (offset >> 8)
+ {
+ case 4: state->y_scroll_d = offset & 0xff; break;
+ case 5: state->y_scroll_e = offset & 0xff; break;
+ case 6: state->y_scroll_f = offset & 0xff; break;
+ }
+ }
}
/*************************************
*
- * VBLANK counter
+ * Frane counter
*
*************************************/
-CUSTOM_INPUT( stactics_get_vblank_count_d3 )
+CUSTOM_INPUT( stactics_get_frame_count_d3 )
{
- stactics_state *state = Machine->driver_data;
+ stactics_state *state = machine->driver_data;
- return (state->vblank_count >> 3) & 0x01;
+ return (state->frame_count >> 3) & 0x01;
}
@@ -181,7 +173,7 @@ WRITE8_HANDLER( stactics_shot_flag_clear_w )
CUSTOM_INPUT( stactics_get_shot_standby )
{
- stactics_state *state = Machine->driver_data;
+ stactics_state *state = machine->driver_data;
return state->shot_standby;
}
@@ -189,7 +181,7 @@ CUSTOM_INPUT( stactics_get_shot_standby )
CUSTOM_INPUT( stactics_get_not_shot_arrive )
{
- stactics_state *state = Machine->driver_data;
+ stactics_state *state = machine->driver_data;
return !state->shot_arrive;
}
@@ -382,11 +374,11 @@ static VIDEO_START( stactics )
state->y_scroll_e = 0;
state->y_scroll_f = 0;
+ state->frame_count = 0;
state->shot_standby = 1;
state->shot_arrive = 0;
state->beam_state = 0;
state->old_beam_state = 0;
- state->vblank_count = 0;
}
@@ -405,8 +397,6 @@ static VIDEO_UPDATE( stactics )
draw_background(state, bitmap, cliprect);
update_artwork(state);
- state->vblank_count = (state->vblank_count + 1) & 0x0f;
-
return 0;
}