summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/gridlee.c
diff options
context:
space:
mode:
author Aaron Giles <aaron@aarongiles.com>2011-03-29 15:50:04 +0000
committer Aaron Giles <aaron@aarongiles.com>2011-03-29 15:50:04 +0000
commit2ad50720237fdd19cf5ab45b8cb6bb21119c00b8 (patch)
treedb21eee69668a06abc3f310ebbd51f5dbadf2de7 /src/mame/drivers/gridlee.c
parentb72cf3c5702b749c7bf26383ff05a9ab55022d31 (diff)
BIG update.
Remove redundant machine items from address_space and device_t. Neither machine nor m_machine are directly accessible anymore. Instead a new getter machine() is available which returns a machine reference. So: space->machine->xxx ==> space->machine().xxx device->machine->yyy ==> device->machine().yyy Globally changed all running_machine pointers to running_machine references. Any function/method that takes a running_machine takes it as a required parameter (1 or 2 exceptions). Being consistent here gets rid of a lot of odd &machine or *machine, but it does mean a very large bulk change across the project. Structs which have a running_machine * now have that variable renamed to m_machine, and now have a shiny new machine() method that works like the space and device methods above. Since most of these are things that should eventually be devices anyway, consider this a step in that direction. 98% of the update was done with regex searches. The changes are architected such that the compiler will catch the remaining errors: // find things that use an embedded machine directly and replace // with a machine() getter call S: ->machine-> R: ->machine\(\)\. // do the same if via a reference S: \.machine-> R: \.machine\(\)\. // convert function parameters to running_machine & S: running_machine \*machine([^;]) R: running_machine \&machine\1 // replace machine-> with machine. S: machine-> R: machine\. // replace &machine() with machine() S: \&([()->a-z0-9_]+machine\(\)) R: \1 // sanity check: look for this used as a cast (running_machine &) // and change to this: *(running_machine *)
Diffstat (limited to 'src/mame/drivers/gridlee.c')
-rw-r--r--src/mame/drivers/gridlee.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/src/mame/drivers/gridlee.c b/src/mame/drivers/gridlee.c
index ac561c3171d..eafd070a7b0 100644
--- a/src/mame/drivers/gridlee.c
+++ b/src/mame/drivers/gridlee.c
@@ -89,7 +89,7 @@
/* local prototypes */
-static void poly17_init(running_machine *machine);
+static void poly17_init(running_machine &machine);
/*************************************
*
@@ -105,18 +105,18 @@ static TIMER_CALLBACK( irq_off_tick )
static TIMER_CALLBACK( irq_timer_tick )
{
- gridlee_state *state = machine->driver_data<gridlee_state>();
+ gridlee_state *state = machine.driver_data<gridlee_state>();
/* next interrupt after scanline 256 is scanline 64 */
if (param == 256)
- state->irq_timer->adjust(machine->primary_screen->time_until_pos(64), 64);
+ state->irq_timer->adjust(machine.primary_screen->time_until_pos(64), 64);
else
- state->irq_timer->adjust(machine->primary_screen->time_until_pos(param + 64), param + 64);
+ state->irq_timer->adjust(machine.primary_screen->time_until_pos(param + 64), param + 64);
/* IRQ starts on scanline 0, 64, 128, etc. */
cputag_set_input_line(machine, "maincpu", M6809_IRQ_LINE, ASSERT_LINE);
/* it will turn off on the next HBLANK */
- state->irq_off->adjust(machine->primary_screen->time_until_pos(param, GRIDLEE_HBSTART));
+ state->irq_off->adjust(machine.primary_screen->time_until_pos(param, GRIDLEE_HBSTART));
}
@@ -128,21 +128,21 @@ static TIMER_CALLBACK( firq_off_tick )
static TIMER_CALLBACK( firq_timer_tick )
{
- gridlee_state *state = machine->driver_data<gridlee_state>();
+ gridlee_state *state = machine.driver_data<gridlee_state>();
/* same time next frame */
- state->firq_timer->adjust(machine->primary_screen->time_until_pos(FIRQ_SCANLINE));
+ state->firq_timer->adjust(machine.primary_screen->time_until_pos(FIRQ_SCANLINE));
/* IRQ starts on scanline FIRQ_SCANLINE? */
cputag_set_input_line(machine, "maincpu", M6809_FIRQ_LINE, ASSERT_LINE);
/* it will turn off on the next HBLANK */
- state->firq_off->adjust(machine->primary_screen->time_until_pos(FIRQ_SCANLINE, GRIDLEE_HBSTART));
+ state->firq_off->adjust(machine.primary_screen->time_until_pos(FIRQ_SCANLINE, GRIDLEE_HBSTART));
}
static MACHINE_START( gridlee )
{
- gridlee_state *state = machine->driver_data<gridlee_state>();
- state->maincpu = machine->device<cpu_device>("maincpu");
+ gridlee_state *state = machine.driver_data<gridlee_state>();
+ state->maincpu = machine.device<cpu_device>("maincpu");
/* create the polynomial tables */
poly17_init(machine);
@@ -150,19 +150,19 @@ static MACHINE_START( gridlee )
state_save_register_global_array(machine, state->last_analog_input);
state_save_register_global_array(machine, state->last_analog_output);
- state->irq_off = machine->scheduler().timer_alloc(FUNC(irq_off_tick));
- state->irq_timer = machine->scheduler().timer_alloc(FUNC(irq_timer_tick));
- state->firq_off = machine->scheduler().timer_alloc(FUNC(firq_off_tick));
- state->firq_timer = machine->scheduler().timer_alloc(FUNC(firq_timer_tick));
+ state->irq_off = machine.scheduler().timer_alloc(FUNC(irq_off_tick));
+ state->irq_timer = machine.scheduler().timer_alloc(FUNC(irq_timer_tick));
+ state->firq_off = machine.scheduler().timer_alloc(FUNC(firq_off_tick));
+ state->firq_timer = machine.scheduler().timer_alloc(FUNC(firq_timer_tick));
}
static MACHINE_RESET( gridlee )
{
- gridlee_state *state = machine->driver_data<gridlee_state>();
+ gridlee_state *state = machine.driver_data<gridlee_state>();
/* start timers to generate interrupts */
- state->irq_timer->adjust(machine->primary_screen->time_until_pos(0));
- state->firq_timer->adjust(machine->primary_screen->time_until_pos(FIRQ_SCANLINE));
+ state->irq_timer->adjust(machine.primary_screen->time_until_pos(0));
+ state->firq_timer->adjust(machine.primary_screen->time_until_pos(FIRQ_SCANLINE));
}
@@ -175,13 +175,13 @@ static MACHINE_RESET( gridlee )
static READ8_HANDLER( analog_port_r )
{
- gridlee_state *state = space->machine->driver_data<gridlee_state>();
+ 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->cocktail_flip]);
+ newval = input_port_read(space->machine(), portnames[offset + 2 * state->cocktail_flip]);
delta = (int)newval - (int)state->last_analog_input[offset];
/* handle the case where we wrap around from 0x00 to 0xff, or vice versa */
@@ -226,9 +226,9 @@ static READ8_HANDLER( analog_port_r )
#define POLY17_SHR 10
#define POLY17_ADD 0x18000
-static void poly17_init(running_machine *machine)
+static void poly17_init(running_machine &machine)
{
- gridlee_state *state = machine->driver_data<gridlee_state>();
+ gridlee_state *state = machine.driver_data<gridlee_state>();
UINT32 i, x = 0;
UINT8 *p, *r;
@@ -258,7 +258,7 @@ static void poly17_init(running_machine *machine)
static READ8_HANDLER( random_num_r )
{
- gridlee_state *state = space->machine->driver_data<gridlee_state>();
+ gridlee_state *state = space->machine().driver_data<gridlee_state>();
UINT32 cc;
/* CPU runs at 1.25MHz, noise source at 100kHz --> multiply by 12.5 */
@@ -279,21 +279,21 @@ static READ8_HANDLER( random_num_r )
static WRITE8_HANDLER( led_0_w )
{
- set_led_status(space->machine, 0, data & 1);
+ set_led_status(space->machine(), 0, data & 1);
logerror("LED 0 %s\n", (data & 1) ? "on" : "off");
}
static WRITE8_HANDLER( led_1_w )
{
- set_led_status(space->machine, 1, data & 1);
+ set_led_status(space->machine(), 1, data & 1);
logerror("LED 1 %s\n", (data & 1) ? "on" : "off");
}
static WRITE8_HANDLER( gridlee_coin_counter_w )
{
- coin_counter_w(space->machine, 0, data & 1);
+ coin_counter_w(space->machine(), 0, data & 1);
logerror("coin counter %s\n", (data & 1) ? "on" : "off");
}