diff options
author | 2012-09-19 19:48:09 +0000 | |
---|---|---|
committer | 2012-09-19 19:48:09 +0000 | |
commit | 621ac620ae1ca743a66bb52aaf5478da01c3bac6 (patch) (github) | |
tree | 2743a87e9077417af7546970d1ea1cc3b8781a63 | |
parent | 33c77e65bbd4513957f2ece623cee476cf439248 (diff) | |
download | mame-621ac620ae1ca743a66bb52aaf5478da01c3bac6.tar.bz2 mame-621ac620ae1ca743a66bb52aaf5478da01c3bac6.zip |
Since nobody checks for NULLs anyway, make
device_memory_interface::space() assert against NULL and
return a reference, and pushed references throughout all
address space usage in the system. Added a has_space()
method to check for those rare case when it is ambiguous.
[Aaron Giles]
Also reinstated the generic space and added fatal error
handlers if anyone tries to actually read/write from it.
848 files changed, 4375 insertions, 4323 deletions
diff --git a/src/emu/cpu/adsp2100/adsp2100.c b/src/emu/cpu/adsp2100/adsp2100.c index bdc335e1057..95e2e31f852 100644 --- a/src/emu/cpu/adsp2100/adsp2100.c +++ b/src/emu/cpu/adsp2100/adsp2100.c @@ -445,10 +445,10 @@ UINT16 adsp2181_device::idma_data_r() void adsp21xx_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); - m_data = space(AS_DATA); - m_io = space(AS_IO); + m_data = &space(AS_DATA); + m_io = has_space(AS_IO) ? &space(AS_IO) : NULL; // "core" save_item(NAME(m_core.ax0.u)); diff --git a/src/emu/cpu/alph8201/alph8201.c b/src/emu/cpu/alph8201/alph8201.c index 363401bf7ba..a783087fc76 100644 --- a/src/emu/cpu/alph8201/alph8201.c +++ b/src/emu/cpu/alph8201/alph8201.c @@ -668,7 +668,7 @@ static CPU_INIT( alpha8201 ) alpha8201_state *cpustate = get_safe_token(device); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); device->save_item(NAME(cpustate->RAM)); diff --git a/src/emu/cpu/am29000/am29000.c b/src/emu/cpu/am29000/am29000.c index 5506a668af6..84ad9f23250 100644 --- a/src/emu/cpu/am29000/am29000.c +++ b/src/emu/cpu/am29000/am29000.c @@ -154,11 +154,11 @@ static CPU_INIT( am29000 ) { am29000_state *am29000 = get_safe_token(device); - am29000->program = device->space(AS_PROGRAM); + am29000->program = &device->space(AS_PROGRAM); am29000->direct = &am29000->program->direct(); - am29000->data = device->space(AS_DATA); + am29000->data = &device->space(AS_DATA); am29000->datadirect = &am29000->data->direct(); - am29000->io = device->space(AS_IO); + am29000->io = &device->space(AS_IO); am29000->cfg = (PRL_AM29000 | PRL_REV_D) << CFG_PRL_SHIFT; /* Register state for saving */ diff --git a/src/emu/cpu/apexc/apexc.c b/src/emu/cpu/apexc/apexc.c index 7d1957b5ccc..5adf71dd1f6 100644 --- a/src/emu/cpu/apexc/apexc.c +++ b/src/emu/cpu/apexc/apexc.c @@ -800,8 +800,8 @@ static CPU_INIT( apexc ) apexc_state *cpustate = get_safe_token(device); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->a)); device->save_item(NAME(cpustate->r)); diff --git a/src/emu/cpu/arm/arm.c b/src/emu/cpu/arm/arm.c index cb99f0347fa..eea2cd3ac08 100644 --- a/src/emu/cpu/arm/arm.c +++ b/src/emu/cpu/arm/arm.c @@ -345,7 +345,7 @@ static CPU_RESET( arm ) cpustate->irq_callback = save_irqcallback; cpustate->endian = save_endian; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* start up in SVC mode with interrupts disabled. */ @@ -528,7 +528,7 @@ static CPU_INIT( arm ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->endian = ENDIANNESS_LITTLE; device->save_item(NAME(cpustate->sArmRegister)); @@ -544,7 +544,7 @@ static CPU_INIT( arm_be ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->endian = ENDIANNESS_BIG; device->save_item(NAME(cpustate->sArmRegister)); diff --git a/src/emu/cpu/arm7/arm7.c b/src/emu/cpu/arm7/arm7.c index 343fc8b1e11..b02b005ab21 100644 --- a/src/emu/cpu/arm7/arm7.c +++ b/src/emu/cpu/arm7/arm7.c @@ -427,7 +427,7 @@ static CPU_INIT( arm7 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); // setup co-proc callbacks diff --git a/src/emu/cpu/arm7/arm7core.c b/src/emu/cpu/arm7/arm7core.c index b15fb7217a7..a8bfaa300fb 100644 --- a/src/emu/cpu/arm7/arm7core.c +++ b/src/emu/cpu/arm7/arm7core.c @@ -140,7 +140,7 @@ static void arm7_core_reset(legacy_cpu_device *device) memset(cpustate, 0, sizeof(arm_state)); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->endian = ENDIANNESS_LITTLE; cpustate->direct = &cpustate->program->direct(); diff --git a/src/emu/cpu/asap/asap.c b/src/emu/cpu/asap/asap.c index 115278ec9a9..2487321cb01 100644 --- a/src/emu/cpu/asap/asap.c +++ b/src/emu/cpu/asap/asap.c @@ -211,7 +211,7 @@ asap_device::asap_device(const machine_config &mconfig, const char *tag, device_ void asap_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); // register our state for the debugger diff --git a/src/emu/cpu/avr8/avr8.c b/src/emu/cpu/avr8/avr8.c index 8c7867e4102..2760706d257 100644 --- a/src/emu/cpu/avr8/avr8.c +++ b/src/emu/cpu/avr8/avr8.c @@ -188,8 +188,8 @@ static CPU_INIT( avr8 ) cpustate->pc = 0; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); WRITE_IO_8(cpustate, AVR8_IO_SREG, 0); diff --git a/src/emu/cpu/ccpu/ccpu.c b/src/emu/cpu/ccpu/ccpu.c index 921c71a07ac..b46faffc255 100644 --- a/src/emu/cpu/ccpu/ccpu.c +++ b/src/emu/cpu/ccpu/ccpu.c @@ -130,10 +130,10 @@ static CPU_INIT( ccpu ) cpustate->external_input = configdata->external_input ? configdata->external_input : read_jmi; cpustate->vector_callback = configdata->vector_callback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->PC)); device->save_item(NAME(cpustate->A)); diff --git a/src/emu/cpu/cop400/cop400.c b/src/emu/cpu/cop400/cop400.c index 263e62a447b..e931c5efacd 100644 --- a/src/emu/cpu/cop400/cop400.c +++ b/src/emu/cpu/cop400/cop400.c @@ -872,10 +872,10 @@ static void cop400_init(legacy_cpu_device *device, UINT8 g_mask, UINT8 d_mask, U /* find address spaces */ - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); /* set output pin masks */ diff --git a/src/emu/cpu/cosmac/cosmac.c b/src/emu/cpu/cosmac/cosmac.c index 5149be749c9..463e36825c2 100644 --- a/src/emu/cpu/cosmac/cosmac.c +++ b/src/emu/cpu/cosmac/cosmac.c @@ -231,9 +231,9 @@ void cosmac_device::device_config_complete() void cosmac_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); - m_io = space(AS_IO); + m_io = &space(AS_IO); // register our state for the debugger state_add(STATE_GENPC, "GENPC", m_pc).callimport().callexport().noshow(); diff --git a/src/emu/cpu/cp1610/cp1610.c b/src/emu/cpu/cp1610/cp1610.c index 7f65df18830..4d0b111f1e4 100644 --- a/src/emu/cpu/cp1610/cp1610.c +++ b/src/emu/cpu/cp1610/cp1610.c @@ -3388,7 +3388,7 @@ static CPU_INIT( cp1610 ) cpustate->intrm_pending = 0; cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); device->save_item(NAME(cpustate->r)); device->save_item(NAME(cpustate->flags)); diff --git a/src/emu/cpu/cubeqcpu/cubeqcpu.c b/src/emu/cpu/cubeqcpu/cubeqcpu.c index bc4064093a5..cd60864229d 100644 --- a/src/emu/cpu/cubeqcpu/cubeqcpu.c +++ b/src/emu/cpu/cubeqcpu/cubeqcpu.c @@ -282,7 +282,7 @@ static CPU_INIT( cquestsnd ) cpustate->sound_data = (UINT16*)device->machine().root_device().memregion(_config->sound_data_region)->base(); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* Allocate RAM shared with 68000 */ @@ -350,7 +350,7 @@ static CPU_INIT( cquestrot ) cpustate->device = device; cpustate->lindevice = device->machine().device<legacy_cpu_device>(rotconfig->lin_cpu_tag); - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); cquestrot_state_register(device); @@ -429,7 +429,7 @@ static CPU_INIT( cquestlin ) cpustate->device = device; cpustate->rotdevice = device->machine().device<legacy_cpu_device>(linconfig->rot_cpu_tag); - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); cquestlin_state_register(device); diff --git a/src/emu/cpu/drcfe.h b/src/emu/cpu/drcfe.h index 68b94ffd481..ddf617ccd85 100644 --- a/src/emu/cpu/drcfe.h +++ b/src/emu/cpu/drcfe.h @@ -180,7 +180,7 @@ private: // CPU parameters cpu_device & m_cpudevice; // CPU device object - address_space * m_program; // program address space for this CPU + address_space & m_program; // program address space for this CPU offs_t m_pageshift; // shift to convert address to a page index // opcode descriptor arrays diff --git a/src/emu/cpu/drcuml.c b/src/emu/cpu/drcuml.c index 4e671565815..626b55538e6 100644 --- a/src/emu/cpu/drcuml.c +++ b/src/emu/cpu/drcuml.c @@ -121,11 +121,11 @@ drcbe_interface::drcbe_interface(drcuml_state &drcuml, drc_cache &cache, device_ device_memory_interface *memory; if (device.interface(memory)) for (address_spacenum spacenum = AS_0; spacenum < ARRAY_LENGTH(m_space); spacenum++) - { - m_space[spacenum] = memory->space(spacenum); - if (m_space[spacenum] != NULL) + if (memory->has_space(spacenum)) + { + m_space[spacenum] = &memory->space(spacenum); m_space[spacenum]->accessors(m_accessors[spacenum]); - } + } } diff --git a/src/emu/cpu/dsp16/dsp16.c b/src/emu/cpu/dsp16/dsp16.c index 61c160a3366..a75529471f5 100644 --- a/src/emu/cpu/dsp16/dsp16.c +++ b/src/emu/cpu/dsp16/dsp16.c @@ -42,7 +42,7 @@ dsp16_device::dsp16_device(const machine_config &mconfig, const char *tag, devic void dsp16_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); save_item(NAME(m_pc)); diff --git a/src/emu/cpu/dsp32/dsp32.c b/src/emu/cpu/dsp32/dsp32.c index e029657b3d5..8a097610c02 100644 --- a/src/emu/cpu/dsp32/dsp32.c +++ b/src/emu/cpu/dsp32/dsp32.c @@ -231,7 +231,7 @@ void dsp32c_device::static_set_config(device_t &device, const dsp32_config &conf void dsp32c_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); // register our state for the debugger diff --git a/src/emu/cpu/dsp56k/dsp56k.c b/src/emu/cpu/dsp56k/dsp56k.c index 7dd60176cdb..7ac2c4a2c53 100644 --- a/src/emu/cpu/dsp56k/dsp56k.c +++ b/src/emu/cpu/dsp56k/dsp56k.c @@ -232,9 +232,9 @@ static CPU_INIT( dsp56k ) //cpustate->config = device->static_config(); //cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); + cpustate->data = &device->space(AS_DATA); /* Setup the direct memory handler for this CPU */ /* NOTE: Be sure to grab this guy and call him if you ever install another direct_update_hander in a driver! */ diff --git a/src/emu/cpu/e132xs/e132xs.c b/src/emu/cpu/e132xs/e132xs.c index c5a532a0741..31a3f12f1b2 100644 --- a/src/emu/cpu/e132xs/e132xs.c +++ b/src/emu/cpu/e132xs/e132xs.c @@ -1542,9 +1542,9 @@ static void hyperstone_init(legacy_cpu_device *device, device_irq_acknowledge_ca cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->timer = device->machine().scheduler().timer_alloc(FUNC(e132xs_timer_callback), (void *)device); cpustate->clock_scale_mask = scale_mask; } @@ -1650,9 +1650,9 @@ static CPU_RESET( hyperstone ) cpustate->irq_callback = save_irqcallback; cpustate->opcodexor = save_opcodexor; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->timer = save_timer; cpustate->tr_clocks_per_tick = 2; diff --git a/src/emu/cpu/esrip/esrip.c b/src/emu/cpu/esrip/esrip.c index a93a120a313..9a32ff4b4a9 100644 --- a/src/emu/cpu/esrip/esrip.c +++ b/src/emu/cpu/esrip/esrip.c @@ -264,7 +264,7 @@ static CPU_INIT( esrip ) cpustate->ipt_ram = auto_alloc_array(device->machine(), UINT16, IPT_RAM_SIZE/2); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* Create the instruction decode lookup table */ diff --git a/src/emu/cpu/f8/f8.c b/src/emu/cpu/f8/f8.c index 616c7322c4c..be67cf7a2ac 100644 --- a/src/emu/cpu/f8/f8.c +++ b/src/emu/cpu/f8/f8.c @@ -1619,9 +1619,9 @@ static CPU_RESET( f8 ) memset(cpustate, 0, sizeof(f8_Regs)); cpustate->irq_callback = save_callback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->iospace = device->space(AS_IO); + cpustate->iospace = &device->space(AS_IO); cpustate->w&=~I; /* save PC0 to PC1 and reset PC0 */ @@ -1967,9 +1967,9 @@ static CPU_INIT( f8 ) f8_Regs *cpustate = get_safe_token(device); cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->iospace = device->space(AS_IO); + cpustate->iospace = &device->space(AS_IO); device->save_item(NAME(cpustate->pc0)); device->save_item(NAME(cpustate->pc1)); diff --git a/src/emu/cpu/g65816/g65816.c b/src/emu/cpu/g65816/g65816.c index 1211686a145..1453109a544 100644 --- a/src/emu/cpu/g65816/g65816.c +++ b/src/emu/cpu/g65816/g65816.c @@ -338,7 +338,7 @@ static CPU_INIT( g65816 ) g65816_set_irq_callback(cpustate, irqcallback); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->cpu_type = CPU_TYPE_G65816; device->save_item(NAME(cpustate->a)); diff --git a/src/emu/cpu/h6280/h6280.c b/src/emu/cpu/h6280/h6280.c index 9d303120f70..6398a35e4d0 100644 --- a/src/emu/cpu/h6280/h6280.c +++ b/src/emu/cpu/h6280/h6280.c @@ -161,9 +161,9 @@ static CPU_INIT( h6280 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); } static CPU_RESET( h6280 ) @@ -178,9 +178,9 @@ static CPU_RESET( h6280 ) memset(cpustate, 0, sizeof(h6280_Regs)); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); /* set I and B flags */ P = _fI | _fB; diff --git a/src/emu/cpu/h83002/h8_16.c b/src/emu/cpu/h83002/h8_16.c index 511ba2f7b48..d50dfdfafd5 100644 --- a/src/emu/cpu/h83002/h8_16.c +++ b/src/emu/cpu/h83002/h8_16.c @@ -217,9 +217,9 @@ static CPU_INIT(h8) h8->mode_8bit = 0; - h8->program = device->space(AS_PROGRAM); + h8->program = &device->space(AS_PROGRAM); h8->direct = &h8->program->direct(); - h8->io = device->space(AS_IO); + h8->io = &device->space(AS_IO); device->save_item(NAME(h8->h8err)); device->save_item(NAME(h8->regs)); diff --git a/src/emu/cpu/h83002/h8_8.c b/src/emu/cpu/h83002/h8_8.c index 3102c6e7d0f..dcfef2cca4d 100644 --- a/src/emu/cpu/h83002/h8_8.c +++ b/src/emu/cpu/h83002/h8_8.c @@ -234,9 +234,9 @@ static CPU_INIT(h8bit) h8->mode_8bit = 1; - h8->program = device->space(AS_PROGRAM); + h8->program = &device->space(AS_PROGRAM); h8->direct = &h8->program->direct(); - h8->io = device->space(AS_IO); + h8->io = &device->space(AS_IO); h8->timer[0] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_0_cb), h8); h8->timer[1] = h8->device->machine().scheduler().timer_alloc(FUNC(h8_timer_1_cb), h8); diff --git a/src/emu/cpu/hcd62121/hcd62121.c b/src/emu/cpu/hcd62121/hcd62121.c index 9a892590883..fe74b62c663 100644 --- a/src/emu/cpu/hcd62121/hcd62121.c +++ b/src/emu/cpu/hcd62121/hcd62121.c @@ -316,8 +316,8 @@ static CPU_INIT( hcd62121 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); } diff --git a/src/emu/cpu/hd61700/hd61700.c b/src/emu/cpu/hd61700/hd61700.c index 31b3b88d266..a2b0b863522 100644 --- a/src/emu/cpu/hd61700/hd61700.c +++ b/src/emu/cpu/hd61700/hd61700.c @@ -124,7 +124,7 @@ void hd61700_cpu_device::static_set_config(device_t &device, const hd61700_confi void hd61700_cpu_device::device_start() { - m_program = this->space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_sec_timer = timer_alloc(SEC_TIMER); m_sec_timer->adjust(attotime::from_seconds(1), 0, attotime::from_seconds(1)); diff --git a/src/emu/cpu/hd6309/hd6309.c b/src/emu/cpu/hd6309/hd6309.c index 8ceeee347fc..3742fcf83b3 100644 --- a/src/emu/cpu/hd6309/hd6309.c +++ b/src/emu/cpu/hd6309/hd6309.c @@ -518,7 +518,7 @@ static CPU_INIT( hd6309 ) m68_state->irq_callback = irqcallback; m68_state->device = device; - m68_state->program = device->space(AS_PROGRAM); + m68_state->program = &device->space(AS_PROGRAM); m68_state->direct = &m68_state->program->direct(); /* setup regtable */ diff --git a/src/emu/cpu/i386/i386.c b/src/emu/cpu/i386/i386.c index f192c55c5da..bb97001e6dc 100644 --- a/src/emu/cpu/i386/i386.c +++ b/src/emu/cpu/i386/i386.c @@ -2882,9 +2882,9 @@ static CPU_INIT( i386 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); device->save_item(NAME( cpustate->reg.d)); device->save_item(NAME(cpustate->sreg[ES].selector)); @@ -3006,9 +3006,9 @@ static CPU_RESET( i386 ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -3497,9 +3497,9 @@ static CPU_RESET( i486 ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -3604,9 +3604,9 @@ static CPU_RESET( pentium ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -3727,9 +3727,9 @@ static CPU_RESET( mediagx ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -3842,9 +3842,9 @@ static CPU_RESET( pentium_pro ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -3938,9 +3938,9 @@ static CPU_RESET( pentium_mmx ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -4034,9 +4034,9 @@ static CPU_RESET( pentium2 ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -4130,9 +4130,9 @@ static CPU_RESET( pentium3 ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; @@ -4226,9 +4226,9 @@ static CPU_RESET( pentium4 ) memset( cpustate, 0, sizeof(*cpustate) ); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sreg[CS].selector = 0xf000; cpustate->sreg[CS].base = 0xffff0000; diff --git a/src/emu/cpu/i4004/i4004.c b/src/emu/cpu/i4004/i4004.c index 2e497928ae1..424212714a9 100644 --- a/src/emu/cpu/i4004/i4004.c +++ b/src/emu/cpu/i4004/i4004.c @@ -462,10 +462,10 @@ static CPU_INIT( i4004 ) cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->PC)); device->save_item(NAME(cpustate->A)); diff --git a/src/emu/cpu/i8008/i8008.c b/src/emu/cpu/i8008/i8008.c index 5acc80b864d..63f4103fe3f 100644 --- a/src/emu/cpu/i8008/i8008.c +++ b/src/emu/cpu/i8008/i8008.c @@ -51,9 +51,9 @@ i8008_device::i8008_device(const machine_config &mconfig, const char *tag, devic void i8008_device::device_start() { // find address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); - m_io = space(AS_IO); + m_io = &space(AS_IO); // save state save_item(NAME(m_PC)); diff --git a/src/emu/cpu/i8085/i8085.c b/src/emu/cpu/i8085/i8085.c index 6c1251d5c4e..0b799c2407a 100644 --- a/src/emu/cpu/i8085/i8085.c +++ b/src/emu/cpu/i8085/i8085.c @@ -1006,9 +1006,9 @@ static void init_808x_common(legacy_cpu_device *device, device_irq_acknowledge_c cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); /* resolve callbacks */ cpustate->out_status_func.resolve(cpustate->config.out_status_func, *device); diff --git a/src/emu/cpu/i86/i286.c b/src/emu/cpu/i86/i286.c index be3832c73d2..95b075a2616 100644 --- a/src/emu/cpu/i86/i286.c +++ b/src/emu/cpu/i86/i286.c @@ -310,8 +310,8 @@ static CPU_INIT( i80286 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); cpustate->direct = &cpustate->program->direct(); /* If a reset parameter is given, take it as pointer to an address mask */ diff --git a/src/emu/cpu/i86/i86.c b/src/emu/cpu/i86/i86.c index bafca70648f..910bf09b509 100644 --- a/src/emu/cpu/i86/i86.c +++ b/src/emu/cpu/i86/i86.c @@ -165,9 +165,9 @@ static CPU_INIT( i8086 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); /* set up the state table */ { @@ -236,9 +236,9 @@ static CPU_RESET( i8086 ) memset(cpustate, 0, sizeof(*cpustate)); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->sregs[CS] = 0xffff; cpustate->base[CS] = SegBase(CS); diff --git a/src/emu/cpu/i860/i860.c b/src/emu/cpu/i860/i860.c index 11801209d50..92cf61fea1c 100644 --- a/src/emu/cpu/i860/i860.c +++ b/src/emu/cpu/i860/i860.c @@ -30,7 +30,7 @@ static CPU_INIT( i860 ) { i860_state_t *cpustate = get_safe_token(device); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); reset_i860(cpustate); i860_set_pin(device, DEC_PIN_BUS_HOLD, 0); i860_set_pin(device, DEC_PIN_RESET, 0); diff --git a/src/emu/cpu/i960/i960.c b/src/emu/cpu/i960/i960.c index fdbf19378e7..059f262e312 100644 --- a/src/emu/cpu/i960/i960.c +++ b/src/emu/cpu/i960/i960.c @@ -2067,7 +2067,7 @@ static CPU_INIT( i960 ) i960->irq_cb = irqcallback; i960->device = device; - i960->program = device->space(AS_PROGRAM); + i960->program = &device->space(AS_PROGRAM); i960->direct = &i960->program->direct(); device->save_item(NAME(i960->PIP)); diff --git a/src/emu/cpu/jaguar/jaguar.c b/src/emu/cpu/jaguar/jaguar.c index 76d43b156b3..f5fdaec6d11 100644 --- a/src/emu/cpu/jaguar/jaguar.c +++ b/src/emu/cpu/jaguar/jaguar.c @@ -417,7 +417,7 @@ static void init_common(int isdsp, legacy_cpu_device *device, device_irq_acknowl jaguar->irq_callback = irqcallback; jaguar->device = device; - jaguar->program = device->space(AS_PROGRAM); + jaguar->program = &device->space(AS_PROGRAM); jaguar->direct = &jaguar->program->direct(); if (configdata != NULL) jaguar->cpu_interrupt = configdata->cpu_int_callback; diff --git a/src/emu/cpu/konami/konami.c b/src/emu/cpu/konami/konami.c index 7fa2ebc27d8..1a11ec36bb1 100644 --- a/src/emu/cpu/konami/konami.c +++ b/src/emu/cpu/konami/konami.c @@ -403,7 +403,7 @@ static CPU_INIT( konami ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); device->save_item(NAME(PC)); diff --git a/src/emu/cpu/lh5801/lh5801.c b/src/emu/cpu/lh5801/lh5801.c index ee0ee95c259..56c37e05184 100644 --- a/src/emu/cpu/lh5801/lh5801.c +++ b/src/emu/cpu/lh5801/lh5801.c @@ -117,8 +117,8 @@ static CPU_INIT( lh5801 ) memset(cpustate, 0, sizeof(*cpustate)); cpustate->config = (const lh5801_cpu_core *) device->static_config(); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); cpustate->direct = &cpustate->program->direct(); } diff --git a/src/emu/cpu/lr35902/lr35902.c b/src/emu/cpu/lr35902/lr35902.c index 63323c60b45..0940542c656 100644 --- a/src/emu/cpu/lr35902/lr35902.c +++ b/src/emu/cpu/lr35902/lr35902.c @@ -117,7 +117,7 @@ inline void lr35902_cpu_device::mem_write_word( UINT16 addr, UINT16 data ) void lr35902_cpu_device::device_start() { m_device = this; - m_program = this->space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); save_item(NAME(m_A)); save_item(NAME(m_F)); diff --git a/src/emu/cpu/m37710/m37710.c b/src/emu/cpu/m37710/m37710.c index 598980dd0a8..3c0232657d9 100644 --- a/src/emu/cpu/m37710/m37710.c +++ b/src/emu/cpu/m37710/m37710.c @@ -978,8 +978,8 @@ static CPU_INIT( m37710 ) INT_ACK = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); cpustate->ICount = 0; diff --git a/src/emu/cpu/m6502/m4510.c b/src/emu/cpu/m6502/m4510.c index 1c259efe054..aef6c8a8196 100644 --- a/src/emu/cpu/m6502/m4510.c +++ b/src/emu/cpu/m6502/m4510.c @@ -191,7 +191,7 @@ static CPU_INIT( m4510 ) cpustate->interrupt_inhibit = 0; cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->space = device->space(AS_PROGRAM); + cpustate->space = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->space->direct(); if ( intf ) diff --git a/src/emu/cpu/m6502/m6502.c b/src/emu/cpu/m6502/m6502.c index 38bd935763e..d7dd22e8d5d 100644 --- a/src/emu/cpu/m6502/m6502.c +++ b/src/emu/cpu/m6502/m6502.c @@ -136,7 +136,7 @@ static void m6502_common_init(legacy_cpu_device *device, device_irq_acknowledge_ cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->space = device->space(AS_PROGRAM); + cpustate->space = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->space->direct(); cpustate->subtype = subtype; cpustate->insn = insn; @@ -548,7 +548,7 @@ static CPU_INIT( deco16 ) { m6502_Regs *cpustate = get_safe_token(device); m6502_common_init(device, irqcallback, SUBTYPE_DECO16, insndeco16, "deco16"); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); } diff --git a/src/emu/cpu/m6502/m6509.c b/src/emu/cpu/m6502/m6509.c index 405452cddf8..1eb652f108b 100644 --- a/src/emu/cpu/m6502/m6509.c +++ b/src/emu/cpu/m6502/m6509.c @@ -141,7 +141,7 @@ static CPU_INIT( m6509 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->space = device->space(AS_PROGRAM); + cpustate->space = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->space->direct(); if ( intf ) diff --git a/src/emu/cpu/m6502/m65ce02.c b/src/emu/cpu/m6502/m65ce02.c index 4eae03063a4..082e17ba6e3 100644 --- a/src/emu/cpu/m6502/m65ce02.c +++ b/src/emu/cpu/m6502/m65ce02.c @@ -101,7 +101,7 @@ static CPU_INIT( m65ce02 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->space = device->space(AS_PROGRAM); + cpustate->space = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->space->direct(); if ( intf ) diff --git a/src/emu/cpu/m6800/m6800.c b/src/emu/cpu/m6800/m6800.c index 448c5787aa3..2c8b6086482 100644 --- a/src/emu/cpu/m6800/m6800.c +++ b/src/emu/cpu/m6800/m6800.c @@ -1046,10 +1046,10 @@ static CPU_INIT( m6800 ) { m6800_state *cpustate = get_safe_token(device); - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); // cpustate->subtype = SUBTYPE_M6800; cpustate->insn = m6800_insn; @@ -1199,10 +1199,10 @@ static CPU_INIT( m6801 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->clock = device->clock() / 4; cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); @@ -1234,10 +1234,10 @@ static CPU_INIT( m6802 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); state_register(cpustate, "m6802"); } @@ -1254,10 +1254,10 @@ static CPU_INIT( m6803 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->clock = device->clock() / 4; cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); @@ -1296,10 +1296,10 @@ static CPU_INIT( m6808 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); state_register(cpustate, "m6808"); } @@ -1317,10 +1317,10 @@ static CPU_INIT( hd6301 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->clock = device->clock() / 4; cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); @@ -1342,10 +1342,10 @@ static CPU_INIT( hd63701 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->clock = device->clock() / 4; cpustate->sci_timer = device->machine().scheduler().timer_alloc(FUNC(sci_tick), cpustate); @@ -1377,10 +1377,10 @@ static CPU_INIT( nsc8105 ) // cpustate->subtype = SUBTYPE_NSC8105; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->insn = nsc8105_insn; cpustate->cycles = cycles_nsc8105; diff --git a/src/emu/cpu/m68000/m68kcpu.c b/src/emu/cpu/m68000/m68kcpu.c index 60894d717b7..157c72da02c 100644 --- a/src/emu/cpu/m68000/m68kcpu.c +++ b/src/emu/cpu/m68000/m68kcpu.c @@ -898,7 +898,7 @@ static CPU_INIT( m68k ) m68ki_cpu_core *m68k = m68k_get_safe_token(device); m68k->device = device; - m68k->program = device->space(AS_PROGRAM); + m68k->program = &device->space(AS_PROGRAM); m68k->int_ack_callback = irqcallback; /* disable all MMUs */ @@ -2065,7 +2065,7 @@ static CPU_INIT( m68307 ) m68k->m68307SERIAL->reset(); m68k->m68307TIMER->reset(); - m68k->internal = device->space(AS_PROGRAM); + m68k->internal = &device->space(AS_PROGRAM); m68k->m68307_base = 0xbfff; m68k->m68307_scrhigh = 0x0007; m68k->m68307_scrlow = 0xf010; @@ -2862,7 +2862,7 @@ static CPU_INIT( m68340 ) m68k->m68340_base = 0x00000000; - m68k->internal = device->space(AS_PROGRAM); + m68k->internal = &device->space(AS_PROGRAM); define_state(device); } diff --git a/src/emu/cpu/m6805/m6805.c b/src/emu/cpu/m6805/m6805.c index 0ac3fb2b549..b759981e145 100644 --- a/src/emu/cpu/m6805/m6805.c +++ b/src/emu/cpu/m6805/m6805.c @@ -479,7 +479,7 @@ static CPU_INIT( m6805 ) state_register(cpustate, "m6805", device); cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); } @@ -493,7 +493,7 @@ static CPU_RESET( m6805 ) cpustate->iCount=50000; /* Used to be global */ cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* Force CPU sub-type and relevant masks */ diff --git a/src/emu/cpu/m6809/m6809.c b/src/emu/cpu/m6809/m6809.c index 318ec6e568e..2989dbdeb55 100644 --- a/src/emu/cpu/m6809/m6809.c +++ b/src/emu/cpu/m6809/m6809.c @@ -377,7 +377,7 @@ static CPU_INIT( m6809 ) m68_state->irq_callback = irqcallback; m68_state->device = device; - m68_state->program = device->space(AS_PROGRAM); + m68_state->program = &device->space(AS_PROGRAM); m68_state->direct = &m68_state->program->direct(); /* setup regtable */ diff --git a/src/emu/cpu/mb86233/mb86233.c b/src/emu/cpu/mb86233/mb86233.c index 28a69ed67bb..0369412ae87 100644 --- a/src/emu/cpu/mb86233/mb86233.c +++ b/src/emu/cpu/mb86233/mb86233.c @@ -111,7 +111,7 @@ static CPU_INIT( mb86233 ) memset(cpustate, 0, sizeof( *cpustate ) ); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); if ( _config ) diff --git a/src/emu/cpu/mb88xx/mb88xx.c b/src/emu/cpu/mb88xx/mb88xx.c index a02799c1da5..9d5227d5ee7 100644 --- a/src/emu/cpu/mb88xx/mb88xx.c +++ b/src/emu/cpu/mb88xx/mb88xx.c @@ -143,10 +143,10 @@ static CPU_INIT( mb88 ) cpustate->irqcallback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->serial = device->machine().scheduler().timer_alloc(FUNC(serial_timer), (void *)device); diff --git a/src/emu/cpu/mc68hc11/mc68hc11.c b/src/emu/cpu/mc68hc11/mc68hc11.c index 6e12288a570..3c9882972f4 100644 --- a/src/emu/cpu/mc68hc11/mc68hc11.c +++ b/src/emu/cpu/mc68hc11/mc68hc11.c @@ -446,9 +446,9 @@ static CPU_INIT( hc11 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->pc)); device->save_item(NAME(cpustate->ix)); diff --git a/src/emu/cpu/mcs48/mcs48.c b/src/emu/cpu/mcs48/mcs48.c index a1b273c1660..5567026d267 100644 --- a/src/emu/cpu/mcs48/mcs48.c +++ b/src/emu/cpu/mcs48/mcs48.c @@ -858,10 +858,10 @@ static void mcs48_init(legacy_cpu_device *device, device_irq_acknowledge_callbac cpustate->int_rom_size = romsize; cpustate->feature_mask = feature_mask; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); /* set up the state table */ { diff --git a/src/emu/cpu/mcs51/mcs51.c b/src/emu/cpu/mcs51/mcs51.c index 4f231851d0e..23eabc3708a 100644 --- a/src/emu/cpu/mcs51/mcs51.c +++ b/src/emu/cpu/mcs51/mcs51.c @@ -2075,10 +2075,10 @@ static CPU_INIT( mcs51 ) mcs51_state->irq_callback = irqcallback; mcs51_state->device = device; - mcs51_state->program = device->space(AS_PROGRAM); + mcs51_state->program = &device->space(AS_PROGRAM); mcs51_state->direct = &mcs51_state->program->direct(); - mcs51_state->data = device->space(AS_DATA); - mcs51_state->io = device->space(AS_IO); + mcs51_state->data = &device->space(AS_DATA); + mcs51_state->io = &device->space(AS_IO); mcs51_state->features = FEATURE_NONE; mcs51_state->ram_mask = 0x7F; /* 128 bytes of ram */ diff --git a/src/emu/cpu/minx/minx.c b/src/emu/cpu/minx/minx.c index 5e82dde3cff..52de6cdc71f 100644 --- a/src/emu/cpu/minx/minx.c +++ b/src/emu/cpu/minx/minx.c @@ -119,7 +119,7 @@ static CPU_INIT( minx ) minx_state *minx = get_safe_token(device); minx->irq_callback = irqcallback; minx->device = device; - minx->program = device->space(AS_PROGRAM); + minx->program = &device->space(AS_PROGRAM); if ( device->static_config() != NULL ) { } diff --git a/src/emu/cpu/mips/mips3com.c b/src/emu/cpu/mips/mips3com.c index 24e5548e7b0..1fe4829efc9 100644 --- a/src/emu/cpu/mips/mips3com.c +++ b/src/emu/cpu/mips/mips3com.c @@ -81,7 +81,7 @@ void mips3com_init(mips3_state *mips, mips3_flavor flavor, int bigendian, legacy mips->cpu_clock = device->clock(); mips->irq_callback = irqcallback; mips->device = device; - mips->program = device->space(AS_PROGRAM); + mips->program = &device->space(AS_PROGRAM); mips->direct = &mips->program->direct(); mips->icache_size = config->icache; mips->dcache_size = config->dcache; diff --git a/src/emu/cpu/mips/r3000.c b/src/emu/cpu/mips/r3000.c index 5c210db49cb..ead2f6ead04 100644 --- a/src/emu/cpu/mips/r3000.c +++ b/src/emu/cpu/mips/r3000.c @@ -311,7 +311,7 @@ static CPU_INIT( r3000 ) r3000->irq_callback = irqcallback; r3000->device = device; - r3000->program = device->space(AS_PROGRAM); + r3000->program = &device->space(AS_PROGRAM); r3000->direct = &r3000->program->direct(); } diff --git a/src/emu/cpu/mn10200/mn10200.c b/src/emu/cpu/mn10200/mn10200.c index c63e1a11ca5..85e1478912c 100644 --- a/src/emu/cpu/mn10200/mn10200.c +++ b/src/emu/cpu/mn10200/mn10200.c @@ -274,8 +274,8 @@ static CPU_INIT(mn10200) memset(cpustate, 0, sizeof(mn102_info)); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->pc)); device->save_item(NAME(cpustate->d)); diff --git a/src/emu/cpu/nec/nec.c b/src/emu/cpu/nec/nec.c index 722ab7b96a3..822478316b9 100644 --- a/src/emu/cpu/nec/nec.c +++ b/src/emu/cpu/nec/nec.c @@ -367,9 +367,9 @@ static void nec_init(legacy_cpu_device *device, device_irq_acknowledge_callback nec_state->irq_callback = irqcallback; nec_state->device = device; - nec_state->program = device->space(AS_PROGRAM); + nec_state->program = &device->space(AS_PROGRAM); nec_state->direct = &nec_state->program->direct(); - nec_state->io = device->space(AS_IO); + nec_state->io = &device->space(AS_IO); } diff --git a/src/emu/cpu/nec/v25.c b/src/emu/cpu/nec/v25.c index 0323bfd7bfc..6a32dec72c2 100644 --- a/src/emu/cpu/nec/v25.c +++ b/src/emu/cpu/nec/v25.c @@ -486,9 +486,9 @@ static void v25_init(legacy_cpu_device *device, device_irq_acknowledge_callback nec_state->irq_callback = irqcallback; nec_state->device = device; - nec_state->program = device->space(AS_PROGRAM); + nec_state->program = &device->space(AS_PROGRAM); nec_state->direct = &nec_state->program->direct(); - nec_state->io = device->space(AS_IO); + nec_state->io = &device->space(AS_IO); } diff --git a/src/emu/cpu/pdp1/pdp1.c b/src/emu/cpu/pdp1/pdp1.c index 272a8e8b4d5..0a1f4e6b340 100644 --- a/src/emu/cpu/pdp1/pdp1.c +++ b/src/emu/cpu/pdp1/pdp1.c @@ -543,7 +543,7 @@ static CPU_INIT( pdp1 ) /* clean-up */ memset (cpustate, 0, sizeof (*cpustate)); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); /* set up params and callbacks */ for (i=0; i<64; i++) diff --git a/src/emu/cpu/pdp1/tx0.c b/src/emu/cpu/pdp1/tx0.c index dadf0cde60f..a4e31b2099b 100644 --- a/src/emu/cpu/pdp1/tx0.c +++ b/src/emu/cpu/pdp1/tx0.c @@ -135,7 +135,7 @@ static void tx0_init_common(legacy_cpu_device *device, device_irq_acknowledge_ca cpustate->ir_mask = is_64kw ? 03 : 037; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); } static CPU_INIT( tx0_64kw ) diff --git a/src/emu/cpu/pic16c5x/pic16c5x.c b/src/emu/cpu/pic16c5x/pic16c5x.c index b5a215f575a..48c3022206e 100644 --- a/src/emu/cpu/pic16c5x/pic16c5x.c +++ b/src/emu/cpu/pic16c5x/pic16c5x.c @@ -727,10 +727,10 @@ static CPU_INIT( pic16c5x ) pic16c5x_state *cpustate = get_safe_token(device); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); /* ensure the internal ram pointers are set before get_info is called */ update_internalram_ptr(cpustate); diff --git a/src/emu/cpu/pic16c62x/pic16c62x.c b/src/emu/cpu/pic16c62x/pic16c62x.c index 4894e428db3..6d62c6e9e5f 100644 --- a/src/emu/cpu/pic16c62x/pic16c62x.c +++ b/src/emu/cpu/pic16c62x/pic16c62x.c @@ -834,10 +834,10 @@ static CPU_INIT( pic16c62x ) pic16c62x_state *cpustate = get_safe_token(device); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); cpustate->CONFIG = 0x3fff; diff --git a/src/emu/cpu/powerpc/ppc.c b/src/emu/cpu/powerpc/ppc.c index 50dae022440..ef9cc57ef19 100644 --- a/src/emu/cpu/powerpc/ppc.c +++ b/src/emu/cpu/powerpc/ppc.c @@ -963,7 +963,7 @@ static CPU_INIT( ppc403 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; } @@ -1009,7 +1009,7 @@ static CPU_INIT( ppc405 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; } @@ -1134,7 +1134,7 @@ static CPU_INIT( ppc603 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; @@ -1282,7 +1282,7 @@ static CPU_INIT( ppc602 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; @@ -1423,7 +1423,7 @@ static CPU_INIT( mpc8240 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; @@ -1549,7 +1549,7 @@ static CPU_INIT( ppc601 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; @@ -1679,7 +1679,7 @@ static CPU_INIT( ppc604 ) ppc.irq_callback = irqcallback; ppc.device = device; - ppc.program = device->space(AS_PROGRAM); + ppc.program = &device->space(AS_PROGRAM); ppc.pvr = configdata->pvr; diff --git a/src/emu/cpu/powerpc/ppccom.c b/src/emu/cpu/powerpc/ppccom.c index b3c4345d39f..fc7c60413dd 100644 --- a/src/emu/cpu/powerpc/ppccom.c +++ b/src/emu/cpu/powerpc/ppccom.c @@ -317,7 +317,7 @@ void ppccom_init(powerpc_state *ppc, powerpc_flavor flavor, UINT32 cap, int tb_d ppc->cpu_clock = device->clock(); ppc->irq_callback = irqcallback; ppc->device = device; - ppc->program = device->space(AS_PROGRAM); + ppc->program = &device->space(AS_PROGRAM); ppc->direct = &ppc->program->direct(); ppc->system_clock = (config != NULL) ? config->bus_frequency : device->clock(); ppc->dcr_read_func = (config != NULL) ? config->dcr_read_func : NULL; diff --git a/src/emu/cpu/pps4/pps4.c b/src/emu/cpu/pps4/pps4.c index 7aa44f631fe..f55cb26c735 100644 --- a/src/emu/cpu/pps4/pps4.c +++ b/src/emu/cpu/pps4/pps4.c @@ -337,10 +337,10 @@ static CPU_INIT( pps4 ) cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->A)); device->save_item(NAME(cpustate->X)); diff --git a/src/emu/cpu/psx/psx.c b/src/emu/cpu/psx/psx.c index 7684ae6648a..b32712d8e0d 100644 --- a/src/emu/cpu/psx/psx.c +++ b/src/emu/cpu/psx/psx.c @@ -1629,7 +1629,7 @@ cxd8606cq_device::cxd8606cq_device(const machine_config &mconfig, const char *ta void psxcpu_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); save_item( NAME(m_op) ); diff --git a/src/emu/cpu/rsp/rsp.c b/src/emu/cpu/rsp/rsp.c index 98db04b393d..6edd8693c84 100644 --- a/src/emu/cpu/rsp/rsp.c +++ b/src/emu/cpu/rsp/rsp.c @@ -281,7 +281,7 @@ static CPU_INIT( rsp ) rsp->irq_callback = irqcallback; rsp->device = device; - rsp->program = device->space(AS_PROGRAM); + rsp->program = &device->space(AS_PROGRAM); rsp->direct = &rsp->program->direct(); #if 1 diff --git a/src/emu/cpu/rsp/rspdrc.c b/src/emu/cpu/rsp/rspdrc.c index 2c59f23a47b..3b7a7208134 100644 --- a/src/emu/cpu/rsp/rspdrc.c +++ b/src/emu/cpu/rsp/rspdrc.c @@ -588,7 +588,7 @@ static void rspcom_init(rsp_state *rsp, legacy_cpu_device *device, device_irq_ac rsp->config = (const rsp_config *)device->static_config(); rsp->irq_callback = irqcallback; rsp->device = device; - rsp->program = device->space(AS_PROGRAM); + rsp->program = &device->space(AS_PROGRAM); rsp->direct = &rsp->program->direct(); #if 1 diff --git a/src/emu/cpu/s2650/s2650.c b/src/emu/cpu/s2650/s2650.c index 20a99fca9be..0e4d9bec2f5 100644 --- a/src/emu/cpu/s2650/s2650.c +++ b/src/emu/cpu/s2650/s2650.c @@ -795,9 +795,9 @@ static CPU_INIT( s2650 ) s2650c->irq_callback = irqcallback; s2650c->device = device; - s2650c->program = device->space(AS_PROGRAM); + s2650c->program = &device->space(AS_PROGRAM); s2650c->direct = &s2650c->program->direct(); - s2650c->io = device->space(AS_IO); + s2650c->io = &device->space(AS_IO); device->save_item(NAME(s2650c->ppc)); device->save_item(NAME(s2650c->page)); @@ -828,9 +828,9 @@ static CPU_RESET( s2650 ) memset(s2650c->ras, 0, sizeof(s2650c->ras)); s2650c->device = device; - s2650c->program = device->space(AS_PROGRAM); + s2650c->program = &device->space(AS_PROGRAM); s2650c->direct = &s2650c->program->direct(); - s2650c->io = device->space(AS_IO); + s2650c->io = &device->space(AS_IO); s2650c->psl = COM | WC; /* force write */ s2650c->psu = 0xff; diff --git a/src/emu/cpu/saturn/saturn.c b/src/emu/cpu/saturn/saturn.c index ab953b6a6dd..736deb4c8cb 100644 --- a/src/emu/cpu/saturn/saturn.c +++ b/src/emu/cpu/saturn/saturn.c @@ -114,7 +114,7 @@ static CPU_INIT( saturn ) cpustate->config = (saturn_cpu_core *) device->static_config(); cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); device->save_item(NAME(cpustate->reg[R0])); diff --git a/src/emu/cpu/sc61860/sc61860.c b/src/emu/cpu/sc61860/sc61860.c index 377d81a337f..b5fc806e270 100644 --- a/src/emu/cpu/sc61860/sc61860.c +++ b/src/emu/cpu/sc61860/sc61860.c @@ -105,7 +105,7 @@ static CPU_INIT( sc61860 ) cpustate->config = (sc61860_cpu_core *) device->static_config(); device->machine().scheduler().timer_pulse(attotime::from_hz(500), FUNC(sc61860_2ms_tick), 0, cpustate); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); } diff --git a/src/emu/cpu/scmp/scmp.c b/src/emu/cpu/scmp/scmp.c index 90d22cdba17..2d7a72e655a 100644 --- a/src/emu/cpu/scmp/scmp.c +++ b/src/emu/cpu/scmp/scmp.c @@ -513,7 +513,7 @@ static CPU_INIT( scmp ) cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); /* resolve callbacks */ diff --git a/src/emu/cpu/se3208/se3208.c b/src/emu/cpu/se3208/se3208.c index 039b38f98dc..aa25186196b 100644 --- a/src/emu/cpu/se3208/se3208.c +++ b/src/emu/cpu/se3208/se3208.c @@ -1717,7 +1717,7 @@ static CPU_RESET( se3208 ) memset(se3208_state,0,sizeof(se3208_state_t)); se3208_state->irq_callback = save_irqcallback; se3208_state->device = device; - se3208_state->program = device->space(AS_PROGRAM); + se3208_state->program = &device->space(AS_PROGRAM); se3208_state->direct = &se3208_state->program->direct(); se3208_state->PC=SE3208_Read32(se3208_state, 0); se3208_state->SR=0; @@ -1788,7 +1788,7 @@ static CPU_INIT( se3208 ) se3208_state->irq_callback = irqcallback; se3208_state->device = device; - se3208_state->program = device->space(AS_PROGRAM); + se3208_state->program = &device->space(AS_PROGRAM); se3208_state->direct = &se3208_state->program->direct(); } diff --git a/src/emu/cpu/sh2/sh2comn.c b/src/emu/cpu/sh2/sh2comn.c index 586c8fd0291..ed95852cbb3 100644 --- a/src/emu/cpu/sh2/sh2comn.c +++ b/src/emu/cpu/sh2/sh2comn.c @@ -961,9 +961,9 @@ void sh2_common_init(sh2_state *sh2, legacy_cpu_device *device, device_irq_ackno } sh2->irq_callback = irqcallback; sh2->device = device; - sh2->program = device->space(AS_PROGRAM); + sh2->program = &device->space(AS_PROGRAM); sh2->direct = &sh2->program->direct(); - sh2->internal = device->space(AS_PROGRAM); + sh2->internal = &device->space(AS_PROGRAM); device->save_item(NAME(sh2->pc)); device->save_item(NAME(sh2->sr)); diff --git a/src/emu/cpu/sh4/sh4.c b/src/emu/cpu/sh4/sh4.c index 7b19754994c..f6110aeb807 100644 --- a/src/emu/cpu/sh4/sh4.c +++ b/src/emu/cpu/sh4/sh4.c @@ -2868,10 +2868,10 @@ static CPU_RESET( common_sh4_reset ) sh4->ftcsr_read_callback = f; sh4->irq_callback = save_irqcallback; sh4->device = device; - sh4->internal = device->space(AS_PROGRAM); - sh4->program = device->space(AS_PROGRAM); + sh4->internal = &device->space(AS_PROGRAM); + sh4->program = &device->space(AS_PROGRAM); sh4->direct = &sh4->program->direct(); - sh4->io = device->space(AS_IO); + sh4->io = &device->space(AS_IO); sh4->dma_timer[0] = tsaved[0]; sh4->dma_timer[1] = tsaved[1]; @@ -3216,9 +3216,9 @@ static CPU_INIT( sh4 ) sh4->irq_callback = irqcallback; sh4->device = device; - sh4->internal = device->space(AS_PROGRAM); - sh4->program = device->space(AS_PROGRAM); - sh4->io = device->space(AS_IO); + sh4->internal = &device->space(AS_PROGRAM); + sh4->program = &device->space(AS_PROGRAM); + sh4->io = &device->space(AS_IO); sh4_default_exception_priorities(sh4); sh4->irln = 15; sh4->test_irq = 0; diff --git a/src/emu/cpu/sharc/sharc.c b/src/emu/cpu/sharc/sharc.c index 19522662862..cbe1db9a9c0 100644 --- a/src/emu/cpu/sharc/sharc.c +++ b/src/emu/cpu/sharc/sharc.c @@ -425,8 +425,8 @@ static CPU_INIT( sharc ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->data = device->space(AS_DATA); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->data = &device->space(AS_DATA); build_opcode_table(); diff --git a/src/emu/cpu/sm8500/sm8500.c b/src/emu/cpu/sm8500/sm8500.c index aaeed029360..574d7d56d90 100644 --- a/src/emu/cpu/sm8500/sm8500.c +++ b/src/emu/cpu/sm8500/sm8500.c @@ -124,7 +124,7 @@ static CPU_INIT( sm8500 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); if ( device->static_config() != NULL ) { cpustate->config.handle_dma = ((SM8500_CONFIG *)device->static_config())->handle_dma; cpustate->config.handle_timers = ((SM8500_CONFIG *)device->static_config())->handle_timers; diff --git a/src/emu/cpu/spc700/spc700.c b/src/emu/cpu/spc700/spc700.c index c716d1a8aa1..e1267e57d33 100644 --- a/src/emu/cpu/spc700/spc700.c +++ b/src/emu/cpu/spc700/spc700.c @@ -1286,7 +1286,7 @@ static CPU_INIT( spc700 ) INT_ACK = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); } diff --git a/src/emu/cpu/ssem/ssem.c b/src/emu/cpu/ssem/ssem.c index 73aacfb6da3..2e6a6aa744a 100644 --- a/src/emu/cpu/ssem/ssem.c +++ b/src/emu/cpu/ssem/ssem.c @@ -149,7 +149,7 @@ static CPU_INIT( ssem ) cpustate->halt = 0; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); } static CPU_EXIT( ssem ) diff --git a/src/emu/cpu/ssp1601/ssp1601.c b/src/emu/cpu/ssp1601/ssp1601.c index 59e4cf34a8f..9fdfe14f784 100644 --- a/src/emu/cpu/ssp1601/ssp1601.c +++ b/src/emu/cpu/ssp1601/ssp1601.c @@ -528,9 +528,9 @@ static CPU_INIT( ssp1601 ) memset(ssp1601_state, 0, sizeof(ssp1601_state_t)); ssp1601_state->gr[0].w.h = 0xffff; // constant reg ssp1601_state->device = device; - ssp1601_state->program = device->space(AS_PROGRAM); + ssp1601_state->program = &device->space(AS_PROGRAM); ssp1601_state->direct = &ssp1601_state->program->direct(); - ssp1601_state->io = device->space(AS_IO); + ssp1601_state->io = &device->space(AS_IO); } diff --git a/src/emu/cpu/superfx/superfx.c b/src/emu/cpu/superfx/superfx.c index ef761deddf3..e4bceb0b4f8 100644 --- a/src/emu/cpu/superfx/superfx.c +++ b/src/emu/cpu/superfx/superfx.c @@ -751,7 +751,7 @@ static CPU_INIT( superfx ) superfx_update_speed(cpustate); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); if (device->static_config() != NULL) { diff --git a/src/emu/cpu/t11/t11.c b/src/emu/cpu/t11/t11.c index 78b242dd72c..0b087e97841 100644 --- a/src/emu/cpu/t11/t11.c +++ b/src/emu/cpu/t11/t11.c @@ -264,7 +264,7 @@ static CPU_INIT( t11 ) cpustate->initial_pc = initial_pc[setup->mode >> 13]; cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); device->save_item(NAME(cpustate->ppc.w.l)); diff --git a/src/emu/cpu/tlcs90/tlcs90.c b/src/emu/cpu/tlcs90/tlcs90.c index 64045b74947..1544e6ba93d 100644 --- a/src/emu/cpu/tlcs90/tlcs90.c +++ b/src/emu/cpu/tlcs90/tlcs90.c @@ -2713,8 +2713,8 @@ static CPU_INIT( t90 ) memset(cpustate, 0, sizeof(t90_Regs)); cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); cpustate->timer_period = attotime::from_hz(device->unscaled_clock()) * 8; diff --git a/src/emu/cpu/tlcs900/tlcs900.c b/src/emu/cpu/tlcs900/tlcs900.c index 630cff01cef..b316b75947e 100644 --- a/src/emu/cpu/tlcs900/tlcs900.c +++ b/src/emu/cpu/tlcs900/tlcs900.c @@ -222,7 +222,7 @@ static CPU_INIT( tlcs900 ) cpustate->intf = (const tlcs900_interface *)device->static_config(); cpustate->irqcallback = irqcallback; cpustate->device = device; - cpustate->program = device->space( AS_PROGRAM ); + cpustate->program = &device->space( AS_PROGRAM ); cpustate->to1.resolve(cpustate->intf->to1, *device ); cpustate->to3.resolve(cpustate->intf->to3, *device ); diff --git a/src/emu/cpu/tms0980/tms0980.c b/src/emu/cpu/tms0980/tms0980.c index 7fadebee03b..985456731b0 100644 --- a/src/emu/cpu/tms0980/tms0980.c +++ b/src/emu/cpu/tms0980/tms0980.c @@ -503,8 +503,8 @@ static void cpu_init_tms_common( legacy_cpu_device *device, const UINT32* decode cpustate->pc_size = pc_size; cpustate->byte_size = byte_size; - cpustate->program = device->space( AS_PROGRAM ); - cpustate->data = device->space( AS_PROGRAM ); + cpustate->program = &device->space( AS_PROGRAM ); + cpustate->data = &device->space( AS_PROGRAM ); device->save_item( NAME(cpustate->prev_pc) ); device->save_item( NAME(cpustate->prev_pa) ); diff --git a/src/emu/cpu/tms32010/tms32010.c b/src/emu/cpu/tms32010/tms32010.c index 7ce87d70a2e..b74e876cc8c 100644 --- a/src/emu/cpu/tms32010/tms32010.c +++ b/src/emu/cpu/tms32010/tms32010.c @@ -826,10 +826,10 @@ static CPU_INIT( tms32010 ) device->save_item(NAME(cpustate->addr_mask)); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); } diff --git a/src/emu/cpu/tms32025/tms32025.c b/src/emu/cpu/tms32025/tms32025.c index 53976a27757..7d38abb827a 100644 --- a/src/emu/cpu/tms32025/tms32025.c +++ b/src/emu/cpu/tms32025/tms32025.c @@ -1676,10 +1676,10 @@ static CPU_INIT( tms32025 ) cpustate->intRAM = auto_alloc_array(device->machine(), UINT16, 0x800); cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->PC)); device->save_item(NAME(cpustate->STR0)); diff --git a/src/emu/cpu/tms32031/tms32031.c b/src/emu/cpu/tms32031/tms32031.c index dcb6f0c8d5a..f81fc2c3bdf 100644 --- a/src/emu/cpu/tms32031/tms32031.c +++ b/src/emu/cpu/tms32031/tms32031.c @@ -368,7 +368,7 @@ inline void tms3203x_device::WMEM(offs_t addr, UINT32 data) void tms3203x_device::device_start() { // find address spaces - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); // save state diff --git a/src/emu/cpu/tms32051/tms32051.c b/src/emu/cpu/tms32051/tms32051.c index d22f28beafb..9ae5294329e 100644 --- a/src/emu/cpu/tms32051/tms32051.c +++ b/src/emu/cpu/tms32051/tms32051.c @@ -223,9 +223,9 @@ static CPU_INIT( tms ) tms32051_state *cpustate = get_safe_token(device); cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); + cpustate->data = &device->space(AS_DATA); cpustate->pcstack_ptr = 0; } diff --git a/src/emu/cpu/tms34010/tms34010.c b/src/emu/cpu/tms34010/tms34010.c index 2f884388bbd..a265c1a39ef 100644 --- a/src/emu/cpu/tms34010/tms34010.c +++ b/src/emu/cpu/tms34010/tms34010.c @@ -626,7 +626,7 @@ static CPU_INIT( tms34010 ) tms->config = configdata; tms->irq_callback = irqcallback; tms->device = device; - tms->program = device->space(AS_PROGRAM); + tms->program = &device->space(AS_PROGRAM); tms->direct = &tms->program->direct(); tms->screen = downcast<screen_device *>(device->machine().device(configdata->screen_tag)); @@ -688,7 +688,7 @@ static CPU_RESET( tms34010 ) tms->irq_callback = save_irqcallback; tms->scantimer = save_scantimer; tms->device = device; - tms->program = device->space(AS_PROGRAM); + tms->program = &device->space(AS_PROGRAM); tms->direct = &tms->program->direct(); /* fetch the initial PC and reset the state */ @@ -699,7 +699,7 @@ static CPU_RESET( tms34010 ) /* the first time we are run */ tms->reset_deferred = tms->config->halt_on_reset; if (tms->config->halt_on_reset) - tms34010_io_register_w(*device->space(AS_PROGRAM), REG_HSTCTLH, 0x8000, 0xffff); + tms34010_io_register_w(device->space(AS_PROGRAM), REG_HSTCTLH, 0x8000, 0xffff); } @@ -1630,7 +1630,7 @@ void tms34010_host_w(device_t *cpu, int reg, int data) case TMS34010_HOST_CONTROL: { tms->external_host_access = TRUE; - address_space &space = *tms->device->space(AS_PROGRAM); + address_space &space = tms->device->space(AS_PROGRAM); tms34010_io_register_w(space, REG_HSTCTLH, data & 0xff00, 0xffff); tms34010_io_register_w(space, REG_HSTCTLL, data & 0x00ff, 0xffff); tms->external_host_access = FALSE; diff --git a/src/emu/cpu/tms57002/tms57002.c b/src/emu/cpu/tms57002/tms57002.c index 615169acab5..83051044b5c 100644 --- a/src/emu/cpu/tms57002/tms57002.c +++ b/src/emu/cpu/tms57002/tms57002.c @@ -787,8 +787,8 @@ void tms57002_device::execute_run() void tms57002_device::device_start() { sti = S_IDLE; - program = space(AS_PROGRAM); - data = space(AS_DATA); + program = &space(AS_PROGRAM); + data = &space(AS_DATA); state_add(STATE_GENPC,"GENPC", pc).noshow(); diff --git a/src/emu/cpu/tms7000/tms7000.c b/src/emu/cpu/tms7000/tms7000.c index 2ab1e66531a..867ccb4dbfa 100644 --- a/src/emu/cpu/tms7000/tms7000.c +++ b/src/emu/cpu/tms7000/tms7000.c @@ -165,9 +165,9 @@ static CPU_INIT( tms7000 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); memset(cpustate->pf, 0, 0x100); memset(cpustate->rf, 0, 0x80); diff --git a/src/emu/cpu/tms9900/99xxcore.h b/src/emu/cpu/tms9900/99xxcore.h index 5d9bf06e7b5..46f0fce2eab 100644 --- a/src/emu/cpu/tms9900/99xxcore.h +++ b/src/emu/cpu/tms9900/99xxcore.h @@ -1294,8 +1294,8 @@ static CPU_INIT( tms99xx ) cpustate->irq_level = 16; cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); - cpustate->io = device->space(AS_IO); + cpustate->program = &device->space(AS_PROGRAM); + cpustate->io = &device->space(AS_IO); #if (TMS99XX_MODEL == TMS9995_ID) cpustate->timer = device->machine().scheduler().timer_alloc(FUNC(decrementer_callback), cpustate); diff --git a/src/emu/cpu/tms9900/tms9900.c b/src/emu/cpu/tms9900/tms9900.c index 69c7aeb6984..dd63344e277 100644 --- a/src/emu/cpu/tms9900/tms9900.c +++ b/src/emu/cpu/tms9900/tms9900.c @@ -167,8 +167,8 @@ void tms99xx_device::device_start() // TODO: Restore state save feature - m_prgspace = space(AS_PROGRAM); // dimemory.h - m_cru = space(AS_IO); + m_prgspace = &space(AS_PROGRAM); // dimemory.h + m_cru = &space(AS_IO); // Resolve our external connections m_external_operation.resolve(conf->external_callback, *this); diff --git a/src/emu/cpu/tms9900/tms9995.c b/src/emu/cpu/tms9900/tms9995.c index 12ea815c502..12b3eee9cf1 100644 --- a/src/emu/cpu/tms9900/tms9995.c +++ b/src/emu/cpu/tms9900/tms9995.c @@ -148,8 +148,8 @@ void tms9995_device::device_start() // TODO: Restore save state suport - m_prgspace = space(AS_PROGRAM); // dimemory.h - m_cru = space(AS_IO); + m_prgspace = &space(AS_PROGRAM); // dimemory.h + m_cru = &space(AS_IO); // Resolve our external connections m_external_operation.resolve(conf->external_callback, *this); diff --git a/src/emu/cpu/unsp/unsp.c b/src/emu/cpu/unsp/unsp.c index ff251174238..9fa918e6ca2 100644 --- a/src/emu/cpu/unsp/unsp.c +++ b/src/emu/cpu/unsp/unsp.c @@ -114,7 +114,7 @@ static CPU_INIT( unsp ) memset(unsp->r, 0, sizeof(UINT16) * UNSP_GPR_COUNT); unsp->device = device; - unsp->program = device->space(AS_PROGRAM); + unsp->program = &device->space(AS_PROGRAM); } static CPU_RESET( unsp ) diff --git a/src/emu/cpu/upd7725/upd7725.c b/src/emu/cpu/upd7725/upd7725.c index 090b242197d..7918c454f58 100755 --- a/src/emu/cpu/upd7725/upd7725.c +++ b/src/emu/cpu/upd7725/upd7725.c @@ -80,8 +80,8 @@ void necdsp_device::device_config_complete() void necdsp_device::device_start() { // get our address spaces - m_program = space(AS_PROGRAM); - m_data = space(AS_DATA); + m_program = &space(AS_PROGRAM); + m_data = &space(AS_DATA); m_direct = &m_program->direct(); // register our state for the debugger diff --git a/src/emu/cpu/upd7810/upd7810.c b/src/emu/cpu/upd7810/upd7810.c index 7957ead8f33..cc563879bc6 100644 --- a/src/emu/cpu/upd7810/upd7810.c +++ b/src/emu/cpu/upd7810/upd7810.c @@ -1702,9 +1702,9 @@ static CPU_INIT( upd7810 ) cpustate->config = *(const UPD7810_CONFIG*) device->static_config(); cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->ppc.w.l)); device->save_item(NAME(cpustate->pc.w.l)); @@ -1787,9 +1787,9 @@ static CPU_RESET( upd7810 ) cpustate->config = save_config; cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->opXX = opXX_7810; cpustate->op48 = op48; diff --git a/src/emu/cpu/v30mz/v30mz.c b/src/emu/cpu/v30mz/v30mz.c index 793ba36034c..085a718ce99 100644 --- a/src/emu/cpu/v30mz/v30mz.c +++ b/src/emu/cpu/v30mz/v30mz.c @@ -130,9 +130,9 @@ v30mz_cpu_device::v30mz_cpu_device(const machine_config &mconfig, const char *ta void v30mz_cpu_device::device_start() { m_irq_callback = static_standard_irq_callback; - m_program = space(AS_PROGRAM); + m_program = &space(AS_PROGRAM); m_direct = &m_program->direct(); - m_io = space(AS_IO); + m_io = &space(AS_IO); save_item(NAME(m_regs.w)); save_item(NAME(m_sregs)); diff --git a/src/emu/cpu/v60/v60.c b/src/emu/cpu/v60/v60.c index c712b013dba..9d3eeae0379 100644 --- a/src/emu/cpu/v60/v60.c +++ b/src/emu/cpu/v60/v60.c @@ -353,9 +353,9 @@ static CPU_INIT( v60 ) cpustate->fetch_xor = BYTE_XOR_LE(0); cpustate->start_pc = 0xfffff0; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); } static CPU_INIT( v70 ) @@ -369,9 +369,9 @@ static CPU_INIT( v70 ) cpustate->fetch_xor = BYTE4_XOR_LE(0); cpustate->start_pc = 0xfffffff0; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); } static CPU_RESET( v60 ) diff --git a/src/emu/cpu/v810/v810.c b/src/emu/cpu/v810/v810.c index 2d319d96798..04a182176cc 100644 --- a/src/emu/cpu/v810/v810.c +++ b/src/emu/cpu/v810/v810.c @@ -1254,9 +1254,9 @@ static CPU_INIT( v810 ) cpustate->nmi_line = CLEAR_LINE; cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); device->save_item(NAME(cpustate->reg)); device->save_item(NAME(cpustate->irq_line)); diff --git a/src/emu/cpu/z180/z180.c b/src/emu/cpu/z180/z180.c index 17c9475f33c..dc313efacc6 100644 --- a/src/emu/cpu/z180/z180.c +++ b/src/emu/cpu/z180/z180.c @@ -2212,9 +2212,9 @@ static CPU_RESET( z180 ) cpustate->irq_state[2] = CLEAR_LINE; cpustate->after_EI = 0; cpustate->ea = 0; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->iospace = device->space(AS_IO); + cpustate->iospace = &device->space(AS_IO); cpustate->device = device; memcpy(cpustate->cc, (UINT8 *)cc_default, sizeof(cpustate->cc)); diff --git a/src/emu/cpu/z8/z8.c b/src/emu/cpu/z8/z8.c index a0771fe8477..f3a897c66cb 100644 --- a/src/emu/cpu/z8/z8.c +++ b/src/emu/cpu/z8/z8.c @@ -661,10 +661,10 @@ static CPU_INIT( z8 ) cpustate->clock = device->clock(); /* find address spaces */ - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->data = device->space(AS_DATA); - cpustate->io = device->space(AS_IO); + cpustate->data = &device->space(AS_DATA); + cpustate->io = &device->space(AS_IO); /* allocate timers */ cpustate->t0_timer = device->machine().scheduler().timer_alloc(FUNC(t0_tick), cpustate); diff --git a/src/emu/cpu/z80/z80.c b/src/emu/cpu/z80/z80.c index 2f7033e98a8..43edf4f52f9 100644 --- a/src/emu/cpu/z80/z80.c +++ b/src/emu/cpu/z80/z80.c @@ -3477,9 +3477,9 @@ static CPU_INIT( z80 ) z80->daisy.init(device, (const z80_daisy_config *)device->static_config()); z80->irq_callback = irqcallback; z80->device = device; - z80->program = device->space(AS_PROGRAM); + z80->program = &device->space(AS_PROGRAM); z80->direct = &z80->program->direct(); - z80->io = device->space(AS_IO); + z80->io = &device->space(AS_IO); z80->IX = z80->IY = 0xffff; /* IX and IY are FFFF after a reset! */ z80->F = ZF; /* Zero flag is set */ diff --git a/src/emu/cpu/z8000/z8000.c b/src/emu/cpu/z8000/z8000.c index 47a79ca2d57..d554b679925 100644 --- a/src/emu/cpu/z8000/z8000.c +++ b/src/emu/cpu/z8000/z8000.c @@ -478,9 +478,9 @@ static CPU_INIT( z8001 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); /* already initialized? */ if(z8000_exec == NULL) @@ -493,9 +493,9 @@ static CPU_INIT( z8002 ) cpustate->irq_callback = irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); /* already initialized? */ if(z8000_exec == NULL) @@ -510,9 +510,9 @@ static CPU_RESET( z8001 ) memset(cpustate, 0, sizeof(*cpustate)); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->fcw = RDMEM_W(cpustate, 2); /* get reset cpustate->fcw */ if(cpustate->fcw & F_SEG) { @@ -532,9 +532,9 @@ static CPU_RESET( z8002 ) memset(cpustate, 0, sizeof(*cpustate)); cpustate->irq_callback = save_irqcallback; cpustate->device = device; - cpustate->program = device->space(AS_PROGRAM); + cpustate->program = &device->space(AS_PROGRAM); cpustate->direct = &cpustate->program->direct(); - cpustate->io = device->space(AS_IO); + cpustate->io = &device->space(AS_IO); cpustate->fcw = RDMEM_W(cpustate, 2); /* get reset cpustate->fcw */ cpustate->pc = RDMEM_W(cpustate, 4); /* get reset cpustate->pc */ } diff --git a/src/emu/debug/debugcmd.c b/src/emu/debug/debugcmd.c index f06fb261457..3df869a3a69 100644 --- a/src/emu/debug/debugcmd.c +++ b/src/emu/debug/debugcmd.c @@ -566,12 +566,12 @@ int debug_command_parameter_cpu_space(running_machine &machine, const char *para return FALSE; /* fetch the space pointer */ - result = cpu->memory().space(spacenum); - if (result == NULL) + if (!cpu->memory().has_space(spacenum)) { debug_console_printf(machine, "No matching memory space found for CPU '%s'\n", cpu->tag()); return FALSE; } + result = &cpu->memory().space(spacenum); return TRUE; } diff --git a/src/emu/debug/debugcpu.c b/src/emu/debug/debugcpu.c index d24ad7282ca..e129a51de53 100644 --- a/src/emu/debug/debugcpu.c +++ b/src/emu/debug/debugcpu.c @@ -1155,7 +1155,6 @@ static UINT64 expression_read_memory(void *param, const char *name, expression_s running_machine &machine = *(running_machine *)param; UINT64 result = ~(UINT64)0 >> (64 - 8*size); device_t *device = NULL; - address_space *space; switch (spacenum) { @@ -1167,9 +1166,11 @@ static UINT64 expression_read_memory(void *param, const char *name, expression_s device = expression_get_device(machine, name); if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); - if (space != NULL) - result = debug_read_memory(*space, space->address_to_byte(address), size, true); + if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL))) + { + address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); + result = debug_read_memory(space, space.address_to_byte(address), size, true); + } break; case EXPSPACE_PROGRAM_PHYSICAL: @@ -1180,9 +1181,11 @@ static UINT64 expression_read_memory(void *param, const char *name, expression_s device = expression_get_device(machine, name); if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL)); - if (space != NULL) - result = debug_read_memory(*space, space->address_to_byte(address), size, false); + if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL))) + { + address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); + result = debug_read_memory(space, space.address_to_byte(address), size, false); + } break; case EXPSPACE_OPCODE: @@ -1191,7 +1194,7 @@ static UINT64 expression_read_memory(void *param, const char *name, expression_s device = expression_get_device(machine, name); if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - result = expression_read_program_direct(*device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size); + result = expression_read_program_direct(device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size); break; case EXPSPACE_REGION: @@ -1321,7 +1324,6 @@ static void expression_write_memory(void *param, const char *name, expression_sp { running_machine &machine = *(running_machine *)param; device_t *device = NULL; - address_space *space; switch (spacenum) { @@ -1333,9 +1335,11 @@ static void expression_write_memory(void *param, const char *name, expression_sp device = expression_get_device(machine, name); if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); - if (space != NULL) - debug_write_memory(*space, space->address_to_byte(address), data, size, true); + if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL))) + { + address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); + debug_write_memory(space, space.address_to_byte(address), data, size, true); + } break; case EXPSPACE_PROGRAM_PHYSICAL: @@ -1346,9 +1350,11 @@ static void expression_write_memory(void *param, const char *name, expression_sp device = expression_get_device(machine, name); if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_PHYSICAL)); - if (space != NULL) - debug_write_memory(*space, space->address_to_byte(address), data, size, false); + if (device->memory().has_space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL))) + { + address_space &space = device->memory().space(AS_PROGRAM + (spacenum - EXPSPACE_PROGRAM_LOGICAL)); + debug_write_memory(space, space.address_to_byte(address), data, size, false); + } break; case EXPSPACE_OPCODE: @@ -1357,7 +1363,7 @@ static void expression_write_memory(void *param, const char *name, expression_sp device = expression_get_device(machine, name); if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - expression_write_program_direct(*device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size, data); + expression_write_program_direct(device->memory().space(AS_PROGRAM), (spacenum == EXPSPACE_OPCODE), address, size, data); break; case EXPSPACE_REGION: @@ -1515,7 +1521,7 @@ static expression_error::error_code expression_validate(void *param, const char } if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - if (device->memory().space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_LOGICAL)) == NULL) + if (!device->memory().has_space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_LOGICAL))) return expression_error::NO_SUCH_MEMORY_SPACE; break; @@ -1531,7 +1537,7 @@ static expression_error::error_code expression_validate(void *param, const char } if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - if (device->memory().space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_PHYSICAL)) == NULL) + if (!device->memory().has_space(AS_PROGRAM + (space - EXPSPACE_PROGRAM_PHYSICAL))) return expression_error::NO_SUCH_MEMORY_SPACE; break; @@ -1545,7 +1551,7 @@ static expression_error::error_code expression_validate(void *param, const char } if (device == NULL) device = debug_cpu_get_visible_cpu(machine); - if (device->memory().space(AS_PROGRAM) == NULL) + if (!device->memory().has_space(AS_PROGRAM)) return expression_error::NO_SUCH_MEMORY_SPACE; break; @@ -1674,12 +1680,12 @@ device_debug::device_debug(device_t &device) // add entries to enable/disable unmap reporting for each space if (m_memory != NULL) { - if (m_memory->space(AS_PROGRAM) != NULL) - m_symtable.add("logunmap", (void *)m_memory->space(AS_PROGRAM), get_logunmap, set_logunmap); - if (m_memory->space(AS_DATA) != NULL) - m_symtable.add("logunmapd", (void *)m_memory->space(AS_DATA), get_logunmap, set_logunmap); - if (m_memory->space(AS_IO) != NULL) - m_symtable.add("logunmapi", (void *)m_memory->space(AS_IO), get_logunmap, set_logunmap); + if (m_memory->has_space(AS_PROGRAM)) + m_symtable.add("logunmap", (void *)&m_memory->space(AS_PROGRAM), get_logunmap, set_logunmap); + if (m_memory->has_space(AS_DATA)) + m_symtable.add("logunmapd", (void *)&m_memory->space(AS_DATA), get_logunmap, set_logunmap); + if (m_memory->has_space(AS_IO)) + m_symtable.add("logunmapi", (void *)&m_memory->space(AS_IO), get_logunmap, set_logunmap); } // add all registers into it @@ -2039,7 +2045,7 @@ offs_t device_debug::disassemble(char *buffer, offs_t pc, const UINT8 *oprom, co #ifdef MAME_DEBUG if (m_memory != NULL && m_disasm != NULL) { - address_space &space = *m_memory->space(AS_PROGRAM); + address_space &space = m_memory->space(AS_PROGRAM); int bytes = space.address_to_byte(result & DASMFLAG_LENGTHMASK); assert(bytes >= m_disasm->min_opcode_bytes()); assert(bytes <= m_disasm->max_opcode_bytes()); @@ -2467,8 +2473,8 @@ void device_debug::hotspot_track(int numspots, int threshhold) } // update the watchpoint flags to include us - if (m_memory != NULL && m_memory->space(AS_PROGRAM) != NULL) - watchpoint_update_flags(*m_memory->space(AS_PROGRAM)); + if (m_memory != NULL && m_memory->has_space(AS_PROGRAM)) + watchpoint_update_flags(m_memory->space(AS_PROGRAM)); } @@ -2666,7 +2672,7 @@ UINT32 device_debug::compute_opcode_crc32(offs_t address) const return 0; // no program interface, just fail - address_space &space = *m_memory->space(AS_PROGRAM); + address_space &space = m_memory->space(AS_PROGRAM); // zero out the buffers UINT8 opbuf[64], argbuf[64]; @@ -3016,7 +3022,7 @@ UINT32 device_debug::dasm_wrapped(astring &buffer, offs_t pc) assert(m_memory != NULL && m_disasm != NULL); // determine the adjusted PC - address_space &space = *m_memory->space(AS_PROGRAM); + address_space &space = m_memory->space(AS_PROGRAM); offs_t pcbyte = space.address_to_byte(pc) & space.bytemask(); // fetch the bytes up to the maximum diff --git a/src/emu/debug/debugcpu.h b/src/emu/debug/debugcpu.h index 86d0106d7ad..1805b8101d4 100644 --- a/src/emu/debug/debugcpu.h +++ b/src/emu/debug/debugcpu.h @@ -146,7 +146,7 @@ public: // commonly-used pass-throughs offs_t pc() const { return (m_state != NULL) ? m_state->pc() : 0; } - int logaddrchars(address_spacenum spacenum = AS_0) const { return (m_memory != NULL && m_memory->space(spacenum) != NULL) ? m_memory->space(spacenum)->logaddrchars() : 8; } + int logaddrchars(address_spacenum spacenum = AS_0) const { return (m_memory != NULL && m_memory->has_space(spacenum)) ? m_memory->space(spacenum).logaddrchars() : 8; } int min_opcode_bytes() const { return (m_disasm != NULL) ? m_disasm->max_opcode_bytes() : 1; } int max_opcode_bytes() const { return (m_disasm != NULL) ? m_disasm->max_opcode_bytes() : 1; } diff --git a/src/emu/debug/dvdisasm.c b/src/emu/debug/dvdisasm.c index 96820a82eb9..735a85d98be 100644 --- a/src/emu/debug/dvdisasm.c +++ b/src/emu/debug/dvdisasm.c @@ -56,7 +56,7 @@ debug_view_disasm_source::debug_view_disasm_source(const char *name, device_t &d : debug_view_source(name, &device), m_device(device), m_disasmintf(dynamic_cast<device_disasm_interface *>(&device)), - m_space(dynamic_cast<device_memory_interface *>(&device)->space(AS_PROGRAM)) + m_space(device.memory().space(AS_PROGRAM)) { } @@ -202,7 +202,7 @@ void debug_view_disasm::view_char(int chval) case DCH_HOME: // set the active column to the PC { const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); - offs_t pc = source.m_space->address_to_byte(source.m_device.safe_pc()) & source.m_space->logbytemask(); + offs_t pc = source.m_space.address_to_byte(source.m_device.safe_pc()) & source.m_space.logbytemask(); // figure out which row the pc is on for (int curline = 0; curline < m_allocated.y; curline++) @@ -241,9 +241,9 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); // compute the increment - int minlen = source.m_space->byte_to_address(source.m_disasmintf->min_opcode_bytes()); + int minlen = source.m_space.byte_to_address(source.m_disasmintf->min_opcode_bytes()); if (minlen == 0) minlen = 1; - int maxlen = source.m_space->byte_to_address(source.m_disasmintf->max_opcode_bytes()); + int maxlen = source.m_space.byte_to_address(source.m_disasmintf->max_opcode_bytes()); if (maxlen == 0) maxlen = 1; // start off numinstrs back @@ -252,19 +252,19 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) curpc = 0; /* loop until we find what we are looking for */ - offs_t targetpcbyte = source.m_space->address_to_byte(targetpc) & source.m_space->logbytemask(); + offs_t targetpcbyte = source.m_space.address_to_byte(targetpc) & source.m_space.logbytemask(); offs_t fillpcbyte = targetpcbyte; offs_t lastgoodpc = targetpc; while (1) { // fill the buffer up to the target - offs_t curpcbyte = source.m_space->address_to_byte(curpc) & source.m_space->logbytemask(); + offs_t curpcbyte = source.m_space.address_to_byte(curpc) & source.m_space.logbytemask(); UINT8 opbuf[1024], argbuf[1024]; while (curpcbyte < fillpcbyte) { fillpcbyte--; - opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(*source.m_space, fillpcbyte, 1, FALSE); - argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(*source.m_space, fillpcbyte, 1, TRUE); + opbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1, FALSE); + argbuf[1000 + fillpcbyte - targetpcbyte] = debug_read_opcode(source.m_space, fillpcbyte, 1, TRUE); } // loop until we get past the target instruction @@ -273,12 +273,12 @@ offs_t debug_view_disasm::find_pc_backwards(offs_t targetpc, int numinstrs) offs_t scanpc; for (scanpc = curpc; scanpc < targetpc; scanpc += instlen) { - offs_t scanpcbyte = source.m_space->address_to_byte(scanpc) & source.m_space->logbytemask(); + offs_t scanpcbyte = source.m_space.address_to_byte(scanpc) & source.m_space.logbytemask(); offs_t physpcbyte = scanpcbyte; // get the disassembly, but only if mapped instlen = 1; - if (debug_cpu_translate(*source.m_space, TRANSLATE_FETCH, &physpcbyte)) + if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH, &physpcbyte)) { char dasmbuffer[100]; instlen = source.m_device.debug()->disassemble(dasmbuffer, scanpc, &opbuf[1000 + scanpcbyte - targetpcbyte], &argbuf[1000 + scanpcbyte - targetpcbyte]) & DASMFLAG_LENGTHMASK; @@ -322,12 +322,12 @@ void debug_view_disasm::generate_bytes(offs_t pcbyte, int numbytes, int minbytes // output the first value int offset = 0; if (maxchars >= char_num * minbytes) - offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(*source.m_space, pcbyte, minbytes, FALSE), minbytes * char_num, source.is_octal())); + offset = sprintf(string, "%s", core_i64_format(debug_read_opcode(source.m_space, pcbyte, minbytes, FALSE), minbytes * char_num, source.is_octal())); // output subsequent values int byte; for (byte = minbytes; byte < numbytes && offset + 1 + char_num * minbytes < maxchars; byte += minbytes) - offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(*source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * char_num, source.is_octal())); + offset += sprintf(&string[offset], " %s", core_i64_format(debug_read_opcode(source.m_space, pcbyte + byte, minbytes, encrypted), minbytes * char_num, source.is_octal())); // if we ran out of room, indicate more string[maxchars - 1] = 0; @@ -348,7 +348,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) int char_num = source.is_octal() ? 3 : 2; // determine how many characters we need for an address and set the divider - m_divider1 = 1 + (source.m_space->logaddrchars()/2*char_num) + 1; + m_divider1 = 1 + (source.m_space.logaddrchars()/2*char_num) + 1; // assume a fixed number of characters for the disassembly m_divider2 = m_divider1 + 1 + m_dasm_width + 1; @@ -358,7 +358,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) int maxbytes = source.m_disasmintf->max_opcode_bytes(); // ensure that the PC is aligned to the minimum opcode size - pc &= ~source.m_space->byte_to_address_end(minbytes - 1); + pc &= ~source.m_space.byte_to_address_end(minbytes - 1); // set the width of the third column according to display mode if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED) @@ -390,7 +390,7 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) for (int line = 0; line < lines; line++) { // convert PC to a byte offset - offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask(); + offs_t pcbyte = source.m_space.address_to_byte(pc) & source.m_space.logbytemask(); // save a copy of the previous line as a backup if we're only doing one line int instr = startline + line; @@ -401,25 +401,25 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) // convert back and set the address of this instruction m_byteaddress[instr] = pcbyte; - sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space->byte_to_address(pcbyte), source.m_space->logaddrchars()/2*char_num, source.is_octal())); + sprintf(&destbuf[0], " %s ", core_i64_format(source.m_space.byte_to_address(pcbyte), source.m_space.logaddrchars()/2*char_num, source.is_octal())); // make sure we can translate the address, and then disassemble the result char buffer[100]; int numbytes = 0; offs_t physpcbyte = pcbyte; - if (debug_cpu_translate(*source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte)) + if (debug_cpu_translate(source.m_space, TRANSLATE_FETCH_DEBUG, &physpcbyte)) { UINT8 opbuf[64], argbuf[64]; // fetch the bytes up to the maximum for (numbytes = 0; numbytes < maxbytes; numbytes++) { - opbuf[numbytes] = debug_read_opcode(*source.m_space, pcbyte + numbytes, 1, FALSE); - argbuf[numbytes] = debug_read_opcode(*source.m_space, pcbyte + numbytes, 1, TRUE); + opbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1, FALSE); + argbuf[numbytes] = debug_read_opcode(source.m_space, pcbyte + numbytes, 1, TRUE); } // disassemble the result - pc += numbytes = source.m_device.debug()->disassemble(buffer, pc & source.m_space->logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK; + pc += numbytes = source.m_device.debug()->disassemble(buffer, pc & source.m_space.logaddrmask(), opbuf, argbuf) & DASMFLAG_LENGTHMASK; } else strcpy(buffer, "<unmapped>"); @@ -431,13 +431,13 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) if (m_right_column == DASM_RIGHTCOL_RAW || m_right_column == DASM_RIGHTCOL_ENCRYPTED) { // get the bytes - numbytes = source.m_space->address_to_byte(numbytes) & source.m_space->logbytemask(); + numbytes = source.m_space.address_to_byte(numbytes) & source.m_space.logbytemask(); generate_bytes(pcbyte, numbytes, minbytes, &destbuf[m_divider2], m_allocated.x - m_divider2, m_right_column == DASM_RIGHTCOL_ENCRYPTED); } else if (m_right_column == DASM_RIGHTCOL_COMMENTS) { // get and add the comment, if present - offs_t comment_address = source.m_space->byte_to_address(m_byteaddress[instr]); + offs_t comment_address = source.m_space.byte_to_address(m_byteaddress[instr]); const char *text = source.m_device.debug()->comment_text(comment_address); if (text != NULL) sprintf(&destbuf[m_divider2], "// %.*s", m_allocated.x - m_divider2 - 1, text); @@ -449,8 +449,8 @@ bool debug_view_disasm::recompute(offs_t pc, int startline, int lines) } // update opcode base information - m_last_direct_decrypted = source.m_space->direct().decrypted(); - m_last_direct_raw = source.m_space->direct().raw(); + m_last_direct_decrypted = source.m_space.direct().decrypted(); + m_last_direct_raw = source.m_space.direct().raw(); m_last_change_count = source.m_device.debug()->comment_change_count(); // now longer need to recompute @@ -469,7 +469,7 @@ void debug_view_disasm::view_update() const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); offs_t pc = source.m_device.safe_pc(); - offs_t pcbyte = source.m_space->address_to_byte(pc) & source.m_space->logbytemask(); + offs_t pcbyte = source.m_space.address_to_byte(pc) & source.m_space.logbytemask(); // update our context; if the expression is dirty, recompute if (m_expression.dirty()) @@ -480,7 +480,7 @@ void debug_view_disasm::view_update() UINT64 result = m_expression.value(); if (result != previous) { - offs_t resultbyte = source.m_space->address_to_byte(result) & source.m_space->logbytemask(); + offs_t resultbyte = source.m_space.address_to_byte(result) & source.m_space.logbytemask(); // see if the new result is an address we already have UINT32 row; @@ -498,7 +498,7 @@ void debug_view_disasm::view_update() } // if the opcode base has changed, rework things - if (source.m_space->direct().decrypted() != m_last_direct_decrypted || source.m_space->direct().raw() != m_last_direct_raw) + if (source.m_space.direct().decrypted() != m_last_direct_decrypted || source.m_space.direct().raw() != m_last_direct_raw) m_recompute = true; // if the comments have changed, redo it @@ -517,7 +517,7 @@ recompute: m_topleft.x = 0; // recompute from where we last recomputed! - recompute(source.m_space->byte_to_address(m_byteaddress[0]), 0, m_total.y); + recompute(source.m_space.byte_to_address(m_byteaddress[0]), 0, m_total.y); } else { @@ -579,7 +579,7 @@ recompute: else { for (device_debug::breakpoint *bp = source.m_device.debug()->breakpoint_first(); bp != NULL; bp = bp->next()) - if (m_byteaddress[effrow] == (source.m_space->address_to_byte(bp->address()) & source.m_space->logbytemask())) + if (m_byteaddress[effrow] == (source.m_space.address_to_byte(bp->address()) & source.m_space.logbytemask())) attrib = DCA_CHANGED; } @@ -627,7 +627,7 @@ recompute: offs_t debug_view_disasm::selected_address() { flush_updates(); - return downcast<const debug_view_disasm_source &>(*m_source).m_space->byte_to_address(m_byteaddress[m_cursor.y]); + return downcast<const debug_view_disasm_source &>(*m_source).m_space.byte_to_address(m_byteaddress[m_cursor.y]); } @@ -695,7 +695,7 @@ void debug_view_disasm::set_disasm_width(UINT32 width) void debug_view_disasm::set_selected_address(offs_t address) { const debug_view_disasm_source &source = downcast<const debug_view_disasm_source &>(*m_source); - offs_t byteaddress = source.m_space->address_to_byte(address) & source.m_space->logbytemask(); + offs_t byteaddress = source.m_space.address_to_byte(address) & source.m_space.logbytemask(); for (int line = 0; line < m_total.y; line++) if (m_byteaddress[line] == byteaddress) { diff --git a/src/emu/debug/dvdisasm.h b/src/emu/debug/dvdisasm.h index a1cd81b008b..f7caac74c66 100644 --- a/src/emu/debug/dvdisasm.h +++ b/src/emu/debug/dvdisasm.h @@ -73,13 +73,13 @@ class debug_view_disasm_source : public debug_view_source public: // getters device_t &device() const { return m_device; } - address_space *space() const { return m_space; } + address_space &space() const { return m_space; } private: // internal state device_t & m_device; // underlying device device_disasm_interface *m_disasmintf; // disassembly interface - address_space * m_space; // address space to display + address_space & m_space; // address space to display }; diff --git a/src/emu/debug/dvmemory.c b/src/emu/debug/dvmemory.c index a8ebc452702..06c788c671a 100644 --- a/src/emu/debug/dvmemory.c +++ b/src/emu/debug/dvmemory.c @@ -154,15 +154,14 @@ void debug_view_memory::enumerate_sources() // first add all the devices' address spaces memory_interface_iterator iter(machine().root_device()); for (device_memory_interface *memintf = iter.first(); memintf != NULL; memintf = iter.next()) - for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++) - { - address_space *space = memintf->space(spacenum); - if (space != NULL) - { - name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space->name()); - m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, *space))); - } - } + if (&memintf->device() != &machine().root_device()) + for (address_spacenum spacenum = AS_0; spacenum < ADDRESS_SPACES; spacenum++) + if (memintf->has_space(spacenum)) + { + address_space &space = memintf->space(spacenum); + name.printf("%s '%s' %s space memory", memintf->device().name(), memintf->device().tag(), space.name()); + m_source_list.append(*auto_alloc(machine(), debug_view_memory_source(name, space))); + } // then add all the memory regions for (memory_region *region = machine().memory().first_region(); region != NULL; region = region->next()) diff --git a/src/emu/devcb.c b/src/emu/devcb.c index 64268282245..b1f3c5b0dbe 100644 --- a/src/emu/devcb.c +++ b/src/emu/devcb.c @@ -144,11 +144,9 @@ address_space &devcb_resolver::resolve_space(int index, const char *tag, device_ throw emu_fatalerror("Device '%s' (requested by %s '%s') has no memory interface", tag, current.name(), current.tag()); // set the real target and function, then prime a delegate - address_space *result = memory->space(index); - if (result == NULL) + if (!memory->has_space(index)) throw emu_fatalerror("Unable to find device '%s' space %d (requested by %s '%s')", tag, index, current.name(), current.tag()); - - return *result; + return memory->space(index); } diff --git a/src/emu/device.h b/src/emu/device.h index d18ab58fa91..b0c1c8658e9 100644 --- a/src/emu/device.h +++ b/src/emu/device.h @@ -984,8 +984,12 @@ inline device_t *device_t::siblingdevice(const char *tag) const // leading caret implies the owner, just skip it if (tag[0] == '^') tag++; - // query relative to the parent - return (m_owner != NULL) ? m_owner->subdevice(tag) : NULL; + // query relative to the parent, if we have one + if (m_owner != NULL) + return m_owner->subdevice(tag); + + // otherwise, it's NULL unless the tag is absolute + return (tag[0] == ':') ? subdevice(tag) : NULL; } diff --git a/src/emu/dimemory.h b/src/emu/dimemory.h index fa1df6c8382..9fd75532a07 100644 --- a/src/emu/dimemory.h +++ b/src/emu/dimemory.h @@ -109,8 +109,10 @@ public: static void static_set_addrmap(device_t &device, address_spacenum spacenum, address_map_constructor map); // basic information getters - address_space *space(int index = 0) const { return m_addrspace[index]; } - address_space *space(address_spacenum index) const { return m_addrspace[static_cast<int>(index)]; } + bool has_space(int index = 0) const { return (m_addrspace[index] != NULL); } + bool has_space(address_spacenum index) const { return (m_addrspace[int(index)] != NULL); } + address_space &space(int index = 0) const { assert(m_addrspace[index] != NULL); return *m_addrspace[index]; } + address_space &space(address_spacenum index) const { assert(m_addrspace[int(index)] != NULL); return *m_addrspace[int(index)]; } // address space accessors void set_address_space(address_spacenum spacenum, address_space &space); diff --git a/src/emu/driver.c b/src/emu/driver.c index 3798b24c830..618c37aeb94 100644 --- a/src/emu/driver.c +++ b/src/emu/driver.c @@ -42,6 +42,17 @@ //************************************************************************** +// ADDRESS_MAPS +//************************************************************************** + +// default address map +static ADDRESS_MAP_START( generic, AS_0, 8, driver_device ) + AM_RANGE(0x00000000, 0xffffffff) AM_DEVREADWRITE(":", driver_device, fatal_generic_read, fatal_generic_write) +ADDRESS_MAP_END + + + +//************************************************************************** // DRIVER DEVICE //************************************************************************** @@ -51,12 +62,14 @@ driver_device::driver_device(const machine_config &mconfig, device_type type, const char *tag) : device_t(mconfig, type, "Driver Device", tag, NULL, 0), + device_memory_interface(mconfig, *this), m_generic_paletteram_8(*this, "paletteram"), m_generic_paletteram2_8(*this, "paletteram2"), m_generic_paletteram_16(*this, "paletteram"), m_generic_paletteram2_16(*this, "paletteram2"), m_generic_paletteram_32(*this, "paletteram"), m_generic_paletteram2_32(*this, "paletteram2"), + m_space_config("generic", ENDIANNESS_LITTLE, 8, 32, 0, NULL, *ADDRESS_MAP_NAME(generic)), m_system(NULL), m_latch_clear_value(0), m_flip_screen_x(0), @@ -313,6 +326,18 @@ void driver_device::device_reset_after_children() } +//------------------------------------------------- +// memory_space_config - return a description of +// any address spaces owned by this device +//------------------------------------------------- + +const address_space_config *driver_device::memory_space_config(address_spacenum spacenum) const +{ + return (spacenum == 0) ? &m_space_config : NULL; +} + + + //************************************************************************** // INTERRUPT ENABLE AND VECTOR HELPERS //************************************************************************** @@ -737,3 +762,25 @@ WRITE16_MEMBER( driver_device::paletteram_RRRRGGGGBBBBRGBx_word_w ) // 8-8-8 RGB palette write handlers WRITE16_MEMBER( driver_device::paletteram_xrgb_word_be_w ) { palette_32bit_word_be_w<8,8,8, 16,8,0>(space, offset, data, mem_mask); } WRITE16_MEMBER( driver_device::paletteram_xbgr_word_be_w ) { palette_32bit_word_be_w<8,8,8, 0,8,16>(space, offset, data, mem_mask); } + + + +//************************************************************************** +// MISC READ/WRITE HANDLERS +//************************************************************************** + +//------------------------------------------------- +// generic space fatal error handlers +//------------------------------------------------- + +READ8_MEMBER( driver_device::fatal_generic_read ) +{ + throw emu_fatalerror("Attempted to read from generic address space (offs %X)\n", offset); +} + +WRITE8_MEMBER( driver_device::fatal_generic_write ) +{ + throw emu_fatalerror("Attempted to write to generic address space (offs %X = %02X)\n", offset, data); +} + + diff --git a/src/emu/driver.h b/src/emu/driver.h index 61d5352642b..df2e9854c60 100644 --- a/src/emu/driver.h +++ b/src/emu/driver.h @@ -166,7 +166,8 @@ typedef void (*legacy_callback_func)(running_machine &machine); // ======================> driver_device // base class for machine driver-specific devices -class driver_device : public device_t +class driver_device : public device_t, + public device_memory_interface { public: // construction/destruction @@ -205,7 +206,7 @@ public: void init_0() { } // memory helpers - address_space &generic_space() const { return *machine().memory().first_space(); } + address_space &generic_space() const { return space(AS_PROGRAM); } // generic interrupt generators void generic_pulse_irq_line(device_execute_interface &exec, int irqline, int cycles); @@ -380,9 +381,12 @@ public: DECLARE_WRITE16_MEMBER( paletteram_xbgr_word_be_w ); // generic input port helpers - // custom handler DECLARE_CUSTOM_INPUT_MEMBER( custom_port_read ); + // general fatal error handlers + DECLARE_READ8_MEMBER( fatal_generic_read ); + DECLARE_WRITE8_MEMBER( fatal_generic_write ); + protected: // helpers called at startup virtual void driver_start(); @@ -403,6 +407,9 @@ protected: virtual void device_start(); virtual void device_reset_after_children(); + // device_memory_interface overrides + virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const; + // internal helpers inline UINT16 paletteram16_le(offs_t offset) const { return m_generic_paletteram_8[offset & ~1] | (m_generic_paletteram_8[offset | 1] << 8); } inline UINT16 paletteram16_be(offs_t offset) const { return m_generic_paletteram_8[offset | 1] | (m_generic_paletteram_8[offset & ~1] << 8); } @@ -424,6 +431,9 @@ private: void soundlatch_sync_callback(void *ptr, INT32 param); void updateflip(); + // configuration state + const address_space_config m_space_config; + // internal state const game_driver * m_system; // pointer to the game driver driver_callback_delegate m_callbacks[CB_COUNT]; // start/reset callbacks diff --git a/src/emu/drivers/testcpu.c b/src/emu/drivers/testcpu.c index eb70134cb98..08e141f2ffc 100644 --- a/src/emu/drivers/testcpu.c +++ b/src/emu/drivers/testcpu.c @@ -123,7 +123,7 @@ public: virtual void machine_start() { // find the CPU's address space - m_space = m_cpu->space(AS_PROGRAM); + m_space = &m_cpu->space(AS_PROGRAM); // configure DRC in the most compatible mode ppcdrc_set_options(m_cpu, PPCDRC_COMPATIBLE_OPTIONS); diff --git a/src/emu/machine.c b/src/emu/machine.c index b3cda2d0fdc..5db01476ce2 100644 --- a/src/emu/machine.c +++ b/src/emu/machine.c @@ -224,7 +224,7 @@ const char *running_machine::describe_context() { cpu_device *cpu = downcast<cpu_device *>(&executing->device()); if (cpu != NULL) - m_context.printf("'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM)->logaddrchars(), cpu->is_octal())); + m_context.printf("'%s' (%s)", cpu->tag(), core_i64_format(cpu->pc(), cpu->space(AS_PROGRAM).logaddrchars(), cpu->is_octal())); } else m_context.cpy("(no context)"); diff --git a/src/emu/machine/6821pia.h b/src/emu/machine/6821pia.h index 4cb7099dc83..0fee70c6889 100644 --- a/src/emu/machine/6821pia.h +++ b/src/emu/machine/6821pia.h @@ -94,9 +94,9 @@ public: void set_port_a_z_mask(UINT8 data) { m_port_a_z_mask = data; }// see second note in .c DECLARE_READ8_MEMBER( porta_r ); - UINT8 porta_r() { return porta_r(*machine().memory().first_space(), 0); } + UINT8 porta_r() { return porta_r(machine().driver_data()->generic_space(), 0); } DECLARE_WRITE8_MEMBER( porta_w ); - void porta_w(UINT8 data) { porta_w(*machine().memory().first_space(), 0, data); } + void porta_w(UINT8 data) { porta_w(machine().driver_data()->generic_space(), 0, data); } void set_a_input(UINT8 data, UINT8 z_mask); UINT8 a_output(); @@ -109,9 +109,9 @@ public: int ca2_output_z(); DECLARE_READ8_MEMBER( portb_r ); - UINT8 portb_r() { return portb_r(*machine().memory().first_space(), 0); } + UINT8 portb_r() { return portb_r(machine().driver_data()->generic_space(), 0); } DECLARE_WRITE8_MEMBER( portb_w ); - void portb_w(UINT8 data) { portb_w(*machine().memory().first_space(), 0, data); } + void portb_w(UINT8 data) { portb_w(machine().driver_data()->generic_space(), 0, data); } UINT8 b_output(); DECLARE_READ_LINE_MEMBER( cb1_r ); diff --git a/src/emu/machine/6840ptm.h b/src/emu/machine/6840ptm.h index ea10790e98e..ff714a62465 100644 --- a/src/emu/machine/6840ptm.h +++ b/src/emu/machine/6840ptm.h @@ -61,9 +61,9 @@ public: int ext_clock(int counter) const { return m_external_clock[counter]; } // get clock frequency DECLARE_WRITE8_MEMBER( write ); - void write(offs_t offset, UINT8 data) { write(*machine().memory().first_space(), offset, data); } + void write(offs_t offset, UINT8 data) { write(machine().driver_data()->generic_space(), offset, data); } DECLARE_READ8_MEMBER( read ); - UINT8 read(offs_t offset) { return read(*machine().memory().first_space(), offset); } + UINT8 read(offs_t offset) { return read(machine().driver_data()->generic_space(), offset); } void set_gate(int idx, int state); DECLARE_WRITE_LINE_MEMBER( set_g1 ); diff --git a/src/emu/machine/amigafdc.c b/src/emu/machine/amigafdc.c index 21dcca3f916..84451aff234 100644 --- a/src/emu/machine/amigafdc.c +++ b/src/emu/machine/amigafdc.c @@ -96,7 +96,7 @@ void amiga_fdc::device_reset() void amiga_fdc::dma_done() { dma_state = DMA_IDLE; - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKBLK, 0xffff); } @@ -233,7 +233,7 @@ void amiga_fdc::live_run(attotime limit) cur_live.bit_counter = 0; } dskbyt |= 0x1000; - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); amiga_custom_w(space, REG_INTREQ, 0x8000 | INTENA_DSKSYN, 0xffff); } else dskbyt &= ~0x1000; diff --git a/src/emu/machine/i8155.c b/src/emu/machine/i8155.c index 5f7a230b3f6..98d62844dd3 100644 --- a/src/emu/machine/i8155.c +++ b/src/emu/machine/i8155.c @@ -538,7 +538,7 @@ WRITE8_MEMBER( i8155_device::io_w ) READ8_MEMBER( i8155_device::memory_r ) { - return this->space()->read_byte(offset); + return this->space().read_byte(offset); } @@ -548,7 +548,7 @@ READ8_MEMBER( i8155_device::memory_r ) WRITE8_MEMBER( i8155_device::memory_w ) { - this->space()->write_byte(offset, data); + this->space().write_byte(offset, data); } diff --git a/src/emu/machine/i8355.c b/src/emu/machine/i8355.c index 5b28fd76bf8..946be0de39a 100644 --- a/src/emu/machine/i8355.c +++ b/src/emu/machine/i8355.c @@ -227,5 +227,5 @@ WRITE8_MEMBER( i8355_device::io_w ) READ8_MEMBER( i8355_device::memory_r ) { - return this->space()->read_byte(offset); + return this->space().read_byte(offset); } diff --git a/src/emu/machine/idectrl.c b/src/emu/machine/idectrl.c index 03f0dde9d70..45e9b83ddf8 100644 --- a/src/emu/machine/idectrl.c +++ b/src/emu/machine/idectrl.c @@ -1859,9 +1859,7 @@ static DEVICE_START( ide_controller ) device_memory_interface *memory; if (!bmtarget->interface(memory)) throw emu_fatalerror("IDE controller '%s' bus master target '%s' has no memory!", device->tag(), config->bmcpu); - ide->dma_space = memory->space(config->bmspace); - if (ide->dma_space == NULL) - throw emu_fatalerror("IDE controller '%s' bus master target '%s' does not have specified space %d!", device->tag(), config->bmcpu, config->bmspace); + ide->dma_space = &memory->space(config->bmspace); ide->dma_address_xor = (ide->dma_space->endianness() == ENDIANNESS_LITTLE) ? 0 : 3; } diff --git a/src/emu/machine/microtch.c b/src/emu/machine/microtch.c index 7315cdbd7fe..37453b56b5b 100644 --- a/src/emu/machine/microtch.c +++ b/src/emu/machine/microtch.c @@ -343,5 +343,5 @@ void microtouch_serial_device::tra_complete() void microtouch_serial_device::rcv_complete() { receive_register_extract(); - microtouch_device::rx(*machine().memory().first_space(), 0, get_received_char()); + microtouch_device::rx(machine().driver_data()->generic_space(), 0, get_received_char()); } diff --git a/src/emu/machine/s3c2400.c b/src/emu/machine/s3c2400.c index 6b222481689..01359553535 100644 --- a/src/emu/machine/s3c2400.c +++ b/src/emu/machine/s3c2400.c @@ -38,7 +38,7 @@ UINT32 s3c2400_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap DEVICE_START( s3c2400 ) { - address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); DEVICE_START_CALL(s3c24xx); space.install_legacy_readwrite_handler( *device, 0x14000000, 0x1400003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w)); space.install_legacy_readwrite_handler( *device, 0x14200000, 0x1420005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w)); diff --git a/src/emu/machine/s3c2410.c b/src/emu/machine/s3c2410.c index be7895d919d..cb404c03853 100644 --- a/src/emu/machine/s3c2410.c +++ b/src/emu/machine/s3c2410.c @@ -38,7 +38,7 @@ UINT32 s3c2410_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap DEVICE_START( s3c2410 ) { - address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); DEVICE_START_CALL(s3c24xx); space.install_legacy_readwrite_handler( *device, 0x48000000, 0x4800003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w)); space.install_legacy_readwrite_handler( *device, 0x49000000, 0x4900005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w)); diff --git a/src/emu/machine/s3c2440.c b/src/emu/machine/s3c2440.c index 9539931ae6a..c5bf9408255 100644 --- a/src/emu/machine/s3c2440.c +++ b/src/emu/machine/s3c2440.c @@ -38,7 +38,7 @@ UINT32 s3c2440_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap DEVICE_START( s3c2440 ) { - address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); space.install_legacy_readwrite_handler( *device, 0x48000000, 0x4800003b, FUNC(s3c24xx_memcon_r), FUNC(s3c24xx_memcon_w)); space.install_legacy_readwrite_handler( *device, 0x49000000, 0x4900005b, FUNC(s3c24xx_usb_host_r), FUNC(s3c24xx_usb_host_w)); space.install_legacy_readwrite_handler( *device, 0x4a000000, 0x4a00001f, FUNC(s3c24xx_irq_r), FUNC(s3c24xx_irq_w)); diff --git a/src/emu/machine/s3c24xx.c b/src/emu/machine/s3c24xx.c index 12f4931dc33..bb09f9c7867 100644 --- a/src/emu/machine/s3c24xx.c +++ b/src/emu/machine/s3c24xx.c @@ -301,7 +301,7 @@ static void s3c24xx_lcd_dma_init( device_t *device) static UINT32 s3c24xx_lcd_dma_read( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - address_space& space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space& space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); UINT8 *vram, data[4]; vram = (UINT8 *)space.get_read_ptr( s3c24xx->lcd.vramaddr_cur); for (int i = 0; i < 2; i++) @@ -345,7 +345,7 @@ static UINT32 s3c24xx_lcd_dma_read( device_t *device) static UINT32 s3c24xx_lcd_dma_read( device_t *device) { s3c24xx_t *s3c24xx = get_token( device); - address_space& space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space& space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); UINT8 *vram, data[4]; vram = (UINT8 *)space.get_read_ptr( s3c24xx->lcd.vramaddr_cur); for (int i = 0; i < 2; i++) @@ -1611,7 +1611,7 @@ static void s3c24xx_dma_trigger( device_t *device, int ch) s3c24xx_t *s3c24xx = get_token( device); s3c24xx_dma_regs_t *regs = &s3c24xx->dma[ch].regs; UINT32 curr_tc, curr_src, curr_dst; - address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); int dsz, inc_src, inc_dst, servmode, tsz; const UINT32 ch_int[] = { S3C24XX_INT_DMA0, S3C24XX_INT_DMA1, S3C24XX_INT_DMA2, S3C24XX_INT_DMA3}; verboselog( device->machine(), 5, "DMA %d trigger\n", ch); @@ -3701,7 +3701,7 @@ static DEVICE_START( s3c24xx ) int om1 = iface_core_pin_r( device, S3C24XX_CORE_PIN_OM1); if ((om0 == 0) && (om1 == 0)) { - address_space &space = *device->machine().device( "maincpu")->memory().space( AS_PROGRAM); + address_space &space = device->machine().device( "maincpu")->memory().space( AS_PROGRAM); space.install_ram( 0x00000000, 0x00000fff, s3c24xx->steppingstone); space.install_ram( 0x40000000, 0x40000fff, s3c24xx->steppingstone); } diff --git a/src/emu/sound/bsmt2000.c b/src/emu/sound/bsmt2000.c index 6884d5a17d5..d6a0b48350f 100644 --- a/src/emu/sound/bsmt2000.c +++ b/src/emu/sound/bsmt2000.c @@ -171,7 +171,7 @@ void bsmt2000_device::device_start() m_cpu = subdevice<tms32015_device>("bsmt2000"); // find our direct access - m_direct = &space()->direct(); + m_direct = &space().direct(); // create the stream; BSMT typically runs at 24MHz and writes to a DAC, so // in theory we should generate a 24MHz stream, but that's certainly overkill diff --git a/src/emu/sound/c352.c b/src/emu/sound/c352.c index fb7f3498a71..28090a0dcaa 100644 --- a/src/emu/sound/c352.c +++ b/src/emu/sound/c352.c @@ -461,7 +461,7 @@ void c352_device::device_start() double u = 10.0; // find our direct access - m_direct = &space()->direct(); + m_direct = &space().direct(); m_sample_rate_base = clock() / 288; diff --git a/src/emu/sound/cdp1869.c b/src/emu/sound/cdp1869.c index 5bc32ba542a..c1915687f45 100644 --- a/src/emu/sound/cdp1869.c +++ b/src/emu/sound/cdp1869.c @@ -87,7 +87,7 @@ inline bool cdp1869_device::is_ntsc() inline UINT8 cdp1869_device::read_page_ram_byte(offs_t pma) { - return space()->read_byte(pma); + return space().read_byte(pma); } @@ -98,7 +98,7 @@ inline UINT8 cdp1869_device::read_page_ram_byte(offs_t pma) inline void cdp1869_device::write_page_ram_byte(offs_t pma, UINT8 data) { - space()->write_byte(pma, data); + space().write_byte(pma, data); } diff --git a/src/emu/sound/disc_inp.c b/src/emu/sound/disc_inp.c index e07f4bfbbdf..7f7cba46ed5 100644 --- a/src/emu/sound/disc_inp.c +++ b/src/emu/sound/disc_inp.c @@ -23,14 +23,14 @@ READ8_DEVICE_HANDLER(discrete_sound_r) { discrete_device *disc_device = downcast<discrete_device *>(device); - return disc_device->read( *disc_device->machine().firstcpu->space(), offset, 0xff); + return disc_device->read( disc_device->machine().firstcpu->space(), offset, 0xff); } WRITE8_DEVICE_HANDLER(discrete_sound_w) { discrete_device *disc_device = downcast<discrete_device *>(device); - disc_device->write(*disc_device->machine().firstcpu->space(), offset, data, 0xff); + disc_device->write(disc_device->machine().firstcpu->space(), offset, data, 0xff); } /************************************************************************ diff --git a/src/emu/sound/es5503.c b/src/emu/sound/es5503.c index 587bbe79063..1296ff5ba36 100644 --- a/src/emu/sound/es5503.c +++ b/src/emu/sound/es5503.c @@ -248,7 +248,7 @@ void es5503_device::device_start() int osc; // find our direct access - m_direct = &space()->direct(); + m_direct = &space().direct(); rege0 = 0xff; diff --git a/src/emu/sound/mos6560.c b/src/emu/sound/mos6560.c index 141930fc98b..92a2fefd25f 100644 --- a/src/emu/sound/mos6560.c +++ b/src/emu/sound/mos6560.c @@ -155,14 +155,14 @@ static const rgb_t PALETTE[] = inline UINT8 mos6560_device::read_videoram(offs_t offset) { - m_last_data = space(AS_0)->read_byte(offset & 0x3fff); + m_last_data = space(AS_0).read_byte(offset & 0x3fff); return m_last_data; } inline UINT8 mos6560_device::read_colorram(offs_t offset) { - return space(AS_1)->read_byte(offset & 0x3ff); + return space(AS_1).read_byte(offset & 0x3ff); } /*------------------------------------------------- diff --git a/src/emu/sound/nes_apu.c b/src/emu/sound/nes_apu.c index 49586758a91..a5875faf521 100644 --- a/src/emu/sound/nes_apu.c +++ b/src/emu/sound/nes_apu.c @@ -703,7 +703,7 @@ static DEVICE_START( nesapu ) info->buffer_size+=info->samps_per_sync; /* Initialize individual chips */ - (info->APU.dpcm).memory = device->machine().device(intf->cpu_tag)->memory().space(AS_PROGRAM); + (info->APU.dpcm).memory = &device->machine().device(intf->cpu_tag)->memory().space(AS_PROGRAM); info->stream = device->machine().sound().stream_alloc(*device, 0, 1, rate, info, nes_psg_update_sound); diff --git a/src/emu/sound/okim6295.c b/src/emu/sound/okim6295.c index 6ab23e55857..21444b9ac2e 100644 --- a/src/emu/sound/okim6295.c +++ b/src/emu/sound/okim6295.c @@ -118,7 +118,7 @@ void okim6295_device::static_set_pin7(device_t &device, int pin7) void okim6295_device::device_start() { // find our direct access - m_direct = &space()->direct(); + m_direct = &space().direct(); // create the stream int divisor = m_pin7_state ? 132 : 165; @@ -220,7 +220,7 @@ void okim6295_device::set_bank_base(offs_t base, bool bDontUpdateStream) if (!m_bank_installed && base != 0) { // override our memory map with a bank - space()->install_read_bank(0x00000, 0x3ffff, tag()); + space().install_read_bank(0x00000, 0x3ffff, tag()); m_bank_installed = true; } diff --git a/src/emu/sound/okim9810.c b/src/emu/sound/okim9810.c index c67bd670031..928ee2687db 100644 --- a/src/emu/sound/okim9810.c +++ b/src/emu/sound/okim9810.c @@ -96,7 +96,7 @@ okim9810_device::okim9810_device(const machine_config &mconfig, const char *tag, void okim9810_device::device_start() { // find our direct access - m_direct = &space()->direct(); + m_direct = &space().direct(); // create the stream //int divisor = m_pin7 ? 132 : 165; diff --git a/src/emu/sound/qs1000.c b/src/emu/sound/qs1000.c index 49b473b5cb1..c2e90028129 100644 --- a/src/emu/sound/qs1000.c +++ b/src/emu/sound/qs1000.c @@ -222,7 +222,7 @@ machine_config_constructor qs1000_device::device_mconfig_additions() const void qs1000_device::device_start() { // Find our direct access - m_direct = &space()->direct(); + m_direct = &space().direct(); // The QS1000 operates at 24MHz. Creating a stream at that rate // would be overkill so we opt for a fraction of that rate which diff --git a/src/emu/video/315_5124.c b/src/emu/video/315_5124.c index 18dd71434d1..d7262749a6b 100644 --- a/src/emu/video/315_5124.c +++ b/src/emu/video/315_5124.c @@ -496,7 +496,7 @@ READ8_MEMBER( sega315_5124_device::vram_read ) if ( !space.debugger_access() ) { /* Load read buffer */ - m_buffer = this->space()->read_byte(m_addr & 0x3fff); + m_buffer = this->space().read_byte(m_addr & 0x3fff); /* Bump internal addthis->ress register */ m_addr += 1; @@ -543,7 +543,7 @@ WRITE8_MEMBER( sega315_5124_device::vram_write ) case 0x00: case 0x01: case 0x02: - this->space()->write_byte(m_addr & 0x3fff, data); + this->space().write_byte(m_addr & 0x3fff, data); break; case 0x03: @@ -582,7 +582,7 @@ WRITE8_MEMBER( sega315_5124_device::register_write ) switch (m_addrmode) { case 0: /* VRAM reading mode */ - m_buffer = this->space()->read_byte(m_addr & 0x3fff); + m_buffer = this->space().read_byte(m_addr & 0x3fff); m_addr += 1; break; @@ -691,7 +691,7 @@ void sega315_5124_device::draw_scanline_mode4( int *line_buffer, int *priority_s y_scroll = ((m_reg[0x00] & 0x80) && (tile_column > 23)) ? 0 : m_reg9copy; tile_line = ((tile_column + x_scroll_start_column) & 0x1f) * 2; - tile_data = space()->read_word(name_table_address + ((((line + y_scroll) % scroll_mod) >> 3) << 6) + tile_line); + tile_data = space().read_word(name_table_address + ((((line + y_scroll) % scroll_mod) >> 3) << 6) + tile_line); tile_selected = (tile_data & 0x01ff); priority_select = tile_data & PRIORITY_BIT; @@ -703,10 +703,10 @@ void sega315_5124_device::draw_scanline_mode4( int *line_buffer, int *priority_s if (vert_selected) tile_line = 0x07 - tile_line; - bit_plane_0 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x00); - bit_plane_1 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x01); - bit_plane_2 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x02); - bit_plane_3 = space()->read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x03); + bit_plane_0 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x00); + bit_plane_1 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x01); + bit_plane_2 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x02); + bit_plane_3 = space().read_byte(((tile_selected << 5) + ((tile_line & 0x07) << 2)) + 0x03); for (pixel_x = 0; pixel_x < 8 ; pixel_x++) { @@ -765,9 +765,9 @@ void sega315_5124_device::select_sprites( int pixel_plot_y, int line ) if (m_reg[0x01] & 0x01) /* Check if MAG is set */ m_sprite_height = m_sprite_height * 2; - for (sprite_index = 0; (sprite_index < 32 * 4) && (space()->read_byte( m_sprite_base + sprite_index ) != 0xd0) && (m_sprite_count < max_sprites + 1); sprite_index += 4) + for (sprite_index = 0; (sprite_index < 32 * 4) && (space().read_byte( m_sprite_base + sprite_index ) != 0xd0) && (m_sprite_count < max_sprites + 1); sprite_index += 4) { - int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1; + int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1; if (sprite_y > 240) { @@ -794,9 +794,9 @@ void sega315_5124_device::select_sprites( int pixel_plot_y, int line ) m_sprite_height = (m_reg[0x01] & 0x02) ? 16 : 8; m_sprite_zoom = (m_reg[0x01] & 0x01) ? 2 : 1; - for (sprite_index = 0; (sprite_index < 64) && (space()->read_byte(m_sprite_base + sprite_index ) != 0xd0 || m_y_pixels != 192) && (m_sprite_count < max_sprites + 1); sprite_index++) + for (sprite_index = 0; (sprite_index < 64) && (space().read_byte(m_sprite_base + sprite_index ) != 0xd0 || m_y_pixels != 192) && (m_sprite_count < max_sprites + 1); sprite_index++) { - int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */ + int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */ if (sprite_y > 240) { @@ -844,9 +844,9 @@ void sega315_5124_device::draw_sprites_mode4( int *line_buffer, int *priority_se for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--) { int sprite_index = m_selected_sprite[sprite_buffer_index]; - int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */ - int sprite_x = space()->read_byte( m_sprite_base + 0x80 + (sprite_index << 1) ); - int sprite_tile_selected = space()->read_byte( m_sprite_base + 0x81 + (sprite_index << 1) ); + int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1; /* sprite y position starts at line 1 */ + int sprite_x = space().read_byte( m_sprite_base + 0x80 + (sprite_index << 1) ); + int sprite_tile_selected = space().read_byte( m_sprite_base + 0x81 + (sprite_index << 1) ); if (sprite_y > 240) { @@ -875,10 +875,10 @@ void sega315_5124_device::draw_sprites_mode4( int *line_buffer, int *priority_se sprite_tile_selected += 1; } - UINT8 bit_plane_0 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x00); - UINT8 bit_plane_1 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x01); - UINT8 bit_plane_2 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x02); - UINT8 bit_plane_3 = space()->read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x03); + UINT8 bit_plane_0 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x00); + UINT8 bit_plane_1 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x01); + UINT8 bit_plane_2 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x02); + UINT8 bit_plane_3 = space().read_byte(((sprite_tile_selected << 5) + ((sprite_line & 0x07) << 2)) + 0x03); for (int pixel_x = 0; pixel_x < 8 ; pixel_x++) { @@ -1002,9 +1002,9 @@ void sega315_5124_device::draw_sprites_tms9918_mode( int *line_buffer, int pixel for (int sprite_buffer_index = m_sprite_count - 1; sprite_buffer_index >= 0; sprite_buffer_index--) { int sprite_index = m_selected_sprite[sprite_buffer_index]; - int sprite_y = space()->read_byte( m_sprite_base + sprite_index ) + 1; - int sprite_x = space()->read_byte( m_sprite_base + sprite_index + 1 ); - UINT8 flags = space()->read_byte( m_sprite_base + sprite_index + 3 ); + int sprite_y = space().read_byte( m_sprite_base + sprite_index ) + 1; + int sprite_x = space().read_byte( m_sprite_base + sprite_index + 1 ); + UINT8 flags = space().read_byte( m_sprite_base + sprite_index + 3 ); int pen_selected = m_palette_offset + ( flags & 0x0f ); if (sprite_y > 240) @@ -1013,7 +1013,7 @@ void sega315_5124_device::draw_sprites_tms9918_mode( int *line_buffer, int pixel if (flags & 0x80) sprite_x -= 32; - int sprite_tile_selected = space()->read_byte( m_sprite_base + sprite_index + 2 ); + int sprite_tile_selected = space().read_byte( m_sprite_base + sprite_index + 2 ); int sprite_line = line - sprite_y; if (m_reg[0x01] & 0x01) @@ -1030,7 +1030,7 @@ void sega315_5124_device::draw_sprites_tms9918_mode( int *line_buffer, int pixel } } - UINT8 pattern = space()->read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line ); + UINT8 pattern = space().read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line ); for (int pixel_x = 0; pixel_x < 8; pixel_x++) { @@ -1099,7 +1099,7 @@ void sega315_5124_device::draw_sprites_tms9918_mode( int *line_buffer, int pixel if (m_reg[0x01] & 0x02) { sprite_tile_selected += 2; - pattern = space()->read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line ); + pattern = space().read_byte( sprite_pattern_base + sprite_tile_selected * 8 + sprite_line ); sprite_x += (m_reg[0x01] & 0x01 ? 16 : 8); for (int pixel_x = 0; pixel_x < 8; pixel_x++) @@ -1191,12 +1191,12 @@ void sega315_5124_device::draw_scanline_mode2( int *line_buffer, int line ) for (tile_column = 0; tile_column < 32; tile_column++) { - UINT8 name = space()->read_byte( name_table_base + tile_column ); + UINT8 name = space().read_byte( name_table_base + tile_column ); UINT8 pattern; UINT8 colors; - pattern = space()->read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) ); - colors = space()->read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) ); + pattern = space().read_byte(pattern_base + (((pattern_offset + name) & pattern_mask) * 8) + (line & 0x07) ); + colors = space().read_byte(color_base + (((pattern_offset + name) & color_mask) * 8) + (line & 0x07) ); for (pixel_x = 0; pixel_x < 8; pixel_x++) { @@ -1237,12 +1237,12 @@ void sega315_5124_device::draw_scanline_mode0( int *line_buffer, int line ) for (tile_column = 0; tile_column < 32; tile_column++) { - UINT8 name = space()->read_byte( name_base + tile_column ); + UINT8 name = space().read_byte( name_base + tile_column ); UINT8 pattern; UINT8 colors; - pattern = space()->read_byte( pattern_base + (name * 8) + (line & 0x07) ); - colors = space()->read_byte( color_base + ( name >> 3 ) ); + pattern = space().read_byte( pattern_base + (name * 8) + (line & 0x07) ); + colors = space().read_byte( color_base + ( name >> 3 ) ); for (pixel_x = 0; pixel_x < 8; pixel_x++) { diff --git a/src/emu/video/crt9007.c b/src/emu/video/crt9007.c index 62a2f089df5..02195c56f38 100644 --- a/src/emu/video/crt9007.c +++ b/src/emu/video/crt9007.c @@ -231,7 +231,7 @@ ADDRESS_MAP_END inline UINT8 crt9007_device::readbyte(offs_t address) { - return space()->read_byte(address); + return space().read_byte(address); } diff --git a/src/emu/video/h63484.c b/src/emu/video/h63484.c index 1327162b9dd..4182c2fd988 100644 --- a/src/emu/video/h63484.c +++ b/src/emu/video/h63484.c @@ -365,7 +365,7 @@ const rom_entry *h63484_device::device_rom_region() const inline UINT8 h63484_device::readbyte(offs_t address) { - return space()->read_byte(address); + return space().read_byte(address); } @@ -375,7 +375,7 @@ inline UINT8 h63484_device::readbyte(offs_t address) inline void h63484_device::writebyte(offs_t address, UINT8 data) { - space()->write_byte(address, data); + space().write_byte(address, data); } diff --git a/src/emu/video/hd61830.c b/src/emu/video/hd61830.c index 1e67270a80e..59a82818607 100644 --- a/src/emu/video/hd61830.c +++ b/src/emu/video/hd61830.c @@ -82,7 +82,7 @@ ROM_END inline UINT8 hd61830_device::readbyte(offs_t address) { - return space()->read_byte(address); + return space().read_byte(address); } @@ -92,7 +92,7 @@ inline UINT8 hd61830_device::readbyte(offs_t address) inline void hd61830_device::writebyte(offs_t address, UINT8 data) { - space()->write_byte(address, data); + space().write_byte(address, data); } diff --git a/src/emu/video/huc6261.c b/src/emu/video/huc6261.c index fd35d54d619..b9d3b0b61be 100644 --- a/src/emu/video/huc6261.c +++ b/src/emu/video/huc6261.c @@ -96,7 +96,7 @@ void huc6261_device::device_timer(emu_timer &timer, device_timer_id id, int para { g_profiler.start( PROFILER_VIDEO ); /* Get next pixel information */ - m_pixel_data = m_huc6270_b->next_pixel( *machine().memory().first_space(), 0, 0xffff ); + m_pixel_data = m_huc6270_b->next_pixel( machine().driver_data()->generic_space(), 0, 0xffff ); g_profiler.stop(); } diff --git a/src/emu/video/huc6272.c b/src/emu/video/huc6272.c index b72c20b9ef8..ec4faee84eb 100644 --- a/src/emu/video/huc6272.c +++ b/src/emu/video/huc6272.c @@ -42,7 +42,7 @@ const address_space_config *huc6272_device::memory_space_config(address_spacenum inline UINT32 huc6272_device::read_dword(offs_t address) { - return space()->read_dword(address << 2); + return space().read_dword(address << 2); } @@ -52,7 +52,7 @@ inline UINT32 huc6272_device::read_dword(offs_t address) inline void huc6272_device::write_dword(offs_t address, UINT32 data) { - space()->write_dword(address << 2, data); + space().write_dword(address << 2, data); } //************************************************************************** diff --git a/src/emu/video/m50458.c b/src/emu/video/m50458.c index 2f0b66e2f00..7e339f35f4e 100644 --- a/src/emu/video/m50458.c +++ b/src/emu/video/m50458.c @@ -148,7 +148,7 @@ const address_space_config *m50458_device::memory_space_config(address_spacenum inline UINT16 m50458_device::read_word(offs_t address) { - return space()->read_word(address << 1); + return space().read_word(address << 1); } //------------------------------------------------- @@ -157,7 +157,7 @@ inline UINT16 m50458_device::read_word(offs_t address) inline void m50458_device::write_word(offs_t address, UINT16 data) { - space()->write_word(address << 1, data); + space().write_word(address << 1, data); } diff --git a/src/emu/video/mb90082.c b/src/emu/video/mb90082.c index 491e3111ebf..8983c44d848 100644 --- a/src/emu/video/mb90082.c +++ b/src/emu/video/mb90082.c @@ -63,7 +63,7 @@ const address_space_config *mb90082_device::memory_space_config(address_spacenum inline UINT16 mb90082_device::read_word(offs_t address) { - return space()->read_word(address << 1); + return space().read_word(address << 1); } //------------------------------------------------- @@ -72,7 +72,7 @@ inline UINT16 mb90082_device::read_word(offs_t address) inline void mb90082_device::write_word(offs_t address, UINT16 data) { - space()->write_word(address << 1, data); + space().write_word(address << 1, data); } //************************************************************************** diff --git a/src/emu/video/mc6845.c b/src/emu/video/mc6845.c index 1a05a77aa5b..2555908f4f5 100644 --- a/src/emu/video/mc6845.c +++ b/src/emu/video/mc6845.c @@ -418,12 +418,12 @@ WRITE8_MEMBER( mos8563_device::register_w ) inline UINT8 mos8563_device::read_videoram(offs_t offset) { - return space(AS_0)->read_byte(offset); + return space(AS_0).read_byte(offset); } inline void mos8563_device::write_videoram(offs_t offset, UINT8 data) { - space(AS_0)->write_byte(offset, data); + space(AS_0).write_byte(offset, data); } diff --git a/src/emu/video/pc_cga.c b/src/emu/video/pc_cga.c index 3373c1f38eb..5f85ac68114 100644 --- a/src/emu/video/pc_cga.c +++ b/src/emu/video/pc_cga.c @@ -329,8 +329,8 @@ static int internal_pc_cga_video_start(running_machine &machine) static VIDEO_START( pc_cga ) { int buswidth; - address_space &space = *machine.firstcpu->space(AS_PROGRAM); - address_space *spaceio = machine.firstcpu->space(AS_IO); + address_space &space = machine.firstcpu->space(AS_PROGRAM); + address_space &spaceio = machine.firstcpu->space(AS_IO); space.install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" ); buswidth = machine.firstcpu->space_config(AS_PROGRAM)->m_databus_width; @@ -357,7 +357,7 @@ static VIDEO_START( pc_cga ) fatalerror("CGA: Bus width %d not supported\n", buswidth); break; } - spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask ); + spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask ); internal_pc_cga_video_start(machine); cga.videoram_size = 0x4000; cga.videoram = auto_alloc_array(machine, UINT8, 0x4000); @@ -370,8 +370,8 @@ static VIDEO_START( pc_cga ) static VIDEO_START( pc_cga32k ) { int buswidth; - address_space &space = *machine.firstcpu->space(AS_PROGRAM); - address_space *spaceio = machine.firstcpu->space(AS_IO); + address_space &space = machine.firstcpu->space(AS_PROGRAM); + address_space &spaceio = machine.firstcpu->space(AS_IO); space.install_readwrite_bank(0xb8000, 0xbffff, "bank11" ); @@ -399,7 +399,7 @@ static VIDEO_START( pc_cga32k ) fatalerror("CGA: Bus width %d not supported\n", buswidth); break; } - spaceio->install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask ); + spaceio.install_legacy_readwrite_handler(0x3d0, 0x3df, FUNC(pc_cga8_r), FUNC(pc_cga8_w), mask ); internal_pc_cga_video_start(machine); @@ -1202,7 +1202,7 @@ static WRITE8_HANDLER( pc_cga8_w ) // Not sure if some all CGA cards have ability to upload char definition // The original CGA card had a char rom UINT8 buswidth = space.machine().firstcpu->space_config(AS_PROGRAM)->m_databus_width; - address_space *space_prg = space.machine().firstcpu->space(AS_PROGRAM); + address_space &space_prg = space.machine().firstcpu->space(AS_PROGRAM); cga.p3df = data; if (data & 1) { UINT64 mask = 0; @@ -1228,12 +1228,12 @@ static WRITE8_HANDLER( pc_cga8_w ) fatalerror("CGA: Bus width %d not supported\n", buswidth); break; } - space_prg->install_legacy_readwrite_handler(0xb8000, 0xb9fff, FUNC(char_ram_r),FUNC(char_ram_w), mask ); + space_prg.install_legacy_readwrite_handler(0xb8000, 0xb9fff, FUNC(char_ram_r),FUNC(char_ram_w), mask ); } else { if (cga.videoram_size== 0x4000) { - space_prg->install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" ); + space_prg.install_readwrite_bank(0xb8000, 0xbbfff, 0, 0x04000, "bank11" ); } else { - space_prg->install_readwrite_bank(0xb8000, 0xbffff, "bank11" ); + space_prg.install_readwrite_bank(0xb8000, 0xbffff, "bank11" ); } } break; @@ -1635,14 +1635,14 @@ static VIDEO_START( pc1512 ) cga.videoram_size = 0x10000; cga.videoram = auto_alloc_array(machine, UINT8, 0x10000 ); - address_space &space = *machine.firstcpu->space( AS_PROGRAM ); - address_space *io_space = machine.firstcpu->space( AS_IO ); + address_space &space = machine.firstcpu->space( AS_PROGRAM ); + address_space &io_space = machine.firstcpu->space( AS_IO ); space.install_read_bank( 0xb8000, 0xbbfff, 0, 0x0C000, "bank1" ); machine.root_device().membank("bank1")->set_base(cga.videoram + videoram_offset[0]); space.install_legacy_write_handler( 0xb8000, 0xbbfff, 0, 0x0C000, FUNC(pc1512_videoram_w), 0xffff); - io_space->install_legacy_readwrite_handler( 0x3d0, 0x3df, FUNC(pc1512_r), FUNC(pc1512_w), 0xffff); + io_space.install_legacy_readwrite_handler( 0x3d0, 0x3df, FUNC(pc1512_r), FUNC(pc1512_w), 0xffff); } diff --git a/src/emu/video/ramdac.c b/src/emu/video/ramdac.c index 6521079e8a9..1d40fe76a7c 100644 --- a/src/emu/video/ramdac.c +++ b/src/emu/video/ramdac.c @@ -61,7 +61,7 @@ const address_space_config *ramdac_device::memory_space_config(address_spacenum inline UINT8 ramdac_device::readbyte(offs_t address) { - return space()->read_byte(address); + return space().read_byte(address); } @@ -71,7 +71,7 @@ inline UINT8 ramdac_device::readbyte(offs_t address) inline void ramdac_device::writebyte(offs_t address, UINT8 data) { - space()->write_byte(address, data); + space().write_byte(address, data); } //------------------------------------------------- diff --git a/src/emu/video/sed1330.c b/src/emu/video/sed1330.c index 5312b4d62e3..48b52f4cf31 100644 --- a/src/emu/video/sed1330.c +++ b/src/emu/video/sed1330.c @@ -89,7 +89,7 @@ ROM_END inline UINT8 sed1330_device::readbyte(offs_t address) { - return space()->read_byte(address); + return space().read_byte(address); } @@ -99,7 +99,7 @@ inline UINT8 sed1330_device::readbyte(offs_t address) inline void sed1330_device::writebyte(offs_t address, UINT8 data) { - space()->write_byte(address, data); + space().write_byte(address, data); } diff --git a/src/emu/video/tms9928a.c b/src/emu/video/tms9928a.c index 4702e6f028a..491fa45174f 100644 --- a/src/emu/video/tms9928a.c +++ b/src/emu/video/tms9928a.c @@ -619,7 +619,7 @@ void tms9928a_device::device_start() m_irq_changed.resolve( m_out_int_line, *this ); // Video RAM is allocated as an own address space - m_vram_space = space(AS_DATA); + m_vram_space = &space(AS_DATA); /* back bitmap */ m_tmpbmp.allocate(TMS9928A_TOTAL_HORZ, TMS9928A_TOTAL_VERT_PAL); diff --git a/src/emu/video/v9938.c b/src/emu/video/v9938.c index e33519f876d..74f8f3e0eea 100644 --- a/src/emu/video/v9938.c +++ b/src/emu/video/v9938.c @@ -614,7 +614,7 @@ void v99x8_device::device_start() m_size_old = -1; // Video RAM is allocated as an own address space - m_vram_space = space(AS_DATA); + m_vram_space = &space(AS_DATA); // allocate VRAM assert(m_vram_size > 0); diff --git a/src/mame/audio/8080bw.c b/src/mame/audio/8080bw.c index 562158d3802..6b38ce0ffdd 100644 --- a/src/mame/audio/8080bw.c +++ b/src/mame/audio/8080bw.c @@ -897,7 +897,7 @@ static TIMER_CALLBACK( schaser_effect_555_cb ) static void schaser_reinit_555_time_remain(_8080bw_state *state) { - address_space &space = *state->m_maincpu->space(AS_PROGRAM); + address_space &space = state->m_maincpu->space(AS_PROGRAM); state->m_schaser_effect_555_time_remain = attotime::from_double(state->m_schaser_effect_555_time_remain_savable); state->schaser_sh_port_2_w(space, 0, state->m_port_2_last_extra); } @@ -918,7 +918,7 @@ MACHINE_START_MEMBER(_8080bw_state,schaser_sh) MACHINE_RESET_MEMBER(_8080bw_state,schaser_sh) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); m_schaser_effect_555_is_low = 0; m_schaser_effect_555_timer->adjust(attotime::never); diff --git a/src/mame/audio/amiga.c b/src/mame/audio/amiga.c index c66c754952a..5b9d4d069fb 100644 --- a/src/mame/audio/amiga.c +++ b/src/mame/audio/amiga.c @@ -76,7 +76,7 @@ INLINE amiga_audio *get_safe_token( device_t *device ) static TIMER_CALLBACK( signal_irq ) { - amiga_custom_w(*machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | (0x80 << param), 0xffff); + amiga_custom_w(machine.device("maincpu")->memory().space(AS_PROGRAM), REG_INTREQ, 0x8000 | (0x80 << param), 0xffff); } diff --git a/src/mame/audio/atarijsa.c b/src/mame/audio/atarijsa.c index 01c4601a0b0..dd212980712 100644 --- a/src/mame/audio/atarijsa.c +++ b/src/mame/audio/atarijsa.c @@ -147,7 +147,7 @@ void atarijsa_init(running_machine &machine, const char *testport, int testmask) /* install POKEY memory handlers */ if (pokey != NULL) - jsacpu->space(AS_PROGRAM)->install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokey_device::read),pokey), write8_delegate(FUNC(pokey_device::write),pokey)); + jsacpu->space(AS_PROGRAM).install_readwrite_handler(0x2c00, 0x2c0f, read8_delegate(FUNC(pokey_device::read),pokey), write8_delegate(FUNC(pokey_device::write),pokey)); init_save_state(machine); atarijsa_reset(); diff --git a/src/mame/audio/cage.c b/src/mame/audio/cage.c index a7a5e954d14..384f566cbe5 100644 --- a/src/mame/audio/cage.c +++ b/src/mame/audio/cage.c @@ -177,7 +177,7 @@ void cage_init(running_machine &machine, offs_t speedup) state->timer[1] = machine.device<timer_device>("cage_timer1"); if (speedup) - state->speedup_ram = state->cpu->space(AS_PROGRAM)->install_legacy_write_handler(speedup, speedup, FUNC(speedup_w)); + state->speedup_ram = state->cpu->space(AS_PROGRAM).install_legacy_write_handler(speedup, speedup, FUNC(speedup_w)); for (chan = 0; chan < DAC_BUFFER_CHANNELS; chan++) { diff --git a/src/mame/audio/cinemat.c b/src/mame/audio/cinemat.c index d966c83c80e..7e49507b57f 100644 --- a/src/mame/audio/cinemat.c +++ b/src/mame/audio/cinemat.c @@ -1491,7 +1491,7 @@ static SOUND_RESET( qb3_sound ) { cinemat_state *state = machine.driver_data<cinemat_state>(); SOUND_RESET_CALL(demon_sound); - machine.device("maincpu")->memory().space(AS_IO)->install_write_handler(0x04, 0x04, write8_delegate(FUNC(cinemat_state::qb3_sound_w),state)); + machine.device("maincpu")->memory().space(AS_IO).install_write_handler(0x04, 0x04, write8_delegate(FUNC(cinemat_state::qb3_sound_w),state)); /* this patch prevents the sound ROM from eating itself when command $0A is sent */ /* on a cube rotate */ diff --git a/src/mame/audio/dcs.c b/src/mame/audio/dcs.c index 753f0b7e3d9..d2f4a7add30 100644 --- a/src/mame/audio/dcs.c +++ b/src/mame/audio/dcs.c @@ -944,8 +944,8 @@ void dcs_init(running_machine &machine) /* find the DCS CPU and the sound ROMs */ dcs.cpu = machine.device<adsp21xx_device>("dcs"); - dcs.program = dcs.cpu->space(AS_PROGRAM); - dcs.data = dcs.cpu->space(AS_DATA); + dcs.program = &dcs.cpu->space(AS_PROGRAM); + dcs.data = &dcs.cpu->space(AS_DATA); dcs.rev = 1; dcs.channels = 1; dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac"); @@ -997,8 +997,8 @@ void dcs2_init(running_machine &machine, int dram_in_mb, offs_t polling_offset) dcs.rev = 4; soundbank_words = 0x800; } - dcs.program = dcs.cpu->space(AS_PROGRAM); - dcs.data = dcs.cpu->space(AS_DATA); + dcs.program = &dcs.cpu->space(AS_PROGRAM); + dcs.data = &dcs.cpu->space(AS_DATA); dcs.channels = 2; dcs.dmadac[0] = machine.device<dmadac_sound_device>("dac1"); dcs.dmadac[1] = machine.device<dmadac_sound_device>("dac2"); @@ -1036,7 +1036,7 @@ void dcs2_init(running_machine &machine, int dram_in_mb, offs_t polling_offset) /* install the speedup handler */ dcs.polling_offset = polling_offset; if (polling_offset) - dcs.polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); + dcs.polling_base = dcs.cpu->space(AS_DATA).install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); /* allocate a watchdog timer for HLE transfers */ dcs.transfer.hle_enabled = (ENABLE_HLE_TRANSFERS && dram_in_mb != 0); @@ -1175,7 +1175,7 @@ static void sdrc_remap_memory(running_machine &machine) /* reinstall the polling hotspot */ if (dcs.polling_offset) - dcs.polling_base = dcs.cpu->space(AS_DATA)->install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); + dcs.polling_base = dcs.cpu->space(AS_DATA).install_legacy_readwrite_handler(dcs.polling_offset, dcs.polling_offset, FUNC(dcs_polling_r), FUNC(dcs_polling_w)); } @@ -2137,7 +2137,7 @@ static TIMER_CALLBACK( s1_ack_callback2 ) machine.scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback2), param); return; } - output_latch_w(*dcs.cpu->space(AS_PROGRAM), 0, 0x000a, 0xffff); + output_latch_w(dcs.cpu->space(AS_PROGRAM), 0, 0x000a, 0xffff); } @@ -2149,7 +2149,7 @@ static TIMER_CALLBACK( s1_ack_callback1 ) machine.scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback1), param); return; } - output_latch_w(*dcs.cpu->space(AS_PROGRAM), 0, param, 0xffff); + output_latch_w(dcs.cpu->space(AS_PROGRAM), 0, param, 0xffff); /* chain to the next word we need to write back */ machine.scheduler().timer_set(attotime::from_usec(1), FUNC(s1_ack_callback2)); @@ -2281,7 +2281,7 @@ static int preprocess_stage_1(running_machine &machine, UINT16 data) static TIMER_CALLBACK( s2_ack_callback ) { - address_space &space = *dcs.cpu->space(AS_PROGRAM); + address_space &space = dcs.cpu->space(AS_PROGRAM); /* if the output is full, stall for a usec */ if (IS_OUTPUT_FULL()) diff --git a/src/mame/audio/harddriv.c b/src/mame/audio/harddriv.c index 0f47974f0b4..7b7f908c794 100644 --- a/src/mame/audio/harddriv.c +++ b/src/mame/audio/harddriv.c @@ -231,13 +231,13 @@ WRITE16_MEMBER(harddriv_state::hdsnd68k_320ram_w) READ16_MEMBER(harddriv_state::hdsnd68k_320ports_r) { - return m_sounddsp->space(AS_IO)->read_word((offset & 7) << 1); + return m_sounddsp->space(AS_IO).read_word((offset & 7) << 1); } WRITE16_MEMBER(harddriv_state::hdsnd68k_320ports_w) { - m_sounddsp->space(AS_IO)->write_word((offset & 7) << 1, data); + m_sounddsp->space(AS_IO).write_word((offset & 7) << 1, data); } diff --git a/src/mame/audio/hyprolyb.c b/src/mame/audio/hyprolyb.c index 8ed7102f7aa..e62a35c1b81 100644 --- a/src/mame/audio/hyprolyb.c +++ b/src/mame/audio/hyprolyb.c @@ -24,7 +24,7 @@ static DEVICE_START( hyprolyb_adpcm ) { hyprolyb_adpcm_state *state = get_safe_token(device); - state->m_space = device->machine().device("audiocpu")->memory().space(AS_PROGRAM); + state->m_space = &device->machine().device("audiocpu")->memory().space(AS_PROGRAM); state->m_msm = device->machine().device("msm"); device->save_item(NAME(state->m_adpcm_ready)); // only bootlegs device->save_item(NAME(state->m_adpcm_busy)); diff --git a/src/mame/audio/jaguar.c b/src/mame/audio/jaguar.c index 161851b5dfc..660069a25bc 100644 --- a/src/mame/audio/jaguar.c +++ b/src/mame/audio/jaguar.c @@ -202,7 +202,7 @@ void jaguar_state::sound_start() #if ENABLE_SPEEDUP_HACKS if (m_hacks_enabled) - m_dsp->space(AS_PROGRAM)->install_write_handler(0xf1a100, 0xf1a103, write32_delegate(FUNC(jaguar_state::dsp_flags_w), this)); + m_dsp->space(AS_PROGRAM).install_write_handler(0xf1a100, 0xf1a103, write32_delegate(FUNC(jaguar_state::dsp_flags_w), this)); #endif } diff --git a/src/mame/audio/leland.c b/src/mame/audio/leland.c index fd842def0ad..ad3ca46a23f 100644 --- a/src/mame/audio/leland.c +++ b/src/mame/audio/leland.c @@ -385,7 +385,7 @@ static STREAM_UPDATE( leland_80186_dac_update ) static STREAM_UPDATE( leland_80186_dma_update ) { leland_sound_state *state = get_safe_token(device); - address_space *dmaspace = (address_space *)param; + address_space &dmaspace = *(address_space *)param; stream_sample_t *buffer = outputs[0]; int i, j; @@ -434,7 +434,7 @@ static STREAM_UPDATE( leland_80186_dma_update ) /* sample-rate convert to the output frequency */ for (j = 0; j < samples && count > 0; j++) { - buffer[j] += ((int)dmaspace->read_byte(source) - 0x80) * volume; + buffer[j] += ((int)dmaspace.read_byte(source) - 0x80) * volume; frac += step; source += frac >> 24; count -= frac >> 24; @@ -521,14 +521,14 @@ static DEVICE_START( common_sh_start ) { leland_sound_state *state = get_safe_token(device); running_machine &machine = device->machine(); - address_space *dmaspace = machine.device("audiocpu")->memory().space(AS_PROGRAM); + address_space &dmaspace = machine.device("audiocpu")->memory().space(AS_PROGRAM); int i; /* determine which sound hardware is installed */ state->m_has_ym2151 = (device->machine().device("ymsnd") != NULL); /* allocate separate streams for the DMA and non-DMA DACs */ - state->m_dma_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, (void *)dmaspace, leland_80186_dma_update); + state->m_dma_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, (void *)&dmaspace, leland_80186_dma_update); state->m_nondma_stream = device->machine().sound().stream_alloc(*device, 0, 1, OUTPUT_RATE, NULL, leland_80186_dac_update); /* if we have a 2151, install an externally driven DAC stream */ @@ -539,7 +539,7 @@ static DEVICE_START( common_sh_start ) } /* create timers here so they stick around */ - state->m_i80186.cpu = &dmaspace->device(); + state->m_i80186.cpu = &dmaspace.device(); state->m_i80186.timer[0].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device); state->m_i80186.timer[1].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device); state->m_i80186.timer[2].int_timer = machine.scheduler().timer_alloc(FUNC(internal_timer_int), device); @@ -1591,12 +1591,12 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) temp = (state->m_i80186.mem.peripheral & 0xffc0) << 4; if (state->m_i80186.mem.middle_size & 0x0040) { - state->m_i80186.cpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w)); + state->m_i80186.cpu->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w)); } else { temp &= 0xffff; - state->m_i80186.cpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w)); + state->m_i80186.cpu->memory().space(AS_IO).install_legacy_readwrite_handler(*device, temp, temp + 0x2ff, FUNC(peripheral_r), FUNC(peripheral_w)); } /* we need to do this at a time when the 80186 context is swapped in */ @@ -1662,12 +1662,12 @@ static WRITE16_DEVICE_HANDLER( i80186_internal_port_w ) temp = (data & 0x0fff) << 8; if (data & 0x1000) { - state->m_i80186.cpu->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w)); + state->m_i80186.cpu->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w)); } else { temp &= 0xffff; - state->m_i80186.cpu->memory().space(AS_IO)->install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w)); + state->m_i80186.cpu->memory().space(AS_IO).install_legacy_readwrite_handler(*device, temp, temp + 0xff, FUNC(i80186_internal_port_r), FUNC(i80186_internal_port_w)); } /* popmessage("Sound CPU reset");*/ break; diff --git a/src/mame/audio/m72.c b/src/mame/audio/m72.c index 21e392b4382..3e9c30a813c 100644 --- a/src/mame/audio/m72.c +++ b/src/mame/audio/m72.c @@ -125,7 +125,7 @@ static DEVICE_START( m72_audio ) state->samples = device->machine().root_device().memregion("samples")->base(); state->samples_size = device->machine().root_device().memregion("samples")->bytes(); - state->space = device->machine().device("soundcpu")->memory().space(AS_IO); + state->space = &device->machine().device("soundcpu")->memory().space(AS_IO); state->dac = device->machine().device<dac_device>("dac"); device->save_item(NAME(state->irqvector)); diff --git a/src/mame/audio/mario.c b/src/mame/audio/mario.c index 301f066da89..7f01dd1f7d1 100644 --- a/src/mame/audio/mario.c +++ b/src/mame/audio/mario.c @@ -425,7 +425,7 @@ static SOUND_START( mario ) if (audiocpu != NULL && audiocpu->type() != Z80) { state->m_eabank = "bank1"; - audiocpu->memory().space(AS_PROGRAM)->install_read_bank(0x000, 0x7ff, "bank1"); + audiocpu->memory().space(AS_PROGRAM).install_read_bank(0x000, 0x7ff, "bank1"); state->membank("bank1")->configure_entry(0, state->memregion("audiocpu")->base()); state->membank("bank1")->configure_entry(1, state->memregion("audiocpu")->base() + 0x1000); } @@ -437,7 +437,7 @@ static SOUND_START( mario ) static SOUND_RESET( mario ) { mario_state *state = machine.driver_data<mario_state>(); - address_space &space = *machine.device("audiocpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("audiocpu")->memory().space(AS_PROGRAM); #if USE_8039 set_ea(machine, 1); diff --git a/src/mame/audio/scramble.c b/src/mame/audio/scramble.c index 33e833aa0a8..2228d7ab0d8 100644 --- a/src/mame/audio/scramble.c +++ b/src/mame/audio/scramble.c @@ -127,7 +127,7 @@ READ8_DEVICE_HANDLER( hotshock_soundlatch_r ) { driver_device *drvstate = space.machine().driver_data<driver_device>(); space.machine().device("audiocpu")->execute().set_input_line(0, CLEAR_LINE); - return drvstate->soundlatch_byte_r(*space.machine().device("audiocpu")->memory().space(AS_PROGRAM),0); + return drvstate->soundlatch_byte_r(space.machine().device("audiocpu")->memory().space(AS_PROGRAM),0); } static void filter_w(device_t *device, int data) diff --git a/src/mame/audio/seibu.c b/src/mame/audio/seibu.c index a17a2953f25..f1a95c28ca7 100644 --- a/src/mame/audio/seibu.c +++ b/src/mame/audio/seibu.c @@ -104,7 +104,7 @@ static UINT8 decrypt_opcode(int a,int src) void seibu_sound_decrypt(running_machine &machine,const char *cpu,int length) { - address_space &space = *machine.device(cpu)->memory().space(AS_PROGRAM); + address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine, UINT8, length); UINT8 *rom = machine.root_device().memregion(cpu)->base(); int i; diff --git a/src/mame/audio/williams.c b/src/mame/audio/williams.c index b1e2b80ad4c..81fdd42f742 100644 --- a/src/mame/audio/williams.c +++ b/src/mame/audio/williams.c @@ -129,7 +129,7 @@ WRITE_LINE_MEMBER(williams_cvsd_sound_device::reset_write) // going high halts the CPU if (state) { - bank_select_w(*m_cpu->space(), 0, 0); + bank_select_w(m_cpu->space(), 0, 0); device_reset(); m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } @@ -404,8 +404,8 @@ WRITE_LINE_MEMBER(williams_narc_sound_device::reset_write) // going high halts the CPU if (state) { - master_bank_select_w(*m_cpu0->space(), 0, 0); - slave_bank_select_w(*m_cpu1->space(), 0, 0); + master_bank_select_w(m_cpu0->space(), 0, 0); + slave_bank_select_w(m_cpu1->space(), 0, 0); device_reset(); m_cpu0->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); m_cpu1->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); @@ -772,7 +772,7 @@ WRITE_LINE_MEMBER(williams_adpcm_sound_device::reset_write) // going high halts the CPU if (state) { - bank_select_w(*m_cpu->space(), 0, 0); + bank_select_w(m_cpu->space(), 0, 0); device_reset(); m_cpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); } diff --git a/src/mame/drivers/1943.c b/src/mame/drivers/1943.c index 3c03db0f443..358d3157a8d 100644 --- a/src/mame/drivers/1943.c +++ b/src/mame/drivers/1943.c @@ -650,7 +650,7 @@ DRIVER_INIT_MEMBER(_1943_state,1943b) DRIVER_INIT_CALL(1943); //it expects 0x00 to be returned from the protection reads because the protection has been patched out. //AM_RANGE(0xc007, 0xc007) AM_READ(c1943_protection_r) - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc007, 0xc007, read8_delegate(FUNC(_1943_state::_1943b_c007_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc007, 0xc007, read8_delegate(FUNC(_1943_state::_1943b_c007_r),this)); } diff --git a/src/mame/drivers/39in1.c b/src/mame/drivers/39in1.c index 6b98d85e599..56d4dff1d14 100644 --- a/src/mame/drivers/39in1.c +++ b/src/mame/drivers/39in1.c @@ -280,7 +280,7 @@ static void pxa255_dma_load_descriptor_and_start(running_machine& machine, int c // Load the next descriptor - address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); + address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); dma_regs->dsadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x4); dma_regs->dtadr[channel] = space.read_dword(dma_regs->ddadr[channel] + 0x8); dma_regs->dcmd[channel] = space.read_dword(dma_regs->ddadr[channel] + 0xc); @@ -320,7 +320,7 @@ static TIMER_CALLBACK( pxa255_dma_dma_end ) UINT16 temp16; UINT32 temp32; - address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); + address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); switch(param) { case 3: @@ -1113,7 +1113,7 @@ static void pxa255_lcd_dma_kickoff(running_machine& machine, int channel) if(lcd_regs->dma[channel].ldcmd & PXA255_LDCMD_PAL) { - address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); + address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); int length = lcd_regs->dma[channel].ldcmd & 0x000fffff; int index = 0; for(index = 0; index < length; index += 2) @@ -1125,7 +1125,7 @@ static void pxa255_lcd_dma_kickoff(running_machine& machine, int channel) } else { - address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); + address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); int length = lcd_regs->dma[channel].ldcmd & 0x000fffff; int index = 0; for(index = 0; index < length; index++) @@ -1145,7 +1145,7 @@ static void pxa255_lcd_check_load_next_branch(running_machine& machine, int chan { verboselog( machine, 4, "pxa255_lcd_check_load_next_branch: Taking branch\n" ); lcd_regs->fbr[channel] &= ~1; - address_space &space = *machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); + address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); //lcd_regs->fbr[channel] = (space.read_dword(lcd_regs->fbr[channel] & 0xfffffff0) & 0xfffffff0) | (lcd_regs->fbr[channel] & 0x00000003); //printf( "%08x\n", lcd_regs->fbr[channel] ); pxa255_lcd_load_dma_descriptor(space, lcd_regs->fbr[channel] & 0xfffffff0, 0); @@ -1466,7 +1466,7 @@ DRIVER_INIT_MEMBER(_39in1_state,39in1) m_dmadac[1] = machine().device<dmadac_sound_device>("dac2"); m_eeprom = machine().device<eeprom_device>("eeprom"); - address_space &space = *machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); + address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); space.install_read_handler (0xa0151648, 0xa015164b, read32_delegate(FUNC(_39in1_state::prot_cheater_r), this)); } diff --git a/src/mame/drivers/8080bw.c b/src/mame/drivers/8080bw.c index 05ee0b431bd..1433fe75b5b 100644 --- a/src/mame/drivers/8080bw.c +++ b/src/mame/drivers/8080bw.c @@ -2532,7 +2532,7 @@ WRITE8_MEMBER(_8080bw_state::invmulti_bank_w) MACHINE_RESET_MEMBER(_8080bw_state,invmulti) { - invmulti_bank_w(*m_maincpu->space(AS_PROGRAM), 0, 0); + invmulti_bank_w(m_maincpu->space(AS_PROGRAM), 0, 0); MACHINE_RESET_CALL_MEMBER(mw8080bw); } diff --git a/src/mame/drivers/adp.c b/src/mame/drivers/adp.c index 5770b1a3280..c94a671e084 100644 --- a/src/mame/drivers/adp.c +++ b/src/mame/drivers/adp.c @@ -280,7 +280,7 @@ static void duart_tx( device_t *device, int channel, UINT8 data ) adp_state *state = device->machine().driver_data<adp_state>(); if (channel == 0) { - state->m_microtouch->rx(*device->machine().memory().first_space(), 0, data); + state->m_microtouch->rx(device->machine().driver_data()->generic_space(), 0, data); } } diff --git a/src/mame/drivers/airbustr.c b/src/mame/drivers/airbustr.c index 3b74e1aa5a8..eb18935dee2 100644 --- a/src/mame/drivers/airbustr.c +++ b/src/mame/drivers/airbustr.c @@ -783,7 +783,7 @@ ROM_END DRIVER_INIT_MEMBER(airbustr_state,airbustr) { - machine().device("master")->memory().space(AS_PROGRAM)->install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(airbustr_state::devram_r),this)); // protection device lives here + machine().device("master")->memory().space(AS_PROGRAM).install_read_handler(0xe000, 0xefff, read8_delegate(FUNC(airbustr_state::devram_r),this)); // protection device lives here } diff --git a/src/mame/drivers/alpha68k.c b/src/mame/drivers/alpha68k.c index b952fe37bbf..fb7ef91a3be 100644 --- a/src/mame/drivers/alpha68k.c +++ b/src/mame/drivers/alpha68k.c @@ -3151,7 +3151,7 @@ DRIVER_INIT_MEMBER(alpha68k_state,kyros) DRIVER_INIT_MEMBER(alpha68k_state,jongbou) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0c0000, 0x0c0001, read16_delegate(FUNC(alpha68k_state::jongbou_inputs_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0c0000, 0x0c0001, read16_delegate(FUNC(alpha68k_state::jongbou_inputs_r),this)); m_invert_controls = 0; m_microcontroller_id = 0x00ff; m_coin_id = 0x23 | (0x24 << 8); diff --git a/src/mame/drivers/appoooh.c b/src/mame/drivers/appoooh.c index 4bc50c4204a..c7baf38dc84 100644 --- a/src/mame/drivers/appoooh.c +++ b/src/mame/drivers/appoooh.c @@ -612,7 +612,7 @@ DRIVER_INIT_MEMBER(appoooh_state,robowres) DRIVER_INIT_MEMBER(appoooh_state,robowresb) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x1c000); } diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index 4912e4ab055..dcc50186df1 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -122,11 +122,11 @@ WRITE8_MEMBER(arcadia_amiga_state::arcadia_cia_0_porta_w) /* swap the write handlers between ROM and bank 1 based on the bit */ if ((data & 1) == 0) /* overlay disabled, map RAM on 0x000000 */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_bank(0x000000, 0x07ffff, "bank1"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1"); else /* overlay enabled, map Amiga system ROM on 0x000000 */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x000000, 0x07ffff); + machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff); /* bit 2 = Power Led on Amiga */ set_led_status(machine(), 0, (data & 2) ? 0 : 1); diff --git a/src/mame/drivers/arkanoid.c b/src/mame/drivers/arkanoid.c index 6016478c4e4..14a7d9524f3 100644 --- a/src/mame/drivers/arkanoid.c +++ b/src/mame/drivers/arkanoid.c @@ -1572,10 +1572,10 @@ ROM_END static void arkanoid_bootleg_init( running_machine &machine ) { arkanoid_state *state = machine.driver_data<arkanoid_state>(); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf000, 0xf000, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f000_r),state) ); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf002, 0xf002, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f002_r),state) ); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd018, 0xd018, write8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d018_w),state) ); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd008, 0xd008, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d008_r),state) ); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf000, 0xf000, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f000_r),state) ); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf002, 0xf002, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_f002_r),state) ); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd018, 0xd018, write8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d018_w),state) ); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd008, 0xd008, read8_delegate(FUNC(arkanoid_state::arkanoid_bootleg_d008_r),state) ); } DRIVER_INIT_MEMBER(arkanoid_state,arkangc) @@ -1660,7 +1660,7 @@ DRIVER_INIT_MEMBER(arkanoid_state,tetrsark) ROM[x] = ROM[x] ^ 0x94; } - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd008, 0xd008, write8_delegate(FUNC(arkanoid_state::tetrsark_d008_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd008, 0xd008, write8_delegate(FUNC(arkanoid_state::tetrsark_d008_w),this)); } diff --git a/src/mame/drivers/armedf.c b/src/mame/drivers/armedf.c index de4ea0773f9..a200c056eae 100644 --- a/src/mame/drivers/armedf.c +++ b/src/mame/drivers/armedf.c @@ -2036,24 +2036,24 @@ DRIVER_INIT_MEMBER(armedf_state,terraf) { m_scroll_type = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c006, 0x07c007, write16_delegate(FUNC(armedf_state::terraf_fg_scrolly_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c008, 0x07c009, write16_delegate(FUNC(armedf_state::terraf_fg_scrollx_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0c0000, 0x0c0001, write16_delegate(FUNC(armedf_state::terraf_fg_scroll_msb_arm_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c006, 0x07c007, write16_delegate(FUNC(armedf_state::terraf_fg_scrolly_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c008, 0x07c009, write16_delegate(FUNC(armedf_state::terraf_fg_scrollx_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0c0000, 0x0c0001, write16_delegate(FUNC(armedf_state::terraf_fg_scroll_msb_arm_w),this)); } DRIVER_INIT_MEMBER(armedf_state,terrafu) { m_scroll_type = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); } DRIVER_INIT_MEMBER(armedf_state,terrafb) { m_scroll_type = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terrafb_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terrafb_io_w),this)); } DRIVER_INIT_MEMBER(armedf_state,armedf) @@ -2066,7 +2066,7 @@ DRIVER_INIT_MEMBER(armedf_state,kozure) { m_scroll_type = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); } @@ -2081,7 +2081,7 @@ DRIVER_INIT_MEMBER(armedf_state,legion) RAM[0x000488 / 2] = 0x4e71; #endif - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); m_scroll_type = 2; } @@ -2096,7 +2096,7 @@ DRIVER_INIT_MEMBER(armedf_state,legiono) /* No need to patch the checksum routine (see notes) ! */ #endif - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::bootleg_io_w),this)); m_scroll_type = 2; } @@ -2104,7 +2104,7 @@ DRIVER_INIT_MEMBER(armedf_state,legiono) DRIVER_INIT_MEMBER(armedf_state,cclimbr2) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07c000, 0x07c001, write16_delegate(FUNC(armedf_state::terraf_io_w),this)); m_scroll_type = 3; } diff --git a/src/mame/drivers/artmagic.c b/src/mame/drivers/artmagic.c index 28d80cf0871..443be53df01 100644 --- a/src/mame/drivers/artmagic.c +++ b/src/mame/drivers/artmagic.c @@ -1164,7 +1164,7 @@ DRIVER_INIT_MEMBER(artmagic_state,ultennis) m_protection_handler = ultennis_protection; /* additional (protection?) hack */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x300000, 0x300001, read16_delegate(FUNC(artmagic_state::ultennis_hack_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x300000, 0x300001, read16_delegate(FUNC(artmagic_state::ultennis_hack_r),this)); } diff --git a/src/mame/drivers/asteroid.c b/src/mame/drivers/asteroid.c index 52cbfbde550..a503034739e 100644 --- a/src/mame/drivers/asteroid.c +++ b/src/mame/drivers/asteroid.c @@ -951,14 +951,14 @@ ROM_END DRIVER_INIT_MEMBER(asteroid_state,asteroidb) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2000, 0x2000, "IN0"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2003, 0x2003, "HS"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2000, 0x2000, "IN0"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2003, 0x2003, "HS"); } DRIVER_INIT_MEMBER(asteroid_state,asterock) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2000, 0x2007, read8_delegate(FUNC(asteroid_state::asterock_IN0_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2000, 0x2007, read8_delegate(FUNC(asteroid_state::asterock_IN0_r),this)); } diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c index 9e404c1fae2..6cc23c755c7 100644 --- a/src/mame/drivers/astrocde.c +++ b/src/mame/drivers/astrocde.c @@ -421,18 +421,18 @@ WRITE8_MEMBER(astrocde_state::profpac_banksw_w) int bank = (data >> 5) & 3; /* this is accessed from I/O &space but modifies program &space, so we normalize here */ - address_space *prog_space = space.device().memory().space(AS_PROGRAM); + address_space &prog_space = space.device().memory().space(AS_PROGRAM); /* remember the banking bits for save state support */ m_profpac_bank = data; /* set the main banking */ - prog_space->install_read_bank(0x4000, 0xbfff, "bank1"); + prog_space.install_read_bank(0x4000, 0xbfff, "bank1"); membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + 0x8000 * bank); /* bank 0 reads video RAM in the 4000-7FFF range */ if (bank == 0) - prog_space->install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r),this)); + prog_space.install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(astrocde_state::profpac_videoram_r),this)); /* if we have a 640k EPROM board, map that on top of the 4000-7FFF range if specified */ if ((data & 0x80) && memregion("user2")->base() != NULL) @@ -443,11 +443,11 @@ WRITE8_MEMBER(astrocde_state::profpac_banksw_w) /* if the bank is in range, map the appropriate bank */ if (bank < 0x28) { - prog_space->install_read_bank(0x4000, 0x7fff, "bank2"); + prog_space.install_read_bank(0x4000, 0x7fff, "bank2"); membank("bank2")->set_base(machine().root_device().memregion("user2")->base() + 0x4000 * bank); } else - prog_space->unmap_read(0x4000, 0x7fff); + prog_space.unmap_read(0x4000, 0x7fff); } } @@ -455,7 +455,7 @@ WRITE8_MEMBER(astrocde_state::profpac_banksw_w) static void profbank_banksw_restore(running_machine &machine) { astrocde_state *state = machine.driver_data<astrocde_state>(); - address_space &space = *machine.device("maincpu")->memory().space(AS_IO); + address_space &space = machine.device("maincpu")->memory().space(AS_IO); state->profpac_banksw_w(space, 0, state->m_profpac_bank); } @@ -1734,98 +1734,98 @@ ROM_END DRIVER_INIT_MEMBER(astrocde_state,seawolf2) { m_video_config = 0x00; - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x40, 0x40, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_1_w),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x41, 0x41, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_2_w),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x42, 0x43, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_lamps_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x40, 0x40, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_1_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x41, 0x41, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_sound_2_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x42, 0x43, 0, 0xff18, write8_delegate(FUNC(astrocde_state::seawolf2_lamps_w),this)); } DRIVER_INIT_MEMBER(astrocde_state,ebases) { m_video_config = AC_SOUND_PRESENT; - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x20, 0x20, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_coin_w),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x28, 0x28, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_trackball_select_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x20, 0x20, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_coin_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x28, 0x28, 0, 0xff07, write8_delegate(FUNC(astrocde_state::ebases_trackball_select_w),this)); } DRIVER_INIT_MEMBER(astrocde_state,spacezap) { m_video_config = AC_SOUND_PRESENT | AC_MONITOR_BW; - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x13, 0x13, 0x03ff, 0xff00, read8_delegate(FUNC(astrocde_state::spacezap_io_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x13, 0x13, 0x03ff, 0xff00, read8_delegate(FUNC(astrocde_state::spacezap_io_r),this)); } DRIVER_INIT_MEMBER(astrocde_state,wow) { m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS; - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_io_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(wow_speech_r)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::wow_io_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(wow_speech_r)); } DRIVER_INIT_MEMBER(astrocde_state,gorf) { m_video_config = AC_SOUND_PRESENT | AC_LIGHTPEN_INTS | AC_STARS; - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_1_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x16, 0x16, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_2_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(gorf_speech_r)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_1_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x16, 0x16, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::gorf_io_2_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_legacy_read_handler(0x17, 0x17, 0xffff, 0xff00, FUNC(gorf_speech_r)); } DRIVER_INIT_MEMBER(astrocde_state,robby) { m_video_config = AC_SOUND_PRESENT; - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::robby_io_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x15, 0x15, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::robby_io_r),this)); } DRIVER_INIT_MEMBER(astrocde_state,profpac) { - address_space *iospace = machine().device("maincpu")->memory().space(AS_IO); + address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); m_video_config = AC_SOUND_PRESENT; - iospace->install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r),this)); - iospace->install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r),this)); + iospace.install_read_handler(0x14, 0x14, 0x0fff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_1_r),this)); + iospace.install_read_handler(0x15, 0x15, 0x77ff, 0xff00, read8_delegate(FUNC(astrocde_state::profpac_io_2_r),this)); /* reset banking */ - profpac_banksw_w(*iospace, 0, 0); + profpac_banksw_w(iospace, 0, 0); machine().save().register_postload(save_prepost_delegate(FUNC(profbank_banksw_restore), &machine())); } DRIVER_INIT_MEMBER(astrocde_state,demndrgn) { - address_space *iospace = machine().device("maincpu")->memory().space(AS_IO); + address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); m_video_config = 0x00; - iospace->install_read_handler(0x14, 0x14, 0x1fff, 0xff00, read8_delegate(FUNC(astrocde_state::demndrgn_io_r),this)); - iospace->install_read_port(0x1c, 0x1c, 0x0000, 0xff00, "FIREX"); - iospace->install_read_port(0x1d, 0x1d, 0x0000, 0xff00, "FIREY"); - iospace->install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w),this)); + iospace.install_read_handler(0x14, 0x14, 0x1fff, 0xff00, read8_delegate(FUNC(astrocde_state::demndrgn_io_r),this)); + iospace.install_read_port(0x1c, 0x1c, 0x0000, 0xff00, "FIREX"); + iospace.install_read_port(0x1d, 0x1d, 0x0000, 0xff00, "FIREY"); + iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::demndrgn_sound_w),this)); /* reset banking */ - profpac_banksw_w(*iospace, 0, 0); + profpac_banksw_w(iospace, 0, 0); machine().save().register_postload(save_prepost_delegate(FUNC(profbank_banksw_restore), &machine())); } DRIVER_INIT_MEMBER(astrocde_state,tenpindx) { - address_space *iospace = machine().device("maincpu")->memory().space(AS_IO); + address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); m_video_config = 0x00; - iospace->install_read_port(0x60, 0x60, 0x0000, 0xff00, "P60"); - iospace->install_read_port(0x61, 0x61, 0x0000, 0xff00, "P61"); - iospace->install_read_port(0x62, 0x62, 0x0000, 0xff00, "P62"); - iospace->install_read_port(0x63, 0x63, 0x0000, 0xff00, "P63"); - iospace->install_read_port(0x64, 0x64, 0x0000, 0xff00, "P64"); - iospace->install_write_handler(0x65, 0x66, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lamp_w),this)); - iospace->install_write_handler(0x67, 0x67, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_counter_w),this)); - iospace->install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w),this)); - iospace->install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w),this)); + iospace.install_read_port(0x60, 0x60, 0x0000, 0xff00, "P60"); + iospace.install_read_port(0x61, 0x61, 0x0000, 0xff00, "P61"); + iospace.install_read_port(0x62, 0x62, 0x0000, 0xff00, "P62"); + iospace.install_read_port(0x63, 0x63, 0x0000, 0xff00, "P63"); + iospace.install_read_port(0x64, 0x64, 0x0000, 0xff00, "P64"); + iospace.install_write_handler(0x65, 0x66, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lamp_w),this)); + iospace.install_write_handler(0x67, 0x67, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_counter_w),this)); + iospace.install_write_handler(0x68, 0x68, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_lights_w),this)); + iospace.install_write_handler(0x97, 0x97, 0x0000, 0xff00, write8_delegate(FUNC(astrocde_state::tenpindx_sound_w),this)); /* reset banking */ - profpac_banksw_w(*iospace, 0, 0); + profpac_banksw_w(iospace, 0, 0); machine().save().register_postload(save_prepost_delegate(FUNC(profbank_banksw_restore), &machine())); } diff --git a/src/mame/drivers/astrof.c b/src/mame/drivers/astrof.c index a620a9a21cf..52d713499d3 100644 --- a/src/mame/drivers/astrof.c +++ b/src/mame/drivers/astrof.c @@ -1290,8 +1290,8 @@ DRIVER_INIT_MEMBER(astrof_state,abattle) rom[i] = prom[rom[i]]; /* set up protection handlers */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this)); } @@ -1304,8 +1304,8 @@ DRIVER_INIT_MEMBER(astrof_state,afire) rom[i] = ~rom[i]; /* set up protection handlers */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::afire_coin_prot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::afire_coin_prot_r),this)); } @@ -1318,8 +1318,8 @@ DRIVER_INIT_MEMBER(astrof_state,sstarbtl) rom[i] = ~rom[i]; /* set up protection handlers */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa003, 0xa003, read8_delegate(FUNC(astrof_state::shoot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xa004, 0xa004, read8_delegate(FUNC(astrof_state::abattle_coin_prot_r),this)); } diff --git a/src/mame/drivers/atarig1.c b/src/mame/drivers/atarig1.c index 1c2281f0212..910f1e051a5 100644 --- a/src/mame/drivers/atarig1.c +++ b/src/mame/drivers/atarig1.c @@ -184,7 +184,7 @@ static void pitfightb_cheap_slapstic_init(running_machine &machine) atarig1_state *state = machine.driver_data<atarig1_state>(); /* install a read handler */ - state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state)); + state->m_bslapstic_base = machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x038000, 0x03ffff, read16_delegate(FUNC(atarig1_state::pitfightb_cheap_slapstic_r),state)); /* allocate memory for a copy of bank 0 */ state->m_bslapstic_bank0 = auto_alloc_array(machine, UINT8, 0x2000); diff --git a/src/mame/drivers/atarig42.c b/src/mame/drivers/atarig42.c index 12d9f12eb5a..376312cfb19 100644 --- a/src/mame/drivers/atarig42.c +++ b/src/mame/drivers/atarig42.c @@ -786,9 +786,9 @@ DRIVER_INIT_MEMBER(atarig42_state,roadriot) m_playfield_base = 0x400; - address_space *main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM); - m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this)); - main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); + address_space &main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM); + m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::roadriot_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::roadriot_sloop_data_w),this)); + main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); asic65_config(machine(), ASIC65_ROMBASED); /* @@ -824,9 +824,9 @@ DRIVER_INIT_MEMBER(atarig42_state,guardian) /* put an RTS there so we don't die */ *(UINT16 *)&memregion("maincpu")->base()[0x80000] = 0x4E75; - address_space *main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM); - m_sloop_base = main->install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this)); - main->set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); + address_space &main = machine().device<m68000_device>("maincpu")->space(AS_PROGRAM); + m_sloop_base = main.install_readwrite_handler(0x000000, 0x07ffff, read16_delegate(FUNC(atarig42_state::guardians_sloop_data_r),this), write16_delegate(FUNC(atarig42_state::guardians_sloop_data_w),this)); + main.set_direct_update_handler(direct_update_delegate(FUNC(atarig42_state::atarig42_sloop_direct_handler), this)); asic65_config(machine(), ASIC65_GUARDIANS); /* diff --git a/src/mame/drivers/atarigt.c b/src/mame/drivers/atarigt.c index e4869b338e8..861e2742496 100644 --- a/src/mame/drivers/atarigt.c +++ b/src/mame/drivers/atarigt.c @@ -80,7 +80,7 @@ MACHINE_RESET_MEMBER(atarigt_state,atarigt) static void cage_irq_callback(running_machine &machine, int reason) { - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); if (reason) atarigen_sound_int_gen(machine.device("maincpu")); @@ -1274,7 +1274,7 @@ DRIVER_INIT_MEMBER(atarigt_state,tmek) m_protection_w = tmek_protection_w; /* temp hack */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xd72000, 0xd75fff, write32_delegate(FUNC(atarigt_state::tmek_pf_w),this)); } diff --git a/src/mame/drivers/atarigx2.c b/src/mame/drivers/atarigx2.c index 8f93e26edbd..56dd3ce6d0c 100644 --- a/src/mame/drivers/atarigx2.c +++ b/src/mame/drivers/atarigx2.c @@ -2236,7 +2236,7 @@ DRIVER_INIT_MEMBER(atarigx2_state,rrreveng) m_playfield_base = 0x000; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xca0fc0, 0xca0fc3, read32_delegate(FUNC(atarigx2_state::rrreveng_prot_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xca0fc0, 0xca0fc3, read32_delegate(FUNC(atarigx2_state::rrreveng_prot_r),this)); } diff --git a/src/mame/drivers/atarisy2.c b/src/mame/drivers/atarisy2.c index 7099a43ce98..6342cd4b27b 100644 --- a/src/mame/drivers/atarisy2.c +++ b/src/mame/drivers/atarisy2.c @@ -242,8 +242,8 @@ MACHINE_RESET_MEMBER(atarisy2_state,atarisy2) atarigen_sound_io_reset(machine().device("soundcpu")); atarigen_scanline_timer_reset(*machine().primary_screen, scanline_update, 64); - address_space *main = machine().device<t11_device>("maincpu")->space(AS_PROGRAM); - main->set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this)); + address_space &main = machine().device<t11_device>("maincpu")->space(AS_PROGRAM); + main.set_direct_update_handler(direct_update_delegate(FUNC(atarisy2_state::atarisy2_direct_handler), this)); m_p2portwr_state = 0; m_p2portrd_state = 0; @@ -340,7 +340,7 @@ WRITE16_MEMBER(atarisy2_state::bankselect_w) static void bankselect_postload(running_machine &machine) { - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); atarisy2_state *state = machine.driver_data<atarisy2_state>(); state->bankselect_w(space, 0, state->m_bankselect[0], 0xffff); diff --git a/src/mame/drivers/atarisy4.c b/src/mame/drivers/atarisy4.c index b9b14ec227d..9b9277539f6 100644 --- a/src/mame/drivers/atarisy4.c +++ b/src/mame/drivers/atarisy4.c @@ -964,7 +964,7 @@ next_line: DRIVER_INIT_MEMBER(atarisy4_state,laststar) { - address_space &main = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &main = machine().device("maincpu")->memory().space(AS_PROGRAM); /* Allocate 16kB of shared RAM */ m_shared_ram[0] = auto_alloc_array_clear(machine(), UINT16, 0x2000); @@ -976,7 +976,7 @@ DRIVER_INIT_MEMBER(atarisy4_state,laststar) /* Set up the DSP */ membank("dsp0_bank0")->set_base(m_shared_ram[0]); membank("dsp0_bank1")->set_base(&m_shared_ram[0][0x800]); - load_ldafile(*machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base()); + load_ldafile(machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base()); } DRIVER_INIT_MEMBER(atarisy4_state,airrace) @@ -986,17 +986,17 @@ DRIVER_INIT_MEMBER(atarisy4_state,airrace) m_shared_ram[1] = auto_alloc_array_clear(machine(), UINT16, 0x4000); /* Populate RAM with data from the HEX files */ - load_hexfile(*machine().device("maincpu")->memory().space(AS_PROGRAM), memregion("code")->base()); + load_hexfile(machine().device("maincpu")->memory().space(AS_PROGRAM), memregion("code")->base()); /* Set up the first DSP */ membank("dsp0_bank0")->set_base(m_shared_ram[0]); membank("dsp0_bank1")->set_base(&m_shared_ram[0][0x800]); - load_ldafile(*machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base()); + load_ldafile(machine().device("dsp0")->memory().space(AS_PROGRAM), memregion("dsp")->base()); /* Set up the second DSP */ membank("dsp1_bank0")->set_base(m_shared_ram[1]); membank("dsp1_bank1")->set_base(&m_shared_ram[1][0x800]); - load_ldafile(*machine().device("dsp1")->memory().space(AS_PROGRAM), memregion("dsp")->base()); + load_ldafile(machine().device("dsp1")->memory().space(AS_PROGRAM), memregion("dsp")->base()); } void atarisy4_state::machine_reset() diff --git a/src/mame/drivers/ataxx.c b/src/mame/drivers/ataxx.c index 5a7f8e0e750..8fffcd00064 100644 --- a/src/mame/drivers/ataxx.c +++ b/src/mame/drivers/ataxx.c @@ -711,7 +711,7 @@ DRIVER_INIT_MEMBER(leland_state,ataxx) leland_rotate_memory(machine(), "slave"); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this)); } @@ -721,7 +721,7 @@ DRIVER_INIT_MEMBER(leland_state,ataxxj) leland_rotate_memory(machine(), "slave"); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(leland_state::ataxx_trackball_r),this)); } @@ -731,9 +731,9 @@ DRIVER_INIT_MEMBER(leland_state,wsf) leland_rotate_memory(machine(), "slave"); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P1_P2"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P3_P4"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "BUTTONS"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P1_P2"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P3_P4"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "BUTTONS"); } @@ -743,14 +743,14 @@ DRIVER_INIT_MEMBER(leland_state,indyheat) leland_rotate_memory(machine(), "slave"); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0x00, 0x02, read8_delegate(FUNC(leland_state::indyheat_wheel_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0x08, 0x0b, read8_delegate(FUNC(leland_state::indyheat_analog_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P1"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P2"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "P3"); + machine().device("master")->memory().space(AS_IO).install_read_handler(0x00, 0x02, read8_delegate(FUNC(leland_state::indyheat_wheel_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0x08, 0x0b, read8_delegate(FUNC(leland_state::indyheat_analog_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P1"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P2"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "P3"); /* set up additional output ports */ - machine().device("master")->memory().space(AS_IO)->install_write_handler(0x08, 0x0b, write8_delegate(FUNC(leland_state::indyheat_analog_w),this)); + machine().device("master")->memory().space(AS_IO).install_write_handler(0x08, 0x0b, write8_delegate(FUNC(leland_state::indyheat_analog_w),this)); } @@ -760,9 +760,9 @@ DRIVER_INIT_MEMBER(leland_state,brutforc) leland_rotate_memory(machine(), "slave"); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P2"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P1"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "P3"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P2"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P1"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "P3"); } @@ -772,12 +772,12 @@ DRIVER_INIT_MEMBER(leland_state,asylum) leland_rotate_memory(machine(), "slave"); /* asylum appears to have some extra RAM for the slave CPU */ - machine().device("slave")->memory().space(AS_PROGRAM)->install_ram(0xf000, 0xfffb); + machine().device("slave")->memory().space(AS_PROGRAM).install_ram(0xf000, 0xfffb); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0d, 0x0d, "P2"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0e, 0x0e, "P1"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x0f, 0x0f, "P3"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0d, 0x0d, "P2"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0e, 0x0e, "P1"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x0f, 0x0f, "P3"); } diff --git a/src/mame/drivers/attckufo.c b/src/mame/drivers/attckufo.c index 2ca49518587..1cce3dd737a 100644 --- a/src/mame/drivers/attckufo.c +++ b/src/mame/drivers/attckufo.c @@ -96,12 +96,12 @@ WRITE8_MEMBER(attckufo_state::attckufo_io_w) READ8_MEMBER(attckufo_state::vic_videoram_r) { - return m_maincpu->space(AS_PROGRAM)->read_byte(offset); + return m_maincpu->space(AS_PROGRAM).read_byte(offset); } READ8_MEMBER(attckufo_state::vic_colorram_r) { - return m_maincpu->space(AS_PROGRAM)->read_byte(offset + 0x400); + return m_maincpu->space(AS_PROGRAM).read_byte(offset + 0x400); } static ADDRESS_MAP_START( cpu_map, AS_PROGRAM, 8, attckufo_state ) diff --git a/src/mame/drivers/atvtrack.c b/src/mame/drivers/atvtrack.c index 76dc617eaf4..209d2d0e394 100644 --- a/src/mame/drivers/atvtrack.c +++ b/src/mame/drivers/atvtrack.c @@ -327,12 +327,11 @@ UINT32 atvtrack_state::screen_update_atvtrack(screen_device &screen, bitmap_rgb3 void atvtrack_state::machine_start() { UINT8 *src, *dst; - address_space *as; nandaddressstep = 0; nandregion = machine().root_device().memregion("maincpu"); - as = machine().device("maincpu")->memory().space(AS_PROGRAM); - dst = (UINT8 *)(as->get_write_ptr(0x0c7f0000)); + address_space &as = machine().device("maincpu")->memory().space(AS_PROGRAM); + dst = (UINT8 *)(as.get_write_ptr(0x0c7f0000)); src = nandregion->base()+0x10; // copy 0x10000 bytes from region "maincpu" offset 0x10 to 0x0c7f0000 memcpy(dst, src, 0x10000); @@ -344,7 +343,7 @@ void atvtrack_state::machine_reset() // The routine initializes the cpu, copies the boot program from the flash memories into the cpu sdram // and finally executes it. // Here there is the setup of the cpu, the boot program is copied in machine_start - address_space &as = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &as = machine().device("maincpu")->memory().space(AS_PROGRAM); // set cpu PC register to 0x0c7f0000 machine().device("maincpu")->state().set_pc(0x0c7f0000); // set BCR2 to 1 diff --git a/src/mame/drivers/backfire.c b/src/mame/drivers/backfire.c index 75f7c5d9e58..df69ec76310 100644 --- a/src/mame/drivers/backfire.c +++ b/src/mame/drivers/backfire.c @@ -714,7 +714,7 @@ DRIVER_INIT_MEMBER(backfire_state,backfire) deco156_decrypt(machine()); machine().device("maincpu")->set_clock_scale(4.0f); /* core timings aren't accurate */ descramble_sound(machine()); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x0170018, 0x017001b, read32_delegate(FUNC(backfire_state::backfire_speedup_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x0170018, 0x017001b, read32_delegate(FUNC(backfire_state::backfire_speedup_r), this)); } GAME( 1995, backfire, 0, backfire, backfire, backfire_state, backfire, ROT0, "Data East Corporation", "Backfire! (set 1)", GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/badlands.c b/src/mame/drivers/badlands.c index 75d094adbd6..7e2e9a1dbdb 100644 --- a/src/mame/drivers/badlands.c +++ b/src/mame/drivers/badlands.c @@ -187,7 +187,7 @@ static void update_interrupts(running_machine &machine) static void scanline_update(screen_device &screen, int scanline) { - address_space &space = *screen.machine().device("audiocpu")->memory().space(AS_PROGRAM); + address_space &space = screen.machine().device("audiocpu")->memory().space(AS_PROGRAM); /* sound IRQ is on 32V */ if (scanline & 32) diff --git a/src/mame/drivers/bagman.c b/src/mame/drivers/bagman.c index 906f795ece1..36e43c5a841 100644 --- a/src/mame/drivers/bagman.c +++ b/src/mame/drivers/bagman.c @@ -932,7 +932,7 @@ DRIVER_INIT_MEMBER(bagman_state,bagman) /* Unmap video enable register, not available on earlier hardware revision(s) Bagman is supposed to have glitches during screen transitions */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0xa003, 0xa003); + machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0xa003, 0xa003); *m_video_enable = 1; } diff --git a/src/mame/drivers/balsente.c b/src/mame/drivers/balsente.c index 9b809130ef4..f94b4f5a413 100644 --- a/src/mame/drivers/balsente.c +++ b/src/mame/drivers/balsente.c @@ -2163,48 +2163,48 @@ DRIVER_INIT_MEMBER(balsente_state,minigolf2) { expand_roms(machine(), 0x0c); DRIVER_INIT_MEMBER(balsente_state,toggle) { expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,nametune) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,nstocker) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); expand_roms(machine(), EXPAND_NONE | SWAP_HALVES); config_shooter_adc(machine(), TRUE, 1); } DRIVER_INIT_MEMBER(balsente_state,sfootbal) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); expand_roms(machine(), EXPAND_ALL | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 0); } DRIVER_INIT_MEMBER(balsente_state,spiker) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_readwrite_handler(0x9f80, 0x9f8f, read8_delegate(FUNC(balsente_state::spiker_expand_r),this), write8_delegate(FUNC(balsente_state::spiker_expand_w),this)); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); expand_roms(machine(), EXPAND_ALL | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 1); } DRIVER_INIT_MEMBER(balsente_state,stompin) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x9f00, 0x9f00, write8_delegate(FUNC(balsente_state::balsente_rombank2_select_w),this)); expand_roms(machine(), 0x0c | SWAP_HALVES); config_shooter_adc(machine(), FALSE, 32); } DRIVER_INIT_MEMBER(balsente_state,rescraid) { expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0 /* noanalog */); } DRIVER_INIT_MEMBER(balsente_state,grudge) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_read_handler(0x9400, 0x9400, read8_delegate(FUNC(balsente_state::grudge_steering_r),this)); expand_roms(machine(), EXPAND_NONE); config_shooter_adc(machine(), FALSE, 0); } DRIVER_INIT_MEMBER(balsente_state,shrike) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_readwrite_handler(0x9e00, 0x9fff, read8_delegate(FUNC(balsente_state::shrike_shared_6809_r),this), write8_delegate(FUNC(balsente_state::shrike_shared_6809_w),this)); space.install_write_handler(0x9e01, 0x9e01, write8_delegate(FUNC(balsente_state::shrike_sprite_select_w),this)); - machine().device("68k")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x10000, 0x1001f, read16_delegate(FUNC(balsente_state::shrike_io_68k_r),this), write16_delegate(FUNC(balsente_state::shrike_io_68k_w),this)); + machine().device("68k")->memory().space(AS_PROGRAM).install_readwrite_handler(0x10000, 0x1001f, read16_delegate(FUNC(balsente_state::shrike_io_68k_r),this), write16_delegate(FUNC(balsente_state::shrike_io_68k_w),this)); expand_roms(machine(), EXPAND_ALL); config_shooter_adc(machine(), FALSE, 32); } diff --git a/src/mame/drivers/beathead.c b/src/mame/drivers/beathead.c index 5e56d8d318e..276d358add3 100644 --- a/src/mame/drivers/beathead.c +++ b/src/mame/drivers/beathead.c @@ -532,8 +532,8 @@ DRIVER_INIT_MEMBER(beathead_state,beathead) atarijsa_init(machine(), "IN2", 0x0040); /* prepare the speedups */ - m_speedup_data = m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), this)); - m_movie_speedup_data = m_maincpu->space(AS_PROGRAM)->install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), this)); + m_speedup_data = m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000ae8, 0x00000aeb, 0, 0, read32_delegate(FUNC(beathead_state::speedup_r), this)); + m_movie_speedup_data = m_maincpu->space(AS_PROGRAM).install_read_handler(0x00000804, 0x00000807, 0, 0, read32_delegate(FUNC(beathead_state::movie_speedup_r), this)); } diff --git a/src/mame/drivers/berzerk.c b/src/mame/drivers/berzerk.c index 9caf42c5a6b..cc6102b0da6 100644 --- a/src/mame/drivers/berzerk.c +++ b/src/mame/drivers/berzerk.c @@ -582,7 +582,7 @@ READ8_MEMBER(berzerk_state::berzerk_audio_r) static SOUND_RESET(berzerk) { - address_space &space = *machine.device("maincpu")->memory().space(AS_IO); + address_space &space = machine.device("maincpu")->memory().space(AS_IO); berzerk_state *state = machine.driver_data<berzerk_state>(); /* clears the flip-flop controlling the volume and freq on the speech chip */ state->berzerk_audio_w(space, 4, 0x40); @@ -1234,9 +1234,9 @@ ROM_END DRIVER_INIT_MEMBER(berzerk_state,moonwarp) { - address_space *io = machine().device("maincpu")->memory().space(AS_IO); - io->install_read_handler (0x48, 0x48, read8_delegate(FUNC(berzerk_state::moonwarp_p1_r), this)); - io->install_read_handler (0x4a, 0x4a, read8_delegate(FUNC(berzerk_state::moonwarp_p2_r), this)); + address_space &io = machine().device("maincpu")->memory().space(AS_IO); + io.install_read_handler (0x48, 0x48, read8_delegate(FUNC(berzerk_state::moonwarp_p1_r), this)); + io.install_read_handler (0x4a, 0x4a, read8_delegate(FUNC(berzerk_state::moonwarp_p2_r), this)); } /************************************* diff --git a/src/mame/drivers/bfm_sc2.c b/src/mame/drivers/bfm_sc2.c index cfac3fa6354..ee7c9013253 100644 --- a/src/mame/drivers/bfm_sc2.c +++ b/src/mame/drivers/bfm_sc2.c @@ -3692,7 +3692,7 @@ WRITE8_MEMBER(bfm_sc2_state::dmd_reset_w) MACHINE_START_MEMBER(bfm_sc2_state,sc2dmd) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_write_handler(0x2800, 0x2800, 0, 0, write8_delegate(FUNC(bfm_sc2_state::vfd1_dmd_w),this)); space.install_write_handler(0x2900, 0x2900, 0, 0, write8_delegate(FUNC(bfm_sc2_state::dmd_reset_w),this)); } diff --git a/src/mame/drivers/btime.c b/src/mame/drivers/btime.c index 38d01f02fc3..ec69a3ef534 100644 --- a/src/mame/drivers/btime.c +++ b/src/mame/drivers/btime.c @@ -2038,7 +2038,7 @@ ROM_END static void decrypt_C10707_cpu(running_machine &machine, const char *cputag) { - address_space &space = *machine.device(cputag)->memory().space(AS_PROGRAM); + address_space &space = machine.device(cputag)->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *rom = machine.root_device().memregion(cputag)->base(); offs_t addr; @@ -2068,7 +2068,7 @@ READ8_MEMBER(btime_state::wtennis_reset_hack_r) static void init_rom1(running_machine &machine) { - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = machine.root_device().memregion("maincpu")->base(); decrypted = auto_alloc_array(machine, UINT8, 0x10000); @@ -2136,7 +2136,7 @@ DRIVER_INIT_MEMBER(btime_state,cookrace) { decrypt_C10707_cpu(machine(), "maincpu"); - machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0200, 0x0fff, "bank10"); + machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_bank(0x0200, 0x0fff, "bank10"); membank("bank10")->set_base(memregion("audiocpu")->base() + 0xe200); m_audio_nmi_enable_type = AUDIO_ENABLE_DIRECT; } @@ -2151,9 +2151,9 @@ DRIVER_INIT_MEMBER(btime_state,wtennis) { decrypt_C10707_cpu(machine(), "maincpu"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc15f, 0xc15f, read8_delegate(FUNC(btime_state::wtennis_reset_hack_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc15f, 0xc15f, read8_delegate(FUNC(btime_state::wtennis_reset_hack_r),this)); - machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0200, 0x0fff, "bank10"); + machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_bank(0x0200, 0x0fff, "bank10"); membank("bank10")->set_base(memregion("audiocpu")->base() + 0xe200); m_audio_nmi_enable_type = AUDIO_ENABLE_AY8910; } diff --git a/src/mame/drivers/bublbobl.c b/src/mame/drivers/bublbobl.c index dd5340ab224..362474398c7 100644 --- a/src/mame/drivers/bublbobl.c +++ b/src/mame/drivers/bublbobl.c @@ -1568,7 +1568,7 @@ DRIVER_INIT_MEMBER(bublbobl_state,tokiob) { DRIVER_INIT_CALL(tokio); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfe00, 0xfe00, read8_delegate(FUNC(bublbobl_state::tokiob_mcu_r),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfe00, 0xfe00, read8_delegate(FUNC(bublbobl_state::tokiob_mcu_r),this) ); } DRIVER_INIT_MEMBER(bublbobl_state,dland) diff --git a/src/mame/drivers/bzone.c b/src/mame/drivers/bzone.c index b16256cf7ac..ff1a3881fab 100644 --- a/src/mame/drivers/bzone.c +++ b/src/mame/drivers/bzone.c @@ -876,7 +876,7 @@ WRITE8_MEMBER(bzone_state::analog_select_w) DRIVER_INIT_MEMBER(bzone_state,bradley) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.install_ram(0x400, 0x7ff); space.install_read_port(0x1808, 0x1808, "1808"); space.install_read_port(0x1809, 0x1809, "1809"); diff --git a/src/mame/drivers/cabal.c b/src/mame/drivers/cabal.c index fc1fd29bf22..1b9c78670c4 100644 --- a/src/mame/drivers/cabal.c +++ b/src/mame/drivers/cabal.c @@ -848,7 +848,7 @@ ROM_END static void seibu_sound_bootleg(running_machine &machine,const char *cpu,int length) { - address_space &space = *machine.device(cpu)->memory().space(AS_PROGRAM); + address_space &space = machine.device(cpu)->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine, UINT8, length); UINT8 *rom = machine.root_device().memregion(cpu)->base(); diff --git a/src/mame/drivers/calchase.c b/src/mame/drivers/calchase.c index d274b3c6ece..c946f720c21 100644 --- a/src/mame/drivers/calchase.c +++ b/src/mame/drivers/calchase.c @@ -977,14 +977,14 @@ DRIVER_INIT_MEMBER(calchase_state,calchase) m_bios_ram = auto_alloc_array(machine(), UINT32, 0x20000/4); pc_vga_init(machine(), vga_setting, NULL); - pc_svga_trident_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, *machine().device("maincpu")->memory().space(AS_IO), 0x0000); + pc_svga_trident_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0xa0000, machine().device("maincpu")->memory().space(AS_IO), 0x0000); init_pc_common(machine(), PCCOMMON_KEYBOARD_AT, calchase_set_keyb_int); intel82439tx_init(machine()); kbdc8042_init(machine(), &at8042); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x3f0b160, 0x3f0b163, read32_delegate(FUNC(calchase_state::calchase_idle_skip_r),this), write32_delegate(FUNC(calchase_state::calchase_idle_skip_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x3f0b160, 0x3f0b163, read32_delegate(FUNC(calchase_state::calchase_idle_skip_r),this), write32_delegate(FUNC(calchase_state::calchase_idle_skip_w),this)); } ROM_START( calchase ) diff --git a/src/mame/drivers/calorie.c b/src/mame/drivers/calorie.c index 3250b726791..dbd33958a24 100644 --- a/src/mame/drivers/calorie.c +++ b/src/mame/drivers/calorie.c @@ -554,7 +554,7 @@ DRIVER_INIT_MEMBER(calorie_state,calorie) DRIVER_INIT_MEMBER(calorie_state,calorieb) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.set_decrypted_region(0x0000, 0x7fff, machine().root_device().memregion("maincpu")->base() + 0x10000); } diff --git a/src/mame/drivers/cd32.c b/src/mame/drivers/cd32.c index d126a1b546b..3df964fc055 100644 --- a/src/mame/drivers/cd32.c +++ b/src/mame/drivers/cd32.c @@ -1438,7 +1438,7 @@ static void serial_w(running_machine &machine, UINT16 data) cd32_state *state = machine.driver_data<cd32_state>(); UINT8 data8 = data & 0xff; if ( data8 != 0x00 ) - state->m_microtouch->rx(*machine.memory().first_space(), 0, data8); + state->m_microtouch->rx(machine.driver_data()->generic_space(), 0, data8); } WRITE8_MEMBER (cd32_state::microtouch_tx) diff --git a/src/mame/drivers/cham24.c b/src/mame/drivers/cham24.c index 60bd543b4d7..85efaff2fad 100644 --- a/src/mame/drivers/cham24.c +++ b/src/mame/drivers/cham24.c @@ -322,7 +322,7 @@ void cham24_state::machine_start() memcpy(&dst[0xc000], &src[0x0f8000], 0x4000); /* uses 8K swapping, all ROM!*/ - machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "bank1"); + machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "bank1"); membank("bank1")->set_base(memregion("gfx1")->base()); /* need nametable ram, though. I doubt this uses more than 2k, but it starts up configured for 4 */ @@ -333,7 +333,7 @@ void cham24_state::machine_start() m_nt_page[3] = m_nt_ram + 0xc00; /* and read/write handlers */ - machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff,read8_delegate(FUNC(cham24_state::nt_r), this), write8_delegate(FUNC(cham24_state::nt_w), this)); + machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff,read8_delegate(FUNC(cham24_state::nt_r), this), write8_delegate(FUNC(cham24_state::nt_w), this)); } DRIVER_INIT_MEMBER(cham24_state,cham24) diff --git a/src/mame/drivers/chihiro.c b/src/mame/drivers/chihiro.c index f239d696da6..8039c356d3b 100644 --- a/src/mame/drivers/chihiro.c +++ b/src/mame/drivers/chihiro.c @@ -448,7 +448,7 @@ public: memset(pmc,0,sizeof(pmc)); memset(ramin,0,sizeof(ramin)); computedilated(); - video_memory=(UINT32 *)machine.firstcpu->space()->get_read_ptr(0xf0000000); + video_memory=(UINT32 *)machine.firstcpu->space().get_read_ptr(0xf0000000); fb.allocate(640,480); objectdata=&(object_data_alloc()); objectdata->data=this; @@ -717,7 +717,7 @@ static void jamtable_disasm(running_machine &machine, address_space &space,UINT3 static void jamtable_disasm_command(running_machine &machine, int ref, int params, const char **param) { - address_space &space=*machine.firstcpu->space(); + address_space &space=machine.firstcpu->space(); UINT64 addr,size; if (params < 2) @@ -731,7 +731,7 @@ static void jamtable_disasm_command(running_machine &machine, int ref, int param static void dump_string_command(running_machine &machine, int ref, int params, const char **param) { - address_space &space=*machine.firstcpu->space(); + address_space &space=machine.firstcpu->space(); UINT64 addr; offs_t address; UINT32 length,maximumlength; @@ -770,7 +770,7 @@ static void dump_string_command(running_machine &machine, int ref, int params, c static void dump_process_command(running_machine &machine, int ref, int params, const char **param) { - address_space &space=*machine.firstcpu->space(); + address_space &space=machine.firstcpu->space(); UINT64 addr; offs_t address; @@ -796,7 +796,7 @@ static void dump_process_command(running_machine &machine, int ref, int params, static void dump_list_command(running_machine &machine, int ref, int params, const char **param) { - address_space &space=*machine.firstcpu->space(); + address_space &space=machine.firstcpu->space(); UINT64 addr,offs,start,old; offs_t address,offset; @@ -1365,8 +1365,8 @@ static const char *const usbregnames[]={ READ32_MEMBER( chihiro_state::usbctrl_r ) { if (offset == 0) { /* hack needed until usb (and jvs) is implemented */ - chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x6a79f,0x01); - chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x6a7a0,0x00); + chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x6a79f,0x01); + chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x6a7a0,0x00); } #ifdef LOG_OHCI if (offset >= 0x54/4) @@ -1689,10 +1689,10 @@ int chihiro_state::smbus_eeprom(int command,int rw,int data) // hack to avoid hanging if eeprom contents are not correct // this would need dumping the serial eeprom on the xbox board if (command == 0) { - chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b744,0x90); - chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b745,0x90); - chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b766,0xc9); - chihiro_devs.pic8259_1->machine().firstcpu->space(0)->write_byte(0x3b767,0xc3); + chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b744,0x90); + chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b745,0x90); + chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b766,0xc9); + chihiro_devs.pic8259_1->machine().firstcpu->space(0).write_byte(0x3b767,0xc3); } data = dummyeeprom[command]+dummyeeprom[command+1]*256; logerror("eeprom: %d %d %d\n",command,rw,data); diff --git a/src/mame/drivers/cinemat.c b/src/mame/drivers/cinemat.c index 171c4dae2d1..3beeaf7ebc4 100644 --- a/src/mame/drivers/cinemat.c +++ b/src/mame/drivers/cinemat.c @@ -1448,34 +1448,34 @@ ROM_END DRIVER_INIT_MEMBER(cinemat_state,speedfrk) { m_gear = 0xe; - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x03, read8_delegate(FUNC(cinemat_state::speedfrk_wheel_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x04, 0x06, read8_delegate(FUNC(cinemat_state::speedfrk_gear_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x03, read8_delegate(FUNC(cinemat_state::speedfrk_wheel_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x04, 0x06, read8_delegate(FUNC(cinemat_state::speedfrk_gear_r),this)); } DRIVER_INIT_MEMBER(cinemat_state,sundance) { - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x00, 0x0f, read8_delegate(FUNC(cinemat_state::sundance_inputs_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x00, 0x0f, read8_delegate(FUNC(cinemat_state::sundance_inputs_r),this)); } DRIVER_INIT_MEMBER(cinemat_state,tailg) { - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this)); } DRIVER_INIT_MEMBER(cinemat_state,boxingb) { - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0c, 0x0f, read8_delegate(FUNC(cinemat_state::boxingb_dial_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0c, 0x0f, read8_delegate(FUNC(cinemat_state::boxingb_dial_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x07, 0x07, write8_delegate(FUNC(cinemat_state::mux_select_w),this)); } DRIVER_INIT_MEMBER(cinemat_state,qb3) { - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0f, 0x0f, read8_delegate(FUNC(cinemat_state::qb3_frame_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x00, 0x00, write8_delegate(FUNC(cinemat_state::qb3_ram_bank_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0f, 0x0f, read8_delegate(FUNC(cinemat_state::qb3_frame_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x00, 0x00, write8_delegate(FUNC(cinemat_state::qb3_ram_bank_w),this)); membank("bank1")->configure_entries(0, 4, m_rambase, 0x100*2); } diff --git a/src/mame/drivers/cischeat.c b/src/mame/drivers/cischeat.c index 5f9239f40eb..1aaacc4deb1 100644 --- a/src/mame/drivers/cischeat.c +++ b/src/mame/drivers/cischeat.c @@ -2481,7 +2481,7 @@ ROM_END DRIVER_INIT_MEMBER(cischeat_state,wildplt) { - machine().device("cpu1")->memory().space(AS_PROGRAM)->install_read_handler(0x080000, 0x087fff, read16_delegate(FUNC(cischeat_state::wildplt_vregs_r),this)); + machine().device("cpu1")->memory().space(AS_PROGRAM).install_read_handler(0x080000, 0x087fff, read16_delegate(FUNC(cischeat_state::wildplt_vregs_r),this)); DRIVER_INIT_CALL(f1gpstar); } diff --git a/src/mame/drivers/cninja.c b/src/mame/drivers/cninja.c index d96313a04dc..703c032106d 100644 --- a/src/mame/drivers/cninja.c +++ b/src/mame/drivers/cninja.c @@ -2083,13 +2083,13 @@ static void cninja_patch( running_machine &machine ) DRIVER_INIT_MEMBER(cninja_state,cninja) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::cninja_sound_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::cninja_sound_w),this)); cninja_patch(machine()); } DRIVER_INIT_MEMBER(cninja_state,stoneage) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::stoneage_sound_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1bc0a8, 0x1bc0a9, write16_delegate(FUNC(cninja_state::stoneage_sound_w),this)); } DRIVER_INIT_MEMBER(cninja_state,mutantf) diff --git a/src/mame/drivers/combatsc.c b/src/mame/drivers/combatsc.c index e6a41994ff1..55178aaa616 100644 --- a/src/mame/drivers/combatsc.c +++ b/src/mame/drivers/combatsc.c @@ -707,7 +707,7 @@ MACHINE_START_MEMBER(combatsc_state,combatscb) void combatsc_state::machine_reset() { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int i; memset(m_io_ram, 0x00, 0x4000); @@ -991,7 +991,7 @@ ROM_END DRIVER_INIT_MEMBER(combatsc_state,combatsc) { /* joystick instead of trackball */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x0404, 0x0404, "IN1"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x0404, 0x0404, "IN1"); } diff --git a/src/mame/drivers/commando.c b/src/mame/drivers/commando.c index 53dd2b50f7e..cd41223bbd4 100644 --- a/src/mame/drivers/commando.c +++ b/src/mame/drivers/commando.c @@ -511,7 +511,7 @@ ROM_END DRIVER_INIT_MEMBER(commando_state,commando) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = machine().root_device().memregion("maincpu")->base(); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000); int A; @@ -531,7 +531,7 @@ DRIVER_INIT_MEMBER(commando_state,commando) DRIVER_INIT_MEMBER(commando_state,spaceinv) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = machine().root_device().memregion("maincpu")->base(); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0xc000); int A; diff --git a/src/mame/drivers/coolpool.c b/src/mame/drivers/coolpool.c index b8913bc56f7..458a042dba2 100644 --- a/src/mame/drivers/coolpool.c +++ b/src/mame/drivers/coolpool.c @@ -1184,7 +1184,7 @@ DRIVER_INIT_MEMBER(coolpool_state,amerdart) DRIVER_INIT_MEMBER(coolpool_state,coolpool) { - machine().device("dsp")->memory().space(AS_IO)->install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this)); + machine().device("dsp")->memory().space(AS_IO).install_read_handler(0x07, 0x07, read16_delegate(FUNC(coolpool_state::coolpool_input_r),this)); register_state_save(machine()); } diff --git a/src/mame/drivers/coolridr.c b/src/mame/drivers/coolridr.c index d6fd3bad0c9..69a981dea20 100644 --- a/src/mame/drivers/coolridr.c +++ b/src/mame/drivers/coolridr.c @@ -1252,8 +1252,8 @@ READ32_MEMBER(coolridr_state::coolridr_hack2_r) DRIVER_INIT_MEMBER(coolridr_state,coolridr) { -// machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x60d88a4, 0x060d88a7, FUNC(coolridr_hack1_r) ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x60d8894, 0x060d8897, read32_delegate(FUNC(coolridr_state::coolridr_hack2_r), this)); +// machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x60d88a4, 0x060d88a7, FUNC(coolridr_hack1_r) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x60d8894, 0x060d8897, read32_delegate(FUNC(coolridr_state::coolridr_hack2_r), this)); } GAME( 1995, coolridr, 0, coolridr, coolridr, coolridr_state, coolridr, ROT0, "Sega", "Cool Riders (US)",GAME_NOT_WORKING|GAME_NO_SOUND ) diff --git a/src/mame/drivers/cosmic.c b/src/mame/drivers/cosmic.c index 0bd0a1fb3e1..291e6a1a2bd 100644 --- a/src/mame/drivers/cosmic.c +++ b/src/mame/drivers/cosmic.c @@ -411,7 +411,7 @@ ADDRESS_MAP_END INPUT_CHANGED_MEMBER(cosmic_state::panic_coin_inserted) { - panic_sound_output_w(*machine().device("maincpu")->memory().space(AS_PROGRAM), 17, newval == 0); + panic_sound_output_w(machine().device("maincpu")->memory().space(AS_PROGRAM), 17, newval == 0); } static INPUT_PORTS_START( panic ) @@ -1538,17 +1538,17 @@ DRIVER_INIT_MEMBER(cosmic_state,cosmica) DRIVER_INIT_MEMBER(cosmic_state,devzone) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4807, 0x4807,write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4807, 0x4807,write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this)); } DRIVER_INIT_MEMBER(cosmic_state,nomnlnd) { dac_device *dac = machine().device<dac_device>("dac"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x5000, 0x5001, read8_delegate(FUNC(cosmic_state::nomnlnd_port_0_1_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x4800, 0x4800); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x4807, 0x4807, write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x480a, 0x480a, write8_delegate(FUNC(dac_device::write_unsigned8),dac)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x5000, 0x5001, read8_delegate(FUNC(cosmic_state::nomnlnd_port_0_1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x4800, 0x4800); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x4807, 0x4807, write8_delegate(FUNC(cosmic_state::cosmic_background_enable_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x480a, 0x480a, write8_delegate(FUNC(dac_device::write_unsigned8),dac)); } DRIVER_INIT_MEMBER(cosmic_state,panic) diff --git a/src/mame/drivers/cps1.c b/src/mame/drivers/cps1.c index 16ab40ea26a..3ec4506ece8 100644 --- a/src/mame/drivers/cps1.c +++ b/src/mame/drivers/cps1.c @@ -10698,10 +10698,10 @@ DRIVER_INIT_MEMBER(cps_state,forgottn) /* Forgotten Worlds has a NEC uPD4701AC on the B-board handling dial inputs from the CN-MOWS connector. */ /* The memory mapping is handled by PAL LWIO */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x800040, 0x800041, write16_delegate(FUNC(cps_state::forgottn_dial_0_reset_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(cps_state::forgottn_dial_1_reset_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x800052, 0x800055, read16_delegate(FUNC(cps_state::forgottn_dial_0_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80005a, 0x80005d, read16_delegate(FUNC(cps_state::forgottn_dial_1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800040, 0x800041, write16_delegate(FUNC(cps_state::forgottn_dial_0_reset_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x800048, 0x800049, write16_delegate(FUNC(cps_state::forgottn_dial_1_reset_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800052, 0x800055, read16_delegate(FUNC(cps_state::forgottn_dial_0_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80005a, 0x80005d, read16_delegate(FUNC(cps_state::forgottn_dial_1_r),this)); save_item(NAME(m_dial)); @@ -10715,8 +10715,8 @@ DRIVER_INIT_MEMBER(cps_state,sf2ee) { /* This specific revision of SF2 has the CPS-B custom mapped at a different address. */ /* The mapping is handled by the PAL IOB2 on the B-board */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_readwrite(0x800140, 0x80017f); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_readwrite(0x800140, 0x80017f); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this)); DRIVER_INIT_CALL(cps1); } @@ -10724,7 +10724,7 @@ DRIVER_INIT_MEMBER(cps_state,sf2ee) DRIVER_INIT_MEMBER(cps_state,sf2thndr) { /* This particular hack uses a modified B-board PAL which mirrors the CPS-B registers at an alternate address */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x8001c0, 0x8001ff, read16_delegate(FUNC(cps_state::cps1_cps_b_r),this), write16_delegate(FUNC(cps_state::cps1_cps_b_w),this)); DRIVER_INIT_CALL(cps1); } @@ -10732,7 +10732,7 @@ DRIVER_INIT_MEMBER(cps_state,sf2thndr) DRIVER_INIT_MEMBER(cps_state,sf2hack) { /* some SF2 hacks have some inputs wired to the LSB instead of MSB */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x800018, 0x80001f, read16_delegate(FUNC(cps_state::cps1_hack_dsw_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x800018, 0x80001f, read16_delegate(FUNC(cps_state::cps1_hack_dsw_r),this)); DRIVER_INIT_CALL(cps1); } @@ -10765,7 +10765,7 @@ DRIVER_INIT_MEMBER(cps_state,pang3b) { /* Pang 3 is the only non-QSound game to have an EEPROM. */ /* It is mapped in the CPS-B address range so probably is on the C-board. */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_port(0x80017a, 0x80017b, "EEPROMIN", "EEPROMOUT"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_port(0x80017a, 0x80017b, "EEPROMIN", "EEPROMOUT"); DRIVER_INIT_CALL(cps1); } @@ -10815,11 +10815,11 @@ DRIVER_INIT_MEMBER(cps_state,sf2mdt) rom[i + 3] = rom[i + 6]; rom[i + 6] = tmp; } - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c01a, 0x70c01b, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c01c, 0x70c01d, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c01e, 0x70c01f, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c010, 0x70c011, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x70c018, 0x70c019, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c01a, 0x70c01b, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c01c, 0x70c01d, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c01e, 0x70c01f, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c010, 0x70c011, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x70c018, 0x70c019, read16_delegate(FUNC(cps_state::sf2mdt_r),this)); DRIVER_INIT_CALL(cps1); } @@ -10827,7 +10827,7 @@ DRIVER_INIT_MEMBER(cps_state,sf2mdt) DRIVER_INIT_MEMBER(cps_state,dinohunt) { // is this shared with the new sound hw? - UINT8* ram = (UINT8*)machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0xf18000, 0xf19fff); + UINT8* ram = (UINT8*)machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0xf18000, 0xf19fff); memset(ram,0xff,0x2000); DRIVER_INIT_CALL(cps1); } diff --git a/src/mame/drivers/cps2.c b/src/mame/drivers/cps2.c index fb6cfd38f08..a9bbed77c92 100644 --- a/src/mame/drivers/cps2.c +++ b/src/mame/drivers/cps2.c @@ -8142,7 +8142,7 @@ DRIVER_INIT_MEMBER(cps_state,pzloop2) save_item(NAME(m_readpaddle)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x804000, 0x804001, FUNC(joy_or_paddle_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x804000, 0x804001, FUNC(joy_or_paddle_r)); } static READ16_HANDLER( gigaman2_dummyqsound_r ) @@ -8176,7 +8176,7 @@ static void gigaman2_gfx_reorder(running_machine &machine) DRIVER_INIT_MEMBER(cps_state,gigaman2) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT16 *rom = (UINT16 *)memregion("maincpu")->base(); int length = memregion("maincpu")->bytes(); @@ -8187,7 +8187,7 @@ DRIVER_INIT_MEMBER(cps_state,gigaman2) m_gigaman2_dummyqsound_ram = auto_alloc_array(machine(), UINT16, 0x20000 / 2); save_pointer(NAME(m_gigaman2_dummyqsound_ram), 0x20000 / 2); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x618000, 0x619fff, FUNC(gigaman2_dummyqsound_r), FUNC(gigaman2_dummyqsound_w)); // no qsound.. + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x618000, 0x619fff, FUNC(gigaman2_dummyqsound_r), FUNC(gigaman2_dummyqsound_w)); // no qsound.. space.set_decrypted_region(0x000000, (length) - 1, &rom[length/4]); m68k_set_encrypted_opcode_range(machine().device("maincpu"), 0, length); } diff --git a/src/mame/drivers/cps3.c b/src/mame/drivers/cps3.c index 9236e1638d1..e282e443e00 100644 --- a/src/mame/drivers/cps3.c +++ b/src/mame/drivers/cps3.c @@ -723,8 +723,8 @@ static void init_common(running_machine &machine, UINT32 key1, UINT32 key2, int state->m_0xc0000000_ram_decrypted = auto_alloc_array(machine, UINT32, 0x400/4); - address_space *main = machine.device<sh2_device>("maincpu")->space(AS_PROGRAM); - main->set_direct_update_handler(direct_update_delegate(FUNC(cps3_state::cps3_direct_handler), state)); + address_space &main = machine.device<sh2_device>("maincpu")->space(AS_PROGRAM); + main.set_direct_update_handler(direct_update_delegate(FUNC(cps3_state::cps3_direct_handler), state)); // flash roms astring tempstr; diff --git a/src/mame/drivers/crbaloon.c b/src/mame/drivers/crbaloon.c index e3d22444064..cbad9c243d6 100644 --- a/src/mame/drivers/crbaloon.c +++ b/src/mame/drivers/crbaloon.c @@ -339,7 +339,7 @@ GFXDECODE_END void crbaloon_state::machine_reset() { - address_space &space = *machine().device("maincpu")->memory().space(AS_IO); + address_space &space = machine().device("maincpu")->memory().space(AS_IO); device_t *discrete = machine().device("discrete"); pc3092_reset(); diff --git a/src/mame/drivers/crgolf.c b/src/mame/drivers/crgolf.c index 23714e40ffd..d3ab5c9a4bf 100644 --- a/src/mame/drivers/crgolf.c +++ b/src/mame/drivers/crgolf.c @@ -614,7 +614,7 @@ ROM_END DRIVER_INIT_MEMBER(crgolf_state,crgolfhi) { - machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_write_handler(0xa000, 0xa003, write8_delegate(FUNC(crgolf_state::crgolfhi_sample_w),this)); + machine().device("audiocpu")->memory().space(AS_PROGRAM).install_write_handler(0xa000, 0xa003, write8_delegate(FUNC(crgolf_state::crgolfhi_sample_w),this)); } diff --git a/src/mame/drivers/crimfght.c b/src/mame/drivers/crimfght.c index 6e844038eda..80227c35ad1 100644 --- a/src/mame/drivers/crimfght.c +++ b/src/mame/drivers/crimfght.c @@ -407,12 +407,12 @@ static KONAMI_SETLINES_CALLBACK( crimfght_banking ) /* bit 5 = select work RAM or palette */ if (lines & 0x20) { - device->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x03ff, "bank3"); - device->memory().space(AS_PROGRAM)->install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state)); + device->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x03ff, "bank3"); + device->memory().space(AS_PROGRAM).install_write_handler(0x0000, 0x03ff, write8_delegate(FUNC(crimfght_state::paletteram_xBBBBBGGGGGRRRRR_byte_be_w), state)); state->membank("bank3")->set_base(state->m_generic_paletteram_8); } else - device->memory().space(AS_PROGRAM)->install_readwrite_bank(0x0000, 0x03ff, "bank1"); /* RAM */ + device->memory().space(AS_PROGRAM).install_readwrite_bank(0x0000, 0x03ff, "bank1"); /* RAM */ /* bit 6 = enable char ROM reading through the video RAM */ k052109_set_rmrd_line(state->m_k052109, (lines & 0x40) ? ASSERT_LINE : CLEAR_LINE); diff --git a/src/mame/drivers/crystal.c b/src/mame/drivers/crystal.c index 984a4ee3a27..4e57ce312a0 100644 --- a/src/mame/drivers/crystal.c +++ b/src/mame/drivers/crystal.c @@ -198,7 +198,7 @@ public: static void IntReq( running_machine &machine, int num ) { crystal_state *state = machine.driver_data<crystal_state>(); - address_space &space = *state->m_maincpu->space(AS_PROGRAM); + address_space &space = state->m_maincpu->space(AS_PROGRAM); UINT32 IntEn = space.read_dword(0x01800c08); UINT32 IntPend = space.read_dword(0x01800c0c); if (IntEn & (1 << num)) @@ -276,7 +276,7 @@ WRITE32_MEMBER(crystal_state::IntAck_w) static IRQ_CALLBACK( icallback ) { crystal_state *state = device->machine().driver_data<crystal_state>(); - address_space &space = *device->memory().space(AS_PROGRAM); + address_space &space = device->memory().space(AS_PROGRAM); UINT32 IntPend = space.read_dword(0x01800c0c); int i; @@ -652,7 +652,7 @@ static void SetVidReg( address_space &space, UINT16 reg, UINT16 val ) UINT32 crystal_state::screen_update_crystal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int DoFlip; UINT32 B0 = 0x0; @@ -717,7 +717,7 @@ void crystal_state::screen_eof_crystal(screen_device &screen, bool state) // rising edge if (state) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT16 head, tail; int DoFlip = 0; diff --git a/src/mame/drivers/cshooter.c b/src/mame/drivers/cshooter.c index 468beca3146..57af6e4a257 100644 --- a/src/mame/drivers/cshooter.c +++ b/src/mame/drivers/cshooter.c @@ -676,7 +676,7 @@ DRIVER_INIT_MEMBER(cshooter_state,cshooter) DRIVER_INIT_MEMBER(cshooter_state,cshootere) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int A; UINT8 *rom = machine().root_device().memregion("maincpu")->base(); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); diff --git a/src/mame/drivers/csplayh5.c b/src/mame/drivers/csplayh5.c index 75672633080..0517768ee85 100644 --- a/src/mame/drivers/csplayh5.c +++ b/src/mame/drivers/csplayh5.c @@ -585,7 +585,7 @@ static Z80CTC_INTERFACE( ctc_intf ) void csplayh5_state::machine_reset() { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int i; // initialize TMPZ84C011 PIO diff --git a/src/mame/drivers/darkmist.c b/src/mame/drivers/darkmist.c index 36dcb921d64..bfe87d968bb 100644 --- a/src/mame/drivers/darkmist.c +++ b/src/mame/drivers/darkmist.c @@ -400,7 +400,7 @@ static void decrypt_snd(running_machine &machine) DRIVER_INIT_MEMBER(darkmist_state,darkmist) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int i, len; UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); UINT8 *buffer = auto_alloc_array(machine(), UINT8, 0x10000); diff --git a/src/mame/drivers/ddealer.c b/src/mame/drivers/ddealer.c index 02214341454..3982718db98 100644 --- a/src/mame/drivers/ddealer.c +++ b/src/mame/drivers/ddealer.c @@ -677,7 +677,7 @@ READ16_MEMBER(ddealer_state::ddealer_mcu_r) DRIVER_INIT_MEMBER(ddealer_state,ddealer) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfe01c, 0xfe01d, read16_delegate(FUNC(ddealer_state::ddealer_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfe01c, 0xfe01d, read16_delegate(FUNC(ddealer_state::ddealer_mcu_r), this)); } ROM_START( ddealer ) diff --git a/src/mame/drivers/ddenlovr.c b/src/mame/drivers/ddenlovr.c index 2b745fe619c..f02a8ee485e 100644 --- a/src/mame/drivers/ddenlovr.c +++ b/src/mame/drivers/ddenlovr.c @@ -10122,7 +10122,7 @@ DRIVER_INIT_MEMBER(dynax_state,rongrong) version of the game might be a bootleg with the protection patched. (both sets need this) */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x60d4, 0x60d4); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x60d4, 0x60d4); } /*************************************************************************** @@ -11387,7 +11387,7 @@ ROM_END DRIVER_INIT_MEMBER(dynax_state,momotaro) { - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0xe0, 0xe0, read8_delegate(FUNC(dynax_state::momotaro_protection_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0xe0, 0xe0, read8_delegate(FUNC(dynax_state::momotaro_protection_r),this)); } GAME( 1992, mmpanic, 0, mmpanic, mmpanic, driver_device, 0, ROT0, "Nakanihon / East Technology (Taito license)", "Monkey Mole Panic (USA)", GAME_NO_COCKTAIL | GAME_SUPPORTS_SAVE ) diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 16bbeb7ad44..a84af8c65af 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -2002,7 +2002,7 @@ DRIVER_INIT_MEMBER(ddragon_state,darktowr) m_sound_irq = M6809_IRQ_LINE; m_ym_irq = M6809_FIRQ_LINE; m_technos_video_hw = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::darktowr_bankswitch_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::darktowr_bankswitch_w),this)); } @@ -2014,7 +2014,7 @@ DRIVER_INIT_MEMBER(ddragon_state,toffy) m_sound_irq = M6809_IRQ_LINE; m_ym_irq = M6809_FIRQ_LINE; m_technos_video_hw = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x3808, 0x3808, write8_delegate(FUNC(ddragon_state::toffy_bankswitch_w),this)); /* the program rom has a simple bitswap encryption */ rom = memregion("maincpu")->base(); diff --git a/src/mame/drivers/deadang.c b/src/mame/drivers/deadang.c index 451d1ef46c8..1c24934bf27 100644 --- a/src/mame/drivers/deadang.c +++ b/src/mame/drivers/deadang.c @@ -422,8 +422,8 @@ DRIVER_INIT_MEMBER(deadang_state,ghunter) seibu_adpcm_decrypt(machine(), "adpcm1"); seibu_adpcm_decrypt(machine(), "adpcm2"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80000, 0x80001, read16_delegate(FUNC(deadang_state::ghunter_trackball_low_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xb0000, 0xb0001, read16_delegate(FUNC(deadang_state::ghunter_trackball_high_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80000, 0x80001, read16_delegate(FUNC(deadang_state::ghunter_trackball_low_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xb0000, 0xb0001, read16_delegate(FUNC(deadang_state::ghunter_trackball_high_r),this)); } /* Game Drivers */ diff --git a/src/mame/drivers/dec0.c b/src/mame/drivers/dec0.c index 60c84931edf..ebb425a486a 100644 --- a/src/mame/drivers/dec0.c +++ b/src/mame/drivers/dec0.c @@ -422,7 +422,7 @@ READ16_MEMBER(dec0_state::slyspy_state_r) void slyspy_set_protection_map(running_machine& machine, int type) { dec0_state *state = machine.driver_data<dec0_state>(); - address_space& space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space& space = machine.device("maincpu")->memory().space(AS_PROGRAM); deco_bac06_device *tilegen1 = (deco_bac06_device*)state->m_tilegen1; deco_bac06_device *tilegen2 = (deco_bac06_device*)state->m_tilegen2; @@ -3043,10 +3043,10 @@ ROM_END DRIVER_INIT_MEMBER(dec0_state,midresb) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x00180000, 0x0018000f, read16_delegate(FUNC(dec0_state::dec0_controls_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x001a0000, 0x001a000f, read16_delegate(FUNC(dec0_state::dec0_rotary_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x00180000, 0x0018000f, read16_delegate(FUNC(dec0_state::dec0_controls_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x001a0000, 0x001a000f, read16_delegate(FUNC(dec0_state::dec0_rotary_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x00180014, 0x00180015, write16_delegate(FUNC(dec0_state::midres_sound_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x00180014, 0x00180015, write16_delegate(FUNC(dec0_state::midres_sound_w),this)); } /******************************************************************************/ diff --git a/src/mame/drivers/dec8.c b/src/mame/drivers/dec8.c index a2f3560821f..e740cac8c3b 100644 --- a/src/mame/drivers/dec8.c +++ b/src/mame/drivers/dec8.c @@ -71,7 +71,7 @@ void dec8_state::screen_eof_dec8(screen_device &screen, bool state) // rising edge if (state) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); dec8_mxc06_karn_buffer_spriteram_w(space, 0, 0); } } @@ -3524,7 +3524,7 @@ DRIVER_INIT_MEMBER(dec8_state,dec8) /* Ghostbusters, Darwin, Oscar use a "Deco 222" custom 6502 for sound. */ DRIVER_INIT_MEMBER(dec8_state,deco222) { - address_space &space = *machine().device("audiocpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("audiocpu")->memory().space(AS_PROGRAM); int A; UINT8 *decrypt; UINT8 *rom; diff --git a/src/mame/drivers/deco32.c b/src/mame/drivers/deco32.c index 410dc01da5c..08c6b1b9e65 100644 --- a/src/mame/drivers/deco32.c +++ b/src/mame/drivers/deco32.c @@ -506,7 +506,7 @@ WRITE32_MEMBER(deco32_state::tattass_prot_w) WRITE32_MEMBER(deco32_state::tattass_control_w) { eeprom_device *eeprom = machine().device<eeprom_device>("eeprom"); - address_space *eeprom_space = eeprom->space(); + address_space &eeprom_space = eeprom->space(); /* Eprom in low byte */ if (mem_mask==0x000000ff) { /* Byte write to low byte only (different from word writing including low byte) */ @@ -556,7 +556,7 @@ WRITE32_MEMBER(deco32_state::tattass_control_w) int d=m_readBitCount/8; int m=7-(m_readBitCount%8); int a=(m_byteAddr+d)%1024; - int b=eeprom_space->read_byte(a); + int b=eeprom_space.read_byte(a); m_tattass_eprom_bit=(b>>m)&1; @@ -573,7 +573,7 @@ WRITE32_MEMBER(deco32_state::tattass_control_w) int b=(m_buffer[24]<<7)|(m_buffer[25]<<6)|(m_buffer[26]<<5)|(m_buffer[27]<<4) |(m_buffer[28]<<3)|(m_buffer[29]<<2)|(m_buffer[30]<<1)|(m_buffer[31]<<0); - eeprom_space->write_byte(m_byteAddr, b); + eeprom_space.write_byte(m_byteAddr, b); } m_lastClock=data&0x20; return; @@ -588,7 +588,7 @@ WRITE32_MEMBER(deco32_state::tattass_control_w) /* Check for read command */ if (m_buffer[0] && m_buffer[1]) { - m_tattass_eprom_bit=(eeprom_space->read_byte(m_byteAddr)>>7)&1; + m_tattass_eprom_bit=(eeprom_space.read_byte(m_byteAddr)>>7)&1; m_readBitCount=1; m_pendingCommand=1; } diff --git a/src/mame/drivers/deco_mlc.c b/src/mame/drivers/deco_mlc.c index 73e699b3150..038c31d3e86 100644 --- a/src/mame/drivers/deco_mlc.c +++ b/src/mame/drivers/deco_mlc.c @@ -738,7 +738,7 @@ DRIVER_INIT_MEMBER(deco_mlc_state,avengrgs) sh2drc_add_pcflush(machine().device("maincpu"), 0x32dc); m_mainCpuIsArm = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x01089a0, 0x01089a3, read32_delegate(FUNC(deco_mlc_state::avengrgs_speedup_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x01089a0, 0x01089a3, read32_delegate(FUNC(deco_mlc_state::avengrgs_speedup_r),this)); descramble_sound(machine()); } diff --git a/src/mame/drivers/decocass.c b/src/mame/drivers/decocass.c index aa79aa04228..7393720ab97 100644 --- a/src/mame/drivers/decocass.c +++ b/src/mame/drivers/decocass.c @@ -1600,7 +1600,7 @@ ROM_END DRIVER_INIT_MEMBER(decocass_state,decocass) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); int A; @@ -1638,8 +1638,8 @@ DRIVER_INIT_MEMBER(decocass_state,decocrom) m_decrypted2[i] = swap_bits_5_6(rom[i]); /* convert charram to a banked ROM */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x6000, 0xafff, "bank1"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x6000, 0xafff, FUNC(decocass_de0091_w)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x6000, 0xafff, "bank1"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x6000, 0xafff, FUNC(decocass_de0091_w)); membank("bank1")->configure_entry(0, m_charram); membank("bank1")->configure_entry(1, memregion("user3")->base()); membank("bank1")->configure_decrypted_entry(0, &m_decrypted[0x6000]); @@ -1647,7 +1647,7 @@ DRIVER_INIT_MEMBER(decocass_state,decocrom) membank("bank1")->set_entry(0); /* install the bank selector */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xe900, 0xe900, FUNC(decocass_e900_w)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xe900, 0xe900, FUNC(decocass_e900_w)); save_pointer(NAME(m_decrypted2), romlength); } @@ -1685,8 +1685,8 @@ DRIVER_INIT_MEMBER(decocass_state,cdsteljn) DRIVER_INIT_CALL(decocass); /* install custom mahjong panel */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0xe413, 0xe413, FUNC(cdsteljn_mux_w)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xe600, 0xe6ff, FUNC(cdsteljn_input_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0xe413, 0xe413, FUNC(cdsteljn_mux_w)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xe600, 0xe6ff, FUNC(cdsteljn_input_r)); } /* -- */ GAME( 1981, decocass, 0, decocass, decocass, decocass_state, decocass, ROT270, "Data East Corporation", "DECO Cassette System", GAME_IS_BIOS_ROOT ) diff --git a/src/mame/drivers/deshoros.c b/src/mame/drivers/deshoros.c index e50116107be..4f56c326f4e 100644 --- a/src/mame/drivers/deshoros.c +++ b/src/mame/drivers/deshoros.c @@ -253,7 +253,7 @@ void destiny_state::machine_start() void destiny_state::machine_reset() { - bank_select_w(*m_maincpu->space(AS_PROGRAM), 0, 0); + bank_select_w(m_maincpu->space(AS_PROGRAM), 0, 0); } static MACHINE_CONFIG_START( destiny, destiny_state ) diff --git a/src/mame/drivers/dfruit.c b/src/mame/drivers/dfruit.c index d79b507ab03..f82966f6c8a 100644 --- a/src/mame/drivers/dfruit.c +++ b/src/mame/drivers/dfruit.c @@ -136,14 +136,14 @@ WRITE8_MEMBER(dfruit_state::dfruit_ram_bank_w) UINT8 dfruit_state::ram_bank_r(UINT16 offset, UINT8 bank_num) { - address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); - return vdp_space->read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);; + address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); + return vdp_space.read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);; } void dfruit_state::ram_bank_w(UINT16 offset, UINT8 data, UINT8 bank_num) { - address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); - vdp_space->write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);; + address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); + vdp_space.write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);; } READ8_MEMBER(dfruit_state::dfruit_ram_0_r) { return ram_bank_r(offset, 0); } diff --git a/src/mame/drivers/dgpix.c b/src/mame/drivers/dgpix.c index aa5f977b676..e3076a60e02 100644 --- a/src/mame/drivers/dgpix.c +++ b/src/mame/drivers/dgpix.c @@ -584,7 +584,7 @@ DRIVER_INIT_MEMBER(dgpix_state,xfiles) rom[BYTE4_XOR_BE(0x3aa933)] = 0; // protection related ? -// machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0xf0c8b440, 0xf0c8b447); +// machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0xf0c8b440, 0xf0c8b447); m_flash_roms = 2; } @@ -604,7 +604,7 @@ DRIVER_INIT_MEMBER(dgpix_state,kdynastg) rom[BYTE4_XOR_BE(0x3a45c9)] = 0; // protection related ? -// machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x12341234, 0x12341243); +// machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x12341234, 0x12341243); m_flash_roms = 4; } diff --git a/src/mame/drivers/dkong.c b/src/mame/drivers/dkong.c index c6cf1f6a1f3..48fc5830727 100644 --- a/src/mame/drivers/dkong.c +++ b/src/mame/drivers/dkong.c @@ -519,8 +519,8 @@ READ8_MEMBER(dkong_state::hb_dma_read_byte) fatalerror("hb_dma_read_byte - unmapped access for 0x%02x - bucket 0x%02x\n", offset, bucket); addr = ((bucket << 7) & 0x7c00) | (offset & 0x3ff); - address_space *prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM); - return prog_space->read_byte(addr); + address_space &prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM); + return prog_space.read_byte(addr); } WRITE8_MEMBER(dkong_state::hb_dma_write_byte) @@ -532,8 +532,8 @@ WRITE8_MEMBER(dkong_state::hb_dma_write_byte) fatalerror("hb_dma_read_byte - unmapped access for 0x%02x - bucket 0x%02x\n", offset, bucket); addr = ((bucket << 7) & 0x7c00) | (offset & 0x3ff); - address_space *prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM); - prog_space->write_byte(addr, data); + address_space &prog_space = machine().device("maincpu")->memory().space(AS_PROGRAM); + prog_space.write_byte(addr, data); } READ8_MEMBER(dkong_state::p8257_ctl_r) @@ -3097,7 +3097,7 @@ DRIVER_INIT_MEMBER(dkong_state,drakton) {7,1,4,0,3,6,2,5}, }; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" ); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little @@ -3119,7 +3119,7 @@ DRIVER_INIT_MEMBER(dkong_state,strtheat) {6,3,4,1,0,7,2,5}, }; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1" ); /* While the PAL supports up to 16 decryption methods, only four are actually used in the PAL. Therefore, we'll take a little @@ -3130,20 +3130,20 @@ DRIVER_INIT_MEMBER(dkong_state,strtheat) drakton_decrypt_rom(machine(), 0x88, 0x1c000, bs[3]); /* custom handlers supporting Joystick or Steering Wheel */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7c00, 0x7c00, read8_delegate(FUNC(dkong_state::strtheat_inputport_0_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7c80, 0x7c80, read8_delegate(FUNC(dkong_state::strtheat_inputport_1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7c00, 0x7c00, read8_delegate(FUNC(dkong_state::strtheat_inputport_0_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7c80, 0x7c80, read8_delegate(FUNC(dkong_state::strtheat_inputport_1_r),this)); } DRIVER_INIT_MEMBER(dkong_state,dkongx) { UINT8 *decrypted; - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); decrypted = auto_alloc_array(machine(), UINT8, 0x10000); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x5fff, "bank1" ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xffff, "bank2" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x5fff, "bank1" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xffff, "bank2" ); space.install_write_handler(0xe000, 0xe000, write8_delegate(FUNC(dkong_state::braze_a15_w),this)); diff --git a/src/mame/drivers/dynax.c b/src/mame/drivers/dynax.c index 4c664b96d81..c4831c7c8b0 100644 --- a/src/mame/drivers/dynax.c +++ b/src/mame/drivers/dynax.c @@ -6477,7 +6477,7 @@ ROM_END DRIVER_INIT_MEMBER(dynax_state,mjreach) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x10060, 0x10060, write8_delegate(FUNC(dynax_state::yarunara_flipscreen_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x10060, 0x10060, write8_delegate(FUNC(dynax_state::yarunara_flipscreen_w),this)); } /*************************************************************************** diff --git a/src/mame/drivers/eolith.c b/src/mame/drivers/eolith.c index 547d9b152af..9e1004d51ad 100644 --- a/src/mame/drivers/eolith.c +++ b/src/mame/drivers/eolith.c @@ -1481,15 +1481,15 @@ DRIVER_INIT_MEMBER(eolith_state,hidctch2) DRIVER_INIT_MEMBER(eolith_state,hidctch3) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xfc200000, 0xfc200003); // this generates pens vibration + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xfc200000, 0xfc200003); // this generates pens vibration // It is not clear why the first reads are needed too - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfce00000, 0xfce00003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfce80000, 0xfce80003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfce00000, 0xfce00003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfce80000, 0xfce80003, read32_delegate(FUNC(eolith_state::hidctch3_pen1_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfcf00000, 0xfcf00003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xfcf80000, 0xfcf80003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfcf00000, 0xfcf00003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xfcf80000, 0xfcf80003, read32_delegate(FUNC(eolith_state::hidctch3_pen2_r),this)); DRIVER_INIT_CALL(eolith); } diff --git a/src/mame/drivers/eprom.c b/src/mame/drivers/eprom.c index d9c146c8c24..603b6e3f6f4 100644 --- a/src/mame/drivers/eprom.c +++ b/src/mame/drivers/eprom.c @@ -721,8 +721,8 @@ DRIVER_INIT_MEMBER(eprom_state,eprom) atarijsa_init(machine(), "260010", 0x0002); /* install CPU synchronization handlers */ - m_sync_data = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this)); - m_sync_data = machine().device("extra")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this)); + m_sync_data = machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this)); + m_sync_data = machine().device("extra")->memory().space(AS_PROGRAM).install_readwrite_handler(0x16cc00, 0x16cc01, read16_delegate(FUNC(eprom_state::sync_r),this), write16_delegate(FUNC(eprom_state::sync_w),this)); } diff --git a/src/mame/drivers/equites.c b/src/mame/drivers/equites.c index 273fb29ea01..8d1aad60da9 100644 --- a/src/mame/drivers/equites.c +++ b/src/mame/drivers/equites.c @@ -1896,8 +1896,8 @@ DRIVER_INIT_MEMBER(equites_state,gekisou) unpack_region(machine(), "gfx3"); // install special handlers for unknown device (protection?) - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x580000, 0x580001, write16_delegate(FUNC(equites_state::gekisou_unknown_0_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x5a0000, 0x5a0001, write16_delegate(FUNC(equites_state::gekisou_unknown_1_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x580000, 0x580001, write16_delegate(FUNC(equites_state::gekisou_unknown_0_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x5a0000, 0x5a0001, write16_delegate(FUNC(equites_state::gekisou_unknown_1_w),this)); } DRIVER_INIT_MEMBER(equites_state,splndrbt) @@ -1910,7 +1910,7 @@ DRIVER_INIT_MEMBER(equites_state,hvoltage) unpack_region(machine(), "gfx3"); #if HVOLTAGE_DEBUG - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0x000038, 0x000039, read16_delegate(FUNC(equites_state::hvoltage_debug_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0x000038, 0x000039, read16_delegate(FUNC(equites_state::hvoltage_debug_r),this)); #endif } diff --git a/src/mame/drivers/exidy.c b/src/mame/drivers/exidy.c index ef58bcfb3f4..5b8dcc4684a 100644 --- a/src/mame/drivers/exidy.c +++ b/src/mame/drivers/exidy.c @@ -1462,7 +1462,7 @@ DRIVER_INIT_MEMBER(exidy_state,phantoma) m_color_latch[0] = 0x09; /* the ROM is actually mapped high */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0xf800, 0xffff, "bank1"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0xf800, 0xffff, "bank1"); membank("bank1")->set_base(memregion("maincpu")->base() + 0xf800); } @@ -1493,7 +1493,7 @@ DRIVER_INIT_MEMBER(exidy_state,pepper2) DRIVER_INIT_MEMBER(exidy_state,fax) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); exidy_video_config(machine(), 0x04, 0x04, TRUE); diff --git a/src/mame/drivers/exidy440.c b/src/mame/drivers/exidy440.c index 7b5acefed25..1a4be8e9910 100644 --- a/src/mame/drivers/exidy440.c +++ b/src/mame/drivers/exidy440.c @@ -301,9 +301,9 @@ void exidy440_bank_select(running_machine &machine, UINT8 bank) if (state->m_showdown_bank_data[0] != NULL) { if (bank == 0 && state->m_bank != 0) - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4000, 0x7fff, read8_delegate(FUNC(exidy440_state::showdown_bank0_r),state)); else if (bank != 0 && state->m_bank == 0) - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x4000, 0x7fff, "bank1"); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x4000, 0x7fff, "bank1"); } /* select the bank and update the bank pointer */ @@ -1931,7 +1931,7 @@ DRIVER_INIT_MEMBER(exidy440_state,exidy440) DRIVER_INIT_MEMBER(exidy440_state,claypign) { DRIVER_INIT_CALL(exidy440); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2ec0, 0x2ec3, read8_delegate(FUNC(exidy440_state::claypign_protection_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2ec0, 0x2ec3, read8_delegate(FUNC(exidy440_state::claypign_protection_r),this)); } @@ -1940,11 +1940,11 @@ DRIVER_INIT_MEMBER(exidy440_state,topsecex) DRIVER_INIT_CALL(exidy440); /* extra input ports and scrolling */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x2ec5, 0x2ec5, read8_delegate(FUNC(exidy440_state::topsecex_input_port_5_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2ec6, 0x2ec6, "AN0"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port(0x2ec7, 0x2ec7, "IN4"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x2ec5, 0x2ec5, read8_delegate(FUNC(exidy440_state::topsecex_input_port_5_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2ec6, 0x2ec6, "AN0"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port(0x2ec7, 0x2ec7, "IN4"); - m_topsecex_yscroll = machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x2ec1, 0x2ec1, write8_delegate(FUNC(exidy440_state::topsecex_yscroll_w),this)); + m_topsecex_yscroll = machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x2ec1, 0x2ec1, write8_delegate(FUNC(exidy440_state::topsecex_yscroll_w),this)); } diff --git a/src/mame/drivers/exprraid.c b/src/mame/drivers/exprraid.c index 4b037f23d10..af69980faea 100644 --- a/src/mame/drivers/exprraid.c +++ b/src/mame/drivers/exprraid.c @@ -805,13 +805,13 @@ DRIVER_INIT_MEMBER(exprraid_state,exprraid) DRIVER_INIT_MEMBER(exprraid_state,wexpressb2) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(exprraid_state::vblank_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x3800, 0x3800, read8_delegate(FUNC(exprraid_state::vblank_r),this)); exprraid_gfx_expand(machine()); } DRIVER_INIT_MEMBER(exprraid_state,wexpressb3) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xFFC0, 0xFFC0, read8_delegate(FUNC(exprraid_state::vblank_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xFFC0, 0xFFC0, read8_delegate(FUNC(exprraid_state::vblank_r),this)); exprraid_gfx_expand(machine()); } diff --git a/src/mame/drivers/famibox.c b/src/mame/drivers/famibox.c index dd70c10eedd..29b25e84664 100644 --- a/src/mame/drivers/famibox.c +++ b/src/mame/drivers/famibox.c @@ -564,8 +564,8 @@ void famibox_state::machine_start() m_nt_page[2] = m_nt_ram + 0x800; m_nt_page[3] = m_nt_ram + 0xc00; - machine().device("ppu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(famibox_state::famibox_nt_r), this), write8_delegate(FUNC(famibox_state::famibox_nt_w), this)); - machine().device("ppu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x1fff, "ppubank1"); + machine().device("ppu")->memory().space(AS_PROGRAM).install_readwrite_handler(0x2000, 0x3eff, read8_delegate(FUNC(famibox_state::famibox_nt_r), this), write8_delegate(FUNC(famibox_state::famibox_nt_w), this)); + machine().device("ppu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x1fff, "ppubank1"); famicombox_bankswitch(machine(), 0); diff --git a/src/mame/drivers/fastfred.c b/src/mame/drivers/fastfred.c index 0fd04efdee4..b7b20e5bcfe 100644 --- a/src/mame/drivers/fastfred.c +++ b/src/mame/drivers/fastfred.c @@ -1000,8 +1000,8 @@ ROM_END DRIVER_INIT_MEMBER(fastfred_state,flyboy) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc085, 0xc099, read8_delegate(FUNC(fastfred_state::flyboy_custom1_io_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc8fb, 0xc900, read8_delegate(FUNC(fastfred_state::flyboy_custom2_io_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc085, 0xc099, read8_delegate(FUNC(fastfred_state::flyboy_custom1_io_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc8fb, 0xc900, read8_delegate(FUNC(fastfred_state::flyboy_custom2_io_r),this)); m_hardware_type = 1; } @@ -1012,29 +1012,29 @@ DRIVER_INIT_MEMBER(fastfred_state,flyboyb) DRIVER_INIT_MEMBER(fastfred_state,fastfred) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::fastfred_custom_io_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::fastfred_custom_io_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff); m_hardware_type = 1; } DRIVER_INIT_MEMBER(fastfred_state,jumpcoas) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff); m_hardware_type = 0; } DRIVER_INIT_MEMBER(fastfred_state,boggy84b) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::jumpcoas_custom_io_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff); m_hardware_type = 2; } DRIVER_INIT_MEMBER(fastfred_state,boggy84) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::boggy84_custom_io_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xc800, 0xcfff); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc800, 0xcfff, read8_delegate(FUNC(fastfred_state::boggy84_custom_io_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xc800, 0xcfff); m_hardware_type = 2; } diff --git a/src/mame/drivers/firebeat.c b/src/mame/drivers/firebeat.c index 8c3709c40c4..24af439b1f8 100644 --- a/src/mame/drivers/firebeat.c +++ b/src/mame/drivers/firebeat.c @@ -2220,9 +2220,9 @@ static void init_lights(running_machine &machine, write32_space_func out1, const if(!out2) out2 = lamp_output2_w, out2name = "lamp_output2_w"; if(!out3) out3 = lamp_output3_w, out3name = "lamp_output3_w"; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000804, 0x7d000807, out1, out1name); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000320, 0x7d000323, out2, out2name); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x7d000324, 0x7d000327, out3, out3name); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x7d000804, 0x7d000807, out1, out1name); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x7d000320, 0x7d000323, out2, out2name); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x7d000324, 0x7d000327, out3, out3name); } static void init_firebeat(running_machine &machine) diff --git a/src/mame/drivers/fitfight.c b/src/mame/drivers/fitfight.c index b3cb8b89385..6b67028bb76 100644 --- a/src/mame/drivers/fitfight.c +++ b/src/mame/drivers/fitfight.c @@ -996,7 +996,7 @@ DRIVER_INIT_MEMBER(fitfight_state,fitfight) { // UINT16 *mem16 = (UINT16 *)machine().root_device().memregion("maincpu")->base(); // mem16[0x0165B2/2] = 0x4e71; // for now so it boots - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::fitfight_700000_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::fitfight_700000_r),this)); m_bbprot_kludge = 0; } @@ -1004,7 +1004,7 @@ DRIVER_INIT_MEMBER(fitfight_state,histryma) { // UINT16 *mem16 = (UINT16 *)machine().root_device().memregion("maincpu")->base(); // mem16[0x017FDC/2] = 0x4e71; // for now so it boots - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::histryma_700000_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x700000, 0x700001, read16_delegate(FUNC(fitfight_state::histryma_700000_r),this)); m_bbprot_kludge = 0; } @@ -1015,7 +1015,7 @@ DRIVER_INIT_MEMBER(fitfight_state,bbprot) DRIVER_INIT_MEMBER(fitfight_state,hotmindff) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200001, 0, 0, read16_delegate(FUNC(fitfight_state::hotmindff_unk_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200001, 0, 0, read16_delegate(FUNC(fitfight_state::hotmindff_unk_r),this)); DRIVER_INIT_CALL(fitfight); } diff --git a/src/mame/drivers/flstory.c b/src/mame/drivers/flstory.c index e0b65d1e1fc..186a1d658d8 100644 --- a/src/mame/drivers/flstory.c +++ b/src/mame/drivers/flstory.c @@ -119,7 +119,7 @@ ADDRESS_MAP_END CUSTOM_INPUT_MEMBER(flstory_state::victnine_mcu_status_bit01_r) { - address_space &space = *m_maincpu->space(AS_PROGRAM); + address_space &space = m_maincpu->space(AS_PROGRAM); return (victnine_mcu_status_r(space, 0) & 3); } diff --git a/src/mame/drivers/freekick.c b/src/mame/drivers/freekick.c index 648eb9799ee..48c012c3639 100644 --- a/src/mame/drivers/freekick.c +++ b/src/mame/drivers/freekick.c @@ -1124,7 +1124,7 @@ ROM_END DRIVER_INIT_MEMBER(freekick_state,gigasb) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.set_decrypted_region(0x0000, 0xbfff, machine().root_device().memregion("maincpu")->base() + 0x10000); } diff --git a/src/mame/drivers/funworld.c b/src/mame/drivers/funworld.c index 5b80993c163..d02ce8e7ca7 100644 --- a/src/mame/drivers/funworld.c +++ b/src/mame/drivers/funworld.c @@ -4535,7 +4535,7 @@ DRIVER_INIT_MEMBER(funworld_state,multiwin) ******************************************************/ { UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int x; @@ -4568,7 +4568,7 @@ DRIVER_INIT_MEMBER(funworld_state,royalcdc) ******************************************************/ UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); int x; diff --git a/src/mame/drivers/gaiden.c b/src/mame/drivers/gaiden.c index 76fc0ba31cf..d986a78a00e 100644 --- a/src/mame/drivers/gaiden.c +++ b/src/mame/drivers/gaiden.c @@ -1495,8 +1495,8 @@ DRIVER_INIT_MEMBER(gaiden_state,wildfang) m_prot = 0; m_jumpcode = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::wildfang_protection_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::wildfang_protection_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::wildfang_protection_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::wildfang_protection_w),this)); } DRIVER_INIT_MEMBER(gaiden_state,raiga) @@ -1507,8 +1507,8 @@ DRIVER_INIT_MEMBER(gaiden_state,raiga) m_prot = 0; m_jumpcode = 0; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::raiga_protection_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x07a006, 0x07a007, read16_delegate(FUNC(gaiden_state::raiga_protection_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x07a804, 0x07a805, write16_delegate(FUNC(gaiden_state::raiga_protection_w),this)); } static void descramble_drgnbowl_gfx(running_machine &machine) diff --git a/src/mame/drivers/galaga.c b/src/mame/drivers/galaga.c index e6dc102537a..08bc8c66dab 100644 --- a/src/mame/drivers/galaga.c +++ b/src/mame/drivers/galaga.c @@ -889,7 +889,7 @@ MACHINE_START_MEMBER(galaga_state,galaga) static void bosco_latch_reset(running_machine &machine) { galaga_state *state = machine.driver_data<galaga_state>(); - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); int i; /* Reset all latches */ @@ -3312,7 +3312,7 @@ DRIVER_INIT_MEMBER(galaga_state,gatsbee) DRIVER_INIT_CALL(galaga); /* Gatsbee has a larger character ROM, we need a handler for banking */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1000, 0x1000, write8_delegate(FUNC(galaga_state::gatsbee_bank_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1000, 0x1000, write8_delegate(FUNC(galaga_state::gatsbee_bank_w),this)); } @@ -3353,8 +3353,8 @@ DRIVER_INIT_MEMBER(xevious_state,xevios) DRIVER_INIT_MEMBER(xevious_state,battles) { /* replace the Namco I/O handlers with interface to the 4th CPU */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x7000, 0x700f, FUNC(battles_customio_data0_r), FUNC(battles_customio_data0_w) ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(0x7100, 0x7100, FUNC(battles_customio0_r), FUNC(battles_customio0_w) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7000, 0x700f, FUNC(battles_customio_data0_r), FUNC(battles_customio_data0_w) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(0x7100, 0x7100, FUNC(battles_customio0_r), FUNC(battles_customio0_w) ); DRIVER_INIT_CALL(xevious); } diff --git a/src/mame/drivers/galaxian.c b/src/mame/drivers/galaxian.c index abb7fb77637..11d7897e3e5 100644 --- a/src/mame/drivers/galaxian.c +++ b/src/mame/drivers/galaxian.c @@ -755,7 +755,7 @@ WRITE8_MEMBER(galaxian_state::explorer_sound_control_w) READ8_MEMBER(galaxian_state::explorer_sound_latch_r) { machine().device("audiocpu")->execute().set_input_line(0, CLEAR_LINE); - return soundlatch_byte_r(*machine().device("audiocpu")->memory().space(AS_PROGRAM), 0); + return soundlatch_byte_r(machine().device("audiocpu")->memory().space(AS_PROGRAM), 0); } @@ -1064,7 +1064,7 @@ static I8255A_INTERFACE( scorpion_ppi8255_1_intf ) INPUT_CHANGED_MEMBER(galaxian_state::gmgalax_game_changed) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* new value is the selected game */ m_gmgalax_selected_game = newval; @@ -2740,7 +2740,7 @@ static void common_init( static void unmap_galaxian_sound(running_machine &machine, offs_t base) { - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); space.unmap_write(base + 0x0004, base + 0x0007, 0, 0x07f8); space.unmap_write(base + 0x0800, base + 0x0807, 0, 0x07f8); @@ -2763,7 +2763,7 @@ DRIVER_INIT_MEMBER(galaxian_state,galaxian) DRIVER_INIT_MEMBER(galaxian_state,nolock) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* same as galaxian... */ DRIVER_INIT_CALL(galaxian); @@ -2775,7 +2775,7 @@ DRIVER_INIT_MEMBER(galaxian_state,nolock) DRIVER_INIT_MEMBER(galaxian_state,azurian) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* yellow bullets instead of white ones */ common_init(machine(), scramble_draw_bullet, galaxian_draw_background, NULL, NULL); @@ -2787,7 +2787,7 @@ DRIVER_INIT_MEMBER(galaxian_state,azurian) DRIVER_INIT_MEMBER(galaxian_state,gmgalax) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, gmgalax_extend_tile_info, gmgalax_extend_sprite_info); @@ -2804,7 +2804,7 @@ DRIVER_INIT_MEMBER(galaxian_state,gmgalax) DRIVER_INIT_MEMBER(galaxian_state,pisces) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); @@ -2816,7 +2816,7 @@ DRIVER_INIT_MEMBER(galaxian_state,pisces) DRIVER_INIT_MEMBER(galaxian_state,batman2) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); @@ -2828,7 +2828,7 @@ DRIVER_INIT_MEMBER(galaxian_state,batman2) DRIVER_INIT_MEMBER(galaxian_state,frogg) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* same as galaxian... */ common_init(machine(), galaxian_draw_bullet, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); @@ -2864,7 +2864,7 @@ DRIVER_INIT_MEMBER(galaxian_state,mooncrsu) DRIVER_INIT_MEMBER(galaxian_state,mooncrgx) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); @@ -2876,7 +2876,7 @@ DRIVER_INIT_MEMBER(galaxian_state,mooncrgx) DRIVER_INIT_MEMBER(galaxian_state,moonqsr) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *decrypt = auto_alloc_array(machine(), UINT8, 0x8000); /* video extensions */ @@ -2894,7 +2894,7 @@ WRITE8_MEMBER(galaxian_state::artic_gfxbank_w) DRIVER_INIT_MEMBER(galaxian_state,pacmanbl) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* same as galaxian... */ DRIVER_INIT_CALL(galaxian); @@ -2954,7 +2954,7 @@ void galaxian_state::tenspot_set_game_bank(running_machine& machine, int bank, i DRIVER_INIT_MEMBER(galaxian_state,tenspot) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* these are needed for batman part 2 to work properly, this banking is probably a property of the artic board, which tenspot appears to have copied */ @@ -2991,7 +2991,7 @@ DRIVER_INIT_MEMBER(galaxian_state,devilfsg) DRIVER_INIT_MEMBER(galaxian_state,zigzag) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), NULL, galaxian_draw_background, NULL, NULL); @@ -3035,8 +3035,8 @@ DRIVER_INIT_MEMBER(galaxian_state,jumpbug) DRIVER_INIT_MEMBER(galaxian_state,checkman) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); - address_space *iospace = machine().device("maincpu")->memory().space(AS_IO); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); @@ -3046,7 +3046,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkman) space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),this)); /* attach the sound command handler */ - iospace->install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); + iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); /* decrypt program code */ decode_checkman(machine()); @@ -3055,7 +3055,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkman) DRIVER_INIT_MEMBER(galaxian_state,checkmaj) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); @@ -3070,7 +3070,7 @@ DRIVER_INIT_MEMBER(galaxian_state,checkmaj) DRIVER_INIT_MEMBER(galaxian_state,dingo) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); @@ -3085,8 +3085,8 @@ DRIVER_INIT_MEMBER(galaxian_state,dingo) DRIVER_INIT_MEMBER(galaxian_state,dingoe) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); - address_space *iospace = machine().device("maincpu")->memory().space(AS_IO); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &iospace = machine().device("maincpu")->memory().space(AS_IO); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); @@ -3096,7 +3096,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingoe) space.install_write_handler(0xb001, 0xb001, 0, 0x7f8, write8_delegate(FUNC(galaxian_state::irq_enable_w),this)); /* attach the sound command handler */ - iospace->install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); + iospace.install_write_handler(0x00, 0x00, 0, 0xffff, write8_delegate(FUNC(galaxian_state::checkman_sound_command_w),this)); space.install_read_handler(0x3001, 0x3001, read8_delegate(FUNC(galaxian_state::dingoe_3001_r),this)); /* Protection check */ @@ -3107,7 +3107,7 @@ DRIVER_INIT_MEMBER(galaxian_state,dingoe) DRIVER_INIT_MEMBER(galaxian_state,skybase) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, pisces_extend_tile_info, pisces_extend_sprite_info); @@ -3125,7 +3125,7 @@ DRIVER_INIT_MEMBER(galaxian_state,skybase) DRIVER_INIT_MEMBER(galaxian_state,kong) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, upper_extend_sprite_info); @@ -3140,7 +3140,7 @@ DRIVER_INIT_MEMBER(galaxian_state,kong) static void mshuttle_decode(running_machine &machine, const UINT8 convtable[8][16]) { - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = machine.root_device().memregion("maincpu")->base(); UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x10000); int A; @@ -3252,7 +3252,7 @@ DRIVER_INIT_MEMBER(galaxian_state,fantastc) DRIVER_INIT_MEMBER(galaxian_state,kingball) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, NULL, NULL); @@ -3272,7 +3272,7 @@ DRIVER_INIT_MEMBER(galaxian_state,kingball) DRIVER_INIT_MEMBER(galaxian_state,scorpnmc) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); @@ -3293,7 +3293,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpnmc) DRIVER_INIT_MEMBER(galaxian_state,thepitm) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), galaxian_draw_bullet, galaxian_draw_background, mooncrst_extend_tile_info, mooncrst_extend_sprite_info); @@ -3317,7 +3317,7 @@ DRIVER_INIT_MEMBER(galaxian_state,thepitm) DRIVER_INIT_MEMBER(galaxian_state,theend) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), theend_draw_bullet, galaxian_draw_background, NULL, NULL); @@ -3336,7 +3336,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scramble) DRIVER_INIT_MEMBER(galaxian_state,explorer) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); @@ -3362,14 +3362,14 @@ DRIVER_INIT_MEMBER(galaxian_state,sfx) m_sfx_tilemap = TRUE; /* sound board has space for extra ROM */ - machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x3fff, "bank1"); + machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x3fff, "bank1"); membank("bank1")->set_base(memregion("audiocpu")->base()); } DRIVER_INIT_MEMBER(galaxian_state,atlantis) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), scramble_draw_bullet, scramble_draw_background, NULL, NULL); @@ -3411,7 +3411,7 @@ DRIVER_INIT_MEMBER(galaxian_state,frogger) DRIVER_INIT_MEMBER(galaxian_state,froggrmc) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* video extensions */ common_init(machine(), NULL, frogger_draw_background, frogger_extend_tile_info, frogger_extend_sprite_info); @@ -3456,12 +3456,12 @@ DRIVER_INIT_MEMBER(galaxian_state,amidar) DRIVER_INIT_MEMBER(galaxian_state,scorpion) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); common_init(machine(), scramble_draw_bullet, scramble_draw_background, batman2_extend_tile_info, upper_extend_sprite_info); /* hook up AY8910 */ - machine().device("audiocpu")->memory().space(AS_IO)->install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this)); + machine().device("audiocpu")->memory().space(AS_IO).install_readwrite_handler(0x00, 0xff, read8_delegate(FUNC(galaxian_state::scorpion_ay8910_r),this), write8_delegate(FUNC(galaxian_state::scorpion_ay8910_w),this)); /* extra ROM */ space.install_read_bank(0x5800, 0x67ff, "bank1"); @@ -3470,7 +3470,7 @@ DRIVER_INIT_MEMBER(galaxian_state,scorpion) /* no background related */ // space.nop_write(0x6803, 0x6803); - machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::scorpion_digitalker_intr_r),this)); + machine().device("audiocpu")->memory().space(AS_PROGRAM).install_read_handler(0x3000, 0x3000, read8_delegate(FUNC(galaxian_state::scorpion_digitalker_intr_r),this)); /* { const UINT8 *rom = memregion("speech")->base(); diff --git a/src/mame/drivers/galgame.c b/src/mame/drivers/galgame.c index fb4a8c7bd52..7d71f7165fb 100644 --- a/src/mame/drivers/galgame.c +++ b/src/mame/drivers/galgame.c @@ -396,7 +396,7 @@ static UINT8 read_uint8(UINT8 *pval, int pos, const UINT8* line, int linelen) DRIVER_INIT_MEMBER(galaxygame_state,galaxygame) { - address_space *main = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &main = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *code = machine().root_device().memregion("code")->base(); int filepos = 0, linepos, linelen; @@ -426,20 +426,20 @@ DRIVER_INIT_MEMBER(galaxygame_state,galaxygame) if ( (linelen >= 15+6) && (line[15] != ' ') ) { read_uint16(&val, 15, line, linelen); - main->write_word(address, val, 0xffff); + main.write_word(address, val, 0xffff); address += 2; if ( (linelen >= 22+6) && (line[22] != ' ') ) { read_uint16(&val, 22, line, linelen); - main->write_word(address, val, 0xffff); + main.write_word(address, val, 0xffff); address += 2; } if ( (linelen >= 29+6) && (line[29] != ' ') ) { read_uint16(&val, 29, line, linelen); - main->write_word(address, val, 0xffff); + main.write_word(address, val, 0xffff); address += 2; } @@ -449,7 +449,7 @@ DRIVER_INIT_MEMBER(galaxygame_state,galaxygame) if ( (linelen >= 18+3) && (line[18] != ' ') ) { read_uint8(&val8, 18, line, linelen); - main->write_byte(address, val8); + main.write_byte(address, val8); address += 1; } } @@ -458,11 +458,11 @@ DRIVER_INIT_MEMBER(galaxygame_state,galaxygame) } // set startup code - main->write_word(0, 012700); /* MOV #0, R0 */ - main->write_word(2, 0); - main->write_word(4, 0x8d00); /* MTPS R0 */ - main->write_word(6, 000167); /* JMP 0500*/ - main->write_word(8, 000500 - 10); + main.write_word(0, 012700); /* MOV #0, R0 */ + main.write_word(2, 0); + main.write_word(4, 0x8d00); /* MTPS R0 */ + main.write_word(6, 000167); /* JMP 0500*/ + main.write_word(8, 000500 - 10); } GAME(1971, galgame, 0, galaxygame, galaxygame, galaxygame_state, galaxygame, ROT270, "Computer Recreations, Inc", "Galaxy Game", GAME_NO_SOUND_HW ) diff --git a/src/mame/drivers/galivan.c b/src/mame/drivers/galivan.c index a8eba034d8e..1fd7b3a8ee6 100644 --- a/src/mame/drivers/galivan.c +++ b/src/mame/drivers/galivan.c @@ -1076,22 +1076,22 @@ WRITE8_MEMBER(galivan_state::youmab_86_w) DRIVER_INIT_MEMBER(galivan_state,youmab) { - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x82, 0x82, write8_delegate(FUNC(galivan_state::youmab_extra_bank_w),this)); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x0000, 0x7fff, "bank3"); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x82, 0x82, write8_delegate(FUNC(galivan_state::youmab_extra_bank_w),this)); // banks rom at 0x8000? writes 0xff and 0x00 before executing code there + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x0000, 0x7fff, "bank3"); membank("bank3")->set_base(memregion("maincpu")->base()); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_bank(0x8000, 0xbfff, "bank2"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_bank(0x8000, 0xbfff, "bank2"); membank("bank2")->configure_entries(0, 2, memregion("user2")->base(), 0x4000); membank("bank2")->set_entry(0); - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x81, 0x81, write8_delegate(FUNC(galivan_state::youmab_81_w),this)); // ?? often, alternating values - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x84, 0x84, write8_delegate(FUNC(galivan_state::youmab_84_w),this)); // ?? often, sequence.. + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x81, 0x81, write8_delegate(FUNC(galivan_state::youmab_81_w),this)); // ?? often, alternating values + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x84, 0x84, write8_delegate(FUNC(galivan_state::youmab_84_w),this)); // ?? often, sequence.. - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xd800, 0xd81f); // scrolling isn't here.. + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xd800, 0xd81f); // scrolling isn't here.. - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x8a, 0x8a, read8_delegate(FUNC(galivan_state::youmab_8a_r),this)); // ??? + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x8a, 0x8a, read8_delegate(FUNC(galivan_state::youmab_8a_r),this)); // ??? - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x86, 0x86, write8_delegate(FUNC(galivan_state::youmab_86_w),this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x86, 0x86, write8_delegate(FUNC(galivan_state::youmab_86_w),this)); } diff --git a/src/mame/drivers/galpani2.c b/src/mame/drivers/galpani2.c index 1d182dfc28f..46c3069cd24 100644 --- a/src/mame/drivers/galpani2.c +++ b/src/mame/drivers/galpani2.c @@ -77,7 +77,7 @@ void galpani2_state::machine_reset() static void galpani2_write_kaneko(device_t *device) { - address_space *dstspace = device->memory().space(AS_PROGRAM); + address_space &dstspace = device->memory().space(AS_PROGRAM); int i,x,tpattidx; unsigned char testpattern[] = {0xFF,0x55,0xAA,0xDD,0xBB,0x99}; @@ -89,57 +89,57 @@ static void galpani2_write_kaneko(device_t *device) { for (tpattidx = 0; tpattidx < 6; tpattidx++) { - if (dstspace->read_byte(i) == testpattern[tpattidx]) x = 1; //ram test fragment present + if (dstspace.read_byte(i) == testpattern[tpattidx]) x = 1; //ram test fragment present } } if ( x == 0 ) { - dstspace->write_byte(0x100000,0x4b); //K - dstspace->write_byte(0x100001,0x41); //A - dstspace->write_byte(0x100002,0x4e); //N - dstspace->write_byte(0x100003,0x45); //E - dstspace->write_byte(0x100004,0x4b); //K - dstspace->write_byte(0x100005,0x4f); //O + dstspace.write_byte(0x100000,0x4b); //K + dstspace.write_byte(0x100001,0x41); //A + dstspace.write_byte(0x100002,0x4e); //N + dstspace.write_byte(0x100003,0x45); //E + dstspace.write_byte(0x100004,0x4b); //K + dstspace.write_byte(0x100005,0x4f); //O } } WRITE8_MEMBER(galpani2_state::galpani2_mcu_init_w) { - address_space *srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM); - address_space *dstspace = machine().device("sub")->memory().space(AS_PROGRAM); + address_space &srcspace = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &dstspace = machine().device("sub")->memory().space(AS_PROGRAM); UINT32 mcu_address, mcu_data; for ( mcu_address = 0x100010; mcu_address < (0x100010 + 6); mcu_address += 1 ) { - mcu_data = srcspace->read_byte(mcu_address ); - dstspace->write_byte(mcu_address-0x10, mcu_data); + mcu_data = srcspace.read_byte(mcu_address ); + dstspace.write_byte(mcu_address-0x10, mcu_data); } machine().device("sub")->execute().set_input_line(INPUT_LINE_IRQ7, HOLD_LINE); //MCU Initialised } static void galpani2_mcu_nmi1(running_machine &machine) { - address_space *srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM); - address_space *dstspace = machine.device("sub")->memory().space(AS_PROGRAM); + address_space &srcspace = machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &dstspace = machine.device("sub")->memory().space(AS_PROGRAM); UINT32 mcu_list, mcu_command, mcu_address, mcu_extra, mcu_src, mcu_dst, mcu_size; for ( mcu_list = 0x100021; mcu_list < (0x100021 + 0x40); mcu_list += 4 ) { - mcu_command = srcspace->read_byte(mcu_list); + mcu_command = srcspace.read_byte(mcu_list); mcu_address = 0x100000 + - (srcspace->read_byte(mcu_list + 1)<<8) + - (srcspace->read_byte(mcu_list + 2)<<0) ; + (srcspace.read_byte(mcu_list + 1)<<8) + + (srcspace.read_byte(mcu_list + 2)<<0) ; - mcu_extra = srcspace->read_byte(mcu_list + 3); //0xff for command $A and $2, 0x02 for others + mcu_extra = srcspace.read_byte(mcu_list + 3); //0xff for command $A and $2, 0x02 for others if (mcu_command != 0) { logerror("%s : MCU [$%06X] endidx = $%02X / command = $%02X addr = $%04X ? = $%02X.\n", machine.describe_context(), mcu_list, - srcspace->read_byte(0x100020), + srcspace.read_byte(0x100020), mcu_command, mcu_address, mcu_extra @@ -152,51 +152,51 @@ static void galpani2_mcu_nmi1(running_machine &machine) break; case 0x02: //Copy N bytes from RAM2 to RAM1?, gp2se is the only one to use it, often! - mcu_src = (srcspace->read_byte(mcu_address + 2)<<8) + - (srcspace->read_byte(mcu_address + 3)<<0) ; + mcu_src = (srcspace.read_byte(mcu_address + 2)<<8) + + (srcspace.read_byte(mcu_address + 3)<<0) ; - mcu_dst = (srcspace->read_byte(mcu_address + 6)<<8) + - (srcspace->read_byte(mcu_address + 7)<<0) ; + mcu_dst = (srcspace.read_byte(mcu_address + 6)<<8) + + (srcspace.read_byte(mcu_address + 7)<<0) ; - mcu_size = (srcspace->read_byte(mcu_address + 8)<<8) + - (srcspace->read_byte(mcu_address + 9)<<0) ; + mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) + + (srcspace.read_byte(mcu_address + 9)<<0) ; logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); for( ; mcu_size > 0 ; mcu_size-- ) { mcu_src &= 0xffff; mcu_dst &= 0xffff; - srcspace->write_byte(0x100000 + mcu_dst,dstspace->read_byte(0x100000 + mcu_src)); + srcspace.write_byte(0x100000 + mcu_dst,dstspace.read_byte(0x100000 + mcu_src)); mcu_src ++; mcu_dst ++; } /* Raise a "job done" flag */ - srcspace->write_byte(mcu_address+0,0xff); - srcspace->write_byte(mcu_address+1,0xff); + srcspace.write_byte(mcu_address+0,0xff); + srcspace.write_byte(mcu_address+1,0xff); break; case 0x0a: // Copy N bytes from RAM1 to RAM2 - mcu_src = (srcspace->read_byte(mcu_address + 2)<<8) + - (srcspace->read_byte(mcu_address + 3)<<0) ; + mcu_src = (srcspace.read_byte(mcu_address + 2)<<8) + + (srcspace.read_byte(mcu_address + 3)<<0) ; - mcu_dst = (srcspace->read_byte(mcu_address + 6)<<8) + - (srcspace->read_byte(mcu_address + 7)<<0) ; + mcu_dst = (srcspace.read_byte(mcu_address + 6)<<8) + + (srcspace.read_byte(mcu_address + 7)<<0) ; - mcu_size = (srcspace->read_byte(mcu_address + 8)<<8) + - (srcspace->read_byte(mcu_address + 9)<<0) ; + mcu_size = (srcspace.read_byte(mcu_address + 8)<<8) + + (srcspace.read_byte(mcu_address + 9)<<0) ; logerror("%s : MCU executes command $%02X, %04X %02X-> %04x\n",machine.describe_context(),mcu_command,mcu_src,mcu_size,mcu_dst); for( ; mcu_size > 0 ; mcu_size-- ) { mcu_src &= 0xffff; mcu_dst &= 0xffff; - dstspace->write_byte(0x100000 + mcu_dst,srcspace->read_byte(0x100000 + mcu_src)); + dstspace.write_byte(0x100000 + mcu_dst,srcspace.read_byte(0x100000 + mcu_src)); mcu_src ++; mcu_dst ++; } /* Raise a "job done" flag */ - srcspace->write_byte(mcu_address+0,0xff); - srcspace->write_byte(mcu_address+1,0xff); + srcspace.write_byte(mcu_address+0,0xff); + srcspace.write_byte(mcu_address+1,0xff); break; @@ -210,14 +210,14 @@ static void galpani2_mcu_nmi1(running_machine &machine) //case 0x85: //? Do what? default: /* Raise a "job done" flag */ - srcspace->write_byte(mcu_address+0,0xff); - srcspace->write_byte(mcu_address+1,0xff); + srcspace.write_byte(mcu_address+0,0xff); + srcspace.write_byte(mcu_address+1,0xff); logerror("%s : MCU ERROR, unknown command $%02X\n",machine.describe_context(),mcu_command); } /* Erase command (so that it won't be processed again)? */ - srcspace->write_byte(mcu_list,0x00); + srcspace.write_byte(mcu_list,0x00); } } diff --git a/src/mame/drivers/gameplan.c b/src/mame/drivers/gameplan.c index 0beaa31ea46..b06eec64339 100644 --- a/src/mame/drivers/gameplan.c +++ b/src/mame/drivers/gameplan.c @@ -187,8 +187,8 @@ WRITE_LINE_MEMBER(gameplan_state::r6532_irq) WRITE8_MEMBER(gameplan_state::r6532_soundlatch_w) { - address_space *progspace = machine().device("maincpu")->memory().space(AS_PROGRAM); - soundlatch_byte_w(*progspace, 0, data); + address_space &progspace = machine().device("maincpu")->memory().space(AS_PROGRAM); + soundlatch_byte_w(progspace, 0, data); } diff --git a/src/mame/drivers/gamtor.c b/src/mame/drivers/gamtor.c index 3773064727b..c51cff31a41 100644 --- a/src/mame/drivers/gamtor.c +++ b/src/mame/drivers/gamtor.c @@ -1254,7 +1254,7 @@ static READ8_HANDLER( vga_setting ) { return 0xff; } // hard-code to color DRIVER_INIT_MEMBER(gaminator_state,gaminator) { pc_vga_init(machine(), vga_setting, NULL); - pc_vga_gamtor_io_init(machine(), *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x44000000, *machine().device("maincpu")->memory().space(AS_PROGRAM), 0x40000000); + pc_vga_gamtor_io_init(machine(), machine().device("maincpu")->memory().space(AS_PROGRAM), 0x44000000, machine().device("maincpu")->memory().space(AS_PROGRAM), 0x40000000); } diff --git a/src/mame/drivers/gauntlet.c b/src/mame/drivers/gauntlet.c index d8eca53275a..10e69c27bfe 100644 --- a/src/mame/drivers/gauntlet.c +++ b/src/mame/drivers/gauntlet.c @@ -145,7 +145,7 @@ static void update_interrupts(running_machine &machine) static void scanline_update(screen_device &screen, int scanline) { - address_space &space = *screen.machine().device("audiocpu")->memory().space(AS_PROGRAM); + address_space &space = screen.machine().device("audiocpu")->memory().space(AS_PROGRAM); /* sound IRQ is on 32V */ if (scanline & 32) diff --git a/src/mame/drivers/gei.c b/src/mame/drivers/gei.c index 237d394f8f5..5ffe0f265b2 100644 --- a/src/mame/drivers/gei.c +++ b/src/mame/drivers/gei.c @@ -220,7 +220,7 @@ WRITE8_MEMBER(gei_state::sound_w) set_led_status(machine(), 9,data & 0x08); /* bit 5 - ticket out in trivia games */ - machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, (data & 0x20)<< 2); + machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, (data & 0x20)<< 2); /* bit 6 enables NMI */ m_nmi_mask = data & 0x40; diff --git a/src/mame/drivers/ghosteo.c b/src/mame/drivers/ghosteo.c index 523206fa7f1..5946687e037 100644 --- a/src/mame/drivers/ghosteo.c +++ b/src/mame/drivers/ghosteo.c @@ -581,7 +581,7 @@ READ32_MEMBER(ghosteo_state::bballoon_speedup_r) void ghosteo_state::machine_reset() { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x4d000010, 0x4d000013,read32_delegate(FUNC(ghosteo_state::bballoon_speedup_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x4d000010, 0x4d000013,read32_delegate(FUNC(ghosteo_state::bballoon_speedup_r), this)); s3c2410 = machine().device("s3c2410"); } diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c index 54cfe730581..eb7900894d0 100644 --- a/src/mame/drivers/gladiatr.c +++ b/src/mame/drivers/gladiatr.c @@ -1022,7 +1022,7 @@ DRIVER_INIT_MEMBER(gladiatr_state,ppking) rom[i+2*j*0x2000] = rom[i+j*0x2000]; } } - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(gladiatr_state::f6a3_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xf6a3,0xf6a3,read8_delegate(FUNC(gladiatr_state::f6a3_r),this)); } diff --git a/src/mame/drivers/glass.c b/src/mame/drivers/glass.c index 8a4e6053d65..c3902a76f73 100644 --- a/src/mame/drivers/glass.c +++ b/src/mame/drivers/glass.c @@ -412,7 +412,7 @@ DRIVER_INIT_MEMBER(glass_state,glass) glass_ROM16_split_gfx(machine(), "gfx2", "gfx1", 0x0200000, 0x0200000, 0x0200000, 0x0300000); /* install custom handler over RAM for protection */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xfec000, 0xfeffff, read16_delegate(FUNC(glass_state::glass_mainram_r), this), write16_delegate(FUNC(glass_state::glass_mainram_w),this)); } diff --git a/src/mame/drivers/gng.c b/src/mame/drivers/gng.c index 931889b63a7..988dcf73e0c 100644 --- a/src/mame/drivers/gng.c +++ b/src/mame/drivers/gng.c @@ -764,7 +764,7 @@ READ8_MEMBER(gng_state::diamond_hack_r) DRIVER_INIT_MEMBER(gng_state,diamond) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x6000, 0x6000, read8_delegate(FUNC(gng_state::diamond_hack_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x6000, 0x6000, read8_delegate(FUNC(gng_state::diamond_hack_r),this)); } diff --git a/src/mame/drivers/goldstar.c b/src/mame/drivers/goldstar.c index 609ba2ca0e8..b0aa15d7a02 100644 --- a/src/mame/drivers/goldstar.c +++ b/src/mame/drivers/goldstar.c @@ -10313,8 +10313,8 @@ DRIVER_INIT_MEMBER(goldstar_state,schery97) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x1d, 0x1d, read8_delegate(FUNC(goldstar_state::fixedvala8_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x2a, 0x2a, read8_delegate(FUNC(goldstar_state::fixedvalb4_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x1d, 0x1d, read8_delegate(FUNC(goldstar_state::fixedvala8_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x2a, 0x2a, read8_delegate(FUNC(goldstar_state::fixedvalb4_r),this)); /* Oki 6295 at 0x20 */ } @@ -10342,7 +10342,7 @@ DRIVER_INIT_MEMBER(goldstar_state,schery97a) } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedval38_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedval38_r),this)); /* Oki 6295 at 0x20 */ } @@ -10368,7 +10368,7 @@ DRIVER_INIT_MEMBER(goldstar_state,skill98) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x1e, 0x1e, read8_delegate(FUNC(goldstar_state::fixedvalea_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x1e, 0x1e, read8_delegate(FUNC(goldstar_state::fixedvalea_r),this)); /* Oki 6295 at 0x20 */ } @@ -10394,7 +10394,7 @@ DRIVER_INIT_MEMBER(goldstar_state,nfb96_c1) } ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x31, 0x31, read8_delegate(FUNC(goldstar_state::fixedval68_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x31, 0x31, read8_delegate(FUNC(goldstar_state::fixedval68_r),this)); } @@ -10421,7 +10421,7 @@ DRIVER_INIT_MEMBER(goldstar_state,nfb96_c2) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x21, 0x21, read8_delegate(FUNC(goldstar_state::fixedval58_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x21, 0x21, read8_delegate(FUNC(goldstar_state::fixedval58_r),this)); } READ8_MEMBER(goldstar_state::fixedval80_r) @@ -10457,11 +10457,11 @@ DRIVER_INIT_MEMBER(goldstar_state,nfb96_d) ROM[i] = x; } // nfb96b needs both of these - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x23, 0x23, read8_delegate(FUNC(goldstar_state::fixedval80_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x5a, 0x5a, read8_delegate(FUNC(goldstar_state::fixedvalaa_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x23, 0x23, read8_delegate(FUNC(goldstar_state::fixedval80_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x5a, 0x5a, read8_delegate(FUNC(goldstar_state::fixedvalaa_r),this)); // csel96b - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x6e, 0x6e, read8_delegate(FUNC(goldstar_state::fixedval96_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x6e, 0x6e, read8_delegate(FUNC(goldstar_state::fixedval96_r),this)); } @@ -10488,7 +10488,7 @@ DRIVER_INIT_MEMBER(goldstar_state,nfb96_dk) } ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x2e, 0x2e, read8_delegate(FUNC(goldstar_state::fixedvalbe_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x2e, 0x2e, read8_delegate(FUNC(goldstar_state::fixedvalbe_r),this)); } @@ -10520,8 +10520,8 @@ DRIVER_INIT_MEMBER(goldstar_state,rp35) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x5e, 0x5e, read8_delegate(FUNC(goldstar_state::fixedval84_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x36, 0x36, read8_delegate(FUNC(goldstar_state::fixedval90_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x5e, 0x5e, read8_delegate(FUNC(goldstar_state::fixedval84_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x36, 0x36, read8_delegate(FUNC(goldstar_state::fixedval90_r),this)); } READ8_MEMBER(goldstar_state::fixedvalb2_r) @@ -10548,7 +10548,7 @@ DRIVER_INIT_MEMBER(goldstar_state,rp36) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x34, 0x34, read8_delegate(FUNC(goldstar_state::fixedvalb2_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x34, 0x34, read8_delegate(FUNC(goldstar_state::fixedvalb2_r),this)); } READ8_MEMBER(goldstar_state::fixedval48_r) @@ -10575,7 +10575,7 @@ DRIVER_INIT_MEMBER(goldstar_state,rp36c3) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x17, 0x17, read8_delegate(FUNC(goldstar_state::fixedval48_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x17, 0x17, read8_delegate(FUNC(goldstar_state::fixedval48_r),this)); } READ8_MEMBER(goldstar_state::fixedval09_r) @@ -10607,8 +10607,8 @@ DRIVER_INIT_MEMBER(goldstar_state,po33) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x32, 0x32, read8_delegate(FUNC(goldstar_state::fixedval74_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x12, 0x12, read8_delegate(FUNC(goldstar_state::fixedval09_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x32, 0x32, read8_delegate(FUNC(goldstar_state::fixedval74_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x12, 0x12, read8_delegate(FUNC(goldstar_state::fixedval09_r),this)); /* oki6295 at 0x20 */ } @@ -10641,8 +10641,8 @@ DRIVER_INIT_MEMBER(goldstar_state,match133) ROM[i] = x; } - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedvalc7_r),this)); - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x1a, 0x1a, read8_delegate(FUNC(goldstar_state::fixedvale4_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x16, 0x16, read8_delegate(FUNC(goldstar_state::fixedvalc7_r),this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x1a, 0x1a, read8_delegate(FUNC(goldstar_state::fixedvale4_r),this)); } DRIVER_INIT_MEMBER(goldstar_state,cherrys) @@ -10707,10 +10707,10 @@ DRIVER_INIT_MEMBER(goldstar_state,unkch4) DRIVER_INIT_MEMBER(goldstar_state,tonypok) { // the ppi doesn't seem to work properly, so just install the inputs directly - address_space *io = machine().device("maincpu")->memory().space(AS_IO); - io->install_read_port(0x04, 0x04, "IN0" ); - io->install_read_port(0x05, 0x05, "IN1" ); - io->install_read_port(0x06, 0x06, "IN2" ); + address_space &io = machine().device("maincpu")->memory().space(AS_IO); + io.install_read_port(0x04, 0x04, "IN0" ); + io.install_read_port(0x05, 0x05, "IN1" ); + io.install_read_port(0x06, 0x06, "IN2" ); } diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 9ec580957d0..6771387e247 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -244,9 +244,9 @@ void gottlieb_state::machine_start() if (m_laserdisc != NULL) { /* attach to the I/O ports */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x05805, 0x05807, 0, 0x07f8, read8_delegate(FUNC(gottlieb_state::laserdisc_status_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x05805, 0x05805, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_command_w),this)); /* command for the player */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x05806, 0x05806, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_select_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x05805, 0x05807, 0, 0x07f8, read8_delegate(FUNC(gottlieb_state::laserdisc_status_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x05805, 0x05805, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_command_w),this)); /* command for the player */ + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x05806, 0x05806, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::laserdisc_select_w),this)); /* allocate a timer for serial transmission, and one for philips code processing */ m_laserdisc_bit_timer = machine().scheduler().timer_alloc(FUNC(laserdisc_bit_callback)); @@ -2451,7 +2451,7 @@ DRIVER_INIT_MEMBER(gottlieb_state,romtiles) DRIVER_INIT_MEMBER(gottlieb_state,stooges) { DRIVER_INIT_CALL(ramtiles); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x05803, 0x05803, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::stooges_output_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x05803, 0x05803, 0, 0x07f8, write8_delegate(FUNC(gottlieb_state::stooges_output_w),this)); } diff --git a/src/mame/drivers/groundfx.c b/src/mame/drivers/groundfx.c index 510b10b4a0e..7cc8b89ca3f 100644 --- a/src/mame/drivers/groundfx.c +++ b/src/mame/drivers/groundfx.c @@ -456,7 +456,7 @@ DRIVER_INIT_MEMBER(groundfx_state,groundfx) int data; /* Speedup handlers */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20b574, 0x20b577, read32_delegate(FUNC(groundfx_state::irq_speedup_r_groundfx),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20b574, 0x20b577, read32_delegate(FUNC(groundfx_state::irq_speedup_r_groundfx),this)); /* make piv tile GFX format suitable for gfxdecode */ offset = size/2; diff --git a/src/mame/drivers/gstream.c b/src/mame/drivers/gstream.c index 2b65f3ecbd5..a9a84d3f0aa 100644 --- a/src/mame/drivers/gstream.c +++ b/src/mame/drivers/gstream.c @@ -640,7 +640,7 @@ READ32_MEMBER(gstream_state::gstream_speedup_r) DRIVER_INIT_MEMBER(gstream_state,gstream) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd1ee0, 0xd1ee3, read32_delegate(FUNC(gstream_state::gstream_speedup_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd1ee0, 0xd1ee3, read32_delegate(FUNC(gstream_state::gstream_speedup_r), this)); } diff --git a/src/mame/drivers/gstriker.c b/src/mame/drivers/gstriker.c index d9ed0a29b42..81dd0d9ef73 100644 --- a/src/mame/drivers/gstriker.c +++ b/src/mame/drivers/gstriker.c @@ -1013,11 +1013,11 @@ static void mcu_init( running_machine &machine ) state->m_pending_command = 0; state->m_mcu_data = 0; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008a, 0x20008b, write16_delegate(FUNC(gstriker_state::twrldc94_mcu_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008a, 0x20008b, read16_delegate(FUNC(gstriker_state::twrldc94_mcu_r),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x20008e, 0x20008f, write16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x20008e, 0x20008f, read16_delegate(FUNC(gstriker_state::twrldc94_prot_reg_r),state)); } DRIVER_INIT_MEMBER(gstriker_state,twrldc94) @@ -1037,8 +1037,8 @@ DRIVER_INIT_MEMBER(gstriker_state,vgoalsoc) m_gametype = 3; mcu_init( machine() ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x200090, 0x200091, write16_delegate(FUNC(gstriker_state::vbl_toggle_w),this)); // vblank toggle + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200090, 0x200091, read16_delegate(FUNC(gstriker_state::vbl_toggle_r),this)); } /*** GAME DRIVERS ************************************************************/ diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c index ec0c06865ac..9a591eddac0 100644 --- a/src/mame/drivers/gsword.c +++ b/src/mame/drivers/gsword.c @@ -905,7 +905,7 @@ DRIVER_INIT_MEMBER(gsword_state,gsword) #endif #if 1 /* hack for sound protection or time out function */ - machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this)); + machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this)); #endif } @@ -920,7 +920,7 @@ DRIVER_INIT_MEMBER(gsword_state,gsword2) #endif #if 1 /* hack for sound protection or time out function */ - machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this)); + machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0x4004, 0x4005, read8_delegate(FUNC(gsword_state::gsword_hack_r),this)); #endif } diff --git a/src/mame/drivers/guab.c b/src/mame/drivers/guab.c index 23bc82f858f..c33c95a1931 100644 --- a/src/mame/drivers/guab.c +++ b/src/mame/drivers/guab.c @@ -608,7 +608,7 @@ INPUT_CHANGED_MEMBER(guab_state::coin_inserted) if (newval == 0) { UINT32 credit; - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* Get the current credit value and add the new coin value */ credit = space.read_dword(0x8002c) + (UINT32)(FPTR)param; diff --git a/src/mame/drivers/gunbustr.c b/src/mame/drivers/gunbustr.c index c79e8cf1dbd..516f6844e6e 100644 --- a/src/mame/drivers/gunbustr.c +++ b/src/mame/drivers/gunbustr.c @@ -442,7 +442,7 @@ READ32_MEMBER(gunbustr_state::main_cycle_r) DRIVER_INIT_MEMBER(gunbustr_state,gunbustr) { /* Speedup handler */ - m_maincpu->space(AS_PROGRAM)->install_read_handler(0x203acc, 0x203acf, read32_delegate(FUNC(gunbustr_state::main_cycle_r),this)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x203acc, 0x203acf, read32_delegate(FUNC(gunbustr_state::main_cycle_r),this)); } DRIVER_INIT_MEMBER(gunbustr_state,gunbustrj) diff --git a/src/mame/drivers/harddriv.c b/src/mame/drivers/harddriv.c index 68af270573d..dd98dc8198b 100644 --- a/src/mame/drivers/harddriv.c +++ b/src/mame/drivers/harddriv.c @@ -3999,9 +3999,9 @@ static void init_multisync(running_machine &machine, int compact_inputs) /* install handlers for the compact driving games' inputs */ if (compact_inputs) { - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x400000, 0x400001, FUNC(hdc68k_wheel_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x408000, 0x408001, FUNC(hdc68k_wheel_edge_reset_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hdc68k_port1_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x400000, 0x400001, FUNC(hdc68k_wheel_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x408000, 0x408001, FUNC(hdc68k_wheel_edge_reset_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hdc68k_port1_r)); } } @@ -4012,18 +4012,18 @@ static void init_adsp(running_machine &machine) harddriv_state *state = machine.driver_data<harddriv_state>(); /* install ADSP program RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_adsp_program_r), FUNC(hd68k_adsp_program_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_adsp_program_r), FUNC(hd68k_adsp_program_w)); /* install ADSP data RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w)); /* install ADSP serial buffer RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x810000, 0x813fff, FUNC(hd68k_adsp_buffer_r), FUNC(hd68k_adsp_buffer_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x810000, 0x813fff, FUNC(hd68k_adsp_buffer_r), FUNC(hd68k_adsp_buffer_w)); /* install ADSP control locations */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x818000, 0x81801f, FUNC(hd68k_adsp_control_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x818060, 0x81807f, FUNC(hd68k_adsp_irq_clear_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x838000, 0x83ffff, FUNC(hd68k_adsp_irq_state_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x818000, 0x81801f, FUNC(hd68k_adsp_control_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x818060, 0x81807f, FUNC(hd68k_adsp_irq_clear_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x838000, 0x83ffff, FUNC(hd68k_adsp_irq_state_r)); } @@ -4033,21 +4033,21 @@ static void init_ds3(running_machine &machine) harddriv_state *state = machine.driver_data<harddriv_state>(); /* install ADSP program RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_ds3_program_r), FUNC(hd68k_ds3_program_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x800000, 0x807fff, FUNC(hd68k_ds3_program_r), FUNC(hd68k_ds3_program_w)); /* install ADSP data RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x80c000, 0x80dfff, FUNC(hdds3_special_r), FUNC(hdds3_special_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x808000, 0x80bfff, FUNC(hd68k_adsp_data_r), FUNC(hd68k_adsp_data_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x80c000, 0x80dfff, FUNC(hdds3_special_r), FUNC(hdds3_special_w)); /* install ADSP control locations */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x820800, 0x820fff, FUNC(hd68k_ds3_girq_state_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x821000, 0x8217ff, FUNC(hd68k_adsp_irq_clear_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x822800, 0x822fff, FUNC(hd68k_ds3_sirq_state_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x823800, 0x823fff, FUNC(hd68k_ds3_control_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x820800, 0x820fff, FUNC(hd68k_ds3_girq_state_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x820000, 0x8207ff, FUNC(hd68k_ds3_gdata_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x821000, 0x8217ff, FUNC(hd68k_adsp_irq_clear_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x822800, 0x822fff, FUNC(hd68k_ds3_sirq_state_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x822000, 0x8227ff, FUNC(hd68k_ds3_sdata_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x823800, 0x823fff, FUNC(hd68k_ds3_control_w)); /* if we have a sound DSP, boot it */ if (state->m_ds4cpu1 != NULL) @@ -4132,26 +4132,26 @@ static void init_dsk(running_machine &machine) UINT8 *usr3 = state->memregion("user3")->base(); /* install ASIC61 */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x85c000, 0x85c7ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x85c000, 0x85c7ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w)); /* install control registers */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x85c800, 0x85c81f, FUNC(hd68k_dsk_control_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x85c800, 0x85c81f, FUNC(hd68k_dsk_control_w)); /* install extra RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x900000, 0x90ffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x900000, 0x90ffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w)); state->m_dsk_ram = (UINT16 *)(usr3 + 0x40000); /* install extra ZRAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x910000, 0x910fff, FUNC(hd68k_dsk_zram_r), FUNC(hd68k_dsk_zram_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x910000, 0x910fff, FUNC(hd68k_dsk_zram_r), FUNC(hd68k_dsk_zram_w)); state->m_dsk_zram = (UINT16 *)(usr3 + 0x50000); /* install ASIC65 */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x914000, 0x917fff, FUNC(asic65_data_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x914000, 0x917fff, FUNC(asic65_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x918000, 0x91bfff, FUNC(asic65_io_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x914000, 0x917fff, FUNC(asic65_data_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x914000, 0x917fff, FUNC(asic65_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x918000, 0x91bfff, FUNC(asic65_io_r)); /* install extra ROM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x940000, 0x9fffff, FUNC(hd68k_dsk_small_rom_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x940000, 0x9fffff, FUNC(hd68k_dsk_small_rom_r)); state->m_dsk_rom = (UINT16 *)(usr3 + 0x00000); /* set up the ASIC65 */ @@ -4166,22 +4166,22 @@ static void init_dsk2(running_machine &machine) UINT8 *usr3 = state->memregion("user3")->base(); /* install ASIC65 */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x824000, 0x824003, FUNC(asic65_data_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x824000, 0x824003, FUNC(asic65_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x825000, 0x825001, FUNC(asic65_io_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x824000, 0x824003, FUNC(asic65_data_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x824000, 0x824003, FUNC(asic65_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x825000, 0x825001, FUNC(asic65_io_r)); /* install ASIC61 */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x827000, 0x8277ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x827000, 0x8277ff, FUNC(hd68k_dsk_dsp32_r), FUNC(hd68k_dsk_dsp32_w)); /* install control registers */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x827800, 0x82781f, FUNC(hd68k_dsk_control_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x827800, 0x82781f, FUNC(hd68k_dsk_control_w)); /* install extra RAM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0x880000, 0x8bffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0x880000, 0x8bffff, FUNC(hd68k_dsk_ram_r), FUNC(hd68k_dsk_ram_w)); state->m_dsk_ram = (UINT16 *)(usr3 + 0x100000); /* install extra ROM */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x900000, 0x9fffff, FUNC(hd68k_dsk_rom_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x900000, 0x9fffff, FUNC(hd68k_dsk_rom_r)); state->m_dsk_rom = (UINT16 *)(usr3 + 0x000000); /* set up the ASIC65 */ @@ -4195,15 +4195,15 @@ static void init_dspcom(running_machine &machine) harddriv_state *state = machine.driver_data<harddriv_state>(); /* install ASIC65 */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x900000, 0x900003, FUNC(asic65_data_w)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x900000, 0x900003, FUNC(asic65_r)); - state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x901000, 0x910001, FUNC(asic65_io_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x900000, 0x900003, FUNC(asic65_data_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x900000, 0x900003, FUNC(asic65_r)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x901000, 0x910001, FUNC(asic65_io_r)); /* set up the ASIC65 */ asic65_config(machine, ASIC65_STEELTAL); /* install DSPCOM control */ - state->m_maincpu->space(AS_PROGRAM)->install_legacy_write_handler(0x904000, 0x90401f, FUNC(hddspcom_control_w)); + state->m_maincpu->space(AS_PROGRAM).install_legacy_write_handler(0x904000, 0x90401f, FUNC(hddspcom_control_w)); } @@ -4215,9 +4215,9 @@ static void init_driver_sound(running_machine &machine) hdsnd_init(machine); /* install sound handlers */ - state->m_maincpu->space(AS_PROGRAM)->install_readwrite_handler(0x840000, 0x840001, read16_delegate(FUNC(harddriv_state::hd68k_snd_data_r),state), write16_delegate(FUNC(harddriv_state::hd68k_snd_data_w),state)); - state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x844000, 0x844001, read16_delegate(FUNC(harddriv_state::hd68k_snd_status_r),state)); - state->m_maincpu->space(AS_PROGRAM)->install_write_handler(0x84c000, 0x84c001, write16_delegate(FUNC(harddriv_state::hd68k_snd_reset_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_readwrite_handler(0x840000, 0x840001, read16_delegate(FUNC(harddriv_state::hd68k_snd_data_r),state), write16_delegate(FUNC(harddriv_state::hd68k_snd_data_w),state)); + state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x844000, 0x844001, read16_delegate(FUNC(harddriv_state::hd68k_snd_status_r),state)); + state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x84c000, 0x84c001, write16_delegate(FUNC(harddriv_state::hd68k_snd_reset_w),state)); } @@ -4238,18 +4238,18 @@ DRIVER_INIT_MEMBER(harddriv_state,harddriv) init_driver_sound(machine()); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w)); - m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w)); - m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r)); + m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w)); + m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w)); + m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r)); m_gsp_speedup_pc = 0xffc00f10; /* set up msp speedup handler */ - m_msp_speedup_addr = m_msp->space(AS_PROGRAM)->install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w)); - m_msp->space(AS_PROGRAM)->install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r)); + m_msp_speedup_addr = m_msp->space(AS_PROGRAM).install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w)); + m_msp->space(AS_PROGRAM).install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r)); m_msp_speedup_pc = 0x00723b00; /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); } @@ -4262,18 +4262,18 @@ DRIVER_INIT_MEMBER(harddriv_state,harddrivc) init_driver_sound(machine()); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w)); - m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w)); - m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r)); + m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w)); + m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w)); + m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r)); m_gsp_speedup_pc = 0xfff40ff0; /* set up msp speedup handler */ - m_msp_speedup_addr = m_msp->space(AS_PROGRAM)->install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w)); - m_msp->space(AS_PROGRAM)->install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r)); + m_msp_speedup_addr = m_msp->space(AS_PROGRAM).install_legacy_write_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_w)); + m_msp->space(AS_PROGRAM).install_legacy_read_handler(0x00751b00, 0x00751b0f, FUNC(hdmsp_speedup_r)); m_msp_speedup_pc = 0x00723b00; /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); } @@ -4286,13 +4286,13 @@ DRIVER_INIT_MEMBER(harddriv_state,stunrun) atarijsa_init(machine(), "IN0", 0x0020); /* set up gsp speedup handler */ - m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w)); - m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w)); - m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r)); + m_gsp_speedup_addr[0] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup1_w)); + m_gsp_speedup_addr[1] = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfffcfc00, 0xfffcfc0f, FUNC(hdgsp_speedup2_w)); + m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff9fc00, 0xfff9fc0f, FUNC(hdgsp_speedup_r)); m_gsp_speedup_pc = 0xfff41070; /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); } @@ -4307,14 +4307,14 @@ DRIVER_INIT_MEMBER(harddriv_state,racedriv) /* set up the slapstic */ slapstic_init(machine(), 117); - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w)); + m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w)); + m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w)); + m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w)); /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); } @@ -4330,22 +4330,22 @@ static void racedrivc_init_common(running_machine &machine, offs_t gsp_protectio /* set up the slapstic */ slapstic_init(machine, 117); - state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w)); + state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w)); /* synchronization */ - state->m_rddsp32_sync[0] = state->m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w)); - state->m_rddsp32_sync[1] = state->m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w)); + state->m_rddsp32_sync[0] = state->m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w)); + state->m_rddsp32_sync[1] = state->m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w)); /* set up protection hacks */ - state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(gsp_protection, gsp_protection + 0x0f, FUNC(hdgsp_protection_w)); + state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM).install_legacy_write_handler(gsp_protection, gsp_protection + 0x0f, FUNC(hdgsp_protection_w)); /* set up gsp speedup handler */ - state->m_gsp_speedup_addr[0] = state->m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_w)); - state->m_gsp->space(AS_PROGRAM)->install_legacy_read_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_r)); + state->m_gsp_speedup_addr[0] = state->m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_w)); + state->m_gsp->space(AS_PROGRAM).install_legacy_read_handler(0xfff76f60, 0xfff76f6f, FUNC(rdgsp_speedup1_r)); state->m_gsp_speedup_pc = 0xfff43a00; /* set up adsp speedup handlers */ - state->m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + state->m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); } DRIVER_INIT_MEMBER(harddriv_state,racedrivc) { racedrivc_init_common(machine(), 0xfff95cd0); } @@ -4357,8 +4357,8 @@ DRIVER_INIT_MEMBER(harddriv_state,racedrivb1) /* this unpleasantness prevents racedrivb1 and racedrivg1 from crashing MAME during boot */ /* both clear the DSP32C's RAM and then release it from reset, causing it to run through */ /* its address space recursively executing instructions */ - m_dsp32->space(AS_PROGRAM)->install_read_handler(0x002000, 0x5fffff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this)); - m_dsp32->space(AS_PROGRAM)->install_read_handler(0x640000, 0xfff7ff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this)); + m_dsp32->space(AS_PROGRAM).install_read_handler(0x002000, 0x5fffff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this)); + m_dsp32->space(AS_PROGRAM).install_read_handler(0x640000, 0xfff7ff, read32_delegate(FUNC(harddriv_state::rddsp_unmap_r),this)); DRIVER_INIT_CALL(racedriv); } @@ -4385,23 +4385,23 @@ static void steeltal_init_common(running_machine &machine, offs_t ds3_transfer_p init_dspcom(machine); atarijsa_init(machine, "IN0", 0x0020); - state->m_maincpu->space(AS_PROGRAM)->install_read_handler(0x908000, 0x908001, read16_delegate(FUNC(harddriv_state::steeltal_dummy_r),state)); + state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x908000, 0x908001, read16_delegate(FUNC(harddriv_state::steeltal_dummy_r),state)); /* set up the SLOOP */ if (!proto_sloop) { - state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_sloop_r), FUNC(st68k_sloop_w)); - state->m_m68k_sloop_alt_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0x4e000, 0x4ffff, FUNC(st68k_sloop_alt_r)); + state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_sloop_r), FUNC(st68k_sloop_w)); + state->m_m68k_sloop_alt_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0x4e000, 0x4ffff, FUNC(st68k_sloop_alt_r)); } else - state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_protosloop_r), FUNC(st68k_protosloop_w)); + state->m_m68k_slapstic_base = state->m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(st68k_protosloop_r), FUNC(st68k_protosloop_w)); /* set up protection hacks */ - state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff965d0, 0xfff965df, FUNC(hdgsp_protection_w)); + state->m_gsp_protection = state->m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff965d0, 0xfff965df, FUNC(hdgsp_protection_w)); /* set up adsp speedup handlers */ - state->m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); - state->m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r)); + state->m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + state->m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r)); state->m_ds3_speedup_addr = &state->m_adsp_data_memory[0x1f99]; state->m_ds3_speedup_pc = 0xff; state->m_ds3_transfer_pc = ds3_transfer_pc; @@ -4423,20 +4423,20 @@ DRIVER_INIT_MEMBER(harddriv_state,strtdriv) /* set up the slapstic */ slapstic_init(machine(), 117); - m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM)->install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w)); + m_m68k_slapstic_base = m_maincpu->space(AS_PROGRAM).install_legacy_readwrite_handler(0xe0000, 0xfffff, FUNC(rd68k_slapstic_r), FUNC(rd68k_slapstic_w)); - m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r)); + m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w)); + m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613c00, 0x613c03, FUNC(rddsp32_sync0_w)); + m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x613e00, 0x613e03, FUNC(rddsp32_sync1_w)); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff960a0, 0xfff960af, FUNC(hdgsp_protection_w)); + m_gsp_protection = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff960a0, 0xfff960af, FUNC(hdgsp_protection_w)); /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r)); m_ds3_speedup_addr = &m_adsp_data_memory[0x1f99]; m_ds3_speedup_pc = 0xff; m_ds3_transfer_pc = 0x43672; @@ -4451,18 +4451,18 @@ DRIVER_INIT_MEMBER(harddriv_state,hdrivair) init_ds3(machine()); init_dsk2(machine()); - m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r)); + m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w)); + m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w)); + m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w)); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff943f0, 0xfff943ff, FUNC(hdgsp_protection_w)); + m_gsp_protection = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff943f0, 0xfff943ff, FUNC(hdgsp_protection_w)); /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f99, 0x1f99, FUNC(hdds3_speedup_r)); m_ds3_speedup_addr = &m_adsp_data_memory[0x1f99]; m_ds3_speedup_pc = 0x2da; m_ds3_transfer_pc = 0x407b8; @@ -4477,18 +4477,18 @@ DRIVER_INIT_MEMBER(harddriv_state,hdrivairp) init_ds3(machine()); init_dsk2(machine()); - m_maincpu->space(AS_PROGRAM)->install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r)); + m_maincpu->space(AS_PROGRAM).install_legacy_read_handler(0xa80000, 0xafffff, FUNC(hda68k_port1_r)); /* synchronization */ - m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w)); - m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM)->install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w)); + m_rddsp32_sync[0] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21fe00, 0x21fe03, FUNC(rddsp32_sync0_w)); + m_rddsp32_sync[1] = m_dsp32->space(AS_PROGRAM).install_legacy_write_handler(0x21ff00, 0x21ff03, FUNC(rddsp32_sync1_w)); /* set up protection hacks */ - m_gsp_protection = m_gsp->space(AS_PROGRAM)->install_legacy_write_handler(0xfff916c0, 0xfff916cf, FUNC(hdgsp_protection_w)); + m_gsp_protection = m_gsp->space(AS_PROGRAM).install_legacy_write_handler(0xfff916c0, 0xfff916cf, FUNC(hdgsp_protection_w)); /* set up adsp speedup handlers */ - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); - m_adsp->space(AS_DATA)->install_legacy_read_handler(0x1f9a, 0x1f9a, FUNC(hdds3_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1fff, 0x1fff, FUNC(hdadsp_speedup_r)); + m_adsp->space(AS_DATA).install_legacy_read_handler(0x1f9a, 0x1f9a, FUNC(hdds3_speedup_r)); m_ds3_speedup_addr = &m_adsp_data_memory[0x1f9a]; m_ds3_speedup_pc = 0x2d9; m_ds3_transfer_pc = 0X407da; diff --git a/src/mame/drivers/highvdeo.c b/src/mame/drivers/highvdeo.c index 11ecd74b03c..f62eca005d3 100644 --- a/src/mame/drivers/highvdeo.c +++ b/src/mame/drivers/highvdeo.c @@ -1201,7 +1201,7 @@ READ16_MEMBER(highvdeo_state::ciclone_status_r) DRIVER_INIT_MEMBER(highvdeo_state,ciclone) { - machine().device("maincpu")->memory().space(AS_IO)->install_read_handler(0x0030, 0x0033, read16_delegate(FUNC(highvdeo_state::ciclone_status_r), this)); + machine().device("maincpu")->memory().space(AS_IO).install_read_handler(0x0030, 0x0033, read16_delegate(FUNC(highvdeo_state::ciclone_status_r), this)); } /* @@ -1271,7 +1271,7 @@ WRITE16_MEMBER(highvdeo_state::fashion_output_w) DRIVER_INIT_MEMBER(highvdeo_state,fashion) { - machine().device("maincpu")->memory().space(AS_IO)->install_write_handler(0x0002, 0x0003, write16_delegate(FUNC(highvdeo_state::fashion_output_w), this)); + machine().device("maincpu")->memory().space(AS_IO).install_write_handler(0x0002, 0x0003, write16_delegate(FUNC(highvdeo_state::fashion_output_w), this)); } GAMEL( 2000, tour4000, 0, tv_vcf, tv_vcf, driver_device, 0, ROT0, "High Video", "Tour 4000", 0, layout_fashion ) diff --git a/src/mame/drivers/hng64.c b/src/mame/drivers/hng64.c index 35cb805c3a4..168661ffafc 100644 --- a/src/mame/drivers/hng64.c +++ b/src/mame/drivers/hng64.c @@ -1806,7 +1806,7 @@ void hng64_state::machine_reset() KL5C80_virtual_mem_sync(this); - address_space &space = *machine().device<z80_device>("comm")->space(AS_PROGRAM); + address_space &space = machine().device<z80_device>("comm")->space(AS_PROGRAM); space.set_direct_update_handler(direct_update_delegate(FUNC(hng64_state::KL5C80_direct_handler), this)); machine().device("comm")->execute().set_input_line(INPUT_LINE_RESET, PULSE_LINE); // reset the CPU and let 'er rip diff --git a/src/mame/drivers/homedata.c b/src/mame/drivers/homedata.c index fbe6c7b5139..e3f52f09690 100644 --- a/src/mame/drivers/homedata.c +++ b/src/mame/drivers/homedata.c @@ -1211,7 +1211,7 @@ MACHINE_RESET_MEMBER(homedata_state,homedata) MACHINE_RESET_MEMBER(homedata_state,pteacher) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* on reset, ports are set as input (high impedance), therefore 0xff output */ pteacher_upd7807_portc_w(space, 0, 0xff); @@ -1227,7 +1227,7 @@ MACHINE_RESET_MEMBER(homedata_state,pteacher) MACHINE_RESET_MEMBER(homedata_state,reikaids) { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); /* on reset, ports are set as input (high impedance), therefore 0xff output */ reikaids_upd7807_portc_w(space, 0, 0xff); @@ -2016,15 +2016,15 @@ DRIVER_INIT_MEMBER(homedata_state,jogakuen) /* it seems that Mahjong Jogakuen runs on the same board as the others, but with just these two addresses swapped. Instead of creating a new MachineDriver, I just fix them here. */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8007, 0x8007, write8_delegate(FUNC(homedata_state::pteacher_blitter_bank_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x8005, 0x8005, write8_delegate(FUNC(homedata_state::pteacher_gfx_bank_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8007, 0x8007, write8_delegate(FUNC(homedata_state::pteacher_blitter_bank_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x8005, 0x8005, write8_delegate(FUNC(homedata_state::pteacher_gfx_bank_w),this)); } DRIVER_INIT_MEMBER(homedata_state,mjikaga) { /* Mahjong Ikagadesuka is different as well. */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x7802, 0x7802, read8_delegate(FUNC(homedata_state::pteacher_snd_r),this)); - machine().device("audiocpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0123, 0x0123, write8_delegate(FUNC(homedata_state::pteacher_snd_answer_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x7802, 0x7802, read8_delegate(FUNC(homedata_state::pteacher_snd_r),this)); + machine().device("audiocpu")->memory().space(AS_PROGRAM).install_write_handler(0x0123, 0x0123, write8_delegate(FUNC(homedata_state::pteacher_snd_answer_w),this)); } DRIVER_INIT_MEMBER(homedata_state,reikaids) diff --git a/src/mame/drivers/hshavoc.c b/src/mame/drivers/hshavoc.c index c631448ed08..3b49c29b81b 100644 --- a/src/mame/drivers/hshavoc.c +++ b/src/mame/drivers/hshavoc.c @@ -218,7 +218,7 @@ DRIVER_INIT_MEMBER(md_cons_state,hshavoc) */ { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); space.nop_write(0x200000, 0x201fff); } diff --git a/src/mame/drivers/hyprduel.c b/src/mame/drivers/hyprduel.c index 38a73db1980..569767ad91f 100644 --- a/src/mame/drivers/hyprduel.c +++ b/src/mame/drivers/hyprduel.c @@ -803,10 +803,10 @@ DRIVER_INIT_MEMBER(hyprduel_state,hyprduel) m_int_num = 0x02; /* cpu synchronization (severe timings) */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc0040e, 0xc00411, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_w),this)); - machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0xc00408, 0xc00409, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xc00408, 0xc00409, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_w),this)); - machine().device("sub")->memory().space(AS_PROGRAM)->install_read_handler(0xfff34c, 0xfff34d, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc0040e, 0xc00411, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_w),this)); + machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0xc00408, 0xc00409, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xc00408, 0xc00409, write16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_w),this)); + machine().device("sub")->memory().space(AS_PROGRAM).install_read_handler(0xfff34c, 0xfff34d, read16_delegate(FUNC(hyprduel_state::hyprduel_cpusync_trigger2_r),this)); } DRIVER_INIT_MEMBER(hyprduel_state,magerror) diff --git a/src/mame/drivers/igs011.c b/src/mame/drivers/igs011.c index ebb695f1777..6b5af2f4ad3 100644 --- a/src/mame/drivers/igs011.c +++ b/src/mame/drivers/igs011.c @@ -1036,17 +1036,17 @@ WRITE16_MEMBER(igs011_state::igs011_prot_addr_w) // m_prot2 = 0x00; - address_space *sp = machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &sp = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = memregion("maincpu")->base(); // Plug previous address range with ROM access - sp->install_rom(m_prot1_addr + 0, m_prot1_addr + 9, rom + m_prot1_addr); + sp.install_rom(m_prot1_addr + 0, m_prot1_addr + 9, rom + m_prot1_addr); m_prot1_addr = (data << 4) ^ 0x8340; // Add protection memory range - sp->install_write_handler(m_prot1_addr + 0, m_prot1_addr + 7, write16_delegate(FUNC(igs011_state::igs011_prot1_w), this)); - sp->install_read_handler (m_prot1_addr + 8, m_prot1_addr + 9, read16_delegate(FUNC(igs011_state::igs011_prot1_r), this)); + sp.install_write_handler(m_prot1_addr + 0, m_prot1_addr + 7, write16_delegate(FUNC(igs011_state::igs011_prot1_w), this)); + sp.install_read_handler (m_prot1_addr + 8, m_prot1_addr + 9, read16_delegate(FUNC(igs011_state::igs011_prot1_r), this)); } /* READ16_MEMBER(igs011_state::igs011_prot_fake_r) @@ -1835,7 +1835,7 @@ DRIVER_INIT_MEMBER(igs011_state,drgnwrldv21) drgnwrld_type2_decrypt(machine()); drgnwrld_gfx_decrypt(machine()); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4c0, 0xd4ff, read16_delegate(FUNC(igs011_state::drgnwrldv21_igs011_prot2_r), this)); /* // PROTECTION CHECKS // bp 32ee; bp 11ca8; bp 23d5e; bp 23fd0; bp 24170; bp 24348; bp 2454e; bp 246cc; bp 24922; bp 24b66; bp 24de2; bp 2502a; bp 25556; bp 269de; bp 2766a; bp 2a830 @@ -1975,7 +1975,7 @@ DRIVER_INIT_MEMBER(igs011_state,dbc) dbc_decrypt(machine()); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::dbc_igs011_prot2_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::dbc_igs011_prot2_r), this)); /* // PROTECTION CHECKS rom[0x04c42/2] = 0x602e; // 004C42: 6604 bne 4c48 (rom test error otherwise) @@ -2005,7 +2005,7 @@ DRIVER_INIT_MEMBER(igs011_state,ryukobou) ryukobou_decrypt(machine()); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::ryukobou_igs011_prot2_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x10600, 0x107ff, read16_delegate(FUNC(igs011_state::ryukobou_igs011_prot2_r), this)); // PROTECTION CHECKS // rom[0x2df68/2] = 0x4e75; // 02DF68: 4E56 FE00 link A6, #-$200 (fills palette with pink otherwise) diff --git a/src/mame/drivers/igs017.c b/src/mame/drivers/igs017.c index 595ec8784fa..f9b245d3738 100644 --- a/src/mame/drivers/igs017.c +++ b/src/mame/drivers/igs017.c @@ -797,7 +797,7 @@ DRIVER_INIT_MEMBER(igs017_state,starzan) starzan_decrypt(data, size, false); // data starzan_decrypt(code, size, true); // opcodes - machine().device("maincpu")->memory().space(AS_PROGRAM)->set_decrypted_region(0x00000, 0x3ffff, code); + machine().device("maincpu")->memory().space(AS_PROGRAM).set_decrypted_region(0x00000, 0x3ffff, code); mgcs_flip_sprites(machine()); } @@ -3393,7 +3393,7 @@ MACHINE_CONFIG_END MACHINE_RESET_MEMBER(igs017_state,lhzb2a) { MACHINE_RESET_CALL_MEMBER( mgcs ); - lhzb2a_input_addr_w(*m_maincpu->space(AS_PROGRAM), 0, 0xf0); + lhzb2a_input_addr_w(m_maincpu->space(AS_PROGRAM), 0, 0xf0); } static MACHINE_CONFIG_START( lhzb2a, igs017_state ) diff --git a/src/mame/drivers/iqblock.c b/src/mame/drivers/iqblock.c index 425ee470ea5..470adf7a58c 100644 --- a/src/mame/drivers/iqblock.c +++ b/src/mame/drivers/iqblock.c @@ -443,7 +443,7 @@ DRIVER_INIT_MEMBER(iqblock_state,iqblock) m_generic_paletteram2_8.set_target(rom + 0x12800, 0x800); m_fgvideoram = rom + 0x16800; m_bgvideoram = rom + 0x17000; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xfe26, 0xfe26, write8_delegate(FUNC(iqblock_state::iqblock_prot_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xfe26, 0xfe26, write8_delegate(FUNC(iqblock_state::iqblock_prot_w),this)); m_video_type=1; } @@ -465,7 +465,7 @@ DRIVER_INIT_MEMBER(iqblock_state,grndtour) m_generic_paletteram2_8.set_target(rom + 0x12800, 0x800); m_fgvideoram = rom + 0x16800; m_bgvideoram = rom + 0x17000; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xfe39, 0xfe39, write8_delegate(FUNC(iqblock_state::grndtour_prot_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xfe39, 0xfe39, write8_delegate(FUNC(iqblock_state::grndtour_prot_w),this)); m_video_type=0; } diff --git a/src/mame/drivers/ironhors.c b/src/mame/drivers/ironhors.c index f766c85f76e..55904d62c0d 100644 --- a/src/mame/drivers/ironhors.c +++ b/src/mame/drivers/ironhors.c @@ -436,7 +436,7 @@ static TIMER_DEVICE_CALLBACK( farwest_irq ) READ8_MEMBER(ironhors_state::farwest_soundlatch_r) { - return soundlatch_byte_r(*m_soundcpu->space(AS_PROGRAM), 0); + return soundlatch_byte_r(m_soundcpu->space(AS_PROGRAM), 0); } static const ym2203_interface farwest_ym2203_config = diff --git a/src/mame/drivers/itech32.c b/src/mame/drivers/itech32.c index 118e66f736e..4f3178709b2 100644 --- a/src/mame/drivers/itech32.c +++ b/src/mame/drivers/itech32.c @@ -704,7 +704,7 @@ WRITE8_MEMBER(itech32_state::drivedge_portb_out) set_led_status(machine(), 1, data & 0x01); set_led_status(machine(), 2, data & 0x02); set_led_status(machine(), 3, data & 0x04); - machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, (data & 0x10) << 3); + machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, (data & 0x10) << 3); coin_counter_w(machine(), 0, (data & 0x20) >> 5); } @@ -722,7 +722,7 @@ WRITE8_MEMBER(itech32_state::pia_portb_out) /* bit 4 controls the ticket dispenser */ /* bit 5 controls the coin counter */ /* bit 6 controls the diagnostic sound LED */ - machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, (data & 0x10) << 3); + machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, (data & 0x10) << 3); coin_counter_w(machine(), 0, (data & 0x20) >> 5); } @@ -4037,8 +4037,8 @@ DRIVER_INIT_MEMBER(itech32_state,drivedge) m_planes = 1; m_is_drivedge = 1; - machine().device("dsp1")->memory().space(AS_PROGRAM)->install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms1_speedup_r),this)); - machine().device("dsp2")->memory().space(AS_PROGRAM)->install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms2_speedup_r),this)); + machine().device("dsp1")->memory().space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms1_speedup_r),this)); + machine().device("dsp2")->memory().space(AS_PROGRAM).install_read_handler(0x8382, 0x8382, read32_delegate(FUNC(itech32_state::drivedge_tms2_speedup_r),this)); } @@ -4054,11 +4054,11 @@ DRIVER_INIT_MEMBER(itech32_state,wcbowl) m_vram_height = 1024; m_planes = 1; - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680000, 0x680001, read16_delegate(FUNC(itech32_state::trackball_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680000, 0x680001, read16_delegate(FUNC(itech32_state::trackball_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_read(0x578000, 0x57ffff); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680080, 0x680081, read16_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0x680080, 0x680081); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_read(0x578000, 0x57ffff); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680080, 0x680081, read16_delegate(FUNC(itech32_state::wcbowl_prot_result_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0x680080, 0x680081); } @@ -4072,8 +4072,8 @@ static void init_sftm_common(running_machine &machine, int prot_addr) state->m_itech020_prot_address = prot_addr; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state)); } @@ -4104,10 +4104,10 @@ static void init_shuffle_bowl_common(running_machine &machine, int prot_addr) state->m_itech020_prot_address = prot_addr; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),state)); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x300000, 0x300003, write32_delegate(FUNC(itech32_state::itech020_color2_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x380000, 0x380003, write32_delegate(FUNC(itech32_state::itech020_color1_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),state)); } @@ -4126,7 +4126,7 @@ DRIVER_INIT_MEMBER(itech32_state,wcbowln) static void install_timekeeper(running_machine &machine) { device_t *device = machine.device("m48t02"); - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_readwrite_handler(*device, 0x681000, 0x6817ff, FUNC(timekeeper_r), FUNC(timekeeper_w), 0xffffffff); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_legacy_readwrite_handler(*device, 0x681000, 0x6817ff, FUNC(timekeeper_r), FUNC(timekeeper_w), 0xffffffff); } DRIVER_INIT_MEMBER(itech32_state,wcbowlt) @@ -4158,7 +4158,7 @@ DRIVER_INIT_MEMBER(itech32_state,gt3d) Hacked versions of this PCB have been found with GT97 through GTClassic. This is _NOT_ a factory modification */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_8bit_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_8bit_r),this)); init_gt_common(machine()); } @@ -4171,8 +4171,8 @@ DRIVER_INIT_MEMBER(itech32_state,aama) board share the same sound CPU code and sample ROMs. This board has all versions of GT for it, GT3D through GTClassic */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x180800, 0x180803, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x181000, 0x181003, read32_delegate(FUNC(itech32_state::trackball32_4bit_p2_r),this)); init_gt_common(machine()); } @@ -4196,7 +4196,7 @@ DRIVER_INIT_MEMBER(itech32_state,s_ver) board: GT97 v1.21S, GT98, GT99, GT2K & GT Classic Versions 1.00S Trackball info is read through 200202 (actually 200203). */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200200, 0x200203, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200200, 0x200203, read32_delegate(FUNC(itech32_state::trackball32_4bit_p1_r),this)); init_gt_common(machine()); } @@ -4210,7 +4210,7 @@ DRIVER_INIT_MEMBER(itech32_state,gt3dl) Player 1 trackball read through 200003 Player 2 trackball read through 200002 */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_4bit_combined_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x200000, 0x200003, read32_delegate(FUNC(itech32_state::trackball32_4bit_combined_r),this)); init_gt_common(machine()); } @@ -4218,7 +4218,7 @@ DRIVER_INIT_MEMBER(itech32_state,gt3dl) DRIVER_INIT_MEMBER(itech32_state,gt2kp) { /* a little extra protection */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gt2kp_prot_result_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gt2kp_prot_result_r),this)); DRIVER_INIT_CALL(aama); /* The protection code is: @@ -4239,7 +4239,7 @@ Label1 bne.s Label1 ; Infinite loop if result isn't 0x01 DRIVER_INIT_MEMBER(itech32_state,gtclasscp) { /* a little extra protection */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gtclass_prot_result_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x680000, 0x680003, read32_delegate(FUNC(itech32_state::gtclass_prot_result_r),this)); DRIVER_INIT_CALL(aama); /* The protection code is: diff --git a/src/mame/drivers/itech8.c b/src/mame/drivers/itech8.c index 9b2301366fb..ab9681ac1ab 100644 --- a/src/mame/drivers/itech8.c +++ b/src/mame/drivers/itech8.c @@ -767,7 +767,7 @@ WRITE8_MEMBER(itech8_state::ym2203_portb_out) /* bit 6 controls the diagnostic sound LED */ /* bit 7 controls the ticket dispenser */ m_pia_portb_data = data; - machine().device<ticket_dispenser_device>("ticket")->write(*machine().memory().first_space(), 0, data & 0x80); + machine().device<ticket_dispenser_device>("ticket")->write(machine().driver_data()->generic_space(), 0, data & 0x80); coin_counter_w(machine(), 0, (data & 0x20) >> 5); } @@ -2630,25 +2630,25 @@ ROM_END DRIVER_INIT_MEMBER(itech8_state,grmatch) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0160, 0x0160, write8_delegate(FUNC(itech8_state::grmatch_palette_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x0180, 0x0180, write8_delegate(FUNC(itech8_state::grmatch_xscroll_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->unmap_write(0x01e0, 0x01ff); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0160, 0x0160, write8_delegate(FUNC(itech8_state::grmatch_palette_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x0180, 0x0180, write8_delegate(FUNC(itech8_state::grmatch_xscroll_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).unmap_write(0x01e0, 0x01ff); } DRIVER_INIT_MEMBER(itech8_state,slikshot) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x0180, 0x0180, FUNC(slikshot_z80_r)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x01cf, 0x01cf, FUNC(slikshot_z80_control_r)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x01cf, 0x01cf, FUNC(slikshot_z80_control_w)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x0180, 0x0180, FUNC(slikshot_z80_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x01cf, 0x01cf, FUNC(slikshot_z80_control_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x01cf, 0x01cf, FUNC(slikshot_z80_control_w)); } DRIVER_INIT_MEMBER(itech8_state,sstrike) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x1180, 0x1180, FUNC(slikshot_z80_r)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler (0x11cf, 0x11cf, FUNC(slikshot_z80_control_r)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_write_handler(0x11cf, 0x11cf, FUNC(slikshot_z80_control_w)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x1180, 0x1180, FUNC(slikshot_z80_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x11cf, 0x11cf, FUNC(slikshot_z80_control_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x11cf, 0x11cf, FUNC(slikshot_z80_control_w)); } @@ -2679,15 +2679,15 @@ DRIVER_INIT_MEMBER(itech8_state,neckneck) DRIVER_INIT_MEMBER(itech8_state,rimrockn) { /* additional input ports */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0161, 0x0161, "161"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0162, 0x0162, "162"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0163, 0x0163, "163"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0164, 0x0164, "164"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port (0x0165, 0x0165, "165"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0161, 0x0161, "161"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0162, 0x0162, "162"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0163, 0x0163, "163"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0164, 0x0164, "164"); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port (0x0165, 0x0165, "165"); /* different banking mechanism (disable the old one) */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01a0, 0x01a0, write8_delegate(FUNC(itech8_state::rimrockn_bank_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x01c0, 0x01df, write8_delegate(FUNC(itech8_state::itech8_blitter_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01a0, 0x01a0, write8_delegate(FUNC(itech8_state::rimrockn_bank_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01c0, 0x01df, write8_delegate(FUNC(itech8_state::itech8_blitter_w),this)); } diff --git a/src/mame/drivers/jack.c b/src/mame/drivers/jack.c index 0529e4c3979..db0bf75497d 100644 --- a/src/mame/drivers/jack.c +++ b/src/mame/drivers/jack.c @@ -1290,7 +1290,7 @@ ROM_END static void treahunt_decode( running_machine &machine ) { int A; - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); UINT8 *rom = machine.root_device().memregion("maincpu")->base(); UINT8 *decrypt = auto_alloc_array(machine, UINT8, 0x4000); int data; @@ -1399,10 +1399,10 @@ DRIVER_INIT_MEMBER(jack_state,striv) } // Set-up the weirdest questions read ever done - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(jack_state::striv_question_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xc000, 0xcfff, read8_delegate(FUNC(jack_state::striv_question_r),this)); // Nop out unused sprites writes - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write(0xb000, 0xb0ff); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write(0xb000, 0xb0ff); m_timer_rate = 128; } diff --git a/src/mame/drivers/jaguar.c b/src/mame/drivers/jaguar.c index 8c5c1d22602..59587104243 100644 --- a/src/mame/drivers/jaguar.c +++ b/src/mame/drivers/jaguar.c @@ -2273,10 +2273,10 @@ void jaguar_state::cojag_common_init(UINT16 gpu_jump_offs, UINT16 spin_pc) /* install synchronization hooks for GPU */ if (m_is_r3000) - m_main_cpu->space(AS_PROGRAM)->install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); + m_main_cpu->space(AS_PROGRAM).install_write_handler(0x04f0b000 + gpu_jump_offs, 0x04f0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); else - m_main_cpu->space(AS_PROGRAM)->install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); - m_gpu->space(AS_PROGRAM)->install_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, read32_delegate(FUNC(jaguar_state::gpu_jump_r), this)); + m_main_cpu->space(AS_PROGRAM).install_write_handler(0xf0b000 + gpu_jump_offs, 0xf0b003 + gpu_jump_offs, write32_delegate(FUNC(jaguar_state::gpu_jump_w), this)); + m_gpu->space(AS_PROGRAM).install_read_handler(0xf03000 + gpu_jump_offs, 0xf03003 + gpu_jump_offs, read32_delegate(FUNC(jaguar_state::gpu_jump_r), this)); m_gpu_jump_address = &m_gpu_ram[gpu_jump_offs/4]; m_gpu_spin_pc = 0xf03000 + spin_pc; @@ -2294,7 +2294,7 @@ DRIVER_INIT_MEMBER(jaguar_state,area51a) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_write_handler(0xa02030, 0xa02033, write32_delegate(FUNC(jaguar_state::area51_main_speedup_w),this)); #endif } @@ -2307,7 +2307,7 @@ DRIVER_INIT_MEMBER(jaguar_state,area51) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x100062e8, 0x100062eb, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2322,7 +2322,7 @@ DRIVER_INIT_MEMBER(jaguar_state,maxforce) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x1000865c, 0x1000865f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2337,7 +2337,7 @@ DRIVER_INIT_MEMBER(jaguar_state,area51mx) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_write_handler(0xa19550, 0xa19557, write32_delegate(FUNC(jaguar_state::area51mx_main_speedup_w),this)); #endif } @@ -2353,7 +2353,7 @@ DRIVER_INIT_MEMBER(jaguar_state,a51mxr3k) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 120; - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x10006f0c, 0x10006f0f, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2366,7 +2366,7 @@ DRIVER_INIT_MEMBER(jaguar_state,fishfren) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 200; - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x10021b60, 0x10021b63, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } @@ -2379,8 +2379,8 @@ void jaguar_state::init_freeze_common(offs_t main_speedup_addr) /* install speedup for main CPU */ m_main_speedup_max_cycles = 200; if (main_speedup_addr != 0) - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this)); - m_main_gpu_wait = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(main_speedup_addr, main_speedup_addr + 3, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r), this)); + m_main_gpu_wait = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x0400d900, 0x0400d900 + 3, read32_delegate(FUNC(jaguar_state::main_gpu_wait_r), this)); #endif } @@ -2399,7 +2399,7 @@ DRIVER_INIT_MEMBER(jaguar_state,vcircle) #if ENABLE_SPEEDUP_HACKS /* install speedup for main CPU */ m_main_speedup_max_cycles = 50; - m_main_speedup = m_main_cpu->space(AS_PROGRAM)->install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); + m_main_speedup = m_main_cpu->space(AS_PROGRAM).install_read_handler(0x12005b34, 0x12005b37, read32_delegate(FUNC(jaguar_state::cojagr3k_main_speedup_r),this)); #endif } diff --git a/src/mame/drivers/jalmah.c b/src/mame/drivers/jalmah.c index b81fa3bd697..3b068d8c7cb 100644 --- a/src/mame/drivers/jalmah.c +++ b/src/mame/drivers/jalmah.c @@ -730,7 +730,7 @@ WRITE16_MEMBER(jalmah_state::urashima_dma_w) static void daireika_palette_dma(running_machine &machine, UINT16 val) { //jalmah_state *state = machine.driver_data<jalmah_state>(); - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); UINT32 index_1, index_2, src_addr, tmp_addr; /*a0=301c0+jm_shared_ram[0x540/2] & 0xf00 */ /*a1=88000*/ @@ -2421,44 +2421,44 @@ READ16_MEMBER(jalmah_state::suchipi_mcu_r) DRIVER_INIT_MEMBER(jalmah_state,urashima) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::urashima_mcu_r), this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::urashima_mcu_w), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::urashima_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::urashima_mcu_w), this)); m_mcu_prg = 0x12; } DRIVER_INIT_MEMBER(jalmah_state,daireika) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::daireika_mcu_r), this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::daireika_mcu_w), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::daireika_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::daireika_mcu_w), this)); m_mcu_prg = 0x11; } DRIVER_INIT_MEMBER(jalmah_state,mjzoomin) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::mjzoomin_mcu_r), this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::mjzoomin_mcu_w), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::mjzoomin_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x80012, 0x80013, write16_delegate(FUNC(jalmah_state::mjzoomin_mcu_w), this)); m_mcu_prg = 0x13; } DRIVER_INIT_MEMBER(jalmah_state,kakumei) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this)); m_mcu_prg = 0x21; } DRIVER_INIT_MEMBER(jalmah_state,kakumei2) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::kakumei_mcu_r), this)); m_mcu_prg = 0x22; } DRIVER_INIT_MEMBER(jalmah_state,suchipi) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::suchipi_mcu_r), this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0x80004, 0x80005, read16_delegate(FUNC(jalmah_state::suchipi_mcu_r), this)); m_mcu_prg = 0x23; } diff --git a/src/mame/drivers/jangou.c b/src/mame/drivers/jangou.c index 140472b23f0..2f3cf3f1a5e 100644 --- a/src/mame/drivers/jangou.c +++ b/src/mame/drivers/jangou.c @@ -1363,7 +1363,7 @@ READ8_MEMBER(jangou_state::jngolady_rng_r) DRIVER_INIT_MEMBER(jangou_state,jngolady) { - machine().device("nsc")->memory().space(AS_PROGRAM)->install_read_handler(0x08, 0x08, read8_delegate(FUNC(jangou_state::jngolady_rng_r),this) ); + machine().device("nsc")->memory().space(AS_PROGRAM).install_read_handler(0x08, 0x08, read8_delegate(FUNC(jangou_state::jngolady_rng_r),this) ); } DRIVER_INIT_MEMBER(jangou_state,luckygrl) diff --git a/src/mame/drivers/jchan.c b/src/mame/drivers/jchan.c index e70f563846b..721f8ee19be 100644 --- a/src/mame/drivers/jchan.c +++ b/src/mame/drivers/jchan.c @@ -722,8 +722,8 @@ ROM_END DRIVER_INIT_MEMBER( jchan_state, jchan ) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x403ffe, 0x403fff, write16_delegate(FUNC(jchan_state::main2sub_cmd_w),this)); - machine().device("sub")->memory().space(AS_PROGRAM)->install_write_handler(0x400000, 0x400001, write16_delegate(FUNC(jchan_state::sub2main_cmd_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x403ffe, 0x403fff, write16_delegate(FUNC(jchan_state::main2sub_cmd_w),this)); + machine().device("sub")->memory().space(AS_PROGRAM).install_write_handler(0x400000, 0x400001, write16_delegate(FUNC(jchan_state::sub2main_cmd_w),this)); } diff --git a/src/mame/drivers/kaneko16.c b/src/mame/drivers/kaneko16.c index 8011d2a6777..5e3b00b0e44 100644 --- a/src/mame/drivers/kaneko16.c +++ b/src/mame/drivers/kaneko16.c @@ -3838,7 +3838,7 @@ DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, shogwarr ) DRIVER_INIT_MEMBER( kaneko16_shogwarr_state, brapboys ) { // sample banking is different on brap boys for the music, why? GALs / PALs ? - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe00000, 0xe00001, write16_delegate(FUNC(kaneko16_shogwarr_state::brapboys_oki_bank_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe00000, 0xe00001, write16_delegate(FUNC(kaneko16_shogwarr_state::brapboys_oki_bank_w),this)); // default sample banks kaneko16_common_oki_bank_w(machine(), "bank10", "oki1", 0, 0x30000, 0x10000); diff --git a/src/mame/drivers/kangaroo.c b/src/mame/drivers/kangaroo.c index 3f3d1ca3eaa..196d09870c3 100644 --- a/src/mame/drivers/kangaroo.c +++ b/src/mame/drivers/kangaroo.c @@ -181,7 +181,7 @@ void kangaroo_state::machine_start() MACHINE_START_MEMBER(kangaroo_state,kangaroo_mcu) { kangaroo_state::machine_start(); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler(0xef00, 0xefff, read8_delegate(FUNC(kangaroo_state::mcu_sim_r),this), write8_delegate(FUNC(kangaroo_state::mcu_sim_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler(0xef00, 0xefff, read8_delegate(FUNC(kangaroo_state::mcu_sim_r),this), write8_delegate(FUNC(kangaroo_state::mcu_sim_w),this)); save_item(NAME(m_mcu_clock)); } diff --git a/src/mame/drivers/kchamp.c b/src/mame/drivers/kchamp.c index 3d85a4e7d9e..3b2b262d642 100644 --- a/src/mame/drivers/kchamp.c +++ b/src/mame/drivers/kchamp.c @@ -711,7 +711,7 @@ ROM_END static UINT8 *decrypt_code(running_machine &machine) { - address_space &space = *machine.device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine.device("maincpu")->memory().space(AS_PROGRAM); UINT8 *decrypted = auto_alloc_array(machine, UINT8, 0x10000); UINT8 *rom = machine.root_device().memregion("maincpu")->base(); int A; diff --git a/src/mame/drivers/konamigv.c b/src/mame/drivers/konamigv.c index 8c9a383f029..8e4f6083eeb 100644 --- a/src/mame/drivers/konamigv.c +++ b/src/mame/drivers/konamigv.c @@ -528,9 +528,9 @@ DRIVER_INIT_MEMBER(konamigv_state,simpbowl) m_flash8[2] = machine().device<fujitsu_29f016a_device>("flash2"); m_flash8[3] = machine().device<fujitsu_29f016a_device>("flash3"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::flash_r),this), write32_delegate(FUNC(konamigv_state::flash_w),this) ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1f6800c0, 0x1f6800c7, read32_delegate(FUNC(konamigv_state::trackball_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1f6800c8, 0x1f6800cb, read32_delegate(FUNC(konamigv_state::unknown_r),this)); /* ?? */ + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::flash_r),this), write32_delegate(FUNC(konamigv_state::flash_w),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1f6800c0, 0x1f6800c7, read32_delegate(FUNC(konamigv_state::trackball_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1f6800c8, 0x1f6800cb, read32_delegate(FUNC(konamigv_state::unknown_r),this)); /* ?? */ DRIVER_INIT_CALL(konamigv); } @@ -617,9 +617,9 @@ DRIVER_INIT_MEMBER(konamigv_state,btchamp) m_flash16[0] = machine().device<sharp_lh28f400_device>("flash"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::btc_trackball_r),this), write32_delegate(FUNC(konamigv_state::btc_trackball_w),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->nop_write ( 0x1f6800e0, 0x1f6800e3); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f680080, 0x1f68008f, read32_delegate(FUNC(konamigv_state::btc_trackball_r),this), write32_delegate(FUNC(konamigv_state::btc_trackball_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).nop_write ( 0x1f6800e0, 0x1f6800e3); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this) ); DRIVER_INIT_CALL(konamigv); } @@ -672,8 +672,8 @@ WRITE32_MEMBER(konamigv_state::tokimeki_serial_w) DRIVER_INIT_MEMBER(konamigv_state,tokimosh) { - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler ( 0x1f680080, 0x1f680083, read32_delegate(FUNC(konamigv_state::tokimeki_serial_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler( 0x1f680090, 0x1f680093, write32_delegate(FUNC(konamigv_state::tokimeki_serial_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler ( 0x1f680080, 0x1f680083, read32_delegate(FUNC(konamigv_state::tokimeki_serial_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler( 0x1f680090, 0x1f680093, write32_delegate(FUNC(konamigv_state::tokimeki_serial_w),this)); DRIVER_INIT_CALL(konamigv); } @@ -697,13 +697,13 @@ DRIVER_INIT_MEMBER(konamigv_state,kdeadeye) m_flash16[0] = machine().device<sharp_lh28f400_device>("flash"); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port ( 0x1f680080, 0x1f680083, "GUNX1" ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port ( 0x1f680090, 0x1f680093, "GUNY1" ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port ( 0x1f6800a0, 0x1f6800a3, "GUNX2" ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port ( 0x1f6800b0, 0x1f6800b3, "GUNY2" ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_port ( 0x1f6800c0, 0x1f6800c3, "BUTTONS" ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler ( 0x1f6800e0, 0x1f6800e3, write32_delegate(FUNC(konamigv_state::kdeadeye_0_w),this) ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port ( 0x1f680080, 0x1f680083, "GUNX1" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port ( 0x1f680090, 0x1f680093, "GUNY1" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port ( 0x1f6800a0, 0x1f6800a3, "GUNX2" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port ( 0x1f6800b0, 0x1f6800b3, "GUNY2" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_port ( 0x1f6800c0, 0x1f6800c3, "BUTTONS" ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler ( 0x1f6800e0, 0x1f6800e3, write32_delegate(FUNC(konamigv_state::kdeadeye_0_w),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f380000, 0x1f3fffff, read32_delegate(FUNC(konamigv_state::btcflash_r),this), write32_delegate(FUNC(konamigv_state::btcflash_w),this)); DRIVER_INIT_CALL(konamigv); } diff --git a/src/mame/drivers/konamigx.c b/src/mame/drivers/konamigx.c index da3049edf61..ec286b47ec0 100644 --- a/src/mame/drivers/konamigx.c +++ b/src/mame/drivers/konamigx.c @@ -3743,8 +3743,8 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx) switch (gameDefs[i].special) { case 1: // LE2 guns - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd44000, 0xd44003, read32_delegate(FUNC(konamigx_state::le2_gun_H_r),this)); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd44004, 0xd44007, read32_delegate(FUNC(konamigx_state::le2_gun_V_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd44000, 0xd44003, read32_delegate(FUNC(konamigx_state::le2_gun_H_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd44004, 0xd44007, read32_delegate(FUNC(konamigx_state::le2_gun_V_r),this)); break; case 2: // tkmmpzdm hack @@ -3780,7 +3780,7 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx) break; case 7: // install type 4 Xilinx protection for non-type 3/4 games - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xcc0000, 0xcc0007, write32_delegate(FUNC(konamigx_state::type4_prot_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xcc0000, 0xcc0007, write32_delegate(FUNC(konamigx_state::type4_prot_w),this)); break; case 8: // tbyahhoo @@ -3800,14 +3800,14 @@ DRIVER_INIT_MEMBER(konamigx_state,konamigx) switch (readback) { case BPP5: - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx5bppspr_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx5bppspr_r),this)); break; case BPP66: - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_legacy_read_handler(0xd00000, 0xd01fff, FUNC(K056832_6bpp_rom_long_r)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler(0xd00000, 0xd01fff, FUNC(K056832_6bpp_rom_long_r)); case BPP6: - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx6bppspr_r),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler(0xd4a000, 0xd4a00f, read32_delegate(FUNC(konamigx_state::gx6bppspr_r),this)); break; } diff --git a/src/mame/drivers/ksys573.c b/src/mame/drivers/ksys573.c index 98f1e005ae9..515cdad733b 100644 --- a/src/mame/drivers/ksys573.c +++ b/src/mame/drivers/ksys573.c @@ -1555,7 +1555,7 @@ WRITE32_MEMBER(ksys573_state::ge765pwbba_w) DRIVER_INIT_MEMBER(ksys573_state,ge765pwbba) { DRIVER_INIT_CALL(konami573); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::ge765pwbba_r),this), write32_delegate(FUNC(ksys573_state::ge765pwbba_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::ge765pwbba_r),this), write32_delegate(FUNC(ksys573_state::ge765pwbba_w),this)); } /* @@ -1667,7 +1667,7 @@ static void gx700pwfbf_init( running_machine &machine, void (*output_callback_fu state->m_gx700pwfbf_output_callback = output_callback_func; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx700pwbf_io_r),state), write32_delegate(FUNC(ksys573_state::gx700pwbf_io_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx700pwbf_io_r),state), write32_delegate(FUNC(ksys573_state::gx700pwbf_io_w),state)); state->save_item( NAME(state->m_gx700pwbf_output_data) ); } @@ -1905,7 +1905,7 @@ WRITE32_MEMBER(ksys573_state::gtrfrks_io_w) DRIVER_INIT_MEMBER(ksys573_state,gtrfrks) { DRIVER_INIT_CALL(konami573); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this)); } /* GX894 digital i/o */ @@ -2218,7 +2218,7 @@ static void gx894pwbba_init( running_machine &machine, void (*output_callback_fu state->m_gx894pwbba_output_callback = output_callback_func; - machine.device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx894pwbba_r),state), write32_delegate(FUNC(ksys573_state::gx894pwbba_w),state)); + machine.device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gx894pwbba_r),state), write32_delegate(FUNC(ksys573_state::gx894pwbba_w),state)); state->m_gx894_ram_write_offset = 0; state->m_gx894_ram_read_offset = 0; @@ -2244,7 +2244,7 @@ DRIVER_INIT_MEMBER(ksys573_state,gtrfrkdigital) DRIVER_INIT_CALL(konami573); gx894pwbba_init( machine(), NULL ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f600000, 0x1f6000ff, read32_delegate(FUNC(ksys573_state::gtrfrks_io_r),this), write32_delegate(FUNC(ksys573_state::gtrfrks_io_w),this) ); } /* ddr solo */ @@ -2536,7 +2536,7 @@ DRIVER_INIT_MEMBER(ksys573_state,dmx) DRIVER_INIT_CALL(konami573); gx894pwbba_init( machine(), dmx_output_callback ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::dmx_io_w),this) ); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::dmx_io_w),this) ); } /* salary man champ */ @@ -2693,7 +2693,7 @@ DRIVER_INIT_MEMBER(ksys573_state,mamboagg) DRIVER_INIT_CALL(konami573); gx894pwbba_init( machine(), mamboagg_output_callback ); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::mamboagg_io_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x1f600000, 0x1f6000ff, write32_delegate(FUNC(ksys573_state::mamboagg_io_w),this)); } @@ -3011,7 +3011,7 @@ READ32_MEMBER(ksys573_state::gunmania_r) DRIVER_INIT_MEMBER(ksys573_state,gunmania) { DRIVER_INIT_CALL(konami573); - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gunmania_r),this), write32_delegate(FUNC(ksys573_state::gunmania_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_readwrite_handler( 0x1f640000, 0x1f6400ff, read32_delegate(FUNC(ksys573_state::gunmania_r),this), write32_delegate(FUNC(ksys573_state::gunmania_w),this)); } /* ADC0834 Interface */ diff --git a/src/mame/drivers/kyugo.c b/src/mame/drivers/kyugo.c index f39846b4ed8..a0a65baf6a0 100644 --- a/src/mame/drivers/kyugo.c +++ b/src/mame/drivers/kyugo.c @@ -510,7 +510,7 @@ void kyugo_state::machine_start() void kyugo_state::machine_reset() { - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); // must start with interrupts and sub CPU disabled m_nmi_mask = 0; kyugo_sub_cpu_control_w(space, 0, 0); @@ -1368,7 +1368,7 @@ ROM_END DRIVER_INIT_MEMBER(kyugo_state,gyrodine) { /* add watchdog */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_write_handler(0xe000, 0xe000, write8_delegate(FUNC(kyugo_state::watchdog_reset_w),this)); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0xe000, 0xe000, write8_delegate(FUNC(kyugo_state::watchdog_reset_w),this)); } @@ -1376,10 +1376,10 @@ DRIVER_INIT_MEMBER(kyugo_state,srdmissn) { /* shared RAM is mapped at 0xe000 as well */ - machine().device("maincpu")->memory().space(AS_PROGRAM)->install_ram(0xe000, 0xe7ff, m_shared_ram); + machine().device("maincpu")->memory().space(AS_PROGRAM).install_ram(0xe000, 0xe7ff, m_shared_ram); /* extra RAM on sub CPU */ - machine().device("sub")->memory().space(AS_PROGRAM)->install_ram(0x8800, 0x8fff); + machine().device("sub")->memory().space(AS_PROGRAM).install_ram(0x8800, 0x8fff); } diff --git a/src/mame/drivers/ladybug.c b/src/mame/drivers/ladybug.c index da0d30fb7df..d4c31be5f02 100644 --- a/src/mame/drivers/ladybug.c +++ b/src/mame/drivers/ladybug.c @@ -1068,7 +1068,7 @@ DRIVER_INIT_MEMBER(ladybug_state,dorodon) /* decode the opcodes */ offs_t i; - address_space &space = *machine().device("maincpu")->memory().space(AS_PROGRAM); + address_space &space = machine().device("maincpu")->memory().space(AS_PROGRAM); UINT8 *decrypted = auto_alloc_array(machine(), UINT8, 0x6000); UINT8 *rom = machine().root_device().memregion("maincpu")->base(); UINT8 *table = machine().root_device().memregion("user1")->base(); diff --git a/src/mame/drivers/lastbank.c b/src/mame/drivers/lastbank.c index 3ea24f78194..0294f0ab34c 100644 --- a/src/mame/drivers/lastbank.c +++ b/src/mame/drivers/lastbank.c @@ -137,14 +137,14 @@ WRITE8_MEMBER(lastbank_state::lastbank_ram_bank_w) UINT8 lastbank_state::ram_bank_r(UINT16 offset, UINT8 bank_num) { - address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); - return vdp_space->read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);; + address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); + return vdp_space.read_byte(offset + (m_ram_bank[bank_num]) * 0x1000);; } void lastbank_state::ram_bank_w(UINT16 offset, UINT8 data, UINT8 bank_num) { - address_space *vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); - vdp_space->write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);; + address_space &vdp_space = machine().device<tc0091lvc_device>("tc0091lvc")->space(); + vdp_space.write_byte(offset + (m_ram_bank[bank_num]) * 0x1000,data);; } READ8_MEMBER(lastbank_state::lastbank_ram_0_r) { return ram_bank_r(offset, 0); } diff --git a/src/mame/drivers/leland.c b/src/mame/drivers/leland.c index 8db6247ec9b..460ba6e0636 100644 --- a/src/mame/drivers/leland.c +++ b/src/mame/drivers/leland.c @@ -1982,11 +1982,11 @@ static void init_master_ports(running_machine &machine, UINT8 mvram_base, UINT8 { leland_state *state = machine.driver_data<leland_state>(); /* set up the master CPU VRAM I/O */ - machine.device("master")->memory().space(AS_IO)->install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),state), write8_delegate(FUNC(leland_state::leland_mvram_port_w),state)); + machine.device("master")->memory().space(AS_IO).install_readwrite_handler(mvram_base, mvram_base + 0x1f, read8_delegate(FUNC(leland_state::leland_mvram_port_r),state), write8_delegate(FUNC(leland_state::leland_mvram_port_w),state)); /* set up the master CPU I/O ports */ - machine.device("master")->memory().space(AS_IO)->install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),state)); - machine.device("master")->memory().space(AS_IO)->install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),state)); + machine.device("master")->memory().space(AS_IO).install_read_handler(io_base, io_base + 0x1f, read8_delegate(FUNC(leland_state::leland_master_input_r),state)); + machine.device("master")->memory().space(AS_IO).install_write_handler(io_base, io_base + 0x0f, write8_delegate(FUNC(leland_state::leland_master_output_w),state)); } @@ -2002,8 +2002,8 @@ DRIVER_INIT_MEMBER(leland_state,cerberus) init_master_ports(machine(), 0x40, 0x80); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0x90, 0x90, read8_delegate(FUNC(leland_state::cerberus_dial_2_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0x80, 0x80, read8_delegate(FUNC(leland_state::cerberus_dial_1_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0x90, 0x90, read8_delegate(FUNC(leland_state::cerberus_dial_2_r),this)); } @@ -2048,7 +2048,7 @@ DRIVER_INIT_MEMBER(leland_state,alleymas) /* kludge warning: the game uses location E0CA to determine if the joysticks are available */ /* it gets cleared by the code, but there is no obvious way for the value to be set to a */ /* non-zero value. If the value is zero, the joystick is never read. */ - m_alleymas_kludge_mem = machine().device("master")->memory().space(AS_PROGRAM)->install_write_handler(0xe0ca, 0xe0ca, write8_delegate(FUNC(leland_state::alleymas_joystick_kludge),this)); + m_alleymas_kludge_mem = machine().device("master")->memory().space(AS_PROGRAM).install_write_handler(0xe0ca, 0xe0ca, write8_delegate(FUNC(leland_state::alleymas_joystick_kludge),this)); } @@ -2071,9 +2071,9 @@ DRIVER_INIT_MEMBER(leland_state,dangerz) init_master_ports(machine(), 0x40, 0x80); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xfc, 0xfc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this)); } @@ -2118,10 +2118,10 @@ DRIVER_INIT_MEMBER(leland_state,redlin2p) init_master_ports(machine(), 0x00, 0xc0); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xd0, 0xd0, read8_delegate(FUNC(leland_state::redline_pedal_2_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::redline_wheel_2_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::redline_wheel_1_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(leland_state::redline_pedal_1_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xd0, 0xd0, read8_delegate(FUNC(leland_state::redline_pedal_2_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::redline_wheel_2_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::redline_wheel_1_r),this)); } @@ -2150,9 +2150,9 @@ DRIVER_INIT_MEMBER(leland_state,viper) init_master_ports(machine(), 0x00, 0xc0); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xb8, 0xb8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xbc, 0xbc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xa4, 0xa4, read8_delegate(FUNC(leland_state::dangerz_input_upper_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xb8, 0xb8, read8_delegate(FUNC(leland_state::dangerz_input_y_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xbc, 0xbc, read8_delegate(FUNC(leland_state::dangerz_input_x_r),this)); } @@ -2169,8 +2169,8 @@ DRIVER_INIT_MEMBER(leland_state,teamqb) init_master_ports(machine(), 0x40, 0x80); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5"); } @@ -2187,8 +2187,8 @@ DRIVER_INIT_MEMBER(leland_state,aafb) init_master_ports(machine(), 0x00, 0xc0); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5"); } @@ -2205,8 +2205,8 @@ DRIVER_INIT_MEMBER(leland_state,aafbb) init_master_ports(machine(), 0x80, 0x40); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5"); } @@ -2223,8 +2223,8 @@ DRIVER_INIT_MEMBER(leland_state,aafbd2p) init_master_ports(machine(), 0x00, 0x40); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7c, 0x7c, "IN4"); - machine().device("master")->memory().space(AS_IO)->install_read_port(0x7f, 0x7f, "IN5"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7c, 0x7c, "IN4"); + machine().device("master")->memory().space(AS_IO).install_read_port(0x7f, 0x7f, "IN5"); } @@ -2242,9 +2242,9 @@ DRIVER_INIT_MEMBER(leland_state,offroad) init_master_ports(machine(), 0x40, 0x80); /* yes, this is intentional */ /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this)); } @@ -2261,9 +2261,9 @@ DRIVER_INIT_MEMBER(leland_state,offroadt) init_master_ports(machine(), 0x80, 0x40); /* set up additional input ports */ - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this)); - machine().device("master")->memory().space(AS_IO)->install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf8, 0xf8, read8_delegate(FUNC(leland_state::offroad_wheel_3_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xf9, 0xf9, read8_delegate(FUNC(leland_state::offroad_wheel_1_r),this)); + machine().device("master")->memory().space(AS_IO).install_read_handler(0xfb, 0xfb, read8_delegate(FUNC(leland_state::offroad_wheel_2_r),this)); } |