summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/drivers/gridlee.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mame/drivers/gridlee.c')
-rw-r--r--src/mame/drivers/gridlee.c44
1 files changed, 21 insertions, 23 deletions
diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c
index d77123d22ce..015d0ca77c9 100644
--- a/src/mame/drivers/gridlee.c
+++ b/src/mame/drivers/gridlee.c
@@ -173,16 +173,15 @@ static MACHINE_RESET( gridlee )
*
*************************************/
-static READ8_HANDLER( analog_port_r )
+READ8_MEMBER(gridlee_state::analog_port_r)
{
- gridlee_state *state = space->machine().driver_data<gridlee_state>();
int delta, sign, magnitude;
UINT8 newval;
static const char *const portnames[] = { "TRACK0_Y", "TRACK0_X", "TRACK1_Y", "TRACK1_X" };
/* first read the new trackball value and compute the signed delta */
- newval = input_port_read(space->machine(), portnames[offset + 2 * state->m_cocktail_flip]);
- delta = (int)newval - (int)state->m_last_analog_input[offset];
+ newval = input_port_read(machine(), portnames[offset + 2 * m_cocktail_flip]);
+ delta = (int)newval - (int)m_last_analog_input[offset];
/* handle the case where we wrap around from 0x00 to 0xff, or vice versa */
if (delta >= 0x80)
@@ -192,18 +191,18 @@ static READ8_HANDLER( analog_port_r )
/* just return the previous value for deltas less than 2, which are ignored */
if (delta >= -1 && delta <= 1)
- return state->m_last_analog_output[offset];
- state->m_last_analog_input[offset] = newval;
+ return m_last_analog_output[offset];
+ m_last_analog_input[offset] = newval;
/* compute the sign and the magnitude */
sign = (delta < 0) ? 0x10 : 0x00;
magnitude = (delta < 0) ? -delta : delta;
/* add the magnitude to the running total */
- state->m_last_analog_output[offset] += magnitude;
+ m_last_analog_output[offset] += magnitude;
/* or in the sign bit and return that */
- return (state->m_last_analog_output[offset] & 15) | sign;
+ return (m_last_analog_output[offset] & 15) | sign;
}
@@ -256,17 +255,16 @@ static void poly17_init(running_machine &machine)
*
*************************************/
-static READ8_HANDLER( random_num_r )
+READ8_MEMBER(gridlee_state::random_num_r)
{
- gridlee_state *state = space->machine().driver_data<gridlee_state>();
UINT32 cc;
/* CPU runs at 1.25MHz, noise source at 100kHz --> multiply by 12.5 */
- cc = state->m_maincpu->total_cycles();
+ cc = m_maincpu->total_cycles();
/* 12.5 = 8 + 4 + 0.5 */
cc = (cc << 3) + (cc << 2) + (cc >> 1);
- return state->m_rand17[cc & POLY17_SIZE];
+ return m_rand17[cc & POLY17_SIZE];
}
@@ -277,23 +275,23 @@ static READ8_HANDLER( random_num_r )
*
*************************************/
-static WRITE8_HANDLER( led_0_w )
+WRITE8_MEMBER(gridlee_state::led_0_w)
{
- set_led_status(space->machine(), 0, data & 1);
+ set_led_status(machine(), 0, data & 1);
logerror("LED 0 %s\n", (data & 1) ? "on" : "off");
}
-static WRITE8_HANDLER( led_1_w )
+WRITE8_MEMBER(gridlee_state::led_1_w)
{
- set_led_status(space->machine(), 1, data & 1);
+ set_led_status(machine(), 1, data & 1);
logerror("LED 1 %s\n", (data & 1) ? "on" : "off");
}
-static WRITE8_HANDLER( gridlee_coin_counter_w )
+WRITE8_MEMBER(gridlee_state::gridlee_coin_counter_w)
{
- coin_counter_w(space->machine(), 0, data & 1);
+ coin_counter_w(machine(), 0, data & 1);
logerror("coin counter %s\n", (data & 1) ? "on" : "off");
}
@@ -309,19 +307,19 @@ static WRITE8_HANDLER( gridlee_coin_counter_w )
static ADDRESS_MAP_START( cpu1_map, AS_PROGRAM, 8, gridlee_state )
AM_RANGE(0x0000, 0x07ff) AM_RAM AM_BASE(m_spriteram)
AM_RANGE(0x0800, 0x7fff) AM_RAM_WRITE_LEGACY(gridlee_videoram_w) AM_BASE(m_videoram)
- AM_RANGE(0x9000, 0x9000) AM_WRITE_LEGACY(led_0_w)
- AM_RANGE(0x9010, 0x9010) AM_WRITE_LEGACY(led_1_w)
- AM_RANGE(0x9020, 0x9020) AM_WRITE_LEGACY(gridlee_coin_counter_w)
+ AM_RANGE(0x9000, 0x9000) AM_WRITE(led_0_w)
+ AM_RANGE(0x9010, 0x9010) AM_WRITE(led_1_w)
+ AM_RANGE(0x9020, 0x9020) AM_WRITE(gridlee_coin_counter_w)
/* { 0x9060, 0x9060, unknown - only written to at startup */
AM_RANGE(0x9070, 0x9070) AM_WRITE_LEGACY(gridlee_cocktail_flip_w)
AM_RANGE(0x9200, 0x9200) AM_WRITE_LEGACY(gridlee_palette_select_w)
AM_RANGE(0x9380, 0x9380) AM_WRITE_LEGACY(watchdog_reset_w)
- AM_RANGE(0x9500, 0x9501) AM_READ_LEGACY(analog_port_r)
+ AM_RANGE(0x9500, 0x9501) AM_READ(analog_port_r)
AM_RANGE(0x9502, 0x9502) AM_READ_PORT("IN0")
AM_RANGE(0x9503, 0x9503) AM_READ_PORT("IN1")
AM_RANGE(0x9600, 0x9600) AM_READ_PORT("DSW")
AM_RANGE(0x9700, 0x9700) AM_READ_PORT("IN2") AM_WRITENOP
- AM_RANGE(0x9820, 0x9820) AM_READ_LEGACY(random_num_r)
+ AM_RANGE(0x9820, 0x9820) AM_READ(random_num_r)
AM_RANGE(0x9828, 0x993f) AM_DEVWRITE_LEGACY("gridlee", gridlee_sound_w)
AM_RANGE(0x9c00, 0x9cff) AM_RAM AM_SHARE("nvram")
AM_RANGE(0xa000, 0xffff) AM_ROM