summaryrefslogtreecommitdiffstats
path: root/src/mame/drivers/lethal.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/lethal.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/lethal.c')
-rw-r--r--src/mame/drivers/lethal.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/mame/drivers/lethal.c b/src/mame/drivers/lethal.c
index dd7a15b2b3d..ed922b7cbaa 100644
--- a/src/mame/drivers/lethal.c
+++ b/src/mame/drivers/lethal.c
@@ -178,8 +178,8 @@ maybe some priority issues / sprite placement issues..
static const char *const gunnames[] = { "LIGHT0_X", "LIGHT0_Y", "LIGHT1_X", "LIGHT1_Y" };
/* a = 1, 2 = player # */
-#define GUNX( a ) (( ( input_port_read(space->machine, gunnames[2 * (a - 1)]) * 287 ) / 0xff ) + 16)
-#define GUNY( a ) (( ( input_port_read(space->machine, gunnames[2 * (a - 1) + 1]) * 223 ) / 0xff ) + 10)
+#define GUNX( a ) (( ( input_port_read(space->machine(), gunnames[2 * (a - 1)]) * 287 ) / 0xff ) + 16)
+#define GUNY( a ) (( ( input_port_read(space->machine(), gunnames[2 * (a - 1) + 1]) * 223 ) / 0xff ) + 10)
/* Default Eeprom for the parent.. otherwise it will always complain first boot */
@@ -210,16 +210,16 @@ static WRITE8_HANDLER( control2_w )
/* bit 4 bankswitches the 4800-4fff region: 0 = registers, 1 = RAM ("CBNK" on schematics) */
/* bit 6 is "SHD0" (some kind of shadow control) */
/* bit 7 is "SHD1" (ditto) */
- lethal_state *state = space->machine->driver_data<lethal_state>();
+ lethal_state *state = space->machine().driver_data<lethal_state>();
state->cur_control2 = data;
- input_port_write(space->machine, "EEPROMOUT", state->cur_control2, 0xff);
+ input_port_write(space->machine(), "EEPROMOUT", state->cur_control2, 0xff);
}
static INTERRUPT_GEN(lethalen_interrupt)
{
- lethal_state *state = device->machine->driver_data<lethal_state>();
+ lethal_state *state = device->machine().driver_data<lethal_state>();
if (k056832_is_irq_enabled(state->k056832, 0))
device_set_input_line(device, HD6309_IRQ_LINE, HOLD_LINE);
@@ -232,7 +232,7 @@ static WRITE8_HANDLER( sound_cmd_w )
static WRITE8_HANDLER( sound_irq_w )
{
- lethal_state *state = space->machine->driver_data<lethal_state>();
+ lethal_state *state = space->machine().driver_data<lethal_state>();
device_set_input_line(state->audiocpu, 0, HOLD_LINE);
}
@@ -243,22 +243,22 @@ static READ8_HANDLER( sound_status_r )
static void sound_nmi( device_t *device )
{
- lethal_state *state = device->machine->driver_data<lethal_state>();
+ lethal_state *state = device->machine().driver_data<lethal_state>();
device_set_input_line(state->audiocpu, INPUT_LINE_NMI, PULSE_LINE);
}
static WRITE8_HANDLER( le_bankswitch_w )
{
- memory_set_bank(space->machine, "bank1", data);
+ memory_set_bank(space->machine(), "bank1", data);
}
static READ8_HANDLER( le_4800_r )
{
- lethal_state *state = space->machine->driver_data<lethal_state>();
+ lethal_state *state = space->machine().driver_data<lethal_state>();
if (state->cur_control2 & 0x10) // RAM enable
{
- return space->machine->generic.paletteram.u8[offset];
+ return space->machine().generic.paletteram.u8[offset];
}
else
{
@@ -339,7 +339,7 @@ static READ8_HANDLER( le_4800_r )
static WRITE8_HANDLER( le_4800_w )
{
- lethal_state *state = space->machine->driver_data<lethal_state>();
+ lethal_state *state = space->machine().driver_data<lethal_state>();
if (state->cur_control2 & 0x10) // RAM enable
{
@@ -595,37 +595,37 @@ static const k054539_interface k054539_config =
static MACHINE_START( lethalen )
{
- lethal_state *state = machine->driver_data<lethal_state>();
- UINT8 *ROM = machine->region("maincpu")->base();
+ lethal_state *state = machine.driver_data<lethal_state>();
+ UINT8 *ROM = machine.region("maincpu")->base();
memory_configure_bank(machine, "bank1", 0, 0x20, &ROM[0x10000], 0x2000);
memory_set_bank(machine, "bank1", 0);
- machine->generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x3800 + 0x02);
+ machine.generic.paletteram.u8 = auto_alloc_array(machine, UINT8, 0x3800 + 0x02);
- state->maincpu = machine->device("maincpu");
- state->audiocpu = machine->device("soundcpu");
- state->k054539 = machine->device("k054539");
- state->k053244 = machine->device("k053244");
- state->k056832 = machine->device("k056832");
- state->k054000 = machine->device("k054000");
+ state->maincpu = machine.device("maincpu");
+ state->audiocpu = machine.device("soundcpu");
+ state->k054539 = machine.device("k054539");
+ state->k053244 = machine.device("k053244");
+ state->k056832 = machine.device("k056832");
+ state->k054000 = machine.device("k054000");
state->save_item(NAME(state->cur_control2));
state->save_item(NAME(state->sprite_colorbase));
state->save_item(NAME(state->layer_colorbase));
- state_save_register_global_pointer(machine, machine->generic.paletteram.u8, 0x3800 + 0x02);
+ state_save_register_global_pointer(machine, machine.generic.paletteram.u8, 0x3800 + 0x02);
}
static MACHINE_RESET( lethalen )
{
- lethal_state *state = machine->driver_data<lethal_state>();
- UINT8 *prgrom = (UINT8 *)machine->region("maincpu")->base();
+ lethal_state *state = machine.driver_data<lethal_state>();
+ UINT8 *prgrom = (UINT8 *)machine.region("maincpu")->base();
int i;
memory_set_bankptr(machine, "bank2", &prgrom[0x48000]);
/* force reset again to read proper reset vector */
- machine->device("maincpu")->reset();
+ machine.device("maincpu")->reset();
for (i = 0; i < 4; i++)
state->layer_colorbase[i] = 0;