diff options
author | 2011-03-29 15:50:04 +0000 | |
---|---|---|
committer | 2011-03-29 15:50:04 +0000 | |
commit | 2ad50720237fdd19cf5ab45b8cb6bb21119c00b8 (patch) | |
tree | db21eee69668a06abc3f310ebbd51f5dbadf2de7 /src/mame/drivers/tomcat.c | |
parent | b72cf3c5702b749c7bf26383ff05a9ab55022d31 (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/tomcat.c')
-rw-r--r-- | src/mame/drivers/tomcat.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/mame/drivers/tomcat.c b/src/mame/drivers/tomcat.c index 077a9ddd050..178f07d9c50 100644 --- a/src/mame/drivers/tomcat.c +++ b/src/mame/drivers/tomcat.c @@ -54,17 +54,17 @@ public: static WRITE16_HANDLER(tomcat_adcon_w) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); state->control_num = data; } static READ16_HANDLER(tomcat_adcread_r) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); switch( state->control_num ) { - case 0: return input_port_read(space->machine, "STICKY"); - case 1: return input_port_read(space->machine, "STICKX"); + case 0: return input_port_read(space->machine(), "STICKY"); + case 1: return input_port_read(space->machine(), "STICKX"); default: return 0x7f7f; } } @@ -73,29 +73,29 @@ static READ16_HANDLER(tomcat_inputs_r) { UINT16 result = 0; if (ACCESSING_BITS_8_15) - result |= input_port_read(space->machine, "IN0") << 8; + result |= input_port_read(space->machine(), "IN0") << 8; return result; } static WRITE16_HANDLER(tomcat_led1on_w) { - set_led_status(space->machine, 1, 1); + set_led_status(space->machine(), 1, 1); } static WRITE16_HANDLER(tomcat_led2on_w) { - set_led_status(space->machine, 2, 1); + set_led_status(space->machine(), 2, 1); } static WRITE16_HANDLER(tomcat_led2off_w) { - set_led_status(space->machine, 2, 0); + set_led_status(space->machine(), 2, 0); } static WRITE16_HANDLER(tomcat_led1off_w) { - set_led_status(space->machine, 1, 0); + set_led_status(space->machine(), 1, 0); } static WRITE16_HANDLER(tomcat_lnkmodel_w) @@ -156,27 +156,27 @@ static WRITE16_HANDLER(tomcat_mresl_w) { // 320 Reset Low (Address Strobe) // Reset TMS320 - device_set_input_line(space->machine->device("dsp"), INPUT_LINE_RESET, ASSERT_LINE); + device_set_input_line(space->machine().device("dsp"), INPUT_LINE_RESET, ASSERT_LINE); } static WRITE16_HANDLER(tomcat_mresh_w) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); // 320 Reset high (Address Strobe) // Release reset of TMS320 state->dsp_BIO = 0; - device_set_input_line(space->machine->device("dsp"), INPUT_LINE_RESET, CLEAR_LINE); + device_set_input_line(space->machine().device("dsp"), INPUT_LINE_RESET, CLEAR_LINE); } static WRITE16_HANDLER(tomcat_irqclr_w) { // Clear IRQ Latch (Address Strobe) - cputag_set_input_line(space->machine, "maincpu", 1, CLEAR_LINE); + cputag_set_input_line(space->machine(), "maincpu", 1, CLEAR_LINE); } static READ16_HANDLER(tomcat_inputs2_r) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); /* * D15 LNKFLAG (Game Link) * D14 PC3 " " @@ -192,15 +192,15 @@ static READ16_HANDLER(tomcat_inputs2_r) static READ16_HANDLER(tomcat_320bio_r) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); state->dsp_BIO = 1; - space->machine->device<cpu_device>("maincpu")->suspend(SUSPEND_REASON_SPIN, 1); + space->machine().device<cpu_device>("maincpu")->suspend(SUSPEND_REASON_SPIN, 1); return 0; } static READ16_HANDLER(dsp_BIO_r) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); if ( cpu_get_pc(space->cpu) == 0x0001 ) { if ( state->dsp_idle == 0 ) @@ -216,7 +216,7 @@ static READ16_HANDLER(dsp_BIO_r) { state->dsp_idle = 0; state->dsp_BIO = 0; - space->machine->device<cpu_device>("maincpu")->resume(SUSPEND_REASON_SPIN ); + space->machine().device<cpu_device>("maincpu")->resume(SUSPEND_REASON_SPIN ); return 0; } else @@ -233,25 +233,25 @@ static READ16_HANDLER(dsp_BIO_r) static READ16_HANDLER(tomcat_shared_ram_r) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); return state->shared_ram[offset]; } static WRITE16_HANDLER(tomcat_shared_ram_w) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); COMBINE_DATA(&state->shared_ram[offset]); } static READ8_HANDLER(tomcat_nvram_r) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); return state->nvram[offset]; } static WRITE8_HANDLER(tomcat_nvram_w) { - tomcat_state *state = space->machine->driver_data<tomcat_state>(); + tomcat_state *state = space->machine().driver_data<tomcat_state>(); state->nvram[offset] = data; } @@ -348,13 +348,13 @@ ROM_END static MACHINE_START(tomcat) { - tomcat_state *state = machine->driver_data<tomcat_state>(); + tomcat_state *state = machine.driver_data<tomcat_state>(); ((UINT16*)state->shared_ram)[0x0000] = 0xf600; ((UINT16*)state->shared_ram)[0x0001] = 0x0000; ((UINT16*)state->shared_ram)[0x0002] = 0xf600; ((UINT16*)state->shared_ram)[0x0003] = 0x0000; - machine->device<nvram_device>("nvram")->set_base(state->nvram, 0x800); + machine.device<nvram_device>("nvram")->set_base(state->nvram, 0x800); state->save_item(NAME(state->nvram)); state->save_item(NAME(state->control_num)); |