diff options
Diffstat (limited to 'src')
187 files changed, 664 insertions, 670 deletions
diff --git a/src/mame/audio/circus.c b/src/mame/audio/circus.c index f6aa2818c81..2d970c4c14b 100644 --- a/src/mame/audio/circus.c +++ b/src/mame/audio/circus.c @@ -173,7 +173,7 @@ DISCRETE_SOUND_END WRITE8_MEMBER(circus_state::circus_clown_z_w) { m_clown_z = (data & 0x0f); - *(machine().root_device().memregion("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG + *(memregion("maincpu")->base() + 0x8000) = data; logerror("Z:%02x\n",data); //DEBUG /* Bits 4-6 enable/disable trigger different events */ switch (m_game_id) diff --git a/src/mame/drivers/asuka.c b/src/mame/drivers/asuka.c index ad29a9907a2..42cc4a3ab99 100644 --- a/src/mame/drivers/asuka.c +++ b/src/mame/drivers/asuka.c @@ -267,7 +267,7 @@ WRITE_LINE_MEMBER(asuka_state::asuka_msm5205_vck) } else { - m_adpcm_data = machine().root_device().memregion("ymsnd")->base()[m_adpcm_pos]; + m_adpcm_data = memregion("ymsnd")->base()[m_adpcm_pos]; m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff; msm5205_data_w(m_msm, m_adpcm_data >> 4); } diff --git a/src/mame/drivers/chinagat.c b/src/mame/drivers/chinagat.c index 5e533fb3a78..c87d18ec6e0 100644 --- a/src/mame/drivers/chinagat.c +++ b/src/mame/drivers/chinagat.c @@ -200,12 +200,12 @@ WRITE8_MEMBER(chinagat_state::chinagat_video_ctrl_w ) WRITE8_MEMBER(chinagat_state::chinagat_bankswitch_w ) { - space.machine().root_device().membank("bank1")->set_entry(data & 0x07); // shall we check (data & 7) < 6 (# of banks)? + membank("bank1")->set_entry(data & 0x07); // shall we check (data & 7) < 6 (# of banks)? } WRITE8_MEMBER(chinagat_state::chinagat_sub_bankswitch_w ) { - space.machine().root_device().membank("bank4")->set_entry(data & 0x07); // shall we check (data & 7) < 6 (# of banks)? + membank("bank4")->set_entry(data & 0x07); // shall we check (data & 7) < 6 (# of banks)? } READ8_MEMBER(chinagat_state::saiyugoub1_mcu_command_r ) diff --git a/src/mame/drivers/chinsan.c b/src/mame/drivers/chinsan.c index 9437f42ff16..90099ac8bf6 100644 --- a/src/mame/drivers/chinsan.c +++ b/src/mame/drivers/chinsan.c @@ -548,7 +548,7 @@ WRITE_LINE_MEMBER(chinsan_state::chin_adpcm_int) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4)); msm5205_data_w(machine().device("adpcm"), m_adpcm_data & 0xf); diff --git a/src/mame/drivers/ddragon.c b/src/mame/drivers/ddragon.c index 6c106d26977..10e47934e14 100644 --- a/src/mame/drivers/ddragon.c +++ b/src/mame/drivers/ddragon.c @@ -449,7 +449,7 @@ void ddragon_state::dd_adpcm_int( device_t *device, int chip ) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; + UINT8 *ROM = memregion("adpcm")->base() + 0x10000 * chip; m_adpcm_data[chip] = ROM[m_adpcm_pos[chip]++]; msm5205_data_w(device, m_adpcm_data[chip] >> 4); diff --git a/src/mame/drivers/docastle.c b/src/mame/drivers/docastle.c index 8f91b68aea5..82f499e323a 100644 --- a/src/mame/drivers/docastle.c +++ b/src/mame/drivers/docastle.c @@ -174,7 +174,7 @@ WRITE_LINE_MEMBER(docastle_state::idsoccer_adpcm_int) } else { - m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos++]; + m_adpcm_data = memregion("adpcm")->base()[m_adpcm_pos++]; msm5205_data_w(m_msm, m_adpcm_data >> 4); } } diff --git a/src/mame/drivers/gamecstl.c b/src/mame/drivers/gamecstl.c index d108a696eb0..5b82dc89caf 100644 --- a/src/mame/drivers/gamecstl.c +++ b/src/mame/drivers/gamecstl.c @@ -225,7 +225,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } else // disable RAM access (reads go to BIOS ROM) { - state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x30000); + state->membank("bank1")->set_base(state->memregion("bios")->base() + 0x30000); } break; } diff --git a/src/mame/drivers/gcpinbal.c b/src/mame/drivers/gcpinbal.c index 2deb7c0bc1d..f190b7ff801 100644 --- a/src/mame/drivers/gcpinbal.c +++ b/src/mame/drivers/gcpinbal.c @@ -214,7 +214,7 @@ WRITE_LINE_MEMBER(gcpinbal_state::gcp_adpcm_int) } else { - UINT8 *ROM = machine().root_device().memregion("msm")->base(); + UINT8 *ROM = memregion("msm")->base(); m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_start] & 0x0f) : (ROM[m_adpcm_start] & 0xf0) >> 4)); msm5205_data_w(m_msm, m_adpcm_data & 0xf); diff --git a/src/mame/drivers/gladiatr.c b/src/mame/drivers/gladiatr.c index c92049fcf8b..a4431f6baf5 100644 --- a/src/mame/drivers/gladiatr.c +++ b/src/mame/drivers/gladiatr.c @@ -256,8 +256,8 @@ MACHINE_RESET_MEMBER(gladiatr_state,gladiator) TAITO8741_start(&gladiator_8741interface); /* 6809 bank memory set */ { - UINT8 *rom = machine().root_device().memregion("audiocpu")->base() + 0x10000; - machine().root_device().membank("bank2")->set_base(rom); + UINT8 *rom = memregion("audiocpu")->base() + 0x10000; + membank("bank2")->set_base(rom); m_audiocpu->reset(); } } @@ -279,10 +279,10 @@ WRITE_LINE_MEMBER(gladiatr_state::gladiator_ym_irq) /*Sound Functions*/ WRITE8_MEMBER(gladiatr_state::glad_adpcm_w) { - UINT8 *rom = machine().root_device().memregion("audiocpu")->base() + 0x10000; + UINT8 *rom = memregion("audiocpu")->base() + 0x10000; /* bit6 = bank offset */ - machine().root_device().membank("bank2")->set_base(rom + ((data & 0x40) ? 0xc000 : 0)); + membank("bank2")->set_base(rom + ((data & 0x40) ? 0xc000 : 0)); msm5205_data_w(m_msm,data); /* bit0..3 */ msm5205_reset_w(m_msm,(data>>5)&1); /* bit 5 */ @@ -998,7 +998,7 @@ DRIVER_INIT_MEMBER(gladiatr_state,gladiatr) UINT8 *rom; int i,j; - rom = machine().root_device().memregion("gfx2")->base(); + rom = memregion("gfx2")->base(); // unpack 3bpp graphics for (j = 3; j >= 0; j--) { @@ -1012,7 +1012,7 @@ DRIVER_INIT_MEMBER(gladiatr_state,gladiatr) swap_block(rom + 0x14000, rom + 0x18000, 0x4000); - rom = machine().root_device().memregion("gfx3")->base(); + rom = memregion("gfx3")->base(); // unpack 3bpp graphics for (j = 5; j >= 0; j--) { @@ -1029,8 +1029,8 @@ DRIVER_INIT_MEMBER(gladiatr_state,gladiatr) swap_block(rom + 0x24000, rom + 0x28000, 0x4000); /* make sure bank is valid in cpu-reset */ - rom = machine().root_device().memregion("audiocpu")->base() + 0x10000; - machine().root_device().membank("bank2")->set_base(rom); + rom = memregion("audiocpu")->base() + 0x10000; + membank("bank2")->set_base(rom); } @@ -1047,14 +1047,14 @@ DRIVER_INIT_MEMBER(gladiatr_state,ppking) UINT8 *rom; int i,j; - rom = machine().root_device().memregion("gfx2")->base(); + rom = memregion("gfx2")->base(); // unpack 3bpp graphics for (i = 0; i < 0x2000; i++) { rom[i+0x2000] = rom[i] >> 4; } - rom = machine().root_device().memregion("gfx3")->base(); + rom = memregion("gfx3")->base(); // unpack 3bpp graphics for (j = 1; j >= 0; j--) { diff --git a/src/mame/drivers/gsword.c b/src/mame/drivers/gsword.c index f36a5e39f12..e23786a4ebc 100644 --- a/src/mame/drivers/gsword.c +++ b/src/mame/drivers/gsword.c @@ -153,7 +153,7 @@ reg: 0->1 (main->2nd) / : (1->0) 2nd->main : int ::gsword_coins_in(void) { /* emulate 8741 coin slot */ - if (machine().root_device().ioport("IN4")->read() & 0xc0) + if (ioport("IN4")->read() & 0xc0) { logerror("Coin In\n"); return 0x80; @@ -895,7 +895,7 @@ ROM_END DRIVER_INIT_MEMBER(gsword_state,gsword) { #if 0 - UINT8 *ROM2 = machine().root_device().memregion("sub")->base(); + UINT8 *ROM2 = memregion("sub")->base(); ROM2[0x1da] = 0xc3; /* patch for rom self check */ ROM2[0x71e] = 0; /* patch for sound protection or time out function */ @@ -910,7 +910,7 @@ DRIVER_INIT_MEMBER(gsword_state,gsword) DRIVER_INIT_MEMBER(gsword_state,gsword2) { #if 0 - UINT8 *ROM2 = machine().root_device().memregion("sub")->base(); + UINT8 *ROM2 = memregion("sub")->base(); ROM2[0x1da] = 0xc3; /* patch for rom self check */ ROM2[0x726] = 0; /* patch for sound protection or time out function */ diff --git a/src/mame/drivers/jantotsu.c b/src/mame/drivers/jantotsu.c index 7aef014ad3c..aeeaedd9eed 100644 --- a/src/mame/drivers/jantotsu.c +++ b/src/mame/drivers/jantotsu.c @@ -303,7 +303,7 @@ WRITE_LINE_MEMBER(jantotsu_state::jan_adpcm_int) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4)); msm5205_data_w(machine().device("adpcm"), m_adpcm_data & 0xf); diff --git a/src/mame/drivers/lucky74.c b/src/mame/drivers/lucky74.c index a4d92df99c6..278c81a3599 100644 --- a/src/mame/drivers/lucky74.c +++ b/src/mame/drivers/lucky74.c @@ -1424,7 +1424,7 @@ WRITE_LINE_MEMBER(lucky74_state::lucky74_adpcm_int) if (m_adpcm_data == -1) { /* transferring 1st nibble */ - m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos]; + m_adpcm_data = memregion("adpcm")->base()[m_adpcm_pos]; m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff; msm5205_data_w(m_msm, m_adpcm_data >> 4); diff --git a/src/mame/drivers/megadrvb.c b/src/mame/drivers/megadrvb.c index e1e819a9a26..479ef1600e4 100644 --- a/src/mame/drivers/megadrvb.c +++ b/src/mame/drivers/megadrvb.c @@ -750,7 +750,7 @@ DRIVER_INIT_MEMBER(md_boot_state,aladmdb) * Game does a check @ 1afc00 with work RAM fff57c that makes it play like the original console version (i.e. 8 energy hits instead of 2) */ #if ENERGY_CONSOLE_MODE - UINT16 *rom = (UINT16 *)machine().root_device().memregion("maincpu")->base(); + UINT16 *rom = (UINT16 *)memregion("maincpu")->base(); rom[0x1afc08/2] = 0x6600; #endif @@ -765,7 +765,7 @@ DRIVER_INIT_MEMBER(md_boot_state,aladmdb) // after this decode look like intentional changes DRIVER_INIT_MEMBER(md_boot_state,mk3mdb) { - UINT8 *rom = machine().root_device().memregion("maincpu")->base(); + UINT8 *rom = memregion("maincpu")->base(); for (int x = 0x000001; x < 0x100001; x += 2) { @@ -818,7 +818,7 @@ DRIVER_INIT_MEMBER(md_boot_state,ssf2mdb) m_maincpu->space(AS_PROGRAM).install_read_bank(0x400000, 0x5fffff, "bank5"); m_maincpu->space(AS_PROGRAM).unmap_write(0x400000, 0x5fffff); - machine().root_device().membank("bank5")->set_base(machine().root_device().memregion( "maincpu" )->base() + 0x400000 ); + membank("bank5")->set_base(memregion( "maincpu" )->base() + 0x400000 ); m_maincpu->space(AS_PROGRAM).install_read_handler(0x770070, 0x770075, read16_delegate(FUNC(md_boot_state::ssf2mdb_dsw_r),this)); @@ -830,7 +830,7 @@ DRIVER_INIT_MEMBER(md_boot_state,ssf2mdb) DRIVER_INIT_MEMBER(md_boot_state,srmdb) { - UINT8* rom = machine().root_device().memregion("maincpu")->base(); + UINT8* rom = memregion("maincpu")->base(); for (int x = 0x00001; x < 0x40000; x += 2) { diff --git a/src/mame/drivers/megaplay.c b/src/mame/drivers/megaplay.c index 3bc73534b88..97a3a3cdd2a 100644 --- a/src/mame/drivers/megaplay.c +++ b/src/mame/drivers/megaplay.c @@ -444,7 +444,7 @@ READ8_MEMBER(mplay_state::bank_r ) } else { - return machine().root_device().memregion("maincpu")->base()[fulladdress ^ 1]; + return memregion("maincpu")->base()[fulladdress ^ 1]; } } else if (fulladdress >= 0xa10000 && fulladdress <= 0xa1001f) // IO Acess @@ -820,9 +820,9 @@ ROM_END void mplay_state::mplay_start() { - UINT8 *src = machine().root_device().memregion("mtbios")->base(); - UINT8 *instruction_rom = machine().root_device().memregion("user1")->base(); - UINT8 *game_rom = machine().root_device().memregion("maincpu")->base(); + UINT8 *src = memregion("mtbios")->base(); + UINT8 *instruction_rom = memregion("user1")->base(); + UINT8 *game_rom = memregion("maincpu")->base(); int offs; memmove(src + 0x10000, src + 0x8000, 0x18000); // move bios.. diff --git a/src/mame/drivers/megatech.c b/src/mame/drivers/megatech.c index af375d25a76..796c3f371c5 100644 --- a/src/mame/drivers/megatech.c +++ b/src/mame/drivers/megatech.c @@ -250,7 +250,7 @@ TIMER_CALLBACK_MEMBER(mtech_state::megatech_z80_stop_state ) printf("megatech_select_game %d\n", param+1); sprintf(tempname, "game%d", param); - game_region = machine().root_device().memregion(tempname)->base(); + game_region = memregion(tempname)->base(); m_maincpu->set_input_line(INPUT_LINE_RESET, ASSERT_LINE); machine().device("genesis_snd_z80")->execute().set_input_line(INPUT_LINE_RESET, ASSERT_LINE); @@ -272,8 +272,8 @@ TIMER_CALLBACK_MEMBER(mtech_state::megatech_z80_stop_state ) else { /* no cart.. */ - memset(machine().root_device().memregion("mtbios")->base() + 0x8000, 0x00, 0x8000); - memset(machine().root_device().memregion("maincpu")->base(), 0x00, 0x400000); + memset(memregion("mtbios")->base() + 0x8000, 0x00, 0x8000); + memset(memregion("maincpu")->base(), 0x00, 0x400000); } return; diff --git a/src/mame/drivers/mermaid.c b/src/mame/drivers/mermaid.c index 44b51b8ef5e..3ef668bdc23 100644 --- a/src/mame/drivers/mermaid.c +++ b/src/mame/drivers/mermaid.c @@ -408,7 +408,7 @@ WRITE_LINE_MEMBER(mermaid_state::rougien_adpcm_int) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); m_adpcm_data = ((m_adpcm_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0) >> 4)); msm5205_data_w(machine().device("adpcm"), m_adpcm_data & 0xf); diff --git a/src/mame/drivers/mlanding.c b/src/mame/drivers/mlanding.c index 621c7a73129..67d4e610710 100644 --- a/src/mame/drivers/mlanding.c +++ b/src/mame/drivers/mlanding.c @@ -301,7 +301,7 @@ WRITE_LINE_MEMBER(mlanding_state::ml_msm5205_vck) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0)>>4) ); msm5205_data_w(m_msm,m_adpcm_data & 0xf); diff --git a/src/mame/drivers/namcos2.c b/src/mame/drivers/namcos2.c index 11f23ce3ae4..5293396d46c 100644 --- a/src/mame/drivers/namcos2.c +++ b/src/mame/drivers/namcos2.c @@ -794,11 +794,11 @@ READ8_MEMBER(namcos2_state::c68_p5_r) if (m_player_mux) { - rv = space.machine().root_device().ioport("MCUB2")->read(); + rv = ioport("MCUB2")->read(); } else { - rv = space.machine().root_device().ioport("MCUB")->read(); + rv = ioport("MCUB")->read(); } return rv; diff --git a/src/mame/drivers/ojankohs.c b/src/mame/drivers/ojankohs.c index aa637016eb8..1c38a80ba87 100644 --- a/src/mame/drivers/ojankohs.c +++ b/src/mame/drivers/ojankohs.c @@ -151,21 +151,19 @@ READ8_MEMBER(ojankohs_state::ojankoc_keymatrix_r) READ8_MEMBER(ojankohs_state::ojankohs_ay8910_0_r) { // DIPSW 1 - device_t &root = machine().root_device(); - return (((root.ioport("DSW1")->read() & 0x01) << 7) | ((root.ioport("DSW1")->read() & 0x02) << 5) | - ((root.ioport("DSW1")->read() & 0x04) << 3) | ((root.ioport("DSW1")->read() & 0x08) << 1) | - ((root.ioport("DSW1")->read() & 0x10) >> 1) | ((root.ioport("DSW1")->read() & 0x20) >> 3) | - ((root.ioport("DSW1")->read() & 0x40) >> 5) | ((root.ioport("DSW1")->read() & 0x80) >> 7)); + return (((ioport("DSW1")->read() & 0x01) << 7) | ((ioport("DSW1")->read() & 0x02) << 5) | + ((ioport("DSW1")->read() & 0x04) << 3) | ((ioport("DSW1")->read() & 0x08) << 1) | + ((ioport("DSW1")->read() & 0x10) >> 1) | ((ioport("DSW1")->read() & 0x20) >> 3) | + ((ioport("DSW1")->read() & 0x40) >> 5) | ((ioport("DSW1")->read() & 0x80) >> 7)); } READ8_MEMBER(ojankohs_state::ojankohs_ay8910_1_r) { // DIPSW 1 - device_t &root = machine().root_device(); - return (((root.ioport("DSW2")->read() & 0x01) << 7) | ((root.ioport("DSW2")->read() & 0x02) << 5) | - ((root.ioport("DSW2")->read() & 0x04) << 3) | ((root.ioport("DSW2")->read() & 0x08) << 1) | - ((root.ioport("DSW2")->read() & 0x10) >> 1) | ((root.ioport("DSW2")->read() & 0x20) >> 3) | - ((root.ioport("DSW2")->read() & 0x40) >> 5) | ((root.ioport("DSW2")->read() & 0x80) >> 7)); + return (((ioport("DSW2")->read() & 0x01) << 7) | ((ioport("DSW2")->read() & 0x02) << 5) | + ((ioport("DSW2")->read() & 0x04) << 3) | ((ioport("DSW2")->read() & 0x08) << 1) | + ((ioport("DSW2")->read() & 0x10) >> 1) | ((ioport("DSW2")->read() & 0x20) >> 3) | + ((ioport("DSW2")->read() & 0x40) >> 5) | ((ioport("DSW2")->read() & 0x80) >> 7)); } READ8_MEMBER(ojankohs_state::ccasino_dipsw3_r) diff --git a/src/mame/drivers/opwolf.c b/src/mame/drivers/opwolf.c index 7f713fabf0d..28d0ead08de 100644 --- a/src/mame/drivers/opwolf.c +++ b/src/mame/drivers/opwolf.c @@ -466,7 +466,7 @@ void opwolf_state::opwolf_msm5205_vck(device_t *device,int chip) } else { - m_adpcm_data[chip] = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos[chip]]; + m_adpcm_data[chip] = memregion("adpcm")->base()[m_adpcm_pos[chip]]; m_adpcm_pos[chip] = (m_adpcm_pos[chip] + 1) & 0x7ffff; msm5205_data_w(device, m_adpcm_data[chip] >> 4); } diff --git a/src/mame/drivers/pachifev.c b/src/mame/drivers/pachifev.c index 636b4b2b909..7f52d5d6561 100644 --- a/src/mame/drivers/pachifev.c +++ b/src/mame/drivers/pachifev.c @@ -279,7 +279,7 @@ WRITE_LINE_MEMBER(pachifev_state::pf_adpcm_int) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); m_adpcm_data = ((m_trigger ? (ROM[m_adpcm_pos] & 0x0f) : (ROM[m_adpcm_pos] & 0xf0)>>4) ); msm5205_data_w(m_msm,m_adpcm_data & 0xf); diff --git a/src/mame/drivers/powerbal.c b/src/mame/drivers/powerbal.c index 32a4017bf27..cac831a9968 100644 --- a/src/mame/drivers/powerbal.c +++ b/src/mame/drivers/powerbal.c @@ -93,7 +93,7 @@ WRITE16_MEMBER(powerbal_state::oki_banking) { int addr = 0x40000 * ((data & 3) - 1); - if (addr < machine().root_device().memregion("oki")->bytes()) + if (addr < memregion("oki")->bytes()) m_oki->set_bank_base(addr); } } diff --git a/src/mame/drivers/rastan.c b/src/mame/drivers/rastan.c index ea37e0ddae1..3e517da6ff3 100644 --- a/src/mame/drivers/rastan.c +++ b/src/mame/drivers/rastan.c @@ -176,7 +176,7 @@ WRITE_LINE_MEMBER(rastan_state::rastan_msm5205_vck) } else { - m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos]; + m_adpcm_data = memregion("adpcm")->base()[m_adpcm_pos]; m_adpcm_pos = (m_adpcm_pos + 1) & 0xffff; msm5205_data_w(m_msm, m_adpcm_data >> 4); } diff --git a/src/mame/drivers/savquest.c b/src/mame/drivers/savquest.c index d6f313c0306..2015e7b3913 100644 --- a/src/mame/drivers/savquest.c +++ b/src/mame/drivers/savquest.c @@ -132,7 +132,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } else // disable RAM access (reads go to BIOS ROM) { - state->membank("bios_f0000")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x30000); + state->membank("bios_f0000")->set_base(state->memregion("bios")->base() + 0x30000); } break; } @@ -145,7 +145,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } else // disable RAM access (reads go to BIOS ROM) { - state->membank("bios_e4000")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x24000); + state->membank("bios_e4000")->set_base(state->memregion("bios")->base() + 0x24000); } if (data & 1) // enable RAM access to region 0xe0000 - 0xe3fff @@ -154,7 +154,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } else // disable RAM access (reads go to BIOS ROM) { - state->membank("bios_e0000")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x20000); + state->membank("bios_e0000")->set_base(state->memregion("bios")->base() + 0x20000); } break; } @@ -167,7 +167,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } else // disable RAM access (reads go to BIOS ROM) { - state->membank("bios_ec000")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x2c000); + state->membank("bios_ec000")->set_base(state->memregion("bios")->base() + 0x2c000); } if (data & 1) // enable RAM access to region 0xe8000 - 0xebfff @@ -176,7 +176,7 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } else // disable RAM access (reads go to BIOS ROM) { - state->membank("bios_e8000")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x28000); + state->membank("bios_e8000")->set_base(state->memregion("bios")->base() + 0x28000); } break; } diff --git a/src/mame/drivers/segac2.c b/src/mame/drivers/segac2.c index 5db1c0f09af..97786db4d47 100644 --- a/src/mame/drivers/segac2.c +++ b/src/mame/drivers/segac2.c @@ -325,8 +325,8 @@ READ16_MEMBER(segac2_state::io_chip_r ) /* otherwise, return an input port */ if (offset == 0x04/2 && m_sound_banks) - return (space.machine().root_device().ioport(portnames[offset])->read() & 0xbf) | (upd7759_busy_r(m_upd7759) << 6); - return space.machine().root_device().ioport(portnames[offset])->read(); + return (ioport(portnames[offset])->read() & 0xbf) | (upd7759_busy_r(m_upd7759) << 6); + return ioport(portnames[offset])->read(); /* 'SEGA' protection */ case 0x10/2: diff --git a/src/mame/drivers/spdodgeb.c b/src/mame/drivers/spdodgeb.c index f117eaa574b..5d4781c7307 100644 --- a/src/mame/drivers/spdodgeb.c +++ b/src/mame/drivers/spdodgeb.c @@ -76,7 +76,7 @@ void spdodgeb_state::spd_adpcm_int( device_t *device, int chip ) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base() + 0x10000 * chip; + UINT8 *ROM = memregion("adpcm")->base() + 0x10000 * chip; m_adpcm_data[chip] = ROM[m_adpcm_pos[chip]++]; msm5205_data_w(device,m_adpcm_data[chip] >> 4); diff --git a/src/mame/drivers/taito_l.c b/src/mame/drivers/taito_l.c index e54e6cec2f3..66e2d05875f 100644 --- a/src/mame/drivers/taito_l.c +++ b/src/mame/drivers/taito_l.c @@ -564,7 +564,7 @@ WRITE_LINE_MEMBER(taitol_state::champwr_msm5205_vck) } else { - m_adpcm_data = machine().root_device().memregion("adpcm")->base()[m_adpcm_pos]; + m_adpcm_data = memregion("adpcm")->base()[m_adpcm_pos]; m_adpcm_pos = (m_adpcm_pos + 1) & 0x1ffff; msm5205_data_w(m_msm, m_adpcm_data >> 4); } diff --git a/src/mame/drivers/taitotz.c b/src/mame/drivers/taitotz.c index f3512ee4bd8..09719b038db 100644 --- a/src/mame/drivers/taitotz.c +++ b/src/mame/drivers/taitotz.c @@ -2605,7 +2605,7 @@ MACHINE_CONFIG_END // Init for BIOS v1.52 void taitotz_state::init_taitotz_152() { - UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base(); + UINT32 *rom = (UINT32*)memregion("user1")->base(); rom[(0x2c87c^4)/4] = 0x38600000; // skip sound load timeout... // rom[(0x2c620^4)/4] = 0x48000014; // ID check skip (not needed with correct serial number) } @@ -2613,7 +2613,7 @@ void taitotz_state::init_taitotz_152() // Init for BIOS 1.11a void taitotz_state::init_taitotz_111a() { - UINT32 *rom = (UINT32*)machine().root_device().memregion("user1")->base(); + UINT32 *rom = (UINT32*)memregion("user1")->base(); rom[(0x2b748^4)/4] = 0x480000b8; // skip sound load timeout } diff --git a/src/mame/drivers/tbowl.c b/src/mame/drivers/tbowl.c index 5e86fc9ed5d..d991add4d8c 100644 --- a/src/mame/drivers/tbowl.c +++ b/src/mame/drivers/tbowl.c @@ -173,7 +173,7 @@ void tbowl_state::tbowl_adpcm_int( device_t *device, int num ) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base() + 0x10000 * num; + UINT8 *ROM = memregion("adpcm")->base() + 0x10000 * num; m_adpcm_data[num] = ROM[m_adpcm_pos[num]++]; msm5205_data_w(device,m_adpcm_data[num] >> 4); diff --git a/src/mame/drivers/tecmo.c b/src/mame/drivers/tecmo.c index 57cf390a0a2..7ba536673cc 100644 --- a/src/mame/drivers/tecmo.c +++ b/src/mame/drivers/tecmo.c @@ -104,7 +104,7 @@ WRITE_LINE_MEMBER(tecmo_state::tecmo_adpcm_int) } else { - UINT8 *ROM = machine().root_device().memregion("adpcm")->base(); + UINT8 *ROM = memregion("adpcm")->base(); m_adpcm_data = ROM[m_adpcm_pos++]; msm5205_data_w(m_msm,m_adpcm_data >> 4); diff --git a/src/mame/drivers/voyager.c b/src/mame/drivers/voyager.c index 619b851975a..15c2d6884dc 100644 --- a/src/mame/drivers/voyager.c +++ b/src/mame/drivers/voyager.c @@ -252,8 +252,8 @@ static void mxtc_config_w(device_t *busdevice, device_t *device, int function, i } #endif - state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base() + 0x10000); - state->membank("bank1")->set_base(busdevice->machine().root_device().memregion("bios")->base()); + state->membank("bank1")->set_base(state->memregion("bios")->base() + 0x10000); + state->membank("bank1")->set_base(state->memregion("bios")->base()); } break; } diff --git a/src/mame/machine/namcos1.c b/src/mame/machine/namcos1.c index 03f6ccc971c..d77b9150ca0 100644 --- a/src/mame/machine/namcos1.c +++ b/src/mame/machine/namcos1.c @@ -919,7 +919,7 @@ WRITE8_MEMBER(namcos1_state::namcos1_mcu_bankswitch_w) /* bit 0-1 : address line A15-A16 */ addr += (data & 3) * 0x8000; - membank("bank20")->set_base(machine().root_device().memregion("mcu")->base() + addr); + membank("bank20")->set_base(memregion("mcu")->base() + addr); } @@ -1125,7 +1125,7 @@ DRIVER_INIT_MEMBER(namcos1_state,bakutotu) static const UINT8 target[8] = {0x34,0x37,0x35,0x37,0x96,0x00,0x2e,0xed}; UINT8 *rombase, *srcptr, *endptr, *scanptr; - rombase = machine().root_device().memregion("user1")->base(); + rombase = memregion("user1")->base(); srcptr = rombase + 0x1e000; endptr = srcptr + 0xa000; diff --git a/src/mame/machine/namcos2.c b/src/mame/machine/namcos2.c index 0bc187439ae..d560d36268b 100644 --- a/src/mame/machine/namcos2.c +++ b/src/mame/machine/namcos2.c @@ -711,10 +711,10 @@ INTERRUPT_GEN_MEMBER(namcos2_shared_state::namcos2_68k_gpu_vblank) WRITE8_MEMBER( namcos2_shared_state::namcos2_sound_bankselect_w ) { - UINT8 *RAM= machine().root_device().memregion("audiocpu")->base(); - UINT32 max = (machine().root_device().memregion("audiocpu")->bytes() - 0x10000) / 0x4000; + UINT8 *RAM= memregion("audiocpu")->base(); + UINT32 max = (memregion("audiocpu")->bytes() - 0x10000) / 0x4000; int bank = ( data >> 4 ) % max; /* 991104.CAB */ - machine().root_device().membank(BANKED_SOUND_ROM)->set_base(&RAM[ 0x10000 + ( 0x4000 * bank ) ] ); + membank(BANKED_SOUND_ROM)->set_base(&RAM[ 0x10000 + ( 0x4000 * bank ) ] ); } /**************************************************************/ @@ -738,28 +738,28 @@ WRITE8_MEMBER( namcos2_shared_state::namcos2_mcu_analog_ctrl_w ) switch((data>>2) & 0x07) { case 0: - namcos2_mcu_analog_data=machine().root_device().ioport("AN0")->read(); + namcos2_mcu_analog_data=ioport("AN0")->read(); break; case 1: - namcos2_mcu_analog_data=machine().root_device().ioport("AN1")->read(); + namcos2_mcu_analog_data=ioport("AN1")->read(); break; case 2: - namcos2_mcu_analog_data=machine().root_device().ioport("AN2")->read(); + namcos2_mcu_analog_data=ioport("AN2")->read(); break; case 3: - namcos2_mcu_analog_data=machine().root_device().ioport("AN3")->read(); + namcos2_mcu_analog_data=ioport("AN3")->read(); break; case 4: - namcos2_mcu_analog_data=machine().root_device().ioport("AN4")->read(); + namcos2_mcu_analog_data=ioport("AN4")->read(); break; case 5: - namcos2_mcu_analog_data=machine().root_device().ioport("AN5")->read(); + namcos2_mcu_analog_data=ioport("AN5")->read(); break; case 6: - namcos2_mcu_analog_data=machine().root_device().ioport("AN6")->read(); + namcos2_mcu_analog_data=ioport("AN6")->read(); break; case 7: - namcos2_mcu_analog_data=machine().root_device().ioport("AN7")->read(); + namcos2_mcu_analog_data=ioport("AN7")->read(); break; default: output_set_value("anunk",data); @@ -817,14 +817,14 @@ READ8_MEMBER( namcos2_shared_state::namcos2_mcu_port_d_r ) int data = 0; /* Read/convert the bits one at a time */ - if(machine().root_device().ioport("AN0")->read() > threshold) data |= 0x01; - if(machine().root_device().ioport("AN1")->read() > threshold) data |= 0x02; - if(machine().root_device().ioport("AN2")->read() > threshold) data |= 0x04; - if(machine().root_device().ioport("AN3")->read() > threshold) data |= 0x08; - if(machine().root_device().ioport("AN4")->read() > threshold) data |= 0x10; - if(machine().root_device().ioport("AN5")->read() > threshold) data |= 0x20; - if(machine().root_device().ioport("AN6")->read() > threshold) data |= 0x40; - if(machine().root_device().ioport("AN7")->read() > threshold) data |= 0x80; + if(ioport("AN0")->read() > threshold) data |= 0x01; + if(ioport("AN1")->read() > threshold) data |= 0x02; + if(ioport("AN2")->read() > threshold) data |= 0x04; + if(ioport("AN3")->read() > threshold) data |= 0x08; + if(ioport("AN4")->read() > threshold) data |= 0x10; + if(ioport("AN5")->read() > threshold) data |= 0x20; + if(ioport("AN6")->read() > threshold) data |= 0x40; + if(ioport("AN7")->read() > threshold) data |= 0x80; /* Return the result */ return data; diff --git a/src/mame/video/vectrex.c b/src/mame/video/vectrex.c index de9cf96ceb7..9dc3871977a 100644 --- a/src/mame/video/vectrex.c +++ b/src/mame/video/vectrex.c @@ -359,9 +359,7 @@ WRITE8_MEMBER(vectrex_state::v_via_pb_w) /* Cartridge bank-switching */ if (m_64k_cart && ((data ^ m_via_out[PORTB]) & 0x40)) { - device_t &root_device = machine().root_device(); - - root_device.membank("bank1")->set_base(root_device.memregion("maincpu")->base() + ((data & 0x40) ? 0x10000 : 0x0000)); + membank("bank1")->set_base(memregion("maincpu")->base() + ((data & 0x40) ? 0x10000 : 0x0000)); } /* Sound */ diff --git a/src/mess/drivers/a2600.c b/src/mess/drivers/a2600.c index ffce1c5b595..d5efc351f4a 100644 --- a/src/mess/drivers/a2600.c +++ b/src/mess/drivers/a2600.c @@ -1263,7 +1263,7 @@ WRITE8_MEMBER(a2600_state::switch_A_w) /* Right controller port */ m_joy2->joy_w( data & 0x0f ); -// switch( machine().root_device().ioport("CONTROLLERS")->read() % CATEGORY_SELECT ) +// switch( ioport("CONTROLLERS")->read() % CATEGORY_SELECT ) // { // case 0x0a: /* KidVid voice module */ // machine().device<cassette_image_device>(CASSETTE_TAG)->change_state(( data & 0x02 ) ? (cassette_state)CASSETTE_MOTOR_DISABLED : (cassette_state)(CASSETTE_MOTOR_ENABLED | CASSETTE_PLAY), (cassette_state)CASSETTE_MOTOR_DISABLED ); @@ -1294,7 +1294,7 @@ WRITE_LINE_MEMBER(a2600_state::irq_callback) READ8_MEMBER(a2600_state::riot_input_port_8_r) { - return machine().root_device().ioport("SWB")->read(); + return ioport("SWB")->read(); } static const riot6532_interface r6532_interface = diff --git a/src/mess/drivers/a5105.c b/src/mess/drivers/a5105.c index 41fe4405d95..6ab6d65cc3c 100644 --- a/src/mess/drivers/a5105.c +++ b/src/mess/drivers/a5105.c @@ -276,7 +276,7 @@ WRITE8_MEMBER( a5105_state::a5105_memsel_w ) prog.unmap_write(0x4000, 0x4000); break; case 1: - membank("bank2")->set_base(machine().root_device().memregion("k5651")->base()); + membank("bank2")->set_base(memregion("k5651")->base()); prog.install_read_bank(0x4000, 0x7fff, "bank2"); prog.unmap_write(0x4000, 0x4000); break; @@ -485,7 +485,7 @@ void a5105_state::machine_reset() m_beep->set_frequency(500); m_ram_base = (UINT8*)machine().device<ram_device>(RAM_TAG)->pointer(); - m_rom_base = (UINT8*)machine().root_device().memregion("maincpu")->base(); + m_rom_base = (UINT8*)memregion("maincpu")->base(); membank("bank1")->set_base(m_rom_base); membank("bank2")->set_base(m_rom_base + 0x4000); diff --git a/src/mess/drivers/alesis.c b/src/mess/drivers/alesis.c index 7baccdde2af..f5c6d917d58 100644 --- a/src/mess/drivers/alesis.c +++ b/src/mess/drivers/alesis.c @@ -343,8 +343,8 @@ ROM_END DRIVER_INIT_MEMBER(alesis_state,hr16) { int i; - UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); - UINT8 *orig = machine().root_device().memregion("user1")->base(); + UINT8 *ROM = memregion("maincpu")->base(); + UINT8 *orig = memregion("user1")->base(); for (i = 0; i < 0x8000; i++) { ROM[BITSWAP16(i,15,14,13,12,11,10,9,8,0,1,2,3,4,5,6,7)] = orig[i]; diff --git a/src/mess/drivers/altos5.c b/src/mess/drivers/altos5.c index dc445117f6d..8e8918f9ef4 100644 --- a/src/mess/drivers/altos5.c +++ b/src/mess/drivers/altos5.c @@ -57,8 +57,8 @@ INPUT_PORTS_END void altos5_state::machine_reset() { - UINT8 *m_p_maincpu = machine().root_device().memregion("maincpu")->base(); - UINT8 *m_p_roms = machine().root_device().memregion("roms")->base(); + UINT8 *m_p_maincpu = memregion("maincpu")->base(); + UINT8 *m_p_roms = memregion("roms")->base(); memcpy(m_p_maincpu, m_p_roms, 0x1000); } diff --git a/src/mess/drivers/amiga.c b/src/mess/drivers/amiga.c index 03e8a518e02..45bd7a4cfbc 100644 --- a/src/mess/drivers/amiga.c +++ b/src/mess/drivers/amiga.c @@ -582,7 +582,7 @@ static const tpi6525_interface cdtv_tpi_intf = READ8_MEMBER(a1200_state::a1200_cia_0_portA_r) { - UINT8 ret = machine().root_device().ioport("CIA0PORTA")->read() & 0xc0; /* Gameport 1 and 0 buttons */ + UINT8 ret = ioport("CIA0PORTA")->read() & 0xc0; /* Gameport 1 and 0 buttons */ ret |= machine().device<amiga_fdc>("fdc")->ciaapra_r(); return ret; } @@ -1123,7 +1123,7 @@ DRIVER_INIT_MEMBER(amiga_state,amiga) /* set up memory */ m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base()); + m_bank1->configure_entry(1, memregion("user1")->base()); /* initialize cartridge (if present) */ amiga_cart_init(machine()); @@ -1149,7 +1149,7 @@ DRIVER_INIT_MEMBER(amiga_state,cdtv) /* set up memory */ m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base()); + m_bank1->configure_entry(1, memregion("user1")->base()); } DRIVER_INIT_MEMBER(a1200_state,a1200) @@ -1171,7 +1171,7 @@ DRIVER_INIT_MEMBER(a1200_state,a1200) /* set up memory */ m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base()); + m_bank1->configure_entry(1, memregion("user1")->base()); } DRIVER_INIT_MEMBER(amiga_state,a3000) @@ -1193,7 +1193,7 @@ DRIVER_INIT_MEMBER(amiga_state,a3000) /* set up memory */ m_bank1->configure_entry(0, m_chip_ram); - m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base()); + m_bank1->configure_entry(1, memregion("user1")->base()); } diff --git a/src/mess/drivers/apc.c b/src/mess/drivers/apc.c index 02184214f20..7ba9a88cdc5 100644 --- a/src/mess/drivers/apc.c +++ b/src/mess/drivers/apc.c @@ -345,7 +345,7 @@ READ8_MEMBER(apc_state::apc_kbd_r) case 0: res = m_keyb.data; pic8259_ir4_w(machine().device("pic8259_master"), 0); break; // according to the source, reading there acks the irq case 1: res = m_keyb.status; break; case 2: res = m_keyb.sig; break; // bit 0: CTRL bit 1: function key (or reversed) - case 3: res = machine().root_device().ioport("KEY_MOD")->read() & 0xff; break; // sh + case 3: res = ioport("KEY_MOD")->read() & 0xff; break; // sh } return res; diff --git a/src/mess/drivers/apexc.c b/src/mess/drivers/apexc.c index 6801924d53c..a2b34a5baff 100644 --- a/src/mess/drivers/apexc.c +++ b/src/mess/drivers/apexc.c @@ -413,7 +413,7 @@ INTERRUPT_GEN_MEMBER(apexc_state::apexc_interrupt) /* read new state of edit keys */ - edit_keys = machine().root_device().ioport("data")->read(); + edit_keys = ioport("data")->read(); /* toggle data reg according to transitions */ m_panel_data_reg ^= edit_keys & (~m_old_edit_keys); @@ -826,7 +826,7 @@ DRIVER_INIT_MEMBER(apexc_state,apexc) 0x00 }; - dst = machine().root_device().memregion("chargen")->base(); + dst = memregion("chargen")->base(); memcpy(dst, fontdata6x8, apexcfontdata_size); } diff --git a/src/mess/drivers/apollo.c b/src/mess/drivers/apollo.c index 70ffa48f90f..3c1b56a6506 100644 --- a/src/mess/drivers/apollo.c +++ b/src/mess/drivers/apollo.c @@ -1062,7 +1062,7 @@ static void apollo_reset_instr_callback(device_t *device) ***************************************************************************/ void apollo_state::machine_start(){ - memory_share *messram = machine().root_device().memshare("messram"); + memory_share *messram = memshare("messram"); //MLOG1(("machine_start_dn3500: ram size is %d MB", (int)messram->bytes()/(1024*1024))); // clear ram diff --git a/src/mess/drivers/arcadia.c b/src/mess/drivers/arcadia.c index c6aff0adef1..e52946333f9 100644 --- a/src/mess/drivers/arcadia.c +++ b/src/mess/drivers/arcadia.c @@ -453,7 +453,7 @@ void arcadia_state::palette_init() DEVICE_IMAGE_LOAD_MEMBER( arcadia_state, arcadia_cart ) { - UINT8 *rom = image.device().machine().root_device().memregion("maincpu")->base(); + UINT8 *rom = memregion("maincpu")->base(); int size; memset(rom, 0, 0x8000); @@ -461,8 +461,8 @@ DEVICE_IMAGE_LOAD_MEMBER( arcadia_state, arcadia_cart ) { size = image.length(); - if (size > image.device().machine().root_device().memregion("maincpu")->bytes()) - size = image.device().machine().root_device().memregion("maincpu")->bytes(); + if (size > memregion("maincpu")->bytes()) + size = memregion("maincpu")->bytes(); if (image.fread(rom, size) != size) return IMAGE_INIT_FAIL; @@ -731,13 +731,13 @@ ROM_END DRIVER_INIT_MEMBER(arcadia_state,arcadia) { int i; - UINT8 *gfx=machine().root_device().memregion("gfx1")->base(); + UINT8 *gfx=memregion("gfx1")->base(); for (i=0; i<256; i++) gfx[i]=i; #if 0 // this is here to allow developement of some simple testroutines // for a real console { - UINT8 *rom=machine().root_device().memregion("maincpu")->base(); + UINT8 *rom=memregion("maincpu")->base(); /* this is a simple routine to display all rom characters on the display for a snapshot */ static const UINT8 prog[]={ // address 0 of course diff --git a/src/mess/drivers/astrocde.c b/src/mess/drivers/astrocde.c index d9672114e4a..a0d9381e373 100644 --- a/src/mess/drivers/astrocde.c +++ b/src/mess/drivers/astrocde.c @@ -343,14 +343,14 @@ MACHINE_RESET_MEMBER(astrocde_mess_state, astrocde) void astrocde_mess_state::get_ram_expansion_settings(int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end) { - if (machine().root_device().ioport("PROTECT")->read() == 0x01) + if (ioport("PROTECT")->read() == 0x01) write_protect_on = 1; else write_protect_on = 0; ram_expansion_installed = 1; - switch(machine().root_device().ioport("CFG")->read()) // check RAM expansion configuration and set address ranges + switch(ioport("CFG")->read()) // check RAM expansion configuration and set address ranges { case 0x00: // No RAM Expansion ram_expansion_installed = 0; diff --git a/src/mess/drivers/atom.c b/src/mess/drivers/atom.c index ef3c3530ff5..bebd034faa0 100644 --- a/src/mess/drivers/atom.c +++ b/src/mess/drivers/atom.c @@ -809,26 +809,26 @@ DEVICE_IMAGE_LOAD_MEMBER( atom_state, atom_cart ) if (image.software_entry() == NULL) { size = image.length(); - temp_copy = auto_alloc_array(image.device().machine(), UINT8, size); + temp_copy = auto_alloc_array(machine(), UINT8, size); if (size > 0x1000) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); - auto_free(image.device().machine(), temp_copy); + auto_free(machine(), temp_copy); return IMAGE_INIT_FAIL; } if (image.fread(temp_copy, size) != size) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file"); - auto_free(image.device().machine(), temp_copy); + auto_free(machine(), temp_copy); return IMAGE_INIT_FAIL; } } else { size = image.get_software_region_length( "rom"); - temp_copy = auto_alloc_array(image.device().machine(), UINT8, size); + temp_copy = auto_alloc_array(machine(), UINT8, size); memcpy(temp_copy, image.get_software_region("rom"), size); } @@ -836,9 +836,9 @@ DEVICE_IMAGE_LOAD_MEMBER( atom_state, atom_cart ) /* With the following, we mirror the cart in the whole memory region */ for (i = 0; i < mirror; i++) - memcpy(image.device().machine().root_device().memregion(this_cart->region)->base() + this_cart->offset + i * size, temp_copy, size); + memcpy(memregion(this_cart->region)->base() + this_cart->offset + i * size, temp_copy, size); - auto_free(image.device().machine(), temp_copy); + auto_free(machine(), temp_copy); return IMAGE_INIT_PASS; } diff --git a/src/mess/drivers/babbage.c b/src/mess/drivers/babbage.c index 2f747339105..dc52aa458dd 100644 --- a/src/mess/drivers/babbage.c +++ b/src/mess/drivers/babbage.c @@ -230,7 +230,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(babbage_state::keyboard_callback) for (i = 0; i < 4; i++) { sprintf(kbdrow,"X%X",i); - inp = machine().root_device().ioport(kbdrow)->read(); + inp = ioport(kbdrow)->read(); for (j = 0; j < 5; j++) if (BIT(inp, j)) diff --git a/src/mess/drivers/bbcbc.c b/src/mess/drivers/bbcbc.c index 1b35a461ae1..be99563a245 100644 --- a/src/mess/drivers/bbcbc.c +++ b/src/mess/drivers/bbcbc.c @@ -134,7 +134,7 @@ static const z80_daisy_config bbcbc_daisy_chain[] = DEVICE_IMAGE_LOAD_MEMBER( bbcbc_state, bbcbc_cart ) { - UINT8 *cart = machine().root_device().memregion("maincpu" )->base() + 0x4000; + UINT8 *cart = memregion("maincpu" )->base() + 0x4000; if ( image.software_entry() == NULL ) { diff --git a/src/mess/drivers/bml3.c b/src/mess/drivers/bml3.c index 5bcfaf4090d..a3751e0a458 100644 --- a/src/mess/drivers/bml3.c +++ b/src/mess/drivers/bml3.c @@ -590,7 +590,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(bml3_state::keyboard_callback) { for(i=0;i<32;i++) { - if((machine().root_device().ioport(portnames[port_i])->read()>>i) & 1) + if((ioport(portnames[port_i])->read()>>i) & 1) { { m_keyb_press = scancode; @@ -642,8 +642,8 @@ void bml3_state::machine_reset() address_space &mem = m_maincpu->space(AS_PROGRAM); /* defaults */ - mem.install_rom(0xa000, 0xfeff,mem.machine().root_device().memregion("maincpu")->base() + 0xa000); - mem.install_rom(0xfff0, 0xffff,mem.machine().root_device().memregion("maincpu")->base() + 0xfff0); + mem.install_rom(0xa000, 0xfeff,memregion("maincpu")->base() + 0xa000); + mem.install_rom(0xfff0, 0xffff,memregion("maincpu")->base() + 0xfff0); mem.install_write_handler(0xa000, 0xbfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_a000_w), this),0); mem.install_write_handler(0xc000, 0xdfff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_c000_w), this),0); mem.install_write_handler(0xe000, 0xefff, 0, 0,write8_delegate(FUNC(bml3_state::bml3_e000_w), this),0); @@ -730,7 +730,7 @@ WRITE8_MEMBER(bml3_state::bml3_piaA_w) else { mem.install_rom(0xa000, 0xbfff, - mem.machine().root_device().memregion("maincpu")->base() + 0xa000); + memregion("maincpu")->base() + 0xa000); mem.install_write_handler(0xa000, 0xbfff, 0, 0, write8_delegate(FUNC(bml3_state::bml3_a000_w), this), 0); @@ -748,7 +748,7 @@ WRITE8_MEMBER(bml3_state::bml3_piaA_w) else { mem.install_rom(0xc000, 0xdfff, - mem.machine().root_device().memregion("maincpu")->base() + 0xc000); + memregion("maincpu")->base() + 0xc000); mem.install_write_handler(0xc000, 0xdfff, 0, 0, write8_delegate(FUNC(bml3_state::bml3_c000_w), this), 0); @@ -766,7 +766,7 @@ WRITE8_MEMBER(bml3_state::bml3_piaA_w) else { mem.install_rom(0xe000, 0xefff, - mem.machine().root_device().memregion("maincpu")->base() + 0xe000); + memregion("maincpu")->base() + 0xe000); mem.install_write_handler(0xe000, 0xefff, 0, 0, write8_delegate(FUNC(bml3_state::bml3_e000_w), this), 0); @@ -782,7 +782,7 @@ WRITE8_MEMBER(bml3_state::bml3_piaA_w) else { mem.install_rom(0xf000, 0xfeff, - mem.machine().root_device().memregion("maincpu")->base() + 0xf000); + memregion("maincpu")->base() + 0xf000); mem.install_write_handler(0xf000, 0xfeff, 0, 0, write8_delegate(FUNC(bml3_state::bml3_f000_w), this), 0); @@ -797,7 +797,7 @@ WRITE8_MEMBER(bml3_state::bml3_piaA_w) else { mem.install_rom(0xfff0, 0xffff, - mem.machine().root_device().memregion("maincpu")->base() + 0xfff0); + memregion("maincpu")->base() + 0xfff0); mem.install_write_handler(0xfff0, 0xffff, 0, 0, write8_delegate(FUNC(bml3_state::bml3_fff0_w), this), 0); diff --git a/src/mess/drivers/camplynx.c b/src/mess/drivers/camplynx.c index 3b66b6f40aa..da6d36f390b 100644 --- a/src/mess/drivers/camplynx.c +++ b/src/mess/drivers/camplynx.c @@ -130,8 +130,7 @@ WRITE8_MEMBER( camplynx_state::lynx48k_bank_w ) WRITE8_MEMBER( camplynx_state::lynx128k_bank_w ) { /* get address space */ - address_space &mem = m_maincpu->space(AS_PROGRAM); - UINT8 *base = mem.machine().root_device().memregion("maincpu")->base(); + UINT8 *base = memregion("maincpu")->base(); /* Set read banks */ UINT8 bank = data & 0x0f; diff --git a/src/mess/drivers/cat.c b/src/mess/drivers/cat.c index 080447d1fe9..eaf4484c78b 100644 --- a/src/mess/drivers/cat.c +++ b/src/mess/drivers/cat.c @@ -343,7 +343,7 @@ public: /* DRIVER_INIT_MEMBER( cat_state,cat ) { - UINT8 *svrom = machine().root_device().memregion("svrom")->base(); + UINT8 *svrom = memregion("svrom")->base(); int i; // fill svrom with the correct 2e80 pattern except where svrom1 sits // first half diff --git a/src/mess/drivers/channelf.c b/src/mess/drivers/channelf.c index e0003963c89..4545ec38f84 100644 --- a/src/mess/drivers/channelf.c +++ b/src/mess/drivers/channelf.c @@ -230,7 +230,7 @@ DEVICE_IMAGE_LOAD_MEMBER( channelf_state, channelf_cart ) return IMAGE_INIT_FAIL; } - if (image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0x0800, size) != size) + if (image.fread( memregion("maincpu")->base() + 0x0800, size) != size) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unable to fully read from file"); return IMAGE_INIT_FAIL; @@ -240,7 +240,7 @@ DEVICE_IMAGE_LOAD_MEMBER( channelf_state, channelf_cart ) else { size = image.get_software_region_length("rom"); - memcpy(image.device().machine().root_device().memregion("maincpu")->base() + 0x0800, image.get_software_region("rom"), size); + memcpy(memregion("maincpu")->base() + 0x0800, image.get_software_region("rom"), size); } return IMAGE_INIT_PASS; diff --git a/src/mess/drivers/coleco.c b/src/mess/drivers/coleco.c index 3de969349db..dfeb73c56ee 100644 --- a/src/mess/drivers/coleco.c +++ b/src/mess/drivers/coleco.c @@ -270,7 +270,7 @@ void coleco_state::machine_reset() m_maincpu->set_input_line_vector(INPUT_LINE_IRQ0, 0xff); - memset(&machine().root_device().memregion(Z80_TAG)->base()[0x6000], 0xff, 0x400); // initialize RAM + memset(&memregion(Z80_TAG)->base()[0x6000], 0xff, 0x400); // initialize RAM } //static int coleco_cart_verify(const UINT8 *cartdata, size_t size) @@ -288,7 +288,7 @@ void coleco_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER( coleco_state,czz50_cart ) { - UINT8 *ptr = image.device().machine().root_device().memregion(Z80_TAG)->base() + 0x8000; + UINT8 *ptr = memregion(Z80_TAG)->base() + 0x8000; UINT32 size; if (image.software_entry() == NULL) diff --git a/src/mess/drivers/comquest.c b/src/mess/drivers/comquest.c index 0bd46dca4f4..05f9254a8dd 100644 --- a/src/mess/drivers/comquest.c +++ b/src/mess/drivers/comquest.c @@ -205,7 +205,7 @@ GFXDECODE_END void comquest_state::machine_reset() { -// UINT8 *mem=machine().root_device().memregion("user1")->base(); +// UINT8 *mem=memregion("user1")->base(); // membank(1)->set_base(mem+0x00000); } diff --git a/src/mess/drivers/cxhumax.c b/src/mess/drivers/cxhumax.c index 0dedb43964f..b7152dc49d8 100644 --- a/src/mess/drivers/cxhumax.c +++ b/src/mess/drivers/cxhumax.c @@ -992,7 +992,7 @@ void cxhumax_state::machine_reset() m_i2c0_regs[0x08/4] = 0x08; // SDA high m_i2c2_regs[0x08/4] = 0x08; // SDA high - UINT8* FLASH = machine().root_device().memregion("flash")->base(); + UINT8* FLASH = memregion("flash")->base(); memcpy(m_ram,FLASH,0x400000); m_chipcontrol_regs[PIN_CONFIG_0_REG] = diff --git a/src/mess/drivers/dectalk.c b/src/mess/drivers/dectalk.c index 01fe39966de..1a61d7c5981 100644 --- a/src/mess/drivers/dectalk.c +++ b/src/mess/drivers/dectalk.c @@ -303,7 +303,7 @@ static UINT8 duart_input(device_t *device) dectalk_state *state = device->machine().driver_data<dectalk_state>(); UINT8 data = 0; data |= state->m_duart_inport&0xF; - data |= (device->machine().root_device().ioport("duart_in")->read()&0xF0); + data |= (state->ioport("duart_in")->read()&0xF0); if ((state->m_hack_self_test == 1) && (state->ioport("hacks")->read()&0x01)) data |= 0x10; // hack to prevent hang if selftest disable bit is kept low past the first read; i suppose the proper use of this bit was an incremental switch, or perhaps its expecting an interrupt later from serial in or tone in? added a dipswitch to disable the hack for testing state->m_hack_self_test = 1; return data; diff --git a/src/mess/drivers/enterp.c b/src/mess/drivers/enterp.c index c2bf9a7ce84..6b02ac77c5d 100644 --- a/src/mess/drivers/enterp.c +++ b/src/mess/drivers/enterp.c @@ -47,7 +47,7 @@ static void enterprise_update_memory_page(address_space &space, offs_t page, int case 0x03: space.install_read_bank(start, end, page_num); space.nop_write(start, end); - state->membank(page_num)->set_base(space.machine().root_device().memregion("exos")->base() + (index * 0x4000)); + state->membank(page_num)->set_base(state->memregion("exos")->base() + (index * 0x4000)); break; case 0x04: @@ -56,7 +56,7 @@ static void enterprise_update_memory_page(address_space &space, offs_t page, int case 0x07: space.install_read_bank(start, end, page_num); space.nop_write(start, end); - state->membank(page_num)->set_base(space.machine().root_device().memregion("cartridges")->base() + ((index - 0x04) * 0x4000)); + state->membank(page_num)->set_base(state->memregion("cartridges")->base() + ((index - 0x04) * 0x4000)); break; case 0x20: @@ -128,13 +128,13 @@ READ8_MEMBER(ep_state::enterprise_dave_reg_read) { case 0x015: /* read keyboard line */ - dave_set_reg(machine().device("custom"), 0x015, machine().root_device().ioport(keynames[keyboard_line])->read()); + dave_set_reg(machine().device("custom"), 0x015, ioport(keynames[keyboard_line])->read()); break; case 0x016: { int ExternalJoystickInputs; - int ExternalJoystickPortInput = machine().root_device().ioport("JOY1")->read(); + int ExternalJoystickPortInput = ioport("JOY1")->read(); if (keyboard_line <= 4) { diff --git a/src/mess/drivers/esq1.c b/src/mess/drivers/esq1.c index 30910cb3b55..1ae0905f1f6 100644 --- a/src/mess/drivers/esq1.c +++ b/src/mess/drivers/esq1.c @@ -180,7 +180,7 @@ static UINT8 esq1_adc_read(device_t *device) void esq1_state::machine_reset() { // set default OSROM banking - membank("osbank")->set_base(machine().root_device().memregion("osrom")->base() ); + membank("osbank")->set_base(memregion("osrom")->base() ); m_mapper_state = 0; m_seq_bank = 0; diff --git a/src/mess/drivers/esq5505.c b/src/mess/drivers/esq5505.c index 26d007ecd70..e751461fa0d 100644 --- a/src/mess/drivers/esq5505.c +++ b/src/mess/drivers/esq5505.c @@ -221,8 +221,8 @@ IRQ_CALLBACK_MEMBER(esq5505_state::maincpu_irq_acknowledge_callback) void esq5505_state::machine_reset() { - m_rom = (UINT16 *)(void *)machine().root_device().memregion("osrom")->base(); - m_ram = (UINT16 *)(void *)machine().root_device().memshare("osram")->ptr(); + m_rom = (UINT16 *)(void *)memregion("osrom")->base(); + m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(esq5505_state::maincpu_irq_acknowledge_callback),this)); } @@ -254,8 +254,8 @@ READ16_MEMBER(esq5505_state::lower_r) // get pointers when 68k resets if (!m_rom) { - m_rom = (UINT16 *)(void *)machine().root_device().memregion("osrom")->base(); - m_ram = (UINT16 *)(void *)machine().root_device().memshare("osram")->ptr(); + m_rom = (UINT16 *)(void *)memregion("osrom")->base(); + m_ram = (UINT16 *)(void *)memshare("osram")->ptr(); } if (m68k_get_fc(m_maincpu) == 0x6) // supervisor mode = ROM @@ -882,8 +882,8 @@ DRIVER_INIT_MEMBER(esq5505_state,sq1) DRIVER_INIT_MEMBER(esq5505_state,denib) { - UINT8 *pNibbles = (UINT8 *)machine().root_device().memregion("nibbles")->base(); - UINT8 *pBS0L = (UINT8 *)machine().root_device().memregion("waverom")->base(); + UINT8 *pNibbles = (UINT8 *)memregion("nibbles")->base(); + UINT8 *pBS0L = (UINT8 *)memregion("waverom")->base(); UINT8 *pBS0H = pBS0L + 0x100000; DRIVER_INIT_CALL(common); diff --git a/src/mess/drivers/esqkt.c b/src/mess/drivers/esqkt.c index 76273350495..08660969110 100644 --- a/src/mess/drivers/esqkt.c +++ b/src/mess/drivers/esqkt.c @@ -93,8 +93,8 @@ public: void esqkt_state::machine_reset() { -// m_rom = (UINT32 *)machine().root_device().memregion("osrom")->base(); -// m_ram = (UINT32 *)machine().root_device().memshare("osram")->ptr(); +// m_rom = (UINT32 *)memregion("osrom")->base(); +// m_ram = (UINT32 *)memshare("osram")->ptr(); // memcpy(m_ram, m_rom, 8); // m_maincpu->reset(); @@ -122,7 +122,7 @@ READ16_MEMBER(esqkt_state::es5510_dsp_r) WRITE16_MEMBER(esqkt_state::es5510_dsp_w) { - UINT8 *snd_mem = (UINT8 *)space.machine().root_device().memregion("waverom")->base(); + UINT8 *snd_mem = (UINT8 *)memregion("waverom")->base(); COMBINE_DATA(&es5510_dsp_ram[offset]); @@ -191,8 +191,8 @@ READ32_MEMBER(esqkt_state::lower_r) // get pointers when 68k resets if (!m_rom) { - m_rom = (UINT32 *)machine().root_device().memregion("osrom")->base(); - m_ram = (UINT32 *)machine().root_device().memshare("osram")->ptr(); + m_rom = (UINT32 *)memregion("osrom")->base(); + m_ram = (UINT32 *)memshare("osram")->ptr(); } if (offset < 0x2000) diff --git a/src/mess/drivers/fk1.c b/src/mess/drivers/fk1.c index 9918b5f42f7..97e6d0d14a6 100644 --- a/src/mess/drivers/fk1.c +++ b/src/mess/drivers/fk1.c @@ -309,7 +309,7 @@ READ8_MEMBER( fk1_state::fk1_bank_rom_r ) { address_space &space_mem = m_maincpu->space(AS_PROGRAM); space_mem.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); + membank("bank1")->set_base(memregion("maincpu")->base()); membank("bank2")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0x10000); return 0; } @@ -387,7 +387,7 @@ INPUT_PORTS_END TIMER_DEVICE_CALLBACK_MEMBER(fk1_state::keyboard_callback) { - if (machine().root_device().ioport("LINE0")->read()) + if (ioport("LINE0")->read()) { m_int_vector = 6; m_maincpu->set_input_line(0, HOLD_LINE); @@ -424,7 +424,7 @@ void fk1_state::machine_reset() UINT8 *ram = machine().device<ram_device>(RAM_TAG)->pointer(); space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); // ROM + membank("bank1")->set_base(memregion("maincpu")->base()); // ROM membank("bank2")->set_base(ram + 0x10000); // VRAM membank("bank3")->set_base(ram + 0x8000); membank("bank4")->set_base(ram + 0xc000); diff --git a/src/mess/drivers/fm7.c b/src/mess/drivers/fm7.c index ad90026b721..b1bb687ee06 100644 --- a/src/mess/drivers/fm7.c +++ b/src/mess/drivers/fm7.c @@ -871,7 +871,7 @@ static void fm7_update_psg(running_machine &machine) break; case 0x09: // Joystick port read - state->m_psg_data = space.machine().root_device().ioport("joy1")->read(); + state->m_psg_data = state->ioport("joy1")->read(); break; } } @@ -940,12 +940,12 @@ READ8_MEMBER(fm7_state::fm7_fmirq_r) READ8_MEMBER(fm7_state::fm77av_joy_1_r) { - return machine().root_device().ioport("joy1")->read(); + return ioport("joy1")->read(); } READ8_MEMBER(fm7_state::fm77av_joy_2_r) { - return machine().root_device().ioport("joy2")->read(); + return ioport("joy2")->read(); } READ8_MEMBER(fm7_state::fm7_unknown_r) @@ -1052,7 +1052,7 @@ static void fm7_update_bank(address_space & space, int bank, UINT8 physical) { if(state->m_init_rom_en && (state->m_type == SYS_FM11 || state->m_type == SYS_FM16)) { - RAM = space.machine().root_device().memregion("init")->base(); + RAM = state->memregion("init")->base(); space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); space.nop_write(bank*0x1000,(bank*0x1000)+size); state->membank(bank_name)->set_base(RAM+(physical<<12)-0x35000); @@ -1063,7 +1063,7 @@ static void fm7_update_bank(address_space & space, int bank, UINT8 physical) { if(state->m_init_rom_en && (state->m_type != SYS_FM11 && state->m_type != SYS_FM16)) { - RAM = space.machine().root_device().memregion("init")->base(); + RAM = state->memregion("init")->base(); space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); space.nop_write(bank*0x1000,(bank*0x1000)+size); state->membank(bank_name)->set_base(RAM+(physical<<12)-0x36000); @@ -1074,7 +1074,7 @@ static void fm7_update_bank(address_space & space, int bank, UINT8 physical) { if(state->m_basic_rom_en && (state->m_type != SYS_FM11 && state->m_type != SYS_FM16)) { - RAM = space.machine().root_device().memregion("fbasic")->base(); + RAM = state->memregion("fbasic")->base(); space.install_read_bank(bank*0x1000,(bank*0x1000)+size,bank_name); space.nop_write(bank*0x1000,(bank*0x1000)+size); state->membank(bank_name)->set_base(RAM+(physical<<12)-0x38000); @@ -1290,9 +1290,9 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm7_keyboard_poll) int bit = 0; int mod = 0; UINT32 keys; - UINT32 modifiers = machine().root_device().ioport("key_modifiers")->read(); + UINT32 modifiers = ioport("key_modifiers")->read(); - if(machine().root_device().ioport("key3")->read() & 0x40000) + if(ioport("key3")->read() & 0x40000) { m_break_flag = 1; m_maincpu->set_input_line(M6809_FIRQ_LINE,ASSERT_LINE); @@ -1321,7 +1321,7 @@ TIMER_CALLBACK_MEMBER(fm7_state::fm7_keyboard_poll) for(x=0;x<3;x++) { - keys = machine().root_device().ioport(portnames[x])->read(); + keys = ioport(portnames[x])->read(); for(y=0;y<32;y++) // loop through each bit in the port { @@ -1853,8 +1853,8 @@ MACHINE_START_MEMBER(fm7_state,fm7) MACHINE_START_MEMBER(fm7_state,fm77av) { - UINT8* RAM = machine().root_device().memregion("maincpu")->base(); - UINT8* ROM = machine().root_device().memregion("init")->base(); + UINT8* RAM = memregion("maincpu")->base(); + UINT8* ROM = memregion("init")->base(); memset(m_shared_ram,0xff,0x80); @@ -1862,7 +1862,7 @@ MACHINE_START_MEMBER(fm7_state,fm77av) memcpy(RAM+0x3fff0,ROM+0x1ff0,16); m_video.subrom = 0; // default sub CPU ROM is type C. - RAM = machine().root_device().memregion("subsyscg")->base(); + RAM = memregion("subsyscg")->base(); membank("bank20")->set_base(RAM); RAM = memregion("subsys_c")->base(); membank("bank21")->set_base(RAM+0x800); @@ -1874,7 +1874,7 @@ MACHINE_START_MEMBER(fm7_state,fm77av) MACHINE_START_MEMBER(fm7_state,fm11) { - UINT8* RAM = machine().root_device().memregion("maincpu")->base(); + UINT8* RAM = memregion("maincpu")->base(); UINT8* ROM = memregion("init")->base(); memset(m_shared_ram,0xff,0x80); @@ -1894,7 +1894,7 @@ MACHINE_START_MEMBER(fm7_state,fm16) void fm7_state::machine_reset() { - UINT8* RAM = machine().root_device().memregion("maincpu")->base(); + UINT8* RAM = memregion("maincpu")->base(); UINT8* ROM = memregion("init")->base(); m_timer->adjust(attotime::from_nsec(2034500),0,attotime::from_nsec(2034500)); @@ -1944,13 +1944,13 @@ void fm7_state::machine_reset() // set boot mode (FM-7 only, AV and later has boot RAM instead) if(m_type == SYS_FM7) { - if(!(machine().root_device().ioport("DSW")->read() & 0x02)) + if(!(ioport("DSW")->read() & 0x02)) { // DOS mode - membank("bank17")->set_base(machine().root_device().memregion("dos")->base()); + membank("bank17")->set_base(memregion("dos")->base()); } else { // BASIC mode - membank("bank17")->set_base(machine().root_device().memregion("basic")->base()); + membank("bank17")->set_base(memregion("basic")->base()); } } if(m_type == SYS_FM77AV || m_type == SYS_FM77AV40EX || m_type == SYS_FM11) diff --git a/src/mess/drivers/fmtowns.c b/src/mess/drivers/fmtowns.c index 8438461e7d3..7b7788c82fe 100644 --- a/src/mess/drivers/fmtowns.c +++ b/src/mess/drivers/fmtowns.c @@ -893,7 +893,7 @@ void towns_state::mouse_timeout() READ8_MEMBER(towns_state::towns_padport_r) { UINT8 ret = 0x00; - UINT32 porttype = space.machine().root_device().ioport("ctrltype")->read(); + UINT32 porttype = ioport("ctrltype")->read(); UINT8 extra1; UINT8 extra2; UINT32 state; @@ -902,12 +902,12 @@ READ8_MEMBER(towns_state::towns_padport_r) { if((porttype & 0x0f) == 0x01) { - extra1 = space.machine().root_device().ioport("joy1_ex")->read(); + extra1 = ioport("joy1_ex")->read(); if(m_towns_pad_mask & 0x10) - ret |= (space.machine().root_device().ioport("joy1")->read() & 0x3f) | 0x40; + ret |= (ioport("joy1")->read() & 0x3f) | 0x40; else - ret |= (space.machine().root_device().ioport("joy1")->read() & 0x0f) | 0x30; + ret |= (ioport("joy1")->read() & 0x0f) | 0x30; if(extra1 & 0x01) // Run button = left+right ret &= ~0x0c; @@ -921,12 +921,12 @@ READ8_MEMBER(towns_state::towns_padport_r) } if((porttype & 0x0f) == 0x04) // 6-button joystick { - extra1 = space.machine().root_device().ioport("6b_joy1_ex")->read(); + extra1 = ioport("6b_joy1_ex")->read(); if(m_towns_pad_mask & 0x10) ret |= 0x7f; else - ret |= (space.machine().root_device().ioport("6b_joy1")->read() & 0x0f) | 0x70; + ret |= (ioport("6b_joy1")->read() & 0x0f) | 0x70; if(!(m_towns_pad_mask & 0x10)) { @@ -975,7 +975,7 @@ READ8_MEMBER(towns_state::towns_padport_r) } // button states are always visible - state = space.machine().root_device().ioport("mouse1")->read(); + state = ioport("mouse1")->read(); if(!(state & 0x01)) ret |= 0x10; if(!(state & 0x02)) @@ -989,12 +989,12 @@ READ8_MEMBER(towns_state::towns_padport_r) { if((porttype & 0xf0) == 0x10) { - extra2 = space.machine().root_device().ioport("joy2_ex")->read(); + extra2 = ioport("joy2_ex")->read(); if(m_towns_pad_mask & 0x20) - ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x3f)) | 0x40; + ret |= ((ioport("joy2")->read() & 0x3f)) | 0x40; else - ret |= ((space.machine().root_device().ioport("joy2")->read() & 0x0f)) | 0x30; + ret |= ((ioport("joy2")->read() & 0x0f)) | 0x30; if(extra2 & 0x01) ret &= ~0x0c; @@ -1008,12 +1008,12 @@ READ8_MEMBER(towns_state::towns_padport_r) } if((porttype & 0xf0) == 0x40) // 6-button joystick { - extra2 = space.machine().root_device().ioport("6b_joy2_ex")->read(); + extra2 = ioport("6b_joy2_ex")->read(); if(m_towns_pad_mask & 0x20) ret |= 0x7f; else - ret |= ((space.machine().root_device().ioport("6b_joy2")->read() & 0x0f)) | 0x70; + ret |= ((ioport("6b_joy2")->read() & 0x0f)) | 0x70; if(!(m_towns_pad_mask & 0x10)) { @@ -1062,7 +1062,7 @@ READ8_MEMBER(towns_state::towns_padport_r) } // button states are always visible - state = space.machine().root_device().ioport("mouse1")->read(); + state = ioport("mouse1")->read(); if(!(state & 0x01)) ret |= 0x10; if(!(state & 0x02)) @@ -1078,7 +1078,7 @@ READ8_MEMBER(towns_state::towns_padport_r) WRITE8_MEMBER(towns_state::towns_pad_mask_w) { UINT8 current_x,current_y; - UINT32 type = space.machine().root_device().ioport("ctrltype")->read(); + UINT32 type = ioport("ctrltype")->read(); m_towns_pad_mask = (data & 0xff); if((type & 0x0f) == 0x02) // mouse @@ -1088,8 +1088,8 @@ WRITE8_MEMBER(towns_state::towns_pad_mask_w) if(m_towns_mouse_output == MOUSE_START) { m_towns_mouse_output = MOUSE_X_HIGH; - current_x = space.machine().root_device().ioport("mouse2")->read(); - current_y = space.machine().root_device().ioport("mouse3")->read(); + current_x = ioport("mouse2")->read(); + current_y = ioport("mouse3")->read(); m_towns_mouse_x = m_prev_x - current_x; m_towns_mouse_y = m_prev_y - current_y; m_prev_x = current_x; @@ -1104,8 +1104,8 @@ WRITE8_MEMBER(towns_state::towns_pad_mask_w) if(m_towns_mouse_output == MOUSE_START) { m_towns_mouse_output = MOUSE_SYNC; - current_x = space.machine().root_device().ioport("mouse2")->read(); - current_y = space.machine().root_device().ioport("mouse3")->read(); + current_x = ioport("mouse2")->read(); + current_y = ioport("mouse3")->read(); m_towns_mouse_x = m_prev_x - current_x; m_towns_mouse_y = m_prev_y - current_y; m_prev_x = current_x; @@ -1124,8 +1124,8 @@ WRITE8_MEMBER(towns_state::towns_pad_mask_w) if(m_towns_mouse_output == MOUSE_START) { m_towns_mouse_output = MOUSE_X_HIGH; - current_x = space.machine().root_device().ioport("mouse2")->read(); - current_y = space.machine().root_device().ioport("mouse3")->read(); + current_x = ioport("mouse2")->read(); + current_y = ioport("mouse3")->read(); m_towns_mouse_x = m_prev_x - current_x; m_towns_mouse_y = m_prev_y - current_y; m_prev_x = current_x; @@ -1140,8 +1140,8 @@ WRITE8_MEMBER(towns_state::towns_pad_mask_w) if(m_towns_mouse_output == MOUSE_START) { m_towns_mouse_output = MOUSE_SYNC; - current_x = space.machine().root_device().ioport("mouse2")->read(); - current_y = space.machine().root_device().ioport("mouse3")->read(); + current_x = ioport("mouse2")->read(); + current_y = ioport("mouse3")->read(); m_towns_mouse_x = m_prev_x - current_x; m_towns_mouse_y = m_prev_y - current_y; m_prev_x = current_x; diff --git a/src/mess/drivers/fp1100.c b/src/mess/drivers/fp1100.c index 92cb36a05ea..24135467bde 100644 --- a/src/mess/drivers/fp1100.c +++ b/src/mess/drivers/fp1100.c @@ -358,7 +358,7 @@ void fp1100_state::machine_reset() for(i=0;i<8;i++) { - slot_type = (machine().root_device().ioport("SLOTS")->read() >> i*2) & 3; + slot_type = (ioport("SLOTS")->read() >> i*2) & 3; m_slot[i].id = id_type[slot_type]; } } diff --git a/src/mess/drivers/fp200.c b/src/mess/drivers/fp200.c index 57fca63399b..42b42ea5b54 100644 --- a/src/mess/drivers/fp200.c +++ b/src/mess/drivers/fp200.c @@ -545,7 +545,7 @@ GFXDECODE_END void fp200_state::machine_start() { - UINT8 *raw_gfx = machine().root_device().memregion("raw_gfx")->base(); + UINT8 *raw_gfx = memregion("raw_gfx")->base(); m_chargen = memregion("chargen")->base(); for(int i=0;i<0x800;i++) diff --git a/src/mess/drivers/geneve.c b/src/mess/drivers/geneve.c index f544af6a448..d77e27554f7 100644 --- a/src/mess/drivers/geneve.c +++ b/src/mess/drivers/geneve.c @@ -745,7 +745,7 @@ void geneve_state::machine_reset() m_ready_line = m_ready_line1 = ASSERT_LINE; - m_peribox->set_genmod(machine().root_device().ioport("MODE")->read()==GENMOD); + m_peribox->set_genmod(ioport("MODE")->read()==GENMOD); m_joyport->write_port(0x01); // select Joystick 1 } diff --git a/src/mess/drivers/gizmondo.c b/src/mess/drivers/gizmondo.c index f51fa531ef8..c1f3ac24abc 100644 --- a/src/mess/drivers/gizmondo.c +++ b/src/mess/drivers/gizmondo.c @@ -94,12 +94,12 @@ static UINT32 s3c2440_gpio_port_r( device_t *device, int port, UINT32 mask) data = data & ~0x000000F2; // keys data |= 0x00F2; - if ((port_c & 0x01) == 0) data &= ~device->machine().root_device().ioport( "PORTF-01")->read(); - if ((port_c & 0x02) == 0) data &= ~device->machine().root_device().ioport( "PORTF-02")->read(); - if ((port_c & 0x04) == 0) data &= ~device->machine().root_device().ioport( "PORTF-04")->read(); - if ((port_c & 0x08) == 0) data &= ~device->machine().root_device().ioport( "PORTF-08")->read(); - if ((port_c & 0x10) == 0) data &= ~device->machine().root_device().ioport( "PORTF-10")->read(); - data &= ~device->machine().root_device().ioport( "PORTF")->read(); + if ((port_c & 0x01) == 0) data &= ~gizmondo->ioport( "PORTF-01")->read(); + if ((port_c & 0x02) == 0) data &= ~gizmondo->ioport( "PORTF-02")->read(); + if ((port_c & 0x04) == 0) data &= ~gizmondo->ioport( "PORTF-04")->read(); + if ((port_c & 0x08) == 0) data &= ~gizmondo->ioport( "PORTF-08")->read(); + if ((port_c & 0x10) == 0) data &= ~gizmondo->ioport( "PORTF-10")->read(); + data &= ~gizmondo->ioport( "PORTF")->read(); } break; case S3C2440_GPIO_PORT_G : @@ -107,7 +107,7 @@ static UINT32 s3c2440_gpio_port_r( device_t *device, int port, UINT32 mask) data = data & ~0x00008001; // keys data = data | 0x8000; - data &= ~device->machine().root_device().ioport( "PORTG")->read(); + data &= ~gizmondo->ioport( "PORTG")->read(); // no sd card inserted data = data | 0x0001; } diff --git a/src/mess/drivers/gp2x.c b/src/mess/drivers/gp2x.c index 1cfe6462929..bf2e03cfddc 100644 --- a/src/mess/drivers/gp2x.c +++ b/src/mess/drivers/gp2x.c @@ -202,7 +202,7 @@ WRITE32_MEMBER( gp2x_state::gp2x_lcdc_w ) READ32_MEMBER( gp2x_state::nand_r ) { - UINT32 *ROM = (UINT32 *)(*machine().root_device().memregion("maincpu")); + UINT32 *ROM = (UINT32 *)(*memregion("maincpu")); UINT32 ret; if (offset == 0) diff --git a/src/mess/drivers/hec2hrp.c b/src/mess/drivers/hec2hrp.c index cceb8d2ee8c..32e919cb416 100644 --- a/src/mess/drivers/hec2hrp.c +++ b/src/mess/drivers/hec2hrp.c @@ -302,7 +302,7 @@ MACHINE_RESET_MEMBER(hec2hrp_state,hec2hrp) MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) /*****************************************************************************/ { - UINT8 *RAM = machine().root_device().memregion("maincpu" )->base(); // pointer to mess ram + UINT8 *RAM = memregion("maincpu" )->base(); // pointer to mess ram //Patch rom possible ! //RAMD2[0xff6b] = 0x0ff; // force verbose mode hector ! @@ -315,13 +315,13 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2hrx) /******************************************************SPECIFIQUE MX ***************************/ membank("bank2")->configure_entry(HECTORMX_BANK_PAGE0 , &RAM[0x0000] ); // Mess ram - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , machine().root_device().memregion("page1")->base() ); // Rom page 1 - membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , machine().root_device().memregion("page2")->base() ); // Rom page 2 + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE1 , memregion("page1")->base() ); // Rom page 1 + membank("bank2")->configure_entry(HECTORMX_BANK_PAGE2 , memregion("page2")->base() ); // Rom page 2 membank("bank2")->set_entry(HECTORMX_BANK_PAGE0); /******************************************************SPECIFIQUE MX ***************************/ /*************************************************SPECIFIQUE DISK II ***************************/ - membank("bank3")->configure_entry(DISCII_BANK_ROM , machine().root_device().memregion("rom_disc2")->base() ); // ROM + membank("bank3")->configure_entry(DISCII_BANK_ROM , memregion("rom_disc2")->base() ); // ROM membank("bank3")->configure_entry(DISCII_BANK_RAM , memregion("disc2mem" )->base() ); // RAM membank("bank3")->set_entry(DISCII_BANK_ROM); /*************************************************SPECIFIQUE DISK II ***************************/ @@ -337,7 +337,7 @@ MACHINE_START_MEMBER(hec2hrp_state,hec2mdhrx) /*****************************************************************************/ //minidisc { - UINT8 *RAM = machine().root_device().memregion("maincpu" )->base(); // pointer to mess ram + UINT8 *RAM = memregion("maincpu" )->base(); // pointer to mess ram // Memory install for bank switching membank("bank1")->configure_entry(HECTOR_BANK_PROG , &RAM[0xc000] ); // Mess ram diff --git a/src/mess/drivers/hp49gp.c b/src/mess/drivers/hp49gp.c index 734bd2eb454..b01d7f452f6 100644 --- a/src/mess/drivers/hp49gp.c +++ b/src/mess/drivers/hp49gp.c @@ -200,13 +200,13 @@ static UINT32 s3c2410_gpio_port_r( device_t *device, int port, UINT32 mask) case S3C2410_GPIO_PORT_G : { data = data & ~0xFF00; - if ((data & 0x02) == 0) data |= (device->machine().root_device().ioport( "ROW1")->read() << 8); - if ((data & 0x04) == 0) data |= (device->machine().root_device().ioport( "ROW2")->read() << 8); - if ((data & 0x08) == 0) data |= (device->machine().root_device().ioport( "ROW3")->read() << 8); - if ((data & 0x10) == 0) data |= (device->machine().root_device().ioport( "ROW4")->read() << 8); - if ((data & 0x20) == 0) data |= (device->machine().root_device().ioport( "ROW5")->read() << 8); - if ((data & 0x40) == 0) data |= (device->machine().root_device().ioport( "ROW6")->read() << 8); - if ((data & 0x80) == 0) data |= (device->machine().root_device().ioport( "ROW7")->read() << 8); + if ((data & 0x02) == 0) data |= (hp49gp->ioport( "ROW1")->read() << 8); + if ((data & 0x04) == 0) data |= (hp49gp->ioport( "ROW2")->read() << 8); + if ((data & 0x08) == 0) data |= (hp49gp->ioport( "ROW3")->read() << 8); + if ((data & 0x10) == 0) data |= (hp49gp->ioport( "ROW4")->read() << 8); + if ((data & 0x20) == 0) data |= (hp49gp->ioport( "ROW5")->read() << 8); + if ((data & 0x40) == 0) data |= (hp49gp->ioport( "ROW6")->read() << 8); + if ((data & 0x80) == 0) data |= (hp49gp->ioport( "ROW7")->read() << 8); } break; case S3C2410_GPIO_PORT_H : @@ -271,7 +271,7 @@ ADDRESS_MAP_END DRIVER_INIT_MEMBER(hp49gp_state,hp49gp) { - UINT8 *rom = (UINT8 *)machine().root_device().memregion( "maincpu")->base(); + UINT8 *rom = (UINT8 *)memregion( "maincpu")->base(); memcpy( m_steppingstone, rom, 1024); lcd_spi_init(); } diff --git a/src/mess/drivers/juicebox.c b/src/mess/drivers/juicebox.c index a9f61f42060..26b63b45d9e 100644 --- a/src/mess/drivers/juicebox.c +++ b/src/mess/drivers/juicebox.c @@ -176,7 +176,7 @@ static UINT32 s3c44b0_gpio_port_r( device_t *device, int port) case S3C44B0_GPIO_PORT_G : { data = 0x0000009F; - data = (data & ~0x1F) | (device->machine().root_device().ioport( "PORTG")->read() & 0x1F); + data = (data & ~0x1F) | (juicebox->ioport( "PORTG")->read() & 0x1F); #if defined(JUICEBOX_ENTER_DEBUG_MENU) if (juicebox->port_g_read_count++ < 1) { diff --git a/src/mess/drivers/jupiter.c b/src/mess/drivers/jupiter.c index 7ab4cc6a942..1b502e02c11 100644 --- a/src/mess/drivers/jupiter.c +++ b/src/mess/drivers/jupiter.c @@ -345,7 +345,7 @@ ROM_END DRIVER_INIT_MEMBER(jupiter2_state,jupiter) { - UINT8 *rom = machine().root_device().memregion(MCM6571AP_TAG)->base(); + UINT8 *rom = memregion(MCM6571AP_TAG)->base(); UINT8 inverted[0x1000]; memcpy(inverted, rom, 0x1000); @@ -367,7 +367,7 @@ DRIVER_INIT_MEMBER(jupiter2_state,jupiter) DRIVER_INIT_MEMBER(jupiter3_state,jupiter3) { - UINT8 *rom = machine().root_device().memregion(Z80_TAG)->base(); + UINT8 *rom = memregion(Z80_TAG)->base(); UINT8 inverted[0x1000]; memcpy(inverted, rom, 0x1000); diff --git a/src/mess/drivers/lcmate2.c b/src/mess/drivers/lcmate2.c index e86858b7e63..0bc8e783d72 100644 --- a/src/mess/drivers/lcmate2.c +++ b/src/mess/drivers/lcmate2.c @@ -200,7 +200,7 @@ void lcmate2_state::palette_init() void lcmate2_state::machine_start() { - membank("rombank")->configure_entries(0, 0x10, (UINT8*)machine().root_device().memregion("maincpu")->base(), 0x4000); + membank("rombank")->configure_entries(0, 0x10, (UINT8*)memregion("maincpu")->base(), 0x4000); } static const gfx_layout lcmate2_charlayout = diff --git a/src/mess/drivers/lynx.c b/src/mess/drivers/lynx.c index b59a4c214b8..2c3e70eb27c 100644 --- a/src/mess/drivers/lynx.c +++ b/src/mess/drivers/lynx.c @@ -141,7 +141,7 @@ static QUICKLOAD_LOAD( lynx ) device_t *cpu = state->m_maincpu; address_space &space = state->m_maincpu->space(AS_PROGRAM); UINT8 *data = NULL; - UINT8 *rom = image.device().machine().root_device().memregion("maincpu")->base(); + UINT8 *rom = state->memregion("maincpu")->base(); UINT8 header[10]; // 80 08 dw Start dw Len B S 9 3 UINT16 start, length; int i; diff --git a/src/mess/drivers/m20.c b/src/mess/drivers/m20.c index ed36a14a98c..016129450d7 100644 --- a/src/mess/drivers/m20.c +++ b/src/mess/drivers/m20.c @@ -816,7 +816,7 @@ void m20_state::machine_start() void m20_state::machine_reset() { - UINT8 *ROM = machine().root_device().memregion("maincpu")->base(); + UINT8 *ROM = memregion("maincpu")->base(); UINT8 *RAM = (UINT8 *)(m_ram->pointer() + 0x4000); if (m_memsize >= 256 * 1024) diff --git a/src/mess/drivers/mc80.c b/src/mess/drivers/mc80.c index 0c535b9a332..79cc6cbf2ba 100644 --- a/src/mess/drivers/mc80.c +++ b/src/mess/drivers/mc80.c @@ -143,7 +143,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mc80_state::mc8020_kbd) for (i = 1; i < 8; i++) { sprintf(kbdrow,"X%X", i); - mem.write_word(0xd20+i, machine().root_device().ioport(kbdrow)->read()); + mem.write_word(0xd20+i, ioport(kbdrow)->read()); } } diff --git a/src/mess/drivers/mekd2.c b/src/mess/drivers/mekd2.c index a98478ee9dc..e5389849446 100644 --- a/src/mess/drivers/mekd2.c +++ b/src/mess/drivers/mekd2.c @@ -301,7 +301,7 @@ DEVICE_IMAGE_LOAD_MEMBER( mekd2_state,mekd2_cart ) static const char magic[] = "MEK6800D2"; char buff[9]; UINT16 addr, size; - UINT8 ident, *RAM = image.device().machine().root_device().memregion("maincpu")->base(); + UINT8 ident, *RAM = memregion("maincpu")->base(); image.fread( buff, sizeof (buff)); if (memcmp(buff, magic, sizeof (buff))) diff --git a/src/mess/drivers/mirage.c b/src/mess/drivers/mirage.c index 40c495974ee..34b406cf40c 100644 --- a/src/mess/drivers/mirage.c +++ b/src/mess/drivers/mirage.c @@ -134,7 +134,7 @@ UINT32 mirage_state::screen_update_mirage(screen_device &screen, bitmap_rgb32 &b void mirage_state::machine_reset() { last_sndram_bank = 0; - membank("sndbank")->set_base(machine().root_device().memregion("es5503")->base() ); + membank("sndbank")->set_base(memregion("es5503")->base() ); } static ADDRESS_MAP_START( mirage_map, AS_PROGRAM, 8, mirage_state ) diff --git a/src/mess/drivers/mmd1.c b/src/mess/drivers/mmd1.c index 1cbbd3452d8..36d1a091612 100644 --- a/src/mess/drivers/mmd1.c +++ b/src/mess/drivers/mmd1.c @@ -466,7 +466,7 @@ DRIVER_INIT_MEMBER(mmd1_state,mmd2) We preset all banks here, so that bankswitching will incur no speed penalty. 0000/0400 indicate ROMs, D800/DC00/E400 indicate RAM, 8000 is a dummy write area for ROM banks. */ - UINT8 *p_ram = machine().root_device().memregion("maincpu")->base(); + UINT8 *p_ram = memregion("maincpu")->base(); membank("bank1")->configure_entry(0, &p_ram[0x0000]); membank("bank1")->configure_entry(1, &p_ram[0xd800]); membank("bank1")->configure_entry(2, &p_ram[0x0c00]); diff --git a/src/mess/drivers/mmodular.c b/src/mess/drivers/mmodular.c index 7b60dab73e7..64a4d975866 100644 --- a/src/mess/drivers/mmodular.c +++ b/src/mess/drivers/mmodular.c @@ -997,7 +997,7 @@ MACHINE_START_MEMBER(polgar_state,van32) // patch LCD delay loop on the 68030 machines until waitstates and/or opcode timings are fixed in MAME core // patches gen32 gen32_41 gen32_oc lond030 - UINT8 *rom = machine().root_device().memregion("maincpu")->base(); + UINT8 *rom = memregion("maincpu")->base(); if(rom[0x870] == 0x0c && rom[0x871] == 0x78) { if (!strcmp(machine().system().name,"gen32_oc")) { diff --git a/src/mess/drivers/multi8.c b/src/mess/drivers/multi8.c index fd747614b4e..669c6119ab8 100644 --- a/src/mess/drivers/multi8.c +++ b/src/mess/drivers/multi8.c @@ -487,7 +487,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(multi8_state::keyboard_callback) { static const char *const portnames[3] = { "key1","key2","key3" }; int i,port_i,scancode; - UINT8 keymod = machine().root_device().ioport("key_modifiers")->read() & 0x1f; + UINT8 keymod = ioport("key_modifiers")->read() & 0x1f; scancode = 0; m_shift_press_flag = ((keymod & 0x02) >> 1); @@ -496,7 +496,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(multi8_state::keyboard_callback) { for(i=0;i<32;i++) { - if((machine().root_device().ioport(portnames[port_i])->read()>>i) & 1) + if((ioport(portnames[port_i])->read()>>i) & 1) { //key_flag = 1; if(!m_shift_press_flag) // shift not pressed @@ -648,8 +648,8 @@ static const ym2203_interface ym2203_config = void multi8_state::machine_start() { - m_p_vram = machine().root_device().memregion("vram")->base(); - m_p_wram = machine().root_device().memregion("wram")->base(); + m_p_vram = memregion("vram")->base(); + m_p_wram = memregion("wram")->base(); m_p_kanji = memregion("kanji")->base(); } diff --git a/src/mess/drivers/mycom.c b/src/mess/drivers/mycom.c index e369801f282..79aa4eff55e 100644 --- a/src/mess/drivers/mycom.c +++ b/src/mess/drivers/mycom.c @@ -478,7 +478,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mycom_state::mycom_kbd) UINT8 x, y, scancode = 0; UINT16 pressed[9]; char kbdrow[3]; - UINT8 modifiers = machine().root_device().ioport("XX")->read(); + UINT8 modifiers = ioport("XX")->read(); UINT8 shift_pressed = (modifiers & 2) >> 1; m_keyb_press_flag = 0; @@ -486,7 +486,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(mycom_state::mycom_kbd) for (x = 0; x < 9; x++) { sprintf(kbdrow,"X%d",x); - pressed[x] = (machine().root_device().ioport(kbdrow)->read()); + pressed[x] = (ioport(kbdrow)->read()); } /* find what has changed */ diff --git a/src/mess/drivers/mz2500.c b/src/mess/drivers/mz2500.c index a457f3d0f7a..e8d9fe2334e 100644 --- a/src/mess/drivers/mz2500.c +++ b/src/mess/drivers/mz2500.c @@ -1809,7 +1809,7 @@ void mz2500_state::machine_reset() machine().device<beep_device>(BEEPER_TAG)->set_frequency(4096); machine().device<beep_device>(BEEPER_TAG)->set_state(0); -// m_monitor_type = machine().root_device().ioport("DSW1")->read() & 0x40 ? 1 : 0; +// m_monitor_type = ioport("DSW1")->read() & 0x40 ? 1 : 0; } static const gfx_layout mz2500_cg_layout = @@ -1966,16 +1966,16 @@ READ8_MEMBER(mz2500_state::mz2500_pio1_porta_r) res = 0xff; for(i=0;i<0xe;i++) - res &= machine().root_device().ioport(keynames[i])->read(); + res &= ioport(keynames[i])->read(); m_pio_latchb = res; return res; } - m_pio_latchb = machine().root_device().ioport(keynames[m_key_mux & 0xf])->read(); + m_pio_latchb = ioport(keynames[m_key_mux & 0xf])->read(); - return machine().root_device().ioport(keynames[m_key_mux & 0xf])->read(); + return ioport(keynames[m_key_mux & 0xf])->read(); } #if 0 diff --git a/src/mess/drivers/mz3500.c b/src/mess/drivers/mz3500.c index 086df4e2253..b5ac0243550 100644 --- a/src/mess/drivers/mz3500.c +++ b/src/mess/drivers/mz3500.c @@ -490,9 +490,9 @@ READ8_MEMBER(mz3500_state::mz3500_io_r) switch(offset) { case 2: - return ((machine().root_device().ioport("SYSTEM_DSW")->read() & 0x0f) << 1) | ((machine().root_device().ioport("FD_DSW")->read() & 0x8) >> 3); + return ((ioport("SYSTEM_DSW")->read() & 0x0f) << 1) | ((ioport("FD_DSW")->read() & 0x8) >> 3); case 3: - return ((machine().root_device().ioport("FD_DSW")->read() & 0x7)<<5) | (m_srdy << 4); + return ((ioport("FD_DSW")->read() & 0x7)<<5) | (m_srdy << 4); } return 0; diff --git a/src/mess/drivers/n64.c b/src/mess/drivers/n64.c index 100d6e2834b..18dba17fe25 100644 --- a/src/mess/drivers/n64.c +++ b/src/mess/drivers/n64.c @@ -177,7 +177,7 @@ DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state,n64_cart) { int i, length; n64_periphs *periphs = image.device().machine().device<n64_periphs>("rcp"); - UINT8 *cart = image.device().machine().root_device().memregion("user2")->base(); + UINT8 *cart = memregion("user2")->base(); if (image.software_entry() == NULL) { @@ -230,7 +230,7 @@ DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state,n64_cart) UINT8 data[0x30800]; battery_image->battery_load(data, 0x30800, 0x00); //memcpy(n64_sram, data, 0x20000); - memcpy(image.device().machine().root_device().memshare("sram")->ptr(), data, 0x20000); + memcpy(memshare("sram")->ptr(), data, 0x20000); memcpy(periphs->m_save_data.eeprom, data + 0x20000, 0x800); memcpy(periphs->m_save_data.mempak[0], data + 0x20800, 0x8000); memcpy(periphs->m_save_data.mempak[1], data + 0x28800, 0x8000); @@ -250,7 +250,7 @@ MACHINE_START_MEMBER(n64_mess_state,n64dd) { machine_start(); - UINT8 *ipl = machine().root_device().memregion("ddipl")->base(); + UINT8 *ipl = memregion("ddipl")->base(); for (int i = 0; i < 0x400000; i += 4) { @@ -268,7 +268,7 @@ MACHINE_START_MEMBER(n64_mess_state,n64dd) INTERRUPT_GEN_MEMBER(n64_mess_state::n64_reset_poll) { n64_periphs *periphs = machine().device<n64_periphs>("rcp"); - periphs->poll_reset_button((machine().root_device().ioport("RESET")->read() & 1) ? true : false); + periphs->poll_reset_button((ioport("RESET")->read() & 1) ? true : false); } static MACHINE_CONFIG_START( n64, n64_mess_state ) diff --git a/src/mess/drivers/nakajies.c b/src/mess/drivers/nakajies.c index 38b811037ac..4a72cc7877b 100644 --- a/src/mess/drivers/nakajies.c +++ b/src/mess/drivers/nakajies.c @@ -503,7 +503,7 @@ ADDRESS_MAP_END INPUT_CHANGED_MEMBER(nakajies_state::trigger_irq) { - UINT8 irqs = machine().root_device().ioport( "debug" )->read(); + UINT8 irqs = ioport( "debug" )->read(); m_irq_active |= irqs; nakajies_update_irqs(machine()); diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c index dde290f1831..1621ae6db52 100644 --- a/src/mess/drivers/nc.c +++ b/src/mess/drivers/nc.c @@ -491,7 +491,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(nc_state::dummy_timer_callback) int inputport_10_state; int changed_bits; - inputport_10_state = machine().root_device().ioport("EXTRA")->read(); + inputport_10_state = ioport("EXTRA")->read(); changed_bits = inputport_10_state^m_previous_inputport_10_state; diff --git a/src/mess/drivers/ngp.c b/src/mess/drivers/ngp.c index 962f4c1a7d2..23380bd4d47 100644 --- a/src/mess/drivers/ngp.c +++ b/src/mess/drivers/ngp.c @@ -728,8 +728,8 @@ DEVICE_IMAGE_LOAD_MEMBER( ngp_state, ngp_cart ) memcpy(cart, image.get_software_region("rom"), filesize); } - //printf("%2x%2x - %x - %x\n", (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x20), (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x21), - // (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x22), (unsigned int) image.device().machine().root_device().memregion("cart")->u8(0x23)); + //printf("%2x%2x - %x - %x\n", (unsigned int) memregion("cart")->u8(0x20), (unsigned int) memregion("cart")->u8(0x21), + // (unsigned int) memregion("cart")->u8(0x22), (unsigned int) memregion("cart")->u8(0x23)); m_flash_chip[0].manufacturer_id = 0x98; switch( filesize ) { diff --git a/src/mess/drivers/palmz22.c b/src/mess/drivers/palmz22.c index 855794ef112..eb586c072f8 100644 --- a/src/mess/drivers/palmz22.c +++ b/src/mess/drivers/palmz22.c @@ -165,7 +165,7 @@ static UINT32 s3c2410_gpio_port_r( device_t *device, int port, UINT32 mask) break; case S3C2410_GPIO_PORT_F : { - data = (data & ~0xFF) | (device->machine().root_device().ioport( "PORT-F")->read() & 0xFF); + data = (data & ~0xFF) | (state->ioport( "PORT-F")->read() & 0xFF); } break; case S3C2410_GPIO_PORT_G : @@ -220,8 +220,8 @@ static READ32_DEVICE_HANDLER( s3c2410_adc_data_r ) { case 0 + 0 : data = 0x2EE + (PALM_Z22_BATTERY_LEVEL * 0xFF / 100); break; case 0 + 1 : data = 0; break; - case 2 + 0 : data = space.machine().root_device().ioport( "PENX")->read(); break; - case 2 + 1 : data = 0x3FF - space.machine().root_device().ioport( "PENY")->read(); break; + case 2 + 0 : data = state->ioport( "PENX")->read(); break; + case 2 + 1 : data = 0x3FF - state->ioport( "PENY")->read(); break; } state->verboselog(5, "s3c2410_adc_data_r %08X\n", data); return data; diff --git a/src/mess/drivers/paso1600.c b/src/mess/drivers/paso1600.c index 13f05887274..4dc92613403 100644 --- a/src/mess/drivers/paso1600.c +++ b/src/mess/drivers/paso1600.c @@ -79,7 +79,7 @@ public: void paso1600_state::video_start() { - m_p_chargen = machine().root_device().memregion("chargen")->base(); + m_p_chargen = memregion("chargen")->base(); m_p_pcg = memregion("pcg")->base(); } diff --git a/src/mess/drivers/pasogo.c b/src/mess/drivers/pasogo.c index 1c1211a00ab..c34abae0399 100644 --- a/src/mess/drivers/pasogo.c +++ b/src/mess/drivers/pasogo.c @@ -398,7 +398,7 @@ void pasogo_state::palette_init() UINT32 pasogo_state::screen_update_pasogo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { //static int width=-1,height=-1; - UINT8 *rom = machine().root_device().memregion("maincpu")->base()+0xb8000; + UINT8 *rom = memregion("maincpu")->base()+0xb8000; static const UINT16 c[]={ 3, 0 }; int x,y; // plot_box(bitmap, 0, 0, 64/*bitmap.width*/, bitmap.height, 0); @@ -550,7 +550,7 @@ DRIVER_INIT_MEMBER(pasogo_state,pasogo) { vg230_init(); memset(&m_ems, 0, sizeof(m_ems)); - membank( "bank27" )->set_base( machine().root_device().memregion("user1")->base() + 0x00000 ); + membank( "bank27" )->set_base( memregion("user1")->base() + 0x00000 ); membank( "bank28" )->set_base( memregion("maincpu")->base() + 0xb8000/*?*/ ); } diff --git a/src/mess/drivers/pasopia7.c b/src/mess/drivers/pasopia7.c index 99c644ea51c..76d199dadf6 100644 --- a/src/mess/drivers/pasopia7.c +++ b/src/mess/drivers/pasopia7.c @@ -137,7 +137,7 @@ VIDEO_START_MEMBER(pasopia7_state,pasopia7) void pasopia7_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) { - UINT8 *vram = machine().root_device().memregion("vram")->base(); + UINT8 *vram = memregion("vram")->base(); int x,y,xi,yi; int count; @@ -168,7 +168,7 @@ void pasopia7_state::draw_cg4_screen(bitmap_ind16 &bitmap,const rectangle &clipr void pasopia7_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) { - UINT8 *vram = machine().root_device().memregion("vram")->base(); + UINT8 *vram = memregion("vram")->base(); UINT8 *gfx_data = memregion("font")->base(); int x,y,xi,yi; int count; @@ -226,7 +226,7 @@ void pasopia7_state::draw_tv_screen(bitmap_ind16 &bitmap,const rectangle &clipre void pasopia7_state::draw_mixed_screen(bitmap_ind16 &bitmap,const rectangle &cliprect,int width) { - UINT8 *vram = machine().root_device().memregion("vram")->base(); + UINT8 *vram = memregion("vram")->base(); UINT8 *gfx_data = memregion("font")->base(); int x,y,xi,yi; int count; diff --git a/src/mess/drivers/pb1000.c b/src/mess/drivers/pb1000.c index 5624f0cc268..e1e7976ebbb 100644 --- a/src/mess/drivers/pb1000.c +++ b/src/mess/drivers/pb1000.c @@ -305,11 +305,11 @@ WRITE16_MEMBER( pb1000_state::gatearray_w ) m_gatearray[offset] = data&0xff; if (m_gatearray[0]) - membank("bank1")->set_base(machine().root_device().memregion("card1")->base()); + membank("bank1")->set_base(memregion("card1")->base()); else if (m_gatearray[1]) - membank("bank1")->set_base(machine().root_device().memregion("card2")->base()); + membank("bank1")->set_base(memregion("card2")->base()); else - membank("bank1")->set_base(machine().root_device().memregion("rom")->base()); + membank("bank1")->set_base(memregion("rom")->base()); } static void lcd_control(hd61700_cpu_device &device, UINT8 data) @@ -491,7 +491,7 @@ TIMER_CALLBACK_MEMBER(pb1000_state::keyboard_timer) void pb1000_state::machine_start() { - membank("bank1")->set_base(machine().root_device().memregion("rom")->base()); + membank("bank1")->set_base(memregion("rom")->base()); m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pb1000_state::keyboard_timer),this)); m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192)); diff --git a/src/mess/drivers/pc100.c b/src/mess/drivers/pc100.c index 4419edf7e44..e96bd57804b 100644 --- a/src/mess/drivers/pc100.c +++ b/src/mess/drivers/pc100.c @@ -423,7 +423,7 @@ static const struct pic8259_interface pc100_pic8259_config = void pc100_state::machine_start() { m_maincpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(pc100_state::pc100_irq_callback),this)); - m_kanji_rom = (UINT16 *)(*machine().root_device().memregion("kanji")); + m_kanji_rom = (UINT16 *)(*memregion("kanji")); m_vram = (UINT16 *)(*memregion("vram")); } diff --git a/src/mess/drivers/pc1500.c b/src/mess/drivers/pc1500.c index e71c6e36021..5545a45f7cd 100644 --- a/src/mess/drivers/pc1500.c +++ b/src/mess/drivers/pc1500.c @@ -68,19 +68,19 @@ UINT8 pc1500_state::pc1500_kb_r(device_t *device) if (!device->started()) return 0; if (!(state->m_kb_matrix & 0x01)) - data &= device->machine().root_device().ioport("KEY0")->read(); + data &= state->ioport("KEY0")->read(); if (!(state->m_kb_matrix & 0x02)) - data &= device->machine().root_device().ioport("KEY1")->read(); + data &= state->ioport("KEY1")->read(); if (!(state->m_kb_matrix & 0x04)) - data &= device->machine().root_device().ioport("KEY2")->read(); + data &= state->ioport("KEY2")->read(); if (!(state->m_kb_matrix & 0x08)) - data &= device->machine().root_device().ioport("KEY3")->read(); + data &= state->ioport("KEY3")->read(); if (!(state->m_kb_matrix & 0x10)) - data &= device->machine().root_device().ioport("KEY4")->read(); + data &= state->ioport("KEY4")->read(); if (!(state->m_kb_matrix & 0x20)) - data &= device->machine().root_device().ioport("KEY5")->read(); + data &= state->ioport("KEY5")->read(); if (!(state->m_kb_matrix & 0x40)) - data &= device->machine().root_device().ioport("KEY6")->read(); + data &= state->ioport("KEY6")->read(); if (!(state->m_kb_matrix & 0x80)) data &= state->ioport("KEY7")->read(); diff --git a/src/mess/drivers/pc8801.c b/src/mess/drivers/pc8801.c index 4b15841fed9..f9449426337 100644 --- a/src/mess/drivers/pc8801.c +++ b/src/mess/drivers/pc8801.c @@ -1196,8 +1196,8 @@ WRITE8_MEMBER(pc8801_state::pc8801_ctrl_w) if(m_mouse.phase == 0) { - m_mouse.x = machine().root_device().ioport("MOUSEX")->read(); - m_mouse.y = machine().root_device().ioport("MOUSEY")->read(); + m_mouse.x = ioport("MOUSEX")->read(); + m_mouse.y = ioport("MOUSEY")->read(); } if(data & 0x40 && (new_time - m_mouse.time) > attotime::from_hz(900)) @@ -2515,15 +2515,15 @@ void pc8801_state::machine_reset() m_has_dictionary = 0; m_has_cdrom = 0; - m_extram_size = extram_type[machine().root_device().ioport("MEM")->read() & 0x0f]; - m_has_opna = machine().root_device().ioport("BOARD_CONFIG")->read() & 1; + m_extram_size = extram_type[ioport("MEM")->read() & 0x0f]; + m_has_opna = ioport("BOARD_CONFIG")->read() & 1; } MACHINE_RESET_MEMBER(pc8801_state,pc8801_clock_speed) { pc8801_state::machine_reset(); m_has_clock_speed = 1; - m_clock_setting = machine().root_device().ioport("CFG")->read() & 0x80; + m_clock_setting = ioport("CFG")->read() & 0x80; m_maincpu->set_unscaled_clock(m_clock_setting ? XTAL_4MHz : XTAL_8MHz); m_fdccpu->set_unscaled_clock(m_clock_setting ? XTAL_4MHz : XTAL_8MHz); // correct? @@ -2568,7 +2568,7 @@ void pc8801_state::fdc_irq_w(bool state) READ8_MEMBER(pc8801_state::opn_porta_r) { - if(machine().root_device().ioport("BOARD_CONFIG")->read() & 2) + if(ioport("BOARD_CONFIG")->read() & 2) { UINT8 shift,res; @@ -2580,9 +2580,9 @@ READ8_MEMBER(pc8801_state::opn_porta_r) return ((res >> shift) & 0x0f) | 0xf0; } - return machine().root_device().ioport("OPN_PA")->read(); + return ioport("OPN_PA")->read(); } -READ8_MEMBER(pc8801_state::opn_portb_r){ return machine().root_device().ioport("OPN_PB")->read(); } +READ8_MEMBER(pc8801_state::opn_portb_r){ return ioport("OPN_PB")->read(); } static const ym2203_interface pc88_ym2203_intf = { diff --git a/src/mess/drivers/pc88va.c b/src/mess/drivers/pc88va.c index 42a8e673f35..56824ee2ae3 100644 --- a/src/mess/drivers/pc88va.c +++ b/src/mess/drivers/pc88va.c @@ -284,7 +284,7 @@ UINT32 pc88va_state::calc_kanji_rom_addr(UINT8 jis1,UINT8 jis2,int x,int y) void pc88va_state::draw_text(bitmap_rgb32 &bitmap, const rectangle &cliprect) { - UINT8 *tvram = machine().root_device().memregion("tvram")->base(); + UINT8 *tvram = memregion("tvram")->base(); UINT8 *kanji = memregion("kanji")->base(); int xi,yi; int x,y; @@ -527,7 +527,7 @@ READ16_MEMBER(pc88va_state::sys_mem_r) return 0xffff; case 1: // TVRAM { - UINT16 *tvram = (UINT16 *)(*machine().root_device().memregion("tvram")); + UINT16 *tvram = (UINT16 *)(*memregion("tvram")); if(((offset*2) & 0x30000) == 0) return tvram[offset]; @@ -536,14 +536,14 @@ READ16_MEMBER(pc88va_state::sys_mem_r) } case 4: { - UINT16 *gvram = (UINT16 *)(*machine().root_device().memregion("gvram")); + UINT16 *gvram = (UINT16 *)(*memregion("gvram")); return gvram[offset]; } case 8: // kanji ROM case 9: { - UINT16 *knj_ram = (UINT16 *)(*machine().root_device().memregion("kanji")); + UINT16 *knj_ram = (UINT16 *)(*memregion("kanji")); UINT32 knj_offset; knj_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000)); @@ -559,7 +559,7 @@ READ16_MEMBER(pc88va_state::sys_mem_r) case 0xc: // Dictionary ROM case 0xd: { - UINT16 *dic_rom = (UINT16 *)(*machine().root_device().memregion("dictionary")); + UINT16 *dic_rom = (UINT16 *)(*memregion("dictionary")); UINT32 dic_offset; dic_offset = (offset + (((m_bank_reg & 0x100) >> 8)*0x20000)); @@ -579,7 +579,7 @@ WRITE16_MEMBER(pc88va_state::sys_mem_w) break; case 1: // TVRAM { - UINT16 *tvram = (UINT16 *)(*machine().root_device().memregion("tvram")); + UINT16 *tvram = (UINT16 *)(*memregion("tvram")); if(((offset*2) & 0x30000) == 0) COMBINE_DATA(&tvram[offset]); @@ -587,7 +587,7 @@ WRITE16_MEMBER(pc88va_state::sys_mem_w) break; case 4: // TVRAM { - UINT16 *gvram = (UINT16 *)(*machine().root_device().memregion("gvram")); + UINT16 *gvram = (UINT16 *)(*memregion("gvram")); COMBINE_DATA(&gvram[offset]); } @@ -595,7 +595,7 @@ WRITE16_MEMBER(pc88va_state::sys_mem_w) case 8: // kanji ROM, backup RAM at 0xb0000 - 0xb3fff case 9: { - UINT16 *knj_ram = (UINT16 *)(*machine().root_device().memregion("kanji")); + UINT16 *knj_ram = (UINT16 *)(*memregion("kanji")); UINT32 knj_offset; knj_offset = ((offset) + (((m_bank_reg & 0x100) >> 8)*0x20000)); @@ -1170,7 +1170,7 @@ WRITE16_MEMBER(pc88va_state::video_pri_w) READ8_MEMBER(pc88va_state::backupram_dsw_r) { - UINT16 *knj_ram = (UINT16 *)(*machine().root_device().memregion("kanji")); + UINT16 *knj_ram = (UINT16 *)(*memregion("kanji")); if(offset == 0) return knj_ram[(0x50000 + 0x1fc2) / 2] & 0xff; @@ -1568,11 +1568,11 @@ READ8_MEMBER(pc88va_state::r232_ctrl_porta_r) { UINT8 sw5, sw4, sw3, sw2,speed_sw; - speed_sw = (machine().root_device().ioport("SPEED_SW")->read() & 1) ? 0x20 : 0x00; - sw5 = (machine().root_device().ioport("DSW")->read() & 0x10); - sw4 = (machine().root_device().ioport("DSW")->read() & 0x08); - sw3 = (machine().root_device().ioport("DSW")->read() & 0x04); - sw2 = (machine().root_device().ioport("DSW")->read() & 0x02); + speed_sw = (ioport("SPEED_SW")->read() & 1) ? 0x20 : 0x00; + sw5 = (ioport("DSW")->read() & 0x10); + sw4 = (ioport("DSW")->read() & 0x08); + sw3 = (ioport("DSW")->read() & 0x04); + sw2 = (ioport("DSW")->read() & 0x02); return 0xc1 | sw5 | sw4 | sw3 | sw2 | speed_sw; } @@ -1581,7 +1581,7 @@ READ8_MEMBER(pc88va_state::r232_ctrl_portb_r) { UINT8 xsw1; - xsw1 = (machine().root_device().ioport("DSW")->read() & 1) ? 0 : 8; + xsw1 = (ioport("DSW")->read() & 1) ? 0 : 8; return 0xf7 | xsw1; } @@ -1673,7 +1673,7 @@ void pc88va_state::machine_start() void pc88va_state::machine_reset() { - UINT8 *ROM00 = machine().root_device().memregion("rom00")->base(); + UINT8 *ROM00 = memregion("rom00")->base(); UINT8 *ROM10 = memregion("rom10")->base(); membank("rom10_bank")->set_base(&ROM10[0x00000]); diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index 3b38257e98e..5b7f3fa2d12 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -3103,9 +3103,9 @@ static I8237_INTERFACE( pc9801rs_dmac_intf ) * ****************************************/ -READ8_MEMBER(pc9801_state::ppi_sys_porta_r){ return machine().root_device().ioport("DSW2")->read(); } -READ8_MEMBER(pc9801_state::ppi_sys_portb_r){ return machine().root_device().ioport("DSW1")->read(); } -READ8_MEMBER(pc9801_state::ppi_prn_portb_r){ return machine().root_device().ioport("DSW5")->read(); } +READ8_MEMBER(pc9801_state::ppi_sys_porta_r){ return ioport("DSW2")->read(); } +READ8_MEMBER(pc9801_state::ppi_sys_portb_r){ return ioport("DSW1")->read(); } +READ8_MEMBER(pc9801_state::ppi_prn_portb_r){ return ioport("DSW5")->read(); } WRITE8_MEMBER(pc9801_state::ppi_sys_portc_w) { @@ -3186,8 +3186,8 @@ READ8_MEMBER(pc9801_state::ppi_mouse_porta_r) return res; } -READ8_MEMBER(pc9801_state::ppi_mouse_portb_r) { return machine().root_device().ioport("DSW3")->read(); } -READ8_MEMBER(pc9801_state::ppi_mouse_portc_r) { return machine().root_device().ioport("DSW4")->read(); } +READ8_MEMBER(pc9801_state::ppi_mouse_portb_r) { return ioport("DSW3")->read(); } +READ8_MEMBER(pc9801_state::ppi_mouse_portc_r) { return ioport("DSW4")->read(); } WRITE8_MEMBER(pc9801_state::ppi_mouse_porta_w) { @@ -3452,17 +3452,17 @@ MACHINE_RESET_MEMBER(pc9801_state,pc9801f) { UINT8 op_mode; UINT8 *ROM; - UINT8 *PRG = machine().root_device().memregion("fdc_data")->base(); + UINT8 *PRG = memregion("fdc_data")->base(); int i; - ROM = machine().root_device().memregion("fdc_bios_2dd")->base(); - op_mode = (machine().root_device().ioport("ROM_LOAD")->read() & 2) >> 1; + ROM = memregion("fdc_bios_2dd")->base(); + op_mode = (ioport("ROM_LOAD")->read() & 2) >> 1; for(i=0;i<0x1000;i++) ROM[i] = PRG[i+op_mode*0x8000]; - ROM = machine().root_device().memregion("fdc_bios_2hd")->base(); - op_mode = machine().root_device().ioport("ROM_LOAD")->read() & 1; + ROM = memregion("fdc_bios_2hd")->base(); + op_mode = ioport("ROM_LOAD")->read() & 1; for(i=0;i<0x1000;i++) ROM[i] = PRG[i+op_mode*0x8000+0x10000]; @@ -3478,7 +3478,7 @@ MACHINE_RESET_MEMBER(pc9801_state,pc9801rs) m_fdc_ctrl = 3; m_access_ctrl = 0; m_keyb_press = 0xff; // temp kludge, for PC-9821 booting -// m_has_opna = machine().root_device().ioport("SOUND_CONFIG")->read() & 1; +// m_has_opna = ioport("SOUND_CONFIG")->read() & 1; memset(m_work_ram, 0, sizeof(UINT8) * 0xa0000); } @@ -4069,10 +4069,10 @@ DRIVER_INIT_MEMBER(pc9801_state,pc9801_kanji) } UINT32 i,j,k; UINT32 pcg_tile; - UINT8 *kanji = machine().root_device().memregion("kanji")->base(); - UINT8 *raw_kanji = machine().root_device().memregion("raw_kanji")->base(); - UINT8 *new_chargen = machine().root_device().memregion("new_chargen")->base(); - UINT8 *chargen = machine().root_device().memregion("chargen")->base(); + UINT8 *kanji = memregion("kanji")->base(); + UINT8 *raw_kanji = memregion("raw_kanji")->base(); + UINT8 *new_chargen = memregion("new_chargen")->base(); + UINT8 *chargen = memregion("chargen")->base(); /* Convert the ROM bitswap here from the original structure */ /* TODO: kanji bitswap should be completely wrong, will check it out once that a dump is remade. */ diff --git a/src/mess/drivers/pce220.c b/src/mess/drivers/pce220.c index c68034158da..650dfefd2ff 100644 --- a/src/mess/drivers/pce220.c +++ b/src/mess/drivers/pce220.c @@ -851,7 +851,7 @@ void pce220_state::machine_start() membank("bank3")->configure_entries(0, 8, rom, 0x4000); membank("bank4")->configure_entries(0, 8, rom, 0x4000); - m_vram = (UINT8*)machine().root_device().memregion("lcd_vram")->base(); + m_vram = (UINT8*)memregion("lcd_vram")->base(); machine().device<nvram_device>("nvram")->set_base(ram, m_ram->size()); } @@ -866,7 +866,7 @@ void pcg850v_state::machine_start() membank("bank3")->configure_entries(0, 22, rom, 0x4000); membank("bank4")->configure_entries(0, 22, rom, 0x4000); - m_vram = (UINT8*)machine().root_device().memregion("lcd_vram")->base(); + m_vram = (UINT8*)memregion("lcd_vram")->base(); machine().device<nvram_device>("nvram")->set_base(ram, m_ram->size()); } @@ -876,7 +876,7 @@ void pce220_state::machine_reset() space.unmap_write(0x0000, 0x3fff); // install the boot code into the first bank - membank("bank1")->set_base(machine().root_device().memregion("user1")->base() + 0x0000); + membank("bank1")->set_base(memregion("user1")->base() + 0x0000); m_lcd_index_row = 0; m_lcd_index_col = 0; diff --git a/src/mess/drivers/pcfx.c b/src/mess/drivers/pcfx.c index 9c232e09aa1..ac6ad2caf5a 100644 --- a/src/mess/drivers/pcfx.c +++ b/src/mess/drivers/pcfx.c @@ -121,7 +121,7 @@ TIMER_CALLBACK_MEMBER(pcfx_state::pad_func) { const char *const padnames[] = { "P1", "P2" }; - m_pad.latch[param] = machine().root_device().ioport(padnames[param])->read(); + m_pad.latch[param] = ioport(padnames[param])->read(); m_pad.status[param] |= 8; m_pad.ctrl[param] &= ~1; // ack TX line // TODO: pad IRQ diff --git a/src/mess/drivers/pdp1.c b/src/mess/drivers/pdp1.c index dd745a07fa7..03c8d4e3d54 100644 --- a/src/mess/drivers/pdp1.c +++ b/src/mess/drivers/pdp1.c @@ -492,7 +492,7 @@ void pdp1_state::machine_reset() { int cfg; - cfg = machine().root_device().ioport("CFG")->read(); + cfg = ioport("CFG")->read(); pdp1_reset_param.extend_support = (cfg >> pdp1_config_extend_bit) & pdp1_config_extend_mask; pdp1_reset_param.hw_mul_div = (cfg >> pdp1_config_hw_mul_div_bit) & pdp1_config_hw_mul_div_mask; pdp1_reset_param.type_20_sbs = (cfg >> pdp1_config_type_20_sbs_bit) & pdp1_config_type_20_sbs_mask; @@ -650,7 +650,7 @@ void pdp1_state::machine_start() }; /* set up our font */ - dst = machine().root_device().memregion("gfx1")->base(); + dst = memregion("gfx1")->base(); memcpy(dst, fontdata6x8, pdp1_fontdata_size); machine().add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(pdp1_state::pdp1_machine_stop),this)); @@ -1805,7 +1805,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) int ta_transitions; - m_maincpu->set_state_int(PDP1_SS, machine().root_device().ioport("SENSE")->read()); + m_maincpu->set_state_int(PDP1_SS, ioport("SENSE")->read()); /* read new state of control keys */ control_keys = ioport("CSW")->read(); @@ -1900,7 +1900,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) /* handle test word keys */ - tw_keys = (machine().root_device().ioport("TWDMSB")->read() << 16) | machine().root_device().ioport("TWDLSB")->read(); + tw_keys = (ioport("TWDMSB")->read() << 16) | ioport("TWDLSB")->read(); /* compute transitions */ tw_transitions = tw_keys & (~ m_old_tw_keys); @@ -1913,7 +1913,7 @@ INTERRUPT_GEN_MEMBER(pdp1_state::pdp1_interrupt) /* handle address keys */ - ta_keys = machine().root_device().ioport("TSTADD")->read(); + ta_keys = ioport("TSTADD")->read(); /* compute transitions */ ta_transitions = ta_keys & (~ m_old_ta_keys); diff --git a/src/mess/drivers/pdp11.c b/src/mess/drivers/pdp11.c index 945bd0b3418..3d81453e8fa 100644 --- a/src/mess/drivers/pdp11.c +++ b/src/mess/drivers/pdp11.c @@ -225,8 +225,8 @@ INPUT_PORTS_END void pdp11_state::machine_reset() { // Load M9301-YA - UINT8* user1 = machine().root_device().memregion("user1")->base(); - UINT8* maincpu = machine().root_device().memregion("maincpu")->base(); + UINT8* user1 = memregion("user1")->base(); + UINT8* maincpu = memregion("maincpu")->base(); int i; for(i=0;i<0x100;i++) { @@ -269,31 +269,31 @@ void pdp11_state::load9312prom(UINT8 *desc, UINT8 *src, int size) MACHINE_RESET_MEMBER(pdp11_state,pdp11ub2) { // Load M9312 - UINT8* user1 = machine().root_device().memregion("consproms")->base() + machine().root_device().ioport("CONSPROM")->read() * 0x0400; - UINT8* maincpu = machine().root_device().memregion("maincpu")->base(); + UINT8* user1 = memregion("consproms")->base() + ioport("CONSPROM")->read() * 0x0400; + UINT8* maincpu = memregion("maincpu")->base(); //0165000 load9312prom(maincpu + 0165000,user1,0x100); - UINT8 s1 = machine().root_device().ioport("S1")->read(); + UINT8 s1 = ioport("S1")->read(); if (s1 & 0x02) { // if boot enabled UINT16 addr = 0173000; if (s1 & 1) { addr = 0165000; } - addr += machine().root_device().ioport("S1_2")->read() * 2; + addr += ioport("S1_2")->read() * 2; m_maincpu->set_state_int(T11_PC, addr); } //0173000 - load9312prom(maincpu + 0173000,machine().root_device().memregion("devproms")->base() + machine().root_device().ioport("DEVPROM1")->read() * 0x0200,0x080); + load9312prom(maincpu + 0173000,memregion("devproms")->base() + ioport("DEVPROM1")->read() * 0x0200,0x080); //0173200 - load9312prom(maincpu + 0173200,machine().root_device().memregion("devproms")->base() + machine().root_device().ioport("DEVPROM2")->read() * 0x0200,0x080); + load9312prom(maincpu + 0173200,memregion("devproms")->base() + ioport("DEVPROM2")->read() * 0x0200,0x080); //0173400 - load9312prom(maincpu + 0173400,machine().root_device().memregion("devproms")->base() + machine().root_device().ioport("DEVPROM3")->read() * 0x0200,0x080); + load9312prom(maincpu + 0173400,memregion("devproms")->base() + ioport("DEVPROM3")->read() * 0x0200,0x080); //0173600 - load9312prom(maincpu + 0173600,machine().root_device().memregion("devproms")->base() + machine().root_device().ioport("DEVPROM4")->read() * 0x0200,0x080); + load9312prom(maincpu + 0173600,memregion("devproms")->base() + ioport("DEVPROM4")->read() * 0x0200,0x080); } diff --git a/src/mess/drivers/pegasus.c b/src/mess/drivers/pegasus.c index 438929cc84d..ba2aebf06b8 100644 --- a/src/mess/drivers/pegasus.c +++ b/src/mess/drivers/pegasus.c @@ -422,7 +422,7 @@ GFXDECODE_END multipart roms will have. */ void pegasus_state::pegasus_decrypt_rom( UINT16 addr ) { - UINT8 b, *ROM = machine().root_device().memregion("maincpu")->base(); + UINT8 b, *ROM = memregion("maincpu")->base(); UINT16 i, j; UINT8 buff[0x1000]; if (ROM[addr] == 0x02) @@ -441,7 +441,7 @@ void pegasus_state::pegasus_decrypt_rom( UINT16 addr ) DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_1 ) { - image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x0000, 0x1000); + image.fread(memregion("maincpu")->base() + 0x0000, 0x1000); pegasus_decrypt_rom( 0x0000 ); return IMAGE_INIT_PASS; @@ -449,7 +449,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_1 ) DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_2 ) { - image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x1000, 0x1000); + image.fread(memregion("maincpu")->base() + 0x1000, 0x1000); pegasus_decrypt_rom( 0x1000 ); return IMAGE_INIT_PASS; @@ -457,7 +457,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_2 ) DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_3 ) { - image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0x2000, 0x1000); + image.fread(memregion("maincpu")->base() + 0x2000, 0x1000); pegasus_decrypt_rom( 0x2000 ); return IMAGE_INIT_PASS; @@ -465,7 +465,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_3 ) DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_4 ) { - image.fread(image.device().machine().root_device().memregion("maincpu")->base() + 0xc000, 0x1000); + image.fread(memregion("maincpu")->base() + 0xc000, 0x1000); pegasus_decrypt_rom( 0xc000 ); return IMAGE_INIT_PASS; @@ -473,7 +473,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_4 ) DEVICE_IMAGE_LOAD_MEMBER( pegasus_state, pegasus_cart_5 ) { - image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0xd000, 0x1000); + image.fread(memregion("maincpu")->base() + 0xd000, 0x1000); pegasus_decrypt_rom( 0xd000 ); return IMAGE_INIT_PASS; diff --git a/src/mess/drivers/pentagon.c b/src/mess/drivers/pentagon.c index 975d4c79b84..62d4408bf1e 100644 --- a/src/mess/drivers/pentagon.c +++ b/src/mess/drivers/pentagon.c @@ -60,8 +60,8 @@ DIRECT_UPDATE_MEMBER(pentagon_state::pentagon_direct) { if (m_beta->started()) { - direct.explicit_configure(0x0000, 0x3fff, 0x3fff, machine().root_device().memregion("beta:beta")->base()); - m_bank1->set_base(machine().root_device().memregion("beta:beta")->base()); + direct.explicit_configure(0x0000, 0x3fff, 0x3fff, memregion("beta:beta")->base()); + m_bank1->set_base(memregion("beta:beta")->base()); } } else diff --git a/src/mess/drivers/pockstat.c b/src/mess/drivers/pockstat.c index 31321eda505..541e8f0aaf8 100644 --- a/src/mess/drivers/pockstat.c +++ b/src/mess/drivers/pockstat.c @@ -753,7 +753,7 @@ WRITE32_MEMBER(pockstat_state::ps_lcd_w) INPUT_CHANGED_MEMBER(pockstat_state::input_update) { - UINT32 buttons = machine().root_device().ioport("BUTTONS")->read(); + UINT32 buttons = ioport("BUTTONS")->read(); ps_intc_set_interrupt_line(PS_INT_BTN_ACTION, (buttons & 1) ? 1 : 0); ps_intc_set_interrupt_line(PS_INT_BTN_RIGHT, (buttons & 2) ? 1 : 0); @@ -803,7 +803,7 @@ WRITE32_MEMBER(pockstat_state::ps_flash_w) if(m_ps_flash_write_count) { m_ps_flash_write_count--; - COMBINE_DATA(&((UINT32*)(*machine().root_device().memregion("flash")))[offset]); + COMBINE_DATA(&((UINT32*)(*memregion("flash")))[offset]); } } @@ -939,7 +939,7 @@ UINT32 pockstat_state::screen_update_pockstat(screen_device &screen, bitmap_rgb3 DEVICE_IMAGE_LOAD_MEMBER( pockstat_state, pockstat_flash ) { int i, length; - UINT8 *cart = image.device().machine().root_device().memregion("flash")->base(); + UINT8 *cart = memregion("flash")->base(); static const char *gme_id = "123-456-STD"; length = image.fread( cart, 0x20f40); diff --git a/src/mess/drivers/psion.c b/src/mess/drivers/psion.c index e09834645dc..32b43737b9a 100644 --- a/src/mess/drivers/psion.c +++ b/src/mess/drivers/psion.c @@ -389,7 +389,7 @@ void psion_state::machine_start() if (m_rom_bank_count) { - UINT8* rom_base = (UINT8 *)machine().root_device().memregion("maincpu")->base(); + UINT8* rom_base = (UINT8 *)memregion("maincpu")->base(); membank("rombank")->configure_entry(0, rom_base + 0x8000); membank("rombank")->configure_entries(1, m_rom_bank_count-1, rom_base + 0x10000, 0x4000); diff --git a/src/mess/drivers/psx.c b/src/mess/drivers/psx.c index e813da11644..d651ea1c646 100644 --- a/src/mess/drivers/psx.c +++ b/src/mess/drivers/psx.c @@ -145,7 +145,7 @@ int psx1_state::load_psxexe( cpu_device *cpu, unsigned char *p_n_file, int n_len logerror( "psx_exe_load: sp %08x\n", psxexe_header->s_addr ); logerror( "psx_exe_load: len %08x\n", psxexe_header->s_size ); - memory_share *share = cpu->machine().root_device().memshare("share1"); + memory_share *share = memshare("share1"); p_ram = (UINT8 *)share->ptr(); n_ram = share->bytes(); @@ -249,7 +249,7 @@ int psx1_state::load_cpe( cpu_device *cpu, unsigned char *p_n_file, int n_len ) ( (int)p_n_file[ n_offset + 6 ] << 16 ) | ( (int)p_n_file[ n_offset + 7 ] << 24 ); - memory_share *share = cpu->machine().root_device().memshare("share1"); + memory_share *share = memshare("share1"); UINT8 *p_ram = (UINT8 *)share->ptr(); UINT32 n_ram = share->bytes(); diff --git a/src/mess/drivers/pv1000.c b/src/mess/drivers/pv1000.c index 1f483a90130..0dbc560d768 100644 --- a/src/mess/drivers/pv1000.c +++ b/src/mess/drivers/pv1000.c @@ -240,7 +240,7 @@ void pv1000_state::palette_init() DEVICE_IMAGE_LOAD_MEMBER( pv1000_state, pv1000_cart ) { - UINT8 *cart = image.device().machine().root_device().memregion("cart")->base(); + UINT8 *cart = memregion("cart")->base(); UINT32 size; if (image.software_entry() == NULL) diff --git a/src/mess/drivers/pv2000.c b/src/mess/drivers/pv2000.c index 423d561e582..ab024809800 100644 --- a/src/mess/drivers/pv2000.c +++ b/src/mess/drivers/pv2000.c @@ -380,7 +380,7 @@ void pv2000_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER( pv2000_state, pv2000_cart ) { - UINT8 *cart = image.device().machine().root_device().memregion("maincpu")->base() + 0xC000; + UINT8 *cart = memregion("maincpu")->base() + 0xC000; UINT32 size; if (image.software_entry() == NULL) diff --git a/src/mess/drivers/pyl601.c b/src/mess/drivers/pyl601.c index f7df9e18878..52b496650ab 100644 --- a/src/mess/drivers/pyl601.c +++ b/src/mess/drivers/pyl601.c @@ -101,7 +101,7 @@ WRITE8_MEMBER(pyl601_state::rom_page_w) { int chip = (data >> 4) % 5; int page = data & 7; - membank("bank2")->set_base(machine().root_device().memregion("romdisk")->base() + chip*0x10000 + page * 0x2000); + membank("bank2")->set_base(memregion("romdisk")->base() + chip*0x10000 + page * 0x2000); } else { diff --git a/src/mess/drivers/ql.c b/src/mess/drivers/ql.c index ce9dd86c6f4..fa4898f3268 100644 --- a/src/mess/drivers/ql.c +++ b/src/mess/drivers/ql.c @@ -310,7 +310,7 @@ READ8_MEMBER( ql_state::trump_card_rom_r ) space.unmap_readwrite(0x0c0000, 0x0fffff); // Setup trumcard rom mapped to rom so unlink us - space.install_rom(0x010000, 0x018000, &machine().root_device().memregion(M68008_TAG)->base()[TRUMP_ROM_BASE]); + space.install_rom(0x010000, 0x018000, &memregion(M68008_TAG)->base()[TRUMP_ROM_BASE]); return memregion(M68008_TAG)->base()[TRUMP_ROM_BASE+offset]; } @@ -318,10 +318,10 @@ READ8_MEMBER( ql_state::trump_card_rom_r ) READ8_MEMBER( ql_state::cart_rom_r ) { // Setup trumcard rom mapped in at $c0000 - space.install_rom(0x0c0000, 0x0c8000, &machine().root_device().memregion(M68008_TAG)->base()[TRUMP_ROM_BASE]); + space.install_rom(0x0c0000, 0x0c8000, &memregion(M68008_TAG)->base()[TRUMP_ROM_BASE]); // Setup cart rom to rom handler, so unlink us - space.install_rom(0x0c000, 0x0ffff, &machine().root_device().memregion(M68008_TAG)->base()[CART_ROM_BASE]); + space.install_rom(0x0c000, 0x0ffff, &memregion(M68008_TAG)->base()[CART_ROM_BASE]); return memregion(M68008_TAG)->base()[CART_ROM_BASE+offset]; } @@ -949,7 +949,7 @@ void ql_state::machine_reset() { case DISK_TYPE_SANDY : logerror("Configuring SandySuperDisk\n"); - program.install_rom(0x0c0000, 0x0c3fff, &machine().root_device().memregion(M68008_TAG)->base()[SANDY_ROM_BASE]); + program.install_rom(0x0c0000, 0x0c3fff, &memregion(M68008_TAG)->base()[SANDY_ROM_BASE]); program.install_read_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, read8_delegate(FUNC(ql_state::disk_io_r), this)); program.install_write_handler(SANDY_IO_BASE, SANDY_IO_END, 0, 0, write8_delegate(FUNC(ql_state::disk_io_w), this)); m_disk_io_base=SANDY_IO_BASE; diff --git a/src/mess/drivers/qx10.c b/src/mess/drivers/qx10.c index 0970412410d..96f3789f7e6 100644 --- a/src/mess/drivers/qx10.c +++ b/src/mess/drivers/qx10.c @@ -270,7 +270,7 @@ void qx10_state::update_memory_mapping() if (!m_memprom) { - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); + membank("bank1")->set_base(memregion("maincpu")->base()); } else { diff --git a/src/mess/drivers/rx78.c b/src/mess/drivers/rx78.c index 6ab94f85bef..de4ec71ce07 100644 --- a/src/mess/drivers/rx78.c +++ b/src/mess/drivers/rx78.c @@ -404,7 +404,7 @@ void rx78_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER( rx78_state, rx78_cart ) { - UINT8 *cart = image.device().machine().root_device().memregion("cart_img")->base(); + UINT8 *cart = memregion("cart_img")->base(); UINT32 size; if (image.software_entry() == NULL) diff --git a/src/mess/drivers/sage2.c b/src/mess/drivers/sage2.c index 11af9725e91..a2af5aea7ae 100644 --- a/src/mess/drivers/sage2.c +++ b/src/mess/drivers/sage2.c @@ -631,8 +631,8 @@ DRIVER_INIT_MEMBER(sage2_state,sage2) program.set_direct_update_handler(direct_update_delegate(FUNC(sage2_state::sage2_direct_update_handler), this)); // patch out i8251 test - machine().root_device().memregion(M68000_TAG)->base()[0x1be8] = 0xd6; - machine().root_device().memregion(M68000_TAG)->base()[0x1be9] = 0x4e; + memregion(M68000_TAG)->base()[0x1be8] = 0xd6; + memregion(M68000_TAG)->base()[0x1be9] = 0x4e; } diff --git a/src/mess/drivers/smc777.c b/src/mess/drivers/smc777.c index 901ffb414f6..288479fef1d 100644 --- a/src/mess/drivers/smc777.c +++ b/src/mess/drivers/smc777.c @@ -933,15 +933,15 @@ TIMER_DEVICE_CALLBACK_MEMBER(smc777_state::keyboard_callback) { static const char *const portnames[11] = { "key0","key1","key2","key3","key4","key5","key6","key7", "key8", "key9", "keya" }; int i,port_i,scancode; - UINT8 shift_mod = machine().root_device().ioport("key_mod")->read() & 1; - UINT8 kana_mod = machine().root_device().ioport("key_mod")->read() & 0x10; + UINT8 shift_mod = ioport("key_mod")->read() & 1; + UINT8 kana_mod = ioport("key_mod")->read() & 0x10; scancode = 0; for(port_i=0;port_i<11;port_i++) { for(i=0;i<8;i++) { - if((machine().root_device().ioport(portnames[port_i])->read()>>i) & 1) + if((ioport(portnames[port_i])->read()>>i) & 1) { m_keyb_press = smc777_keytable[shift_mod & 1][scancode]; if(kana_mod) { m_keyb_press|=0x80; } diff --git a/src/mess/drivers/socrates.c b/src/mess/drivers/socrates.c index 025c1f21a55..9f8d45637f8 100644 --- a/src/mess/drivers/socrates.c +++ b/src/mess/drivers/socrates.c @@ -152,7 +152,7 @@ void socrates_state::socrates_set_rom_bank( ) void socrates_state::socrates_set_ram_bank( ) { - membank( "bank2" )->set_base( machine().root_device().memregion("vram")->base() + ( (m_ram_bank&0x3) * 0x4000 )); // window 0 + membank( "bank2" )->set_base( memregion("vram")->base() + ( (m_ram_bank&0x3) * 0x4000 )); // window 0 membank( "bank3" )->set_base( memregion("vram")->base() + ( ((m_ram_bank&0xC)>>2) * 0x4000 )); // window 1 } @@ -164,7 +164,7 @@ void socrates_state::socrates_update_kb( ) // first check that the kb latch[1] is clear; if it isn't, don't touch it! if ((m_kb_latch_low[1] != 0) || (m_kb_latch_high[1] != 1)) return; // next check for joypad buttons - keyvalue = machine().root_device().ioport("keyboard_jp")->read(); + keyvalue = ioport("keyboard_jp")->read(); if (keyvalue != 0) { m_kb_latch_low[1] = (keyvalue & 0xFF0)>>4; @@ -174,11 +174,11 @@ void socrates_state::socrates_update_kb( ) // next check for mouse movement. // this isn't written yet, so write me please! // next check if shift is down - shift = machine().root_device().ioport("keyboard_50")->read(); + shift = ioport("keyboard_50")->read(); // find key low and high byte ok keyboard section for (row = 4; row>=0; row--) { - keyvalue = machine().root_device().ioport(rownames[row])->read(); + keyvalue = ioport(rownames[row])->read(); if (keyvalue != 0) { for (powerof2 = 9; powerof2 >= 0; powerof2--) @@ -237,7 +237,7 @@ void socrates_state::machine_reset() DRIVER_INIT_MEMBER(socrates_state,socrates) { - UINT8 *gfx = machine().root_device().memregion("vram")->base(); + UINT8 *gfx = memregion("vram")->base(); int i; /* fill vram with its init powerup bit pattern, so startup has the checkerboard screen */ for (i = 0; i < 0x10000; i++) diff --git a/src/mess/drivers/ssem.c b/src/mess/drivers/ssem.c index f587a97fbfa..d248ab49e64 100644 --- a/src/mess/drivers/ssem.c +++ b/src/mess/drivers/ssem.c @@ -89,11 +89,11 @@ enum INPUT_CHANGED_MEMBER(ssem_state::panel_check) { - UINT8 edit0_state = machine().root_device().ioport("EDIT0")->read(); - UINT8 edit1_state = machine().root_device().ioport("EDIT1")->read(); - UINT8 edit2_state = machine().root_device().ioport("EDIT2")->read(); - UINT8 edit3_state = machine().root_device().ioport("EDIT3")->read(); - UINT8 misc_state = machine().root_device().ioport("MISC")->read(); + UINT8 edit0_state = ioport("EDIT0")->read(); + UINT8 edit1_state = ioport("EDIT1")->read(); + UINT8 edit2_state = ioport("EDIT2")->read(); + UINT8 edit3_state = ioport("EDIT3")->read(); + UINT8 misc_state = ioport("MISC")->read(); device_t *ssem_cpu = m_maincpu; switch( (int)(FPTR)param ) diff --git a/src/mess/drivers/ssystem3.c b/src/mess/drivers/ssystem3.c index 4d124483f70..c76514523ea 100644 --- a/src/mess/drivers/ssystem3.c +++ b/src/mess/drivers/ssystem3.c @@ -127,39 +127,39 @@ READ8_MEMBER(ssystem3_state::ssystem3_via_read_a) { UINT8 data=0xff; #if 1 // time switch - if (!(m_porta&0x10)) data&=machine().root_device().ioport("matrix1")->read()|0xf1; - if (!(m_porta&0x20)) data&=machine().root_device().ioport("matrix2")->read()|0xf1; - if (!(m_porta&0x40)) data&=machine().root_device().ioport("matrix3")->read()|0xf1; - if (!(m_porta&0x80)) data&=machine().root_device().ioport("matrix4")->read()|0xf1; + if (!(m_porta&0x10)) data&=ioport("matrix1")->read()|0xf1; + if (!(m_porta&0x20)) data&=ioport("matrix2")->read()|0xf1; + if (!(m_porta&0x40)) data&=ioport("matrix3")->read()|0xf1; + if (!(m_porta&0x80)) data&=ioport("matrix4")->read()|0xf1; #else - if (!(m_porta&0x10)) data&=machine().root_device().ioport("matrix1")->read()|0xf0; - if (!(m_porta&0x20)) data&=machine().root_device().ioport("matrix2")->read()|0xf0; - if (!(m_porta&0x40)) data&=machine().root_device().ioport("matrix3")->read()|0xf0; - if (!(m_porta&0x80)) data&=machine().root_device().ioport("matrix4")->read()|0xf0; + if (!(m_porta&0x10)) data&=ioport("matrix1")->read()|0xf0; + if (!(m_porta&0x20)) data&=ioport("matrix2")->read()|0xf0; + if (!(m_porta&0x40)) data&=ioport("matrix3")->read()|0xf0; + if (!(m_porta&0x80)) data&=ioport("matrix4")->read()|0xf0; #endif if (!(m_porta&1)) { - if (!(machine().root_device().ioport("matrix1")->read()&1)) data&=~0x10; - if (!(machine().root_device().ioport("matrix2")->read()&1)) data&=~0x20; - if (!(machine().root_device().ioport("matrix3")->read()&1)) data&=~0x40; + if (!(ioport("matrix1")->read()&1)) data&=~0x10; + if (!(ioport("matrix2")->read()&1)) data&=~0x20; + if (!(ioport("matrix3")->read()&1)) data&=~0x40; if (!(ioport("matrix4")->read()&1)) data&=~0x80; } if (!(m_porta&2)) { - if (!(machine().root_device().ioport("matrix1")->read()&2)) data&=~0x10; - if (!(machine().root_device().ioport("matrix2")->read()&2)) data&=~0x20; - if (!(machine().root_device().ioport("matrix3")->read()&2)) data&=~0x40; - if (!(machine().root_device().ioport("matrix4")->read()&2)) data&=~0x80; + if (!(ioport("matrix1")->read()&2)) data&=~0x10; + if (!(ioport("matrix2")->read()&2)) data&=~0x20; + if (!(ioport("matrix3")->read()&2)) data&=~0x40; + if (!(ioport("matrix4")->read()&2)) data&=~0x80; } if (!(m_porta&4)) { - if (!(machine().root_device().ioport("matrix1")->read()&4)) data&=~0x10; - if (!(machine().root_device().ioport("matrix2")->read()&4)) data&=~0x20; - if (!(machine().root_device().ioport("matrix3")->read()&4)) data&=~0x40; - if (!(machine().root_device().ioport("matrix4")->read()&4)) data&=~0x80; + if (!(ioport("matrix1")->read()&4)) data&=~0x10; + if (!(ioport("matrix2")->read()&4)) data&=~0x20; + if (!(ioport("matrix3")->read()&4)) data&=~0x40; + if (!(ioport("matrix4")->read()&4)) data&=~0x80; } if (!(m_porta&8)) { - if (!(machine().root_device().ioport("matrix1")->read()&8)) data&=~0x10; - if (!(machine().root_device().ioport("matrix2")->read()&8)) data&=~0x20; - if (!(machine().root_device().ioport("matrix3")->read()&8)) data&=~0x40; - if (!(machine().root_device().ioport("matrix4")->read()&8)) data&=~0x80; + if (!(ioport("matrix1")->read()&8)) data&=~0x10; + if (!(ioport("matrix2")->read()&8)) data&=~0x20; + if (!(ioport("matrix3")->read()&8)) data&=~0x40; + if (!(ioport("matrix4")->read()&8)) data&=~0x80; } // logerror("%.4x via port a read %02x\n",(int)activecpu_get_pc(), data); return data; diff --git a/src/mess/drivers/studio2.c b/src/mess/drivers/studio2.c index 5e74e6066ae..b5a5e72fc7a 100644 --- a/src/mess/drivers/studio2.c +++ b/src/mess/drivers/studio2.c @@ -262,7 +262,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state, st2_cartslot_load ) for (int block = 0; block < (header.blocks - 1); block++) { UINT16 offset = header.page[block] << 8; - UINT8 *ptr = ((UINT8 *) image.device().machine().root_device().memregion(CDP1802_TAG)->base()) + offset; + UINT8 *ptr = ((UINT8 *) memregion(CDP1802_TAG)->base()) + offset; if (LOG) logerror("ST2 Reading block %u to %04x\n", block, offset); @@ -518,7 +518,7 @@ DEVICE_IMAGE_LOAD_MEMBER( studio2_state, studio2_cart_load ) // WARNING: list code currently assume that cart mapping starts at 0x400. // the five dumps currently available work like this, but the .st2 format // allows for more freedom... how was the content of a real cart mapped? - UINT8 *ptr = ((UINT8 *) image.device().machine().root_device().memregion(CDP1802_TAG)->base()) + 0x400; + UINT8 *ptr = ((UINT8 *) memregion(CDP1802_TAG)->base()) + 0x400; memcpy(ptr, image.get_software_region("rom"), image.get_software_region_length("rom")); return IMAGE_INIT_PASS; } diff --git a/src/mess/drivers/supracan.c b/src/mess/drivers/supracan.c index b788ad04713..09a0910b859 100644 --- a/src/mess/drivers/supracan.c +++ b/src/mess/drivers/supracan.c @@ -412,8 +412,8 @@ void supracan_state::video_start() { m_sprite_final_bitmap.allocate(1024, 1024, BITMAP_FORMAT_IND16); - m_vram = (UINT16*)(*machine().root_device().memregion("ram_gfx")); - m_vram_swapped = (UINT16*)(*machine().root_device().memregion("ram_gfx2")); + m_vram = (UINT16*)(*memregion("ram_gfx")); + m_vram_swapped = (UINT16*)(*memregion("ram_gfx2")); m_vram_addr_swapped = (UINT8*)(*memregion("ram_gfx3")); // hack for 1bpp layer at startup m_tilemap_sizes[0][0] = &machine().tilemap().create(tilemap_get_info_delegate(FUNC(supracan_state::get_supracan_tilemap0_tile_info),this), TILEMAP_SCAN_ROWS, 8, 8, 32, 32); @@ -1728,7 +1728,7 @@ WRITE16_MEMBER( supracan_state::supracan_video_w ) DEVICE_IMAGE_LOAD_MEMBER( supracan_state, supracan_cart ) { - UINT8 *cart = image.device().machine().root_device().memregion("cart")->base(); + UINT8 *cart = memregion("cart")->base(); UINT32 size = 0; if (image.software_entry() == NULL) diff --git a/src/mess/drivers/svision.c b/src/mess/drivers/svision.c index 2a3f49d3c92..cee1239f719 100644 --- a/src/mess/drivers/svision.c +++ b/src/mess/drivers/svision.c @@ -482,7 +482,7 @@ DEVICE_IMAGE_LOAD_MEMBER( svision_state, svision_cart ) size = image.length(); temp_copy = auto_alloc_array(image.device().machine(), UINT8, size); - if (size > image.device().machine().root_device().memregion("user1")->bytes()) + if (size > memregion("user1")->bytes()) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Unsupported cartridge size"); auto_free(image.device().machine(), temp_copy); @@ -503,12 +503,12 @@ DEVICE_IMAGE_LOAD_MEMBER( svision_state, svision_cart ) memcpy(temp_copy, image.get_software_region("rom"), size); } - mirror = image.device().machine().root_device().memregion("user1")->bytes() / size; + mirror = memregion("user1")->bytes() / size; /* With the following, we mirror the cart in the whole "user1" memory region */ for (i = 0; i < mirror; i++) { - memcpy(image.device().machine().root_device().memregion("user1")->base() + i * size, temp_copy, size); + memcpy(memregion("user1")->base() + i * size, temp_copy, size); } auto_free(image.device().machine(), temp_copy); diff --git a/src/mess/drivers/systec.c b/src/mess/drivers/systec.c index 518f67fa4d7..ac1bb3f5f3a 100644 --- a/src/mess/drivers/systec.c +++ b/src/mess/drivers/systec.c @@ -94,8 +94,8 @@ INPUT_PORTS_END void systec_state::machine_reset() { - UINT8 *m_p_maincpu = machine().root_device().memregion("maincpu")->base(); - UINT8 *m_p_roms = machine().root_device().memregion("roms")->base(); + UINT8 *m_p_maincpu = memregion("maincpu")->base(); + UINT8 *m_p_roms = memregion("roms")->base(); memcpy(m_p_maincpu, m_p_roms, 0x2000); } diff --git a/src/mess/drivers/tec1.c b/src/mess/drivers/tec1.c index 54db84cced5..b077a123ff3 100644 --- a/src/mess/drivers/tec1.c +++ b/src/mess/drivers/tec1.c @@ -237,17 +237,17 @@ TIMER_CALLBACK_MEMBER(tec1_state::tec1_kbd_callback) // 74C923 4 by 5 key encoder. // if previous key is still held, bail out - if (machine().root_device().ioport(keynames[m_kbd_row])->read()) - if (tec1_convert_col_to_bin(machine().root_device().ioport(keynames[m_kbd_row])->read(), m_kbd_row) == m_kbd) + if (ioport(keynames[m_kbd_row])->read()) + if (tec1_convert_col_to_bin(ioport(keynames[m_kbd_row])->read(), m_kbd_row) == m_kbd) return; m_kbd_row++; m_kbd_row &= 3; /* see if a key pressed */ - if (machine().root_device().ioport(keynames[m_kbd_row])->read()) + if (ioport(keynames[m_kbd_row])->read()) { - m_kbd = tec1_convert_col_to_bin(machine().root_device().ioport(keynames[m_kbd_row])->read(), m_kbd_row); + m_kbd = tec1_convert_col_to_bin(ioport(keynames[m_kbd_row])->read(), m_kbd_row); m_maincpu->set_input_line(INPUT_LINE_NMI, HOLD_LINE); m_key_pressed = TRUE; } diff --git a/src/mess/drivers/ti990_10.c b/src/mess/drivers/ti990_10.c index 70dbf7a1d74..bc4ef89d149 100644 --- a/src/mess/drivers/ti990_10.c +++ b/src/mess/drivers/ti990_10.c @@ -297,7 +297,7 @@ DRIVER_INIT_MEMBER(ti990_10_state,ti990_10) /* load specific ti990/12 rom page */ const int page = 3; - memmove(machine().root_device().memregion("maincpu")->base()+0x1FFC00, machine().root_device().memregion("maincpu")->base()+0x1FFC00+(page*0x400), 0x400); + memmove(memregion("maincpu")->base()+0x1FFC00, memregion("maincpu")->base()+0x1FFC00+(page*0x400), 0x400); #endif vdt911_init(machine()); } diff --git a/src/mess/drivers/ti99_2.c b/src/mess/drivers/ti99_2.c index 96e681040af..ce15333a509 100644 --- a/src/mess/drivers/ti99_2.c +++ b/src/mess/drivers/ti99_2.c @@ -121,14 +121,14 @@ DRIVER_INIT_MEMBER(ti99_2_state,ti99_2_32) m_ROM_paged = 1; } -#define TI99_2_32_ROMPAGE0 (machine().root_device().memregion("maincpu")->base()+0x4000) -#define TI99_2_32_ROMPAGE1 (machine().root_device().memregion("maincpu")->base()+0x10000) +#define TI99_2_32_ROMPAGE0 (memregion("maincpu")->base()+0x4000) +#define TI99_2_32_ROMPAGE1 (memregion("maincpu")->base()+0x10000) void ti99_2_state::machine_reset() { m_irq_state = ASSERT_LINE; if (! m_ROM_paged) - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()+0x4000); + membank("bank1")->set_base(memregion("maincpu")->base()+0x4000); else membank("bank1")->set_base((memregion("maincpu")->base()+0x4000)); } diff --git a/src/mess/drivers/ti99_4p.c b/src/mess/drivers/ti99_4p.c index 67ca8a17984..9cd3a18fdca 100644 --- a/src/mess/drivers/ti99_4p.c +++ b/src/mess/drivers/ti99_4p.c @@ -820,8 +820,8 @@ void ti99_4p_state::machine_start() m_tms9901 = static_cast<tms9901_device*>(machine().device(TMS9901_TAG)); m_joyport = static_cast<joyport_device*>(machine().device(JOYPORT_TAG)); - m_ram = (UINT16*)(*machine().root_device().memregion(SAMSMEM_TAG)); - m_scratchpad = (UINT16*)(*machine().root_device().memregion(PADMEM_TAG)); + m_ram = (UINT16*)(*memregion(SAMSMEM_TAG)); + m_scratchpad = (UINT16*)(*memregion(PADMEM_TAG)); m_peribox->senila(CLEAR_LINE); m_peribox->senilb(CLEAR_LINE); @@ -830,7 +830,7 @@ void ti99_4p_state::machine_start() m_ready_line = m_ready_line_dmux = ASSERT_LINE; - UINT16 *rom = (UINT16*)(*machine().root_device().memregion("maincpu")); + UINT16 *rom = (UINT16*)(*memregion("maincpu")); m_rom0 = rom + 0x2000; m_dsr = rom + 0x6000; m_rom6a = rom + 0x3000; diff --git a/src/mess/drivers/trs80.c b/src/mess/drivers/trs80.c index 8bfcf86b7fe..67c7fdab0f8 100644 --- a/src/mess/drivers/trs80.c +++ b/src/mess/drivers/trs80.c @@ -900,7 +900,7 @@ DRIVER_INIT_MEMBER(trs80_state,lnw80) { m_mode = 0; m_model4 = 0; - m_p_gfxram = machine().root_device().memregion("gfx2")->base(); + m_p_gfxram = memregion("gfx2")->base(); m_p_videoram.set_target(memregion("maincpu")->base()+0x4000,m_p_videoram.bytes()); } diff --git a/src/mess/drivers/tsispch.c b/src/mess/drivers/tsispch.c index fea33b7c5ce..5dd23b3a16c 100644 --- a/src/mess/drivers/tsispch.c +++ b/src/mess/drivers/tsispch.c @@ -278,8 +278,8 @@ void tsispch_state::machine_reset() DRIVER_INIT_MEMBER(tsispch_state,prose2k) { - UINT8 *dspsrc = (UINT8 *)(*machine().root_device().memregion("dspprgload")); - UINT32 *dspprg = (UINT32 *)(*machine().root_device().memregion("dspprg")); + UINT8 *dspsrc = (UINT8 *)(*memregion("dspprgload")); + UINT32 *dspprg = (UINT32 *)(*memregion("dspprg")); fprintf(stderr,"driver init\n"); // unpack 24 bit 7720 data into 32 bit space and shuffle it so it can run as 7725 code // data format as-is in dspsrc: (L = always 0, X = doesn't matter) diff --git a/src/mess/drivers/tutor.c b/src/mess/drivers/tutor.c index 38dbff07233..0fbdd9e3fb3 100644 --- a/src/mess/drivers/tutor.c +++ b/src/mess/drivers/tutor.c @@ -231,7 +231,7 @@ DRIVER_INIT_MEMBER(tutor_state,tutor) { m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this)); - membank("bank1")->configure_entry(0, machine().root_device().memregion("maincpu")->base() + basic_base); + membank("bank1")->configure_entry(0, memregion("maincpu")->base() + basic_base); membank("bank1")->configure_entry(1, memregion("maincpu")->base() + cartridge_base); membank("bank1")->set_entry(0); } @@ -301,7 +301,7 @@ READ8_MEMBER( tutor_state::key_r ) DEVICE_IMAGE_LOAD_MEMBER( tutor_state, tutor_cart ) { UINT32 size; - UINT8 *ptr = image.device().machine().root_device().memregion("maincpu")->base(); + UINT8 *ptr = memregion("maincpu")->base(); if (image.software_entry() == NULL) { @@ -320,7 +320,7 @@ DEVICE_IMAGE_LOAD_MEMBER( tutor_state, tutor_cart ) DEVICE_IMAGE_UNLOAD_MEMBER( tutor_state, tutor_cart ) { - memset(image.device().machine().root_device().memregion("maincpu")->base() + cartridge_base, 0, 0x6000); + memset(memregion("maincpu")->base() + cartridge_base, 0, 0x6000); } /* diff --git a/src/mess/drivers/tx0.c b/src/mess/drivers/tx0.c index c4f10ff48bb..3773c48f16e 100644 --- a/src/mess/drivers/tx0.c +++ b/src/mess/drivers/tx0.c @@ -70,7 +70,7 @@ DRIVER_INIT_MEMBER(tx0_state,tx0) }; /* set up our font */ - dst = machine().root_device().memregion("gfx1")->base(); + dst = memregion("gfx1")->base(); memcpy(dst, fontdata6x8, tx0_fontdata_size); } @@ -1575,7 +1575,7 @@ INTERRUPT_GEN_MEMBER(tx0_state::tx0_interrupt) /* handle toggle switch register keys */ - tsr_keys = (machine().root_device().ioport("MSW")->read() << 16) | machine().root_device().ioport("LSW")->read(); + tsr_keys = (ioport("MSW")->read() << 16) | ioport("LSW")->read(); /* compute transitions */ tsr_transitions = tsr_keys & (~ m_old_tsr_keys); diff --git a/src/mess/drivers/unior.c b/src/mess/drivers/unior.c index 03a7a24b082..76b25260dec 100644 --- a/src/mess/drivers/unior.c +++ b/src/mess/drivers/unior.c @@ -248,7 +248,7 @@ void unior_state::machine_reset() void unior_state::video_start() { - m_p_chargen = machine().root_device().memregion("chargen")->base(); + m_p_chargen = memregion("chargen")->base(); m_p_vram = memregion("vram")->base(); } diff --git a/src/mess/drivers/unixpc.c b/src/mess/drivers/unixpc.c index ed9b20c8e2b..9e47916e6fe 100644 --- a/src/mess/drivers/unixpc.c +++ b/src/mess/drivers/unixpc.c @@ -65,7 +65,7 @@ WRITE16_MEMBER( unixpc_state::romlmap_w ) if (BIT(data, 15)) space.install_ram(0x000000, 0x3fffff, m_ram->pointer()); else - space.install_rom(0x000000, 0x3fffff, space.machine().root_device().memregion("bootrom")->base()); + space.install_rom(0x000000, 0x3fffff, memregion("bootrom")->base()); } void unixpc_state::machine_reset() diff --git a/src/mess/drivers/v6809.c b/src/mess/drivers/v6809.c index a4e94512161..fed3cbc1a8a 100644 --- a/src/mess/drivers/v6809.c +++ b/src/mess/drivers/v6809.c @@ -169,7 +169,7 @@ MC6845_ON_UPDATE_ADDR_CHANGED( v6809_update_addr ) void v6809_state::video_start() { - m_p_chargen = machine().root_device().memregion("chargen")->base(); + m_p_chargen = memregion("chargen")->base(); m_p_videoram = memregion("videoram")->base(); } diff --git a/src/mess/drivers/vboy.c b/src/mess/drivers/vboy.c index b3a80576e3b..8cdca4b4b18 100644 --- a/src/mess/drivers/vboy.c +++ b/src/mess/drivers/vboy.c @@ -1349,12 +1349,11 @@ WRITE32_MEMBER(vboy_state::sram_w) DEVICE_IMAGE_LOAD_MEMBER( vboy_state, vboy_cart ) { - vboy_state *state = image.device().machine().driver_data<vboy_state>(); UINT32 chip = 0; - UINT8 *ROM = image.device().machine().root_device().memregion("cartridge")->base(); + UINT8 *ROM = memregion("cartridge")->base(); UINT32 cart_size; - state->m_nvptr = (UINT8 *)NULL; + m_nvptr = (UINT8 *)NULL; if (image.software_entry() == NULL) { cart_size = image.length(); @@ -1372,17 +1371,17 @@ DEVICE_IMAGE_LOAD_MEMBER( vboy_state, vboy_cart ) if (chip) { - state->m_nvptr = (UINT8 *)&state->m_vboy_sram; + m_nvptr = (UINT8 *)&m_vboy_sram; - state->m_maincpu->space(AS_PROGRAM).install_read_handler(0x06000000, 0x0600ffff, read32_delegate(FUNC(vboy_state::sram_r),state)); - state->m_maincpu->space(AS_PROGRAM).install_write_handler(0x06000000, 0x0600ffff, write32_delegate(FUNC(vboy_state::sram_w),state)); + m_maincpu->space(AS_PROGRAM).install_read_handler(0x06000000, 0x0600ffff, read32_delegate(FUNC(vboy_state::sram_r),this)); + m_maincpu->space(AS_PROGRAM).install_write_handler(0x06000000, 0x0600ffff, write32_delegate(FUNC(vboy_state::sram_w),this)); - image.battery_load(state->m_nvptr, 0x10000, 0x00); - state->m_nvimage = image; + image.battery_load(m_nvptr, 0x10000, 0x00); + m_nvimage = image; } else { - state->m_nvimage = NULL; + m_nvimage = NULL; } return IMAGE_INIT_PASS; diff --git a/src/mess/drivers/vg5k.c b/src/mess/drivers/vg5k.c index 6689ec8ca1d..4b0877870b3 100644 --- a/src/mess/drivers/vg5k.c +++ b/src/mess/drivers/vg5k.c @@ -326,7 +326,7 @@ GFXDECODE_END DRIVER_INIT_MEMBER(vg5k_state,vg5k) { - UINT8 *FNT = machine().root_device().memregion("ef9345")->base(); + UINT8 *FNT = memregion("ef9345")->base(); UINT16 a,b,c,d,dest=0x2000; /* Unscramble the chargen rom as the format is too complex for gfxdecode to handle unaided */ diff --git a/src/mess/drivers/vt100.c b/src/mess/drivers/vt100.c index aa6f92cefa2..0f4be6125ce 100644 --- a/src/mess/drivers/vt100.c +++ b/src/mess/drivers/vt100.c @@ -130,7 +130,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(vt100_state::keyboard_callback) for(i = 0; i < 16; i++) { sprintf(kbdrow,"LINE%X", i); - code = machine().root_device().ioport(kbdrow)->read(); + code = ioport(kbdrow)->read(); if (code < 0xff) { m_keyboard_int = 1; diff --git a/src/mess/drivers/vt240.c b/src/mess/drivers/vt240.c index 9db93dffff5..62206de6742 100644 --- a/src/mess/drivers/vt240.c +++ b/src/mess/drivers/vt240.c @@ -200,7 +200,7 @@ ROM_END /* Driver */ DRIVER_INIT_MEMBER(vt240_state,vt240) { - UINT8 *ROM = machine().root_device().memregion("ipl")->base(); + UINT8 *ROM = memregion("ipl")->base(); /* patch T11 check */ ROM[0x09d] = 0x00; diff --git a/src/mess/drivers/vta2000.c b/src/mess/drivers/vta2000.c index 59791eab410..fff535a29b2 100644 --- a/src/mess/drivers/vta2000.c +++ b/src/mess/drivers/vta2000.c @@ -56,7 +56,7 @@ void vta2000_state::machine_reset() void vta2000_state::video_start() { - m_p_chargen = machine().root_device().memregion("chargen")->base(); + m_p_chargen = memregion("chargen")->base(); m_p_videoram = memregion("maincpu")->base()+0x8000; } diff --git a/src/mess/drivers/x07.c b/src/mess/drivers/x07.c index 7ff4c40ae34..6b768ade8a5 100644 --- a/src/mess/drivers/x07.c +++ b/src/mess/drivers/x07.c @@ -333,8 +333,8 @@ void x07_state::t6834_cmd (UINT8 cmd) break; case 0x1c: //UDC Init { - memcpy(m_t6834_ram + 0x200, (UINT8*)machine().root_device().memregion("gfx1")->base() + 0x400, 0x100); - memcpy(m_t6834_ram + 0x300, (UINT8*)machine().root_device().memregion("gfx1")->base() + 0x700, 0x100); + memcpy(m_t6834_ram + 0x200, (UINT8*)memregion("gfx1")->base() + 0x400, 0x100); + memcpy(m_t6834_ram + 0x300, (UINT8*)memregion("gfx1")->base() + 0x700, 0x100); } break; @@ -928,8 +928,8 @@ INPUT_CHANGED_MEMBER( x07_state::kb_func_keys ) INPUT_CHANGED_MEMBER( x07_state::kb_keys ) { UINT8 modifier; - UINT8 a1 = field.machine().root_device().ioport("A1")->read(); - UINT8 bz = field.machine().root_device().ioport("BZ")->read(); + UINT8 a1 = ioport("A1")->read(); + UINT8 bz = ioport("BZ")->read(); UINT8 keycode = (UINT8)(FPTR)param; if (m_kb_on && !newval) diff --git a/src/mess/drivers/x1.c b/src/mess/drivers/x1.c index be2d440115e..8110616dfe4 100644 --- a/src/mess/drivers/x1.c +++ b/src/mess/drivers/x1.c @@ -2370,11 +2370,11 @@ IRQ_CALLBACK_MEMBER(x1_state::x1_irq_callback) TIMER_DEVICE_CALLBACK_MEMBER(x1_state::x1_keyboard_callback) { address_space &space = machine().device("x1_cpu")->memory().space(AS_PROGRAM); - UINT32 key1 = machine().root_device().ioport("key1")->read(); - UINT32 key2 = machine().root_device().ioport("key2")->read(); - UINT32 key3 = machine().root_device().ioport("key3")->read(); - UINT32 key4 = machine().root_device().ioport("tenkey")->read(); - UINT32 f_key = machine().root_device().ioport("f_keys")->read(); + UINT32 key1 = ioport("key1")->read(); + UINT32 key2 = ioport("key2")->read(); + UINT32 key3 = ioport("key3")->read(); + UINT32 key4 = ioport("tenkey")->read(); + UINT32 f_key = ioport("f_keys")->read(); if(m_key_irq_vector) { @@ -2426,7 +2426,7 @@ TIMER_CALLBACK_MEMBER(x1_state::x1_rtc_increment) MACHINE_RESET_MEMBER(x1_state,x1) { - //UINT8 *ROM = machine().root_device().memregion("x1_cpu")->base(); + //UINT8 *ROM = memregion("x1_cpu")->base(); int i; memset(m_gfx_bitmap_ram,0x00,0xc000*2); @@ -2715,8 +2715,8 @@ ROM_END DRIVER_INIT_MEMBER(x1_state,x1_kanji) { UINT32 i,j,k,l; - UINT8 *kanji = machine().root_device().memregion("kanji")->base(); - UINT8 *raw_kanji = machine().root_device().memregion("raw_kanji")->base(); + UINT8 *kanji = memregion("kanji")->base(); + UINT8 *raw_kanji = memregion("raw_kanji")->base(); k = 0; for(l=0;l<2;l++) diff --git a/src/mess/drivers/x68k.c b/src/mess/drivers/x68k.c index dd64246b1aa..38056e17822 100644 --- a/src/mess/drivers/x68k.c +++ b/src/mess/drivers/x68k.c @@ -439,7 +439,7 @@ void x68k_state::x68k_keyboard_push_scancode(unsigned char code) { m_mfp.rsr |= 0x80; // Buffer full // mfp_trigger_irq(MFP_IRQ_RX_FULL); - if(machine().root_device().ioport("options")->read() & 0x01) + if(ioport("options")->read() & 0x01) { m_current_vector[6] = 0x4c; m_maincpu->set_input_line_and_vector(6,ASSERT_LINE,0x4c); @@ -469,7 +469,7 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_keyboard_poll) { m_keyboard.keytime[x] -= 5; } - if(!(machine().root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + if(!(ioport(keynames[x / 32])->read() & (1 << (x % 32)))) { if(m_keyboard.keyon[x] != 0) { @@ -483,14 +483,14 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_keyboard_poll) // check to see if a key is being held if(m_keyboard.keyon[x] != 0 && m_keyboard.keytime[x] == 0 && m_keyboard.last_pressed == x) { - if(machine().root_device().ioport(keynames[m_keyboard.last_pressed / 32])->read() & (1 << (m_keyboard.last_pressed % 32))) + if(ioport(keynames[m_keyboard.last_pressed / 32])->read() & (1 << (m_keyboard.last_pressed % 32))) { x68k_keyboard_push_scancode(m_keyboard.last_pressed); m_keyboard.keytime[m_keyboard.last_pressed] = (m_keyboard.repeat^2)*5+30; logerror("KB: Holding key 0x%02x\n",m_keyboard.last_pressed); } } - if((machine().root_device().ioport(keynames[x / 32])->read() & (1 << (x % 32)))) + if((ioport(keynames[x / 32])->read() & (1 << (x % 32)))) { if(m_keyboard.keyon[x] == 0) { @@ -533,15 +533,15 @@ int x68k_state::x68k_read_mouse() switch(m_mouse.inputtype) { case 0: - ipt = machine().root_device().ioport("mouse1")->read(); + ipt = ioport("mouse1")->read(); break; case 1: - val = machine().root_device().ioport("mouse2")->read(); + val = ioport("mouse2")->read(); ipt = val - m_mouse.last_mouse_x; m_mouse.last_mouse_x = val; break; case 2: - val = machine().root_device().ioport("mouse3")->read(); + val = ioport("mouse3")->read(); ipt = val - m_mouse.last_mouse_y; m_mouse.last_mouse_y = val; break; @@ -678,7 +678,7 @@ UINT8 x68k_state::md_3button_r(int port) { if(port == 1) { - UINT8 porta = machine().root_device().ioport("md3b")->read() & 0xff; + UINT8 porta = ioport("md3b")->read() & 0xff; UINT8 portb = (ioport("md3b")->read() >> 8) & 0xff; if(m_mdctrl.mux1 & 0x10) { @@ -691,8 +691,8 @@ UINT8 x68k_state::md_3button_r(int port) } if(port == 2) { - UINT8 porta = (machine().root_device().ioport("md3b")->read() >> 16) & 0xff; - UINT8 portb = (machine().root_device().ioport("md3b")->read() >> 24) & 0xff; + UINT8 porta = (ioport("md3b")->read() >> 16) & 0xff; + UINT8 portb = (ioport("md3b")->read() >> 24) & 0xff; if(m_mdctrl.mux2 & 0x20) { return porta | 0x90; @@ -726,8 +726,8 @@ UINT8 x68k_state::md_6button_r(int port) { if(port == 1) { - UINT8 porta = machine().root_device().ioport("md6b")->read() & 0xff; - UINT8 portb = (machine().root_device().ioport("md6b")->read() >> 8) & 0xff; + UINT8 porta = ioport("md6b")->read() & 0xff; + UINT8 portb = (ioport("md6b")->read() >> 8) & 0xff; UINT8 extra = ioport("md6b_extra")->read() & 0x0f; switch(m_mdctrl.seq1) @@ -764,9 +764,9 @@ UINT8 x68k_state::md_6button_r(int port) } if(port == 2) { - UINT8 porta = (machine().root_device().ioport("md6b")->read() >> 16) & 0xff; - UINT8 portb = (machine().root_device().ioport("md6b")->read() >> 24) & 0xff; - UINT8 extra = (machine().root_device().ioport("md6b_extra")->read() >> 4) & 0x0f; + UINT8 porta = (ioport("md6b")->read() >> 16) & 0xff; + UINT8 portb = (ioport("md6b")->read() >> 24) & 0xff; + UINT8 extra = (ioport("md6b_extra")->read() >> 4) & 0x0f; switch(m_mdctrl.seq2) { @@ -814,7 +814,7 @@ UINT8 x68k_state::xpd1lr_r(int port) { if(port == 1) { - UINT8 porta = machine().root_device().ioport("xpd1lr")->read() & 0xff; + UINT8 porta = ioport("xpd1lr")->read() & 0xff; UINT8 portb = (ioport("xpd1lr")->read() >> 8) & 0xff; if(m_mdctrl.mux1 & 0x10) { @@ -827,8 +827,8 @@ UINT8 x68k_state::xpd1lr_r(int port) } if(port == 2) { - UINT8 porta = (machine().root_device().ioport("xpd1lr")->read() >> 16) & 0xff; - UINT8 portb = (machine().root_device().ioport("xpd1lr")->read() >> 24) & 0xff; + UINT8 porta = (ioport("xpd1lr")->read() >> 16) & 0xff; + UINT8 portb = (ioport("xpd1lr")->read() >> 24) & 0xff; if(m_mdctrl.mux2 & 0x20) { return porta; @@ -844,7 +844,7 @@ UINT8 x68k_state::xpd1lr_r(int port) // Judging from the XM6 source code, PPI ports A and B are joystick inputs READ8_MEMBER(x68k_state::ppi_port_a_r) { - int ctrl = machine().root_device().ioport("ctrltype")->read() & 0x0f; + int ctrl = ioport("ctrltype")->read() & 0x0f; switch(ctrl) { @@ -866,7 +866,7 @@ READ8_MEMBER(x68k_state::ppi_port_a_r) READ8_MEMBER(x68k_state::ppi_port_b_r) { - int ctrl = machine().root_device().ioport("ctrltype")->read() & 0xf0; + int ctrl = ioport("ctrltype")->read() & 0xf0; switch(ctrl) { @@ -2564,8 +2564,8 @@ MACHINE_START_MEMBER(x68k_state,x68030) DRIVER_INIT_MEMBER(x68k_state,x68000) { - unsigned char* rom = machine().root_device().memregion("maincpu")->base(); - unsigned char* user2 = machine().root_device().memregion("user2")->base(); + unsigned char* rom = memregion("maincpu")->base(); + unsigned char* user2 = memregion("user2")->base(); //FIXME // m_gvram = auto_alloc_array(machine(), UINT16, 0x080000/sizeof(UINT16)); // m_tvram = auto_alloc_array(machine(), UINT16, 0x080000/sizeof(UINT16)); diff --git a/src/mess/drivers/z100.c b/src/mess/drivers/z100.c index d53981c1c8e..84ed8547090 100644 --- a/src/mess/drivers/z100.c +++ b/src/mess/drivers/z100.c @@ -760,7 +760,7 @@ void z100_state::machine_reset() { int i; - if(machine().root_device().ioport("CONFIG")->read() & 1) + if(ioport("CONFIG")->read() & 1) { for(i=0;i<8;i++) palette_set_color_rgb(machine(), i,pal1bit(i >> 1),pal1bit(i >> 2),pal1bit(i >> 0)); @@ -812,7 +812,7 @@ ROM_END DRIVER_INIT_MEMBER(z100_state,z100) { - UINT8 *ROM = machine().root_device().memregion("ipl")->base(); + UINT8 *ROM = memregion("ipl")->base(); ROM[0xfc116 & 0x3fff] = 0x90; // patch parity IRQ check ROM[0xfc117 & 0x3fff] = 0x90; diff --git a/src/mess/drivers/z88.c b/src/mess/drivers/z88.c index 6002c76512a..0083933fbb2 100644 --- a/src/mess/drivers/z88.c +++ b/src/mess/drivers/z88.c @@ -547,7 +547,7 @@ INPUT_PORTS_END void z88_state::machine_start() { - m_bios = (UINT8*)machine().root_device().memregion("bios")->base(); + m_bios = (UINT8*)memregion("bios")->base(); m_ram_base = (UINT8*)m_ram->pointer(); // configure the memory banks diff --git a/src/mess/machine/ac1.c b/src/mess/machine/ac1.c index a83ba9d93ad..ab7bcb95f23 100644 --- a/src/mess/machine/ac1.c +++ b/src/mess/machine/ac1.c @@ -25,13 +25,13 @@ READ8_MEMBER(ac1_state::ac1_port_b_r) READ8_MEMBER(ac1_state::ac1_port_a_r) { - UINT8 line0 = machine().root_device().ioport("LINE0")->read(); - UINT8 line1 = machine().root_device().ioport("LINE1")->read(); - UINT8 line2 = machine().root_device().ioport("LINE2")->read(); - UINT8 line3 = machine().root_device().ioport("LINE3")->read(); - UINT8 line4 = machine().root_device().ioport("LINE4")->read(); - UINT8 line5 = machine().root_device().ioport("LINE5")->read(); - UINT8 line6 = machine().root_device().ioport("LINE6")->read(); + UINT8 line0 = ioport("LINE0")->read(); + UINT8 line1 = ioport("LINE1")->read(); + UINT8 line2 = ioport("LINE2")->read(); + UINT8 line3 = ioport("LINE3")->read(); + UINT8 line4 = ioport("LINE4")->read(); + UINT8 line5 = ioport("LINE5")->read(); + UINT8 line6 = ioport("LINE6")->read(); UINT8 SH = BNOT(BIT(line6,0)); UINT8 CTRL = BNOT(BIT(line6,1)); diff --git a/src/mess/machine/amstrad.c b/src/mess/machine/amstrad.c index a8014aa0b85..d0fd0f3896e 100644 --- a/src/mess/machine/amstrad.c +++ b/src/mess/machine/amstrad.c @@ -275,7 +275,7 @@ with different data and be able to select the other entries - not tested on a re and not supported by this driver */ PALETTE_INIT_MEMBER(amstrad_state,kccomp) { - const UINT8 *color_prom = machine().root_device().memregion("proms")->base(); + const UINT8 *color_prom = memregion("proms")->base(); int i; color_prom = color_prom+0x018000; @@ -323,7 +323,7 @@ PALETTE_INIT_MEMBER(amstrad_state,aleste) int i; /* CPC Colour data is stored in the colour ROM (RFCOLDAT.BIN) at 0x140-0x17f */ - unsigned char* pal = machine().root_device().memregion("user4")->base(); + unsigned char* pal = memregion("user4")->base(); for(i=0; i<32; i++) { diff --git a/src/mess/machine/apple1.c b/src/mess/machine/apple1.c index a22498ed4b1..81b3b786caf 100644 --- a/src/mess/machine/apple1.c +++ b/src/mess/machine/apple1.c @@ -282,7 +282,7 @@ TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) /* First we check the RESET and CLEAR SCREEN pushbutton switches. */ /* The RESET switch resets the CPU and the 6820 PIA. */ - if (machine().root_device().ioport("KEY5")->read() & 0x0001) + if (ioport("KEY5")->read() & 0x0001) { if (!m_reset_flag) { m_reset_flag = 1; @@ -298,7 +298,7 @@ TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) } /* The CLEAR SCREEN switch clears the video hardware. */ - if (machine().root_device().ioport("KEY5")->read() & 0x0002) + if (ioport("KEY5")->read() & 0x0002) { if (!m_vh_clrscrn_pressed) { @@ -323,14 +323,14 @@ TIMER_CALLBACK_MEMBER(apple1_state::apple1_kbd_poll) /* The keyboard strobe line should always be low when a scan starts. */ pia->ca1_w(0); - shiftkeys = machine().root_device().ioport("KEY4")->read() & 0x0003; - ctrlkeys = machine().root_device().ioport("KEY4")->read() & 0x000c; + shiftkeys = ioport("KEY4")->read() & 0x0003; + ctrlkeys = ioport("KEY4")->read() & 0x000c; for (port = 0; port < 4; port++) { UINT32 portval, newkeys; - portval = machine().root_device().ioport(keynames[port])->read(); + portval = ioport(keynames[port])->read(); newkeys = portval & ~(m_kbd_last_scan[port]); if (newkeys) diff --git a/src/mess/machine/apple2gs.c b/src/mess/machine/apple2gs.c index 206c9471a9a..56f72d259f5 100644 --- a/src/mess/machine/apple2gs.c +++ b/src/mess/machine/apple2gs.c @@ -850,7 +850,7 @@ static WRITE8_HANDLER( gssnd_w ) case 1: // data write if (state->m_sndglu_ctrl & 0x40) // docram access { - UINT8 *docram = space.machine().root_device().memregion("es5503")->base(); + UINT8 *docram = state->memregion("es5503")->base(); docram[state->m_sndglu_addr] = data; } else diff --git a/src/mess/machine/bbc.c b/src/mess/machine/bbc.c index 47711b2f1cc..087a3d10493 100644 --- a/src/mess/machine/bbc.c +++ b/src/mess/machine/bbc.c @@ -753,7 +753,7 @@ INTERRUPT_GEN_MEMBER(bbc_state::bbcb_keyscan) /* KBD IC4 8 input NAND gate */ /* set the value of via_system ca2, by checking for any keys being pressed on the selected m_column */ - if ((machine().root_device().ioport(colnames[m_column])->read() | 0x01) != 0xff) + if ((ioport(colnames[m_column])->read() | 0x01) != 0xff) { via_0->write_ca2(1); } @@ -793,7 +793,7 @@ INTERRUPT_GEN_MEMBER(bbc_state::bbcm_keyscan) /* KBD IC4 8 input NAND gate */ /* set the value of via_system ca2, by checking for any keys being pressed on the selected m_column */ - if ((machine().root_device().ioport(colnames[m_column])->read() | 0x01) != 0xff) + if ((ioport(colnames[m_column])->read() | 0x01) != 0xff) { via_0->write_ca2(1); } @@ -831,7 +831,7 @@ static int bbc_keyboard(address_space &space, int data) if (state->m_column < 10) { - res = space.machine().root_device().ioport(colnames[state->m_column])->read(); + res = state->ioport(colnames[state->m_column])->read(); } else { @@ -1155,7 +1155,7 @@ READ8_MEMBER(bbc_state::bbcb_via_system_read_portb) //logerror("SYSTEM read portb %d\n",0xf | input_port(machine, "IN0")|(TMSint<<6)|(TMSrdy<<7)); - return (0xf | machine().root_device().ioport("IN0")->read()|(TMSint<<6)|(TMSrdy<<7)); + return (0xf | ioport("IN0")->read()|(TMSint<<6)|(TMSrdy<<7)); } @@ -2007,9 +2007,9 @@ MACHINE_START_MEMBER(bbc_state,bbcb) m_mc6850_clock = 0; //removed from here because MACHINE_START can no longer read DIP swiches. //put in MACHINE_RESET instead. - //m_DFSType= (machine().root_device().ioport("BBCCONFIG")->read()>>0)&0x07; - //m_SWRAMtype=(machine().root_device().ioport("BBCCONFIG")->read()>>3)&0x03; - //m_RAMSize= (machine().root_device().ioport("BBCCONFIG")->read()>>5)&0x01; + //m_DFSType= (ioport("BBCCONFIG")->read()>>0)&0x07; + //m_SWRAMtype=(ioport("BBCCONFIG")->read()>>3)&0x03; + //m_RAMSize= (ioport("BBCCONFIG")->read()>>5)&0x01; /*set up the required disc controller*/ //switch (m_DFSType) { @@ -2025,9 +2025,9 @@ MACHINE_START_MEMBER(bbc_state,bbcb) MACHINE_RESET_MEMBER(bbc_state,bbcb) { UINT8 *ram = m_region_maincpu->base(); - m_DFSType= (machine().root_device().ioport("BBCCONFIG")->read() >> 0) & 0x07; - m_SWRAMtype = (machine().root_device().ioport("BBCCONFIG")->read() >> 3) & 0x03; - m_RAMSize= (machine().root_device().ioport("BBCCONFIG")->read() >> 5) & 0x01; + m_DFSType= (ioport("BBCCONFIG")->read() >> 0) & 0x07; + m_SWRAMtype = (ioport("BBCCONFIG")->read() >> 3) & 0x03; + m_RAMSize= (ioport("BBCCONFIG")->read() >> 5) & 0x01; m_bank1->set_base(ram); if (m_RAMSize) diff --git a/src/mess/machine/bebox.c b/src/mess/machine/bebox.c index fad7e783599..770f2b10f18 100644 --- a/src/mess/machine/bebox.c +++ b/src/mess/machine/bebox.c @@ -1040,7 +1040,7 @@ DRIVER_INIT_MEMBER(bebox_state,bebox) address_space &space_1 = machine().device("ppc2")->memory().space(AS_PROGRAM); /* set up boot and flash ROM */ - membank("bank2")->set_base(machine().root_device().memregion("user2")->base()); + membank("bank2")->set_base(memregion("user2")->base()); /* install MESS managed RAM */ space_0.install_readwrite_bank(0, machine().device<ram_device>(RAM_TAG)->size() - 1, 0, 0x02000000, "bank3"); diff --git a/src/mess/machine/bk.c b/src/mess/machine/bk.c index 19167582635..6536e84a268 100644 --- a/src/mess/machine/bk.c +++ b/src/mess/machine/bk.c @@ -23,7 +23,7 @@ TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) for(i = 1; i < 12; i++) { - code = machine().root_device().ioport(keynames[i-1])->read(); + code = ioport(keynames[i-1])->read(); if (code != 0) { for(j = 0; j < 8; j++) @@ -34,7 +34,7 @@ TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) break; } } - if ((machine().root_device().ioport("LINE0")->read() & 4) == 4) + if ((ioport("LINE0")->read() & 4) == 4) { if (i==6 || i==7) { @@ -42,7 +42,7 @@ TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) } } - if ((machine().root_device().ioport("LINE0")->read() & 4) == 4) + if ((ioport("LINE0")->read() & 4) == 4) { if (i>=8 && i<=11) { @@ -50,7 +50,7 @@ TIMER_CALLBACK_MEMBER(bk_state::keyboard_callback) } } m_key_pressed = 0x40; - if ((machine().root_device().ioport("LINE0")->read() & 2) == 0) + if ((ioport("LINE0")->read() & 2) == 0) { m_key_irq_vector = 0x30; } diff --git a/src/mess/machine/cgenie.c b/src/mess/machine/cgenie.c index 3272e305b59..0584b9e1f55 100644 --- a/src/mess/machine/cgenie.c +++ b/src/mess/machine/cgenie.c @@ -69,7 +69,7 @@ void cgenie_state::machine_reset() /* wipe out font RAM */ memset(&ROM[0x0f400], 0xff, 0x0400); - if( machine().root_device().ioport("DSW0")->read() & 0x80 ) + if( ioport("DSW0")->read() & 0x80 ) { logerror("cgenie floppy discs enabled\n"); } @@ -79,9 +79,9 @@ void cgenie_state::machine_reset() } /* copy DOS ROM, if enabled or wipe out that memory area */ - if( machine().root_device().ioport("DSW0")->read() & 0x40 ) + if( ioport("DSW0")->read() & 0x40 ) { - if ( machine().root_device().ioport("DSW0")->read() & 0x80 ) + if ( ioport("DSW0")->read() & 0x80 ) { space.install_read_bank(0xc000, 0xdfff, "bank10"); space.nop_write(0xc000, 0xdfff); @@ -99,22 +99,22 @@ void cgenie_state::machine_reset() { space.nop_readwrite(0xc000, 0xdfff); logerror("cgenie DOS disabled\n"); - memset(&machine().root_device().memregion("maincpu")->base()[0x0c000], 0x00, 0x2000); + memset(&memregion("maincpu")->base()[0x0c000], 0x00, 0x2000); } /* copy EXT ROM, if enabled or wipe out that memory area */ - if( machine().root_device().ioport("DSW0")->read() & 0x20 ) + if( ioport("DSW0")->read() & 0x20 ) { space.install_rom(0xe000, 0xefff, 0); // mess 0135u3 need to check logerror("cgenie EXT enabled\n"); - memcpy(&machine().root_device().memregion("maincpu")->base()[0x0e000], - &machine().root_device().memregion("maincpu")->base()[0x12000], 0x1000); + memcpy(&memregion("maincpu")->base()[0x0e000], + &memregion("maincpu")->base()[0x12000], 0x1000); } else { space.nop_readwrite(0xe000, 0xefff); logerror("cgenie EXT disabled\n"); - memset(&machine().root_device().memregion("maincpu")->base()[0x0e000], 0x00, 0x1000); + memset(&memregion("maincpu")->base()[0x0e000], 0x00, 0x1000); } m_cass_level = 0; @@ -279,13 +279,13 @@ READ8_HANDLER( cgenie_psg_port_b_r ) /* comparator value */ state->m_psg_b_inp = 0x00; - if( space.machine().root_device().ioport("JOY0")->read() > state->m_psg_a_out ) + if( state->ioport("JOY0")->read() > state->m_psg_a_out ) state->m_psg_b_inp |= 0x80; - if( space.machine().root_device().ioport("JOY1")->read() > state->m_psg_a_out ) + if( state->ioport("JOY1")->read() > state->m_psg_a_out ) state->m_psg_b_inp |= 0x40; - if( space.machine().root_device().ioport("JOY2")->read() > state->m_psg_a_out ) + if( state->ioport("JOY2")->read() > state->m_psg_a_out ) state->m_psg_b_inp |= 0x20; if( state->ioport("JOY3")->read() > state->m_psg_a_out ) @@ -297,22 +297,22 @@ READ8_HANDLER( cgenie_psg_port_b_r ) state->m_psg_b_inp = 0xFF; if( !(state->m_psg_a_out & 0x01) ) - state->m_psg_b_inp &= ~space.machine().root_device().ioport("KP0")->read(); + state->m_psg_b_inp &= ~state->ioport("KP0")->read(); if( !(state->m_psg_a_out & 0x02) ) - state->m_psg_b_inp &= ~space.machine().root_device().ioport("KP1")->read(); + state->m_psg_b_inp &= ~state->ioport("KP1")->read(); if( !(state->m_psg_a_out & 0x04) ) - state->m_psg_b_inp &= ~space.machine().root_device().ioport("KP2")->read(); + state->m_psg_b_inp &= ~state->ioport("KP2")->read(); if( !(state->m_psg_a_out & 0x08) ) - state->m_psg_b_inp &= ~space.machine().root_device().ioport("KP3")->read(); + state->m_psg_b_inp &= ~state->ioport("KP3")->read(); if( !(state->m_psg_a_out & 0x10) ) - state->m_psg_b_inp &= ~space.machine().root_device().ioport("KP4")->read(); + state->m_psg_b_inp &= ~state->ioport("KP4")->read(); if( !(state->m_psg_a_out & 0x20) ) - state->m_psg_b_inp &= ~space.machine().root_device().ioport("KP5")->read(); + state->m_psg_b_inp &= ~state->ioport("KP5")->read(); } return state->m_psg_b_inp; } diff --git a/src/mess/machine/coco.c b/src/mess/machine/coco.c index 9e424012a5e..2942a8e9916 100644 --- a/src/mess/machine/coco.c +++ b/src/mess/machine/coco.c @@ -101,11 +101,11 @@ coco_state::coco_state(const machine_config &mconfig, device_type type, const ch void coco_state::analog_port_start(analog_input_t *analog, const char *rx_tag, const char *ry_tag, const char *lx_tag, const char *ly_tag, const char *buttons_tag) { - analog->m_input[0][0] = machine().root_device().ioport(rx_tag); - analog->m_input[0][1] = machine().root_device().ioport(ry_tag); - analog->m_input[1][0] = machine().root_device().ioport(lx_tag); - analog->m_input[1][1] = machine().root_device().ioport(ly_tag); - analog->m_buttons = machine().root_device().ioport(buttons_tag); + analog->m_input[0][0] = ioport(rx_tag); + analog->m_input[0][1] = ioport(ry_tag); + analog->m_input[1][0] = ioport(lx_tag); + analog->m_input[1][1] = ioport(ly_tag); + analog->m_buttons = ioport(buttons_tag); } @@ -124,7 +124,7 @@ void coco_state::device_start() { char name[32]; snprintf(name, sizeof(name) / sizeof(name[0]), "row%d", i); - m_keyboard[i] = machine().root_device().ioport(name); + m_keyboard[i] = ioport(name); } /* look up analog ports */ @@ -136,8 +136,8 @@ void coco_state::device_start() DIECOM_LIGHTGUN_LX_TAG, DIECOM_LIGHTGUN_LY_TAG, DIECOM_LIGHTGUN_BUTTONS_TAG); /* look up miscellaneous controls */ - m_joystick_type_control = machine().root_device().ioport(CTRL_SEL_TAG); - m_joystick_hires_control = machine().root_device().ioport(HIRES_INTF_TAG); + m_joystick_type_control = ioport(CTRL_SEL_TAG); + m_joystick_hires_control = ioport(HIRES_INTF_TAG); /* timers */ m_hiresjoy_transition_timer[0] = timer_alloc(TIMER_HIRES_JOYSTICK_X); diff --git a/src/mess/machine/concept.c b/src/mess/machine/concept.c index 79f0e79c7d7..bef11c88cf6 100644 --- a/src/mess/machine/concept.c +++ b/src/mess/machine/concept.c @@ -216,7 +216,7 @@ READ8_MEMBER(concept_state::via_in_b) { UINT8 status; - status = ((machine().root_device().ioport("DSW0")->read() & 0x80) >> 1) | ((machine().root_device().ioport("DSW0")->read() & 0x40) << 1); + status = ((ioport("DSW0")->read() & 0x80) >> 1) | ((ioport("DSW0")->read() & 0x40) << 1); LOG(("via_in_b: VIA port B (DIP switches, Video, Comm Rate) - status: 0x%2.2x\n", status)); return status; } diff --git a/src/mess/machine/dgn_beta.c b/src/mess/machine/dgn_beta.c index b9fd833e968..f30b7dc1550 100644 --- a/src/mess/machine/dgn_beta.c +++ b/src/mess/machine/dgn_beta.c @@ -545,7 +545,7 @@ READ8_MEMBER(dgn_beta_state::d_pia0_pb_r) { for(Idx=0; Idx<NoKeyrows; Idx++) { - m_Keyboard[Idx] = machine().root_device().ioport(keynames[Idx])->read(); + m_Keyboard[Idx] = ioport(keynames[Idx])->read(); if(m_Keyboard[Idx] != 0x7F) m_KAny_next = 1; diff --git a/src/mess/machine/electron.c b/src/mess/machine/electron.c index 07ac7f6ff3b..8906cfe5dec 100644 --- a/src/mess/machine/electron.c +++ b/src/mess/machine/electron.c @@ -154,7 +154,7 @@ WRITE8_MEMBER(electron_state::electron_1mhz_w) READ8_MEMBER(electron_state::electron_ula_r) { - UINT8 data = ((UINT8 *)machine().root_device().memregion("user1")->base())[0x43E00 + offset]; + UINT8 data = ((UINT8 *)memregion("user1")->base())[0x43E00 + offset]; switch ( offset & 0x0f ) { case 0x00: /* Interrupt status */ diff --git a/src/mess/machine/hp48.c b/src/mess/machine/hp48.c index 012d71f367c..e87e3eea1dd 100644 --- a/src/mess/machine/hp48.c +++ b/src/mess/machine/hp48.c @@ -302,7 +302,7 @@ static void hp48_update_kdn( running_machine &machine ) TIMER_CALLBACK_MEMBER(hp48_state::hp48_kbd_cb) { /* NMI for ON key */ - if ( machine().root_device().ioport( "ON" )->read() ) + if ( ioport( "ON" )->read() ) { LOG(( "%f hp48_kbd_cb: keyboard interrupt, on key\n", machine().time().as_double() )); diff --git a/src/mess/machine/kaypro.c b/src/mess/machine/kaypro.c index b89b945216f..3b729ed402a 100644 --- a/src/mess/machine/kaypro.c +++ b/src/mess/machine/kaypro.c @@ -48,7 +48,7 @@ WRITE8_MEMBER( kaypro_state::common_pio_system_w ) { mem.unmap_readwrite (0x0000, 0x3fff); mem.install_read_bank (0x0000, 0x0fff, "bank1"); - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); + membank("bank1")->set_base(memregion("maincpu")->base()); mem.install_readwrite_handler (0x3000, 0x3fff, read8_delegate(FUNC(kaypro_state::kaypro_videoram_r), this), write8_delegate(FUNC(kaypro_state::kaypro_videoram_w), this)); } else @@ -56,8 +56,8 @@ WRITE8_MEMBER( kaypro_state::common_pio_system_w ) mem.unmap_readwrite(0x0000, 0x3fff); mem.install_read_bank (0x0000, 0x3fff, "bank2"); mem.install_write_bank (0x0000, 0x3fff, "bank3"); - membank("bank2")->set_base(machine().root_device().memregion("rambank")->base()); - membank("bank3")->set_base(machine().root_device().memregion("rambank")->base()); + membank("bank2")->set_base(memregion("rambank")->base()); + membank("bank3")->set_base(memregion("rambank")->base()); } wd17xx_dden_w(m_fdc, BIT(data, 5)); @@ -161,15 +161,15 @@ WRITE8_MEMBER( kaypro_state::kaypro2x_system_port_w ) { mem.unmap_readwrite (0x0000, 0x3fff); mem.install_read_bank (0x0000, 0x1fff, "bank1"); - membank("bank1")->set_base(mem.machine().root_device().memregion("maincpu")->base()); + membank("bank1")->set_base(memregion("maincpu")->base()); } else { mem.unmap_readwrite (0x0000, 0x3fff); mem.install_read_bank (0x0000, 0x3fff, "bank2"); mem.install_write_bank (0x0000, 0x3fff, "bank3"); - membank("bank2")->set_base(mem.machine().root_device().memregion("rambank")->base()); - membank("bank3")->set_base(mem.machine().root_device().memregion("rambank")->base()); + membank("bank2")->set_base(memregion("rambank")->base()); + membank("bank3")->set_base(memregion("rambank")->base()); } wd17xx_dden_w(m_fdc, BIT(data, 5)); diff --git a/src/mess/machine/kramermc.c b/src/mess/machine/kramermc.c index bae61782879..eeab9a5a5d0 100644 --- a/src/mess/machine/kramermc.c +++ b/src/mess/machine/kramermc.c @@ -21,7 +21,7 @@ READ8_MEMBER(kramermc_state::kramermc_port_b_r) { static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3", "LINE4", "LINE5", "LINE6", "LINE7" }; - return machine().root_device().ioport(keynames[m_key_row])->read(); + return ioport(keynames[m_key_row])->read(); } WRITE8_MEMBER(kramermc_state::kramermc_port_a_w) diff --git a/src/mess/machine/llc.c b/src/mess/machine/llc.c index e22bd01902c..de2cfbf9b8f 100644 --- a/src/mess/machine/llc.c +++ b/src/mess/machine/llc.c @@ -155,13 +155,13 @@ MACHINE_RESET_MEMBER(llc_state,llc2) address_space &space = m_maincpu->space(AS_PROGRAM); space.unmap_write(0x0000, 0x3fff); - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base()); + membank("bank1")->set_base(memregion("maincpu")->base()); space.unmap_write(0x4000, 0x5fff); - membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x4000); + membank("bank2")->set_base(memregion("maincpu")->base() + 0x4000); space.unmap_write(0x6000, 0xbfff); - membank("bank3")->set_base(machine().root_device().memregion("maincpu")->base() + 0x6000); + membank("bank3")->set_base(memregion("maincpu")->base() + 0x6000); space.install_write_bank(0xc000, 0xffff, "bank4"); membank("bank4")->set_base(machine().device<ram_device>(RAM_TAG)->pointer() + 0xc000); @@ -193,7 +193,7 @@ WRITE8_MEMBER(llc_state::llc2_basic_enable_w) if (data & 0x02) { mem_space.unmap_write(0x4000, 0x5fff); - membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000); + membank("bank2")->set_base(memregion("maincpu")->base() + 0x10000); } else { diff --git a/src/mess/machine/lviv.c b/src/mess/machine/lviv.c index aa842ebedab..fc9439a6156 100644 --- a/src/mess/machine/lviv.c +++ b/src/mess/machine/lviv.c @@ -100,21 +100,21 @@ READ8_MEMBER(lviv_state::lviv_ppi_1_porta_r) READ8_MEMBER(lviv_state::lviv_ppi_1_portb_r)/* keyboard reading */ { - return ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : machine().root_device().ioport("KEY0")->read()) & - ((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : machine().root_device().ioport("KEY1")->read()) & - ((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : machine().root_device().ioport("KEY2")->read()) & - ((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : machine().root_device().ioport("KEY3")->read()) & - ((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : machine().root_device().ioport("KEY4")->read()) & - ((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : machine().root_device().ioport("KEY5")->read()) & - ((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : machine().root_device().ioport("KEY6")->read()) & + return ((m_ppi_port_outputs[1][0] & 0x01) ? 0xff : ioport("KEY0")->read()) & + ((m_ppi_port_outputs[1][0] & 0x02) ? 0xff : ioport("KEY1")->read()) & + ((m_ppi_port_outputs[1][0] & 0x04) ? 0xff : ioport("KEY2")->read()) & + ((m_ppi_port_outputs[1][0] & 0x08) ? 0xff : ioport("KEY3")->read()) & + ((m_ppi_port_outputs[1][0] & 0x10) ? 0xff : ioport("KEY4")->read()) & + ((m_ppi_port_outputs[1][0] & 0x20) ? 0xff : ioport("KEY5")->read()) & + ((m_ppi_port_outputs[1][0] & 0x40) ? 0xff : ioport("KEY6")->read()) & ((m_ppi_port_outputs[1][0] & 0x80) ? 0xff : ioport("KEY7")->read()); } READ8_MEMBER(lviv_state::lviv_ppi_1_portc_r)/* keyboard reading */ { - return ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : machine().root_device().ioport("KEY8")->read()) & - ((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : machine().root_device().ioport("KEY9" )->read()) & - ((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : machine().root_device().ioport("KEY10")->read()) & + return ((m_ppi_port_outputs[1][2] & 0x01) ? 0xff : ioport("KEY8")->read()) & + ((m_ppi_port_outputs[1][2] & 0x02) ? 0xff : ioport("KEY9" )->read()) & + ((m_ppi_port_outputs[1][2] & 0x04) ? 0xff : ioport("KEY10")->read()) & ((m_ppi_port_outputs[1][2] & 0x08) ? 0xff : ioport("KEY11")->read()); } @@ -177,7 +177,7 @@ WRITE8_MEMBER(lviv_state::lviv_io_w) membank("bank1")->set_base(ram); membank("bank2")->set_base(ram + 0x4000); membank("bank3")->set_base(ram + 0x8000); - membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + 0x010000); + membank("bank4")->set_base(memregion("maincpu")->base() + 0x010000); } else { diff --git a/src/mess/machine/lynx.c b/src/mess/machine/lynx.c index 4f2976e2343..8ba27be1940 100644 --- a/src/mess/machine/lynx.c +++ b/src/mess/machine/lynx.c @@ -1038,7 +1038,7 @@ READ8_MEMBER(lynx_state::suzy_read) value = ioport("PAUSE")->read(); break; case RCART: - value = *(machine().root_device().memregion("user1")->base() + (m_suzy.high * m_granularity) + m_suzy.low); + value = *(memregion("user1")->base() + (m_suzy.high * m_granularity) + m_suzy.low); m_suzy.low = (m_suzy.low + 1) & (m_granularity - 1); break; //case RCART_BANK1: /* we need bank 1 emulation!!! */ @@ -1969,7 +1969,7 @@ void lynx_state::machine_start() save_pointer(NAME(m_mem_fe00.target()), m_mem_fe00.bytes()); machine().save().register_postload(save_prepost_delegate(FUNC(lynx_state::lynx_postload), this)); - membank("bank3")->configure_entry(0, machine().root_device().memregion("maincpu")->base() + 0x0000); + membank("bank3")->configure_entry(0, memregion("maincpu")->base() + 0x0000); membank("bank3")->configure_entry(1, m_mem_fe00); membank("bank4")->configure_entry(0, memregion("maincpu")->base() + 0x01fa); membank("bank4")->configure_entry(1, m_mem_fffa); diff --git a/src/mess/machine/mbee.c b/src/mess/machine/mbee.c index 2e786251065..3e244d91a16 100644 --- a/src/mess/machine/mbee.c +++ b/src/mess/machine/mbee.c @@ -756,7 +756,7 @@ QUICKLOAD_LOAD( mbee ) device_t *cpu = state->m_maincpu; address_space &space = state->m_maincpu->space(AS_PROGRAM); UINT16 i, j; - UINT8 data, sw = image.device().machine().root_device().ioport("CONFIG")->read() & 1; /* reading the dipswitch: 1 = autorun */ + UINT8 data, sw = state->ioport("CONFIG")->read() & 1; /* reading the dipswitch: 1 = autorun */ if (!mame_stricmp(image.filetype(), "mwb")) { @@ -835,7 +835,7 @@ QUICKLOAD_LOAD( mbee_z80bin ) if (execute_address != 0xffff) { /* check to see if autorun is on (I hate how this works) */ - autorun = image.device().machine().root_device().ioport("CONFIG")->read_safe(0xFF) & 1; + autorun = state->ioport("CONFIG")->read_safe(0xFF) & 1; device_t *cpu = state->m_maincpu; address_space &space = state->m_maincpu->space(AS_PROGRAM); diff --git a/src/mess/machine/mboard.c b/src/mess/machine/mboard.c index 9eb49144fe7..55385eba0cf 100644 --- a/src/mess/machine/mboard.c +++ b/src/mess/machine/mboard.c @@ -322,14 +322,14 @@ void mboard_state::check_board_buttons() /* check click on border pieces */ i=0; - port_input=machine().root_device().ioport("B_BLACK")->read(); + port_input=ioport("B_BLACK")->read(); if (port_input) { i=get_first_bit(port_input)+6; click_on_border_piece=TRUE; } - port_input=machine().root_device().ioport("B_WHITE")->read(); + port_input=ioport("B_WHITE")->read(); if (port_input) { i=get_first_bit(port_input); @@ -366,7 +366,7 @@ void mboard_state::check_board_buttons() /* check click on board */ - data = machine().root_device().ioport(keynames[board_row])->read_safe(0xff); + data = ioport(keynames[board_row])->read_safe(0xff); if ((data != 0xff) && (!mouse_down) ) { @@ -412,7 +412,7 @@ void mboard_state::check_board_buttons() mouse_down = 0; /* check click on border - remove selected piece*/ - if (machine().root_device().ioport("LINE10")->read_safe(0x01)) + if (ioport("LINE10")->read_safe(0x01)) { if (mouse_hold_piece) { @@ -432,7 +432,7 @@ void mboard_state::check_board_buttons() /* check additional buttons */ if (data == 0xff) { - port_input=machine().root_device().ioport("B_BUTTONS")->read(); + port_input=ioport("B_BUTTONS")->read(); if (port_input==0x01) { clear_board(); diff --git a/src/mess/machine/microtan.c b/src/mess/machine/microtan.c index 38edfa7b42c..d27975c269a 100644 --- a/src/mess/machine/microtan.c +++ b/src/mess/machine/microtan.c @@ -163,7 +163,7 @@ static cassette_image_device *cassette_device_image(running_machine &machine) **************************************************************/ READ8_MEMBER(microtan_state::via_0_in_a) { - int data = machine().root_device().ioport("JOY")->read(); + int data = ioport("JOY")->read(); LOG(("microtan_via_0_in_a %02X\n", data)); return data; } @@ -436,12 +436,12 @@ INTERRUPT_GEN_MEMBER(microtan_state::microtan_interrupt) row = 9; - newvar = machine().root_device().ioport("ROW8")->read(); + newvar = ioport("ROW8")->read(); chg = m_keyrows[--row] ^ newvar; while ( !chg && row > 0) { - newvar = machine().root_device().ioport(keynames[row - 1])->read(); + newvar = ioport(keynames[row - 1])->read(); chg = m_keyrows[--row] ^ newvar; } if (!chg) @@ -574,7 +574,7 @@ void microtan_state::machine_reset() for (i = 1; i < 10; i++) { - m_keyrows[i] = machine().root_device().ioport(keynames[i-1])->read(); + m_keyrows[i] = ioport(keynames[i-1])->read(); } set_led_status(machine(), 1, (m_keyrows[3] & 0x80) ? 0 : 1); } diff --git a/src/mess/machine/mtx.c b/src/mess/machine/mtx.c index 539f4bb5c26..f2243b4d98b 100644 --- a/src/mess/machine/mtx.c +++ b/src/mess/machine/mtx.c @@ -375,7 +375,7 @@ MACHINE_START_MEMBER(mtx_state,mtx512) m_cassette = machine().device<cassette_image_device>(CASSETTE_TAG); /* configure memory */ - membank("bank1")->set_base(machine().root_device().memregion("user1")->base()); + membank("bank1")->set_base(memregion("user1")->base()); membank("bank2")->configure_entries(0, 8, memregion("user2")->base(), 0x2000); membank("bank3")->configure_entries(0, messram->size()/0x4000/2, messram->pointer(), 0x4000); membank("bank4")->configure_entries(0, messram->size()/0x4000/2, messram->pointer() + messram->size()/2, 0x4000); diff --git a/src/mess/machine/mz700.c b/src/mess/machine/mz700.c index b89d23f2add..2a253131280 100644 --- a/src/mess/machine/mz700.c +++ b/src/mess/machine/mz700.c @@ -146,7 +146,7 @@ READ8_MEMBER(mz_state::mz800_bank_0_r) /* switch in cgrom */ spc.install_read_bank(0x1000, 0x1fff, "bank2"); spc.nop_write(0x1000, 0x1fff); - membank("bank2")->set_base(machine().root_device().memregion("monitor")->base() + 0x1000); + membank("bank2")->set_base(memregion("monitor")->base() + 0x1000); if (m_mz700_mode) { @@ -250,7 +250,7 @@ WRITE8_MEMBER(mz_state::mz700_bank_2_w) spc.install_read_bank(0x0000, 0x0fff, "bank1"); spc.nop_write(0x0000, 0x0fff); - membank("bank1")->set_base(machine().root_device().memregion("monitor")->base()); + membank("bank1")->set_base(memregion("monitor")->base()); } WRITE8_MEMBER(mz_state::mz700_bank_3_w) @@ -294,7 +294,7 @@ WRITE8_MEMBER(mz_state::mz700_bank_3_w) /* switch in mz800 monitor rom if not locked */ spc.install_read_bank(0xe000, 0xffff, "bank8"); spc.nop_write(0xe000, 0xffff); - membank("bank8")->set_base(machine().root_device().memregion("monitor")->base() + 0x2000); + membank("bank8")->set_base(memregion("monitor")->base() + 0x2000); m_mz800_ram_monitor = TRUE; } } @@ -320,7 +320,7 @@ WRITE8_MEMBER(mz_state::mz700_bank_4_w) /* monitor rom and cgrom */ spc.install_read_bank(0x0000, 0x1fff, "bank1"); spc.nop_write(0x0000, 0x1fff); - membank("bank1")->set_base(machine().root_device().memregion("monitor")->base()); + membank("bank1")->set_base(memregion("monitor")->base()); /* ram from 0x2000 to 0x7fff */ spc.install_readwrite_bank(0x2000, 0x7fff, "bank3"); @@ -350,7 +350,7 @@ WRITE8_MEMBER(mz_state::mz700_bank_4_w) /* mz800 monitor rom from 0xe000 to 0xffff */ spc.install_read_bank(0xe000, 0xffff, "bank8"); spc.nop_write(0xe000, 0xffff); - membank("bank8")->set_base(machine().root_device().memregion("monitor")->base() + 0x2000); + membank("bank8")->set_base(memregion("monitor")->base() + 0x2000); m_mz800_ram_monitor = TRUE; m_mz800_ram_lock = FALSE; /* reset lock? */ @@ -436,7 +436,7 @@ READ8_MEMBER(mz_state::pio_port_b_r) for(i=0;i<10;i++) { if(key_line & (1 << i)) - res |= machine().root_device().ioport(keynames[i])->read(); + res |= ioport(keynames[i])->read(); } return res; @@ -583,7 +583,7 @@ READ8_MEMBER(mz_state::mz800_crtc_r) /* port EA */ READ8_MEMBER(mz_state::mz800_ramdisk_r) { - UINT8 *mem = space.machine().root_device().memregion("user1")->base(); + UINT8 *mem = memregion("user1")->base(); UINT8 data = mem[m_mz800_ramaddr]; LOG(2,"mz800_ramdisk_r",("[%04X] -> %02X\n", m_mz800_ramaddr, data),machine()); if (m_mz800_ramaddr++ == 0) diff --git a/src/mess/machine/nes.c b/src/mess/machine/nes.c index 0ea2800d18a..935211186f5 100644 --- a/src/mess/machine/nes.c +++ b/src/mess/machine/nes.c @@ -41,8 +41,8 @@ void nes_state::init_nes_core() m_vram_chunks = 0; m_pcb_id = NO_BOARD; - m_rom = machine().root_device().memregion("maincpu")->base(); - m_ciram = machine().root_device().memregion("ciram")->base(); + m_rom = memregion("maincpu")->base(); + m_ciram = memregion("ciram")->base(); // other pointers got set in the loading routine /* Brutal hack put in as a consequence of the new memory system; we really need to fix the NES code */ diff --git a/src/mess/machine/oric.c b/src/mess/machine/oric.c index 88d4166bd31..ce5c4fde484 100644 --- a/src/mess/machine/oric.c +++ b/src/mess/machine/oric.c @@ -1295,7 +1295,7 @@ READ8_MEMBER(oric_state::telestrat_via2_in_b_func) /* right joystick selected? */ if (m_telestrat_via2_port_b_data & (1<<7)) { - data &= machine().root_device().ioport("JOY1")->read(); + data &= ioport("JOY1")->read(); } data |= m_telestrat_via2_port_b_data & ((1<<7) | (1<<6) | (1<<5)); diff --git a/src/mess/machine/pc.c b/src/mess/machine/pc.c index e412167011f..e8fef360d17 100644 --- a/src/mess/machine/pc.c +++ b/src/mess/machine/pc.c @@ -779,7 +779,7 @@ READ8_MEMBER(pc_state::ibm5160_ppi_porta_r) * 01 - color 40x25 * 6-7 The number of floppy disk drives */ - data = machine().root_device().ioport("DSW0")->read(); + data = ioport("DSW0")->read(); } else { @@ -802,13 +802,13 @@ READ8_MEMBER(pc_state::ibm5160_ppi_portc_r) if (m_ppi_portc_switch_high) { /* read hi nibble of S2 */ - data = (data & 0xf0) | ((machine().root_device().ioport("DSW0")->read() >> 4) & 0x0f); + data = (data & 0xf0) | ((ioport("DSW0")->read() >> 4) & 0x0f); PIO_LOG(1,"PIO_C_r (hi)",("$%02x\n", data)); } else { /* read lo nibble of S2 */ - data = (data & 0xf0) | (machine().root_device().ioport("DSW0")->read() & 0x0f); + data = (data & 0xf0) | (ioport("DSW0")->read() & 0x0f); PIO_LOG(1,"PIO_C_r (lo)",("$%02x\n", data)); } @@ -872,7 +872,7 @@ READ8_MEMBER(pc_state::pc_ppi_porta_r) * 01 - color 40x25 * 6-7 The number of floppy disk drives */ - data = machine().root_device().ioport("DSW0")->read(); + data = ioport("DSW0")->read(); } else { @@ -924,18 +924,18 @@ TIMER_CALLBACK_MEMBER(pc_state::mc1502_keyb_signal_callback) { UINT8 key = 0; - key |= machine().root_device().ioport("Y1")->read(); - key |= machine().root_device().ioport("Y2")->read(); - key |= machine().root_device().ioport("Y3")->read(); - key |= machine().root_device().ioport("Y4")->read(); - key |= machine().root_device().ioport("Y5")->read(); - key |= machine().root_device().ioport("Y6")->read(); - key |= machine().root_device().ioport("Y7")->read(); - key |= machine().root_device().ioport("Y8")->read(); - key |= machine().root_device().ioport("Y9")->read(); - key |= machine().root_device().ioport("Y10")->read(); - key |= machine().root_device().ioport("Y11")->read(); - key |= machine().root_device().ioport("Y12")->read(); + key |= ioport("Y1")->read(); + key |= ioport("Y2")->read(); + key |= ioport("Y3")->read(); + key |= ioport("Y4")->read(); + key |= ioport("Y5")->read(); + key |= ioport("Y6")->read(); + key |= ioport("Y7")->read(); + key |= ioport("Y8")->read(); + key |= ioport("Y9")->read(); + key |= ioport("Y10")->read(); + key |= ioport("Y11")->read(); + key |= ioport("Y12")->read(); // DBG_LOG(1,"mc1502_k_s_c",("= %02X (%d) %s\n", key, mc1502_keyb.pulsing, // (key || mc1502_keyb.pulsing) ? " will IRQ" : "")); @@ -1002,18 +1002,18 @@ READ8_MEMBER(pc_state::mc1502_kppi_porta_r) { UINT8 key = 0; - if (mc1502_keyb.mask & 0x0001) { key |= machine().root_device().ioport("Y1")->read(); } - if (mc1502_keyb.mask & 0x0002) { key |= machine().root_device().ioport("Y2")->read(); } - if (mc1502_keyb.mask & 0x0004) { key |= machine().root_device().ioport("Y3")->read(); } - if (mc1502_keyb.mask & 0x0008) { key |= machine().root_device().ioport("Y4")->read(); } - if (mc1502_keyb.mask & 0x0010) { key |= machine().root_device().ioport("Y5")->read(); } - if (mc1502_keyb.mask & 0x0020) { key |= machine().root_device().ioport("Y6")->read(); } - if (mc1502_keyb.mask & 0x0040) { key |= machine().root_device().ioport("Y7")->read(); } - if (mc1502_keyb.mask & 0x0080) { key |= machine().root_device().ioport("Y8")->read(); } - if (mc1502_keyb.mask & 0x0100) { key |= machine().root_device().ioport("Y9")->read(); } - if (mc1502_keyb.mask & 0x0200) { key |= machine().root_device().ioport("Y10")->read(); } - if (mc1502_keyb.mask & 0x0400) { key |= machine().root_device().ioport("Y11")->read(); } - if (mc1502_keyb.mask & 0x0800) { key |= machine().root_device().ioport("Y12")->read(); } + if (mc1502_keyb.mask & 0x0001) { key |= ioport("Y1")->read(); } + if (mc1502_keyb.mask & 0x0002) { key |= ioport("Y2")->read(); } + if (mc1502_keyb.mask & 0x0004) { key |= ioport("Y3")->read(); } + if (mc1502_keyb.mask & 0x0008) { key |= ioport("Y4")->read(); } + if (mc1502_keyb.mask & 0x0010) { key |= ioport("Y5")->read(); } + if (mc1502_keyb.mask & 0x0020) { key |= ioport("Y6")->read(); } + if (mc1502_keyb.mask & 0x0040) { key |= ioport("Y7")->read(); } + if (mc1502_keyb.mask & 0x0080) { key |= ioport("Y8")->read(); } + if (mc1502_keyb.mask & 0x0100) { key |= ioport("Y9")->read(); } + if (mc1502_keyb.mask & 0x0200) { key |= ioport("Y10")->read(); } + if (mc1502_keyb.mask & 0x0400) { key |= ioport("Y11")->read(); } + if (mc1502_keyb.mask & 0x0800) { key |= ioport("Y12")->read(); } key ^= 0xff; // DBG_LOG(2,"mc1502_kppi_porta_r",("= %02X\n", key)); return key; @@ -1374,8 +1374,8 @@ DRIVER_INIT_MEMBER(pc_state,pcmda) DRIVER_INIT_MEMBER(pc_state,europc) { - UINT8 *gfx = &machine().root_device().memregion("gfx1")->base()[0x8000]; - UINT8 *rom = &machine().root_device().memregion("maincpu")->base()[0]; + UINT8 *gfx = &memregion("gfx1")->base()[0x8000]; + UINT8 *rom = &memregion("maincpu")->base()[0]; int i; /* just a plain bit pattern for graphics data generation */ @@ -1407,7 +1407,7 @@ DRIVER_INIT_MEMBER(pc_state,t1000hx) DRIVER_INIT_MEMBER(pc_state,pc200) { - UINT8 *gfx = &machine().root_device().memregion("gfx1")->base()[0x8000]; + UINT8 *gfx = &memregion("gfx1")->base()[0x8000]; int i; /* just a plain bit pattern for graphics data generation */ @@ -1419,7 +1419,7 @@ DRIVER_INIT_MEMBER(pc_state,pc200) DRIVER_INIT_MEMBER(pc_state,ppc512) { - UINT8 *gfx = &machine().root_device().memregion("gfx1")->base()[0x8000]; + UINT8 *gfx = &memregion("gfx1")->base()[0x8000]; int i; /* just a plain bit pattern for graphics data generation */ @@ -1430,7 +1430,7 @@ DRIVER_INIT_MEMBER(pc_state,ppc512) } DRIVER_INIT_MEMBER(pc_state,pc1512) { - UINT8 *gfx = &machine().root_device().memregion("gfx1")->base()[0x8000]; + UINT8 *gfx = &memregion("gfx1")->base()[0x8000]; int i; /* just a plain bit pattern for graphics data generation */ @@ -1586,7 +1586,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pc_state, pcjr_cartridge ) size = image.get_software_region_length("rom" ); - memcpy( image.device().machine().root_device().memregion("maincpu")->base() + address, cart, size ); + memcpy( memregion("maincpu")->base() + address, cart, size ); } else { @@ -1615,7 +1615,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pc_state, pcjr_cartridge ) } /* Read the cartridge contents */ - if ( ( image_size - 0x200 ) != image.fread(image.device().machine().root_device().memregion("maincpu")->base() + address, image_size - 0x200 ) ) + if ( ( image_size - 0x200 ) != image.fread(memregion("maincpu")->base() + address, image_size - 0x200 ) ) { image.seterror(IMAGE_ERROR_UNSUPPORTED, "Unable to read cartridge contents" ); return IMAGE_INIT_FAIL; diff --git a/src/mess/machine/pc1350.c b/src/mess/machine/pc1350.c index 527e2e01e00..d652cfe103c 100644 --- a/src/mess/machine/pc1350.c +++ b/src/mess/machine/pc1350.c @@ -119,7 +119,7 @@ void pc1350_state::machine_start() } device_t *main_cpu = m_maincpu; - UINT8 *ram = machine().root_device().memregion("maincpu")->base() + 0x2000; + UINT8 *ram = memregion("maincpu")->base() + 0x2000; UINT8 *cpu = sc61860_internal_ram(main_cpu); machine().device<nvram_device>("cpu_nvram")->set_base(cpu, 96); diff --git a/src/mess/machine/pc1403.c b/src/mess/machine/pc1403.c index 8d89b4820fc..ed1b842a44f 100644 --- a/src/mess/machine/pc1403.c +++ b/src/mess/machine/pc1403.c @@ -154,7 +154,7 @@ TIMER_CALLBACK_MEMBER(pc1403_state::pc1403_power_up) DRIVER_INIT_MEMBER(pc1403_state,pc1403) { int i; - UINT8 *gfx=machine().root_device().memregion("gfx1")->base(); + UINT8 *gfx=memregion("gfx1")->base(); for (i=0; i<128; i++) gfx[i]=i; diff --git a/src/mess/machine/pce.c b/src/mess/machine/pce.c index 332ab640d44..5316de36876 100644 --- a/src/mess/machine/pce.c +++ b/src/mess/machine/pce.c @@ -306,7 +306,7 @@ MACHINE_RESET_MEMBER(pce_state,mess_pce) /* Note: Arcade Card BIOS contents are the same as System 3, only internal HW differs. We use a category to select between modes (some games can be run in either S-CD or A-CD modes) */ - m_acard = machine().root_device().ioport("A_CARD")->read() & 1; + m_acard = ioport("A_CARD")->read() & 1; } /* todo: how many input ports does the PCE have? */ diff --git a/src/mess/machine/pokemini.c b/src/mess/machine/pokemini.c index 6089e983732..d89c17abc99 100644 --- a/src/mess/machine/pokemini.c +++ b/src/mess/machine/pokemini.c @@ -1383,7 +1383,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pokemini_state, pokemini_cart ) image.fseek(0x2100, SEEK_SET); size -= 0x2100; - if (size != image.fread( image.device().machine().root_device().memregion("maincpu")->base() + 0x2100, size)) + if (size != image.fread( memregion("maincpu")->base() + 0x2100, size)) { image.seterror(IMAGE_ERROR_UNSPECIFIED, "Error occurred while reading ROM image"); return IMAGE_INIT_FAIL; @@ -1393,7 +1393,7 @@ DEVICE_IMAGE_LOAD_MEMBER( pokemini_state, pokemini_cart ) { UINT8 *cart_rom = image.get_software_region("rom"); UINT32 cart_rom_size = image.get_software_region_length("rom"); - memcpy(image.device().machine().root_device().memregion("maincpu")->base() + 0x2100, cart_rom + 0x2100, cart_rom_size - 0x2100); + memcpy(memregion("maincpu")->base() + 0x2100, cart_rom + 0x2100, cart_rom_size - 0x2100); } return IMAGE_INIT_PASS; diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c index c02cc3f9546..cdacca5a0db 100644 --- a/src/mess/machine/poly88.c +++ b/src/mess/machine/poly88.c @@ -140,7 +140,7 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) int data; int current_level; -// if (!(machine().root_device().ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ +// if (!(ioport("DSW0")->read() & 0x02)) /* V.24 / Tape Switch */ //{ /* tape reading */ if (m_cassette->get_state()&CASSETTE_PLAY) diff --git a/src/mess/machine/pp01.c b/src/mess/machine/pp01.c index eb7754b0c5c..5378a4ed070 100644 --- a/src/mess/machine/pp01.c +++ b/src/mess/machine/pp01.c @@ -201,7 +201,7 @@ READ8_MEMBER(pp01_state::pp01_8255_portb_r) "LINE8", "LINE9", "LINEA", "LINEB", "LINEC", "LINED", "LINEE", "LINEF" }; - return (machine().root_device().ioport(keynames[m_key_line])->read() & 0x3F) | (machine().root_device().ioport("LINEALL")->read() & 0xC0); + return (ioport(keynames[m_key_line])->read() & 0x3F) | (ioport("LINEALL")->read() & 0xC0); } WRITE8_MEMBER(pp01_state::pp01_8255_portb_w) { diff --git a/src/mess/machine/rmnimbus.c b/src/mess/machine/rmnimbus.c index 109e1eb07de..841f8b1edbf 100644 --- a/src/mess/machine/rmnimbus.c +++ b/src/mess/machine/rmnimbus.c @@ -2861,9 +2861,9 @@ TIMER_CALLBACK_MEMBER(rmnimbus_state::mouse_callback) mouse_joy_state *state = &m_nimbus_mouse; - state->m_reg0a4 = machine().root_device().ioport(MOUSE_BUTTON_TAG)->read() | 0xC0; - x = machine().root_device().ioport(MOUSEX_TAG)->read(); - y = machine().root_device().ioport(MOUSEY_TAG)->read(); + state->m_reg0a4 = ioport(MOUSE_BUTTON_TAG)->read() | 0xC0; + x = ioport(MOUSEX_TAG)->read(); + y = ioport(MOUSEY_TAG)->read(); UINT8 mxa; UINT8 mxb; diff --git a/src/mess/machine/samcoupe.c b/src/mess/machine/samcoupe.c index 2bd8b49ae23..65e1fd37d2f 100644 --- a/src/mess/machine/samcoupe.c +++ b/src/mess/machine/samcoupe.c @@ -327,7 +327,7 @@ void samcoupe_state::machine_reset() m_mouse_data[0] = 0xff; m_mouse_data[1] = 0xff; - if (machine().root_device().ioport("config")->read() & 0x01) + if (ioport("config")->read() & 0x01) { /* install RTC */ spaceio.install_readwrite_handler(0xef, 0xef, 0xffff, 0xff00, read8_delegate(FUNC(samcoupe_state::samcoupe_rtc_r),this), write8_delegate(FUNC(samcoupe_state::samcoupe_rtc_w),this)); diff --git a/src/mess/machine/thomson.c b/src/mess/machine/thomson.c index db2d65a0e11..fcd8e2c0b4a 100644 --- a/src/mess/machine/thomson.c +++ b/src/mess/machine/thomson.c @@ -358,7 +358,7 @@ void thomson_state::thom_set_caps_led( int led ) DEVICE_IMAGE_LOAD_MEMBER( thomson_state, to7_cartridge ) { int i,j; - UINT8* pos = image.device().machine().root_device().memregion("maincpu" )->base() + 0x10000; + UINT8* pos = memregion("maincpu" )->base() + 0x10000; offs_t size; char name[129]; diff --git a/src/mess/machine/ti85.c b/src/mess/machine/ti85.c index e37bcca2178..ea03f530ff8 100644 --- a/src/mess/machine/ti85.c +++ b/src/mess/machine/ti85.c @@ -17,7 +17,7 @@ TIMER_CALLBACK_MEMBER(ti85_state::ti85_timer_callback) { - if (machine().root_device().ioport("ON")->read() & 0x01) + if (ioport("ON")->read() & 0x01) { if (m_ON_interrupt_mask && !m_ON_pressed) { diff --git a/src/mess/machine/vector06.c b/src/mess/machine/vector06.c index e41e7152778..2ac6b26ea3a 100644 --- a/src/mess/machine/vector06.c +++ b/src/mess/machine/vector06.c @@ -138,11 +138,11 @@ IRQ_CALLBACK_MEMBER(vector06_state::vector06_irq_callback) TIMER_CALLBACK_MEMBER(vector06_state::reset_check_callback) { - UINT8 val = machine().root_device().ioport("RESET")->read(); + UINT8 val = ioport("RESET")->read(); if (BIT(val, 0)) { - membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + 0x10000); + membank("bank1")->set_base(memregion("maincpu")->base() + 0x10000); m_maincpu->reset(); } diff --git a/src/mess/machine/vtech2.c b/src/mess/machine/vtech2.c index 8cb5d0507b4..307cd0038b9 100644 --- a/src/mess/machine/vtech2.c +++ b/src/mess/machine/vtech2.c @@ -59,7 +59,7 @@ static const char *const mwa_bank_hard[4] = DRIVER_INIT_MEMBER(vtech2_state,laser) { - UINT8 *gfx = machine().root_device().memregion("gfx2")->base(); + UINT8 *gfx = memregion("gfx2")->base(); int i; m_laser_track_x2[0] = m_laser_track_x2[1] = 80; @@ -200,33 +200,33 @@ int vtech2_state::mra_bank(int bank, int offs) { if( (offs & 0x0300) == 0x0000 ) /* keyboard row A */ { - if( machine().root_device().ioport("ROWA")->read() != m_row_a ) + if( ioport("ROWA")->read() != m_row_a ) { - m_row_a = machine().root_device().ioport("ROWA")->read(); + m_row_a = ioport("ROWA")->read(); data &= m_row_a; } } if( (offs & 0x0300) == 0x0100 ) /* keyboard row B */ { - if( machine().root_device().ioport("ROWB")->read() != m_row_b ) + if( ioport("ROWB")->read() != m_row_b ) { - m_row_b = machine().root_device().ioport("ROWB")->read(); + m_row_b = ioport("ROWB")->read(); data &= m_row_b; } } if( (offs & 0x0300) == 0x0200 ) /* keyboard row C */ { - if( machine().root_device().ioport("ROWC")->read() != m_row_c ) + if( ioport("ROWC")->read() != m_row_c ) { - m_row_c = machine().root_device().ioport("ROWC")->read(); + m_row_c = ioport("ROWC")->read(); data &= m_row_c; } } if( (offs & 0x0300) == 0x0300 ) /* keyboard row D */ { - if( machine().root_device().ioport("ROWD")->read() != m_row_d ) + if( ioport("ROWD")->read() != m_row_d ) { - m_row_d = machine().root_device().ioport("ROWD")->read(); + m_row_d = ioport("ROWD")->read(); data &= m_row_d; } } @@ -235,21 +235,21 @@ int vtech2_state::mra_bank(int bank, int offs) { /* All Lasers keyboard rows 0 through 7 */ if( !(offs & 0x01) ) - data &= machine().root_device().ioport("ROW0")->read(); + data &= ioport("ROW0")->read(); if( !(offs & 0x02) ) - data &= machine().root_device().ioport("ROW1")->read(); + data &= ioport("ROW1")->read(); if( !(offs & 0x04) ) - data &= machine().root_device().ioport("ROW2")->read(); + data &= ioport("ROW2")->read(); if( !(offs & 0x08) ) - data &= machine().root_device().ioport("ROW3")->read(); + data &= ioport("ROW3")->read(); if( !(offs & 0x10) ) - data &= machine().root_device().ioport("ROW4")->read(); + data &= ioport("ROW4")->read(); if( !(offs & 0x20) ) - data &= machine().root_device().ioport("ROW5")->read(); + data &= ioport("ROW5")->read(); if( !(offs & 0x40) ) - data &= machine().root_device().ioport("ROW6")->read(); + data &= ioport("ROW6")->read(); if( !(offs & 0x80) ) - data &= machine().root_device().ioport("ROW7")->read(); + data &= ioport("ROW7")->read(); } /* what's bit 7 good for? tape input maybe? */ diff --git a/src/mess/video/fmtowns.c b/src/mess/video/fmtowns.c index 4ee6b4c0ddb..de9796d9e8a 100644 --- a/src/mess/video/fmtowns.c +++ b/src/mess/video/fmtowns.c @@ -249,7 +249,7 @@ static void towns_update_kanji_offset(running_machine &machine) READ8_MEMBER( towns_state::towns_video_cff80_r ) { - UINT8* ROM = space.machine().root_device().memregion("user")->base(); + UINT8* ROM = memregion("user")->base(); switch(offset) { @@ -592,7 +592,7 @@ READ8_MEMBER(towns_state::towns_video_unknown_r) READ8_MEMBER(towns_state::towns_spriteram_low_r) { UINT8* RAM = m_messram->pointer(); - UINT8* ROM = space.machine().root_device().memregion("user")->base(); + UINT8* ROM = memregion("user")->base(); if(offset < 0x1000) { // 0xc8000-0xc8fff diff --git a/src/mess/video/mbee.c b/src/mess/video/mbee.c index 9779edd15c0..9b685d8b142 100644 --- a/src/mess/video/mbee.c +++ b/src/mess/video/mbee.c @@ -372,24 +372,24 @@ WRITE8_MEMBER ( mbee_state::m6545_data_w ) VIDEO_START_MEMBER(mbee_state,mbee) { - m_p_videoram = machine().root_device().memregion("videoram")->base(); + m_p_videoram = memregion("videoram")->base(); m_p_gfxram = memregion("gfx")->base()+0x1000; m_is_premium = 0; } VIDEO_START_MEMBER(mbee_state,mbeeic) { - m_p_videoram = machine().root_device().memregion("videoram")->base(); - m_p_colorram = machine().root_device().memregion("colorram")->base(); + m_p_videoram = memregion("videoram")->base(); + m_p_colorram = memregion("colorram")->base(); m_p_gfxram = memregion("gfx")->base()+0x1000; m_is_premium = 0; } VIDEO_START_MEMBER(mbee_state,mbeeppc) { - m_p_videoram = machine().root_device().memregion("videoram")->base(); - m_p_colorram = machine().root_device().memregion("colorram")->base(); - m_p_gfxram = machine().root_device().memregion("gfx")->base()+0x1000; + m_p_videoram = memregion("videoram")->base(); + m_p_colorram = memregion("colorram")->base(); + m_p_gfxram = memregion("gfx")->base()+0x1000; m_p_attribram = memregion("attrib")->base(); m_is_premium = 1; } @@ -563,7 +563,7 @@ MC6845_UPDATE_ROW( mbeeppc_update_row ) PALETTE_INIT_MEMBER(mbee_state,mbeeic) { - const UINT8 *color_prom = machine().root_device().memregion("proms")->base(); + const UINT8 *color_prom = memregion("proms")->base(); UINT16 i; UINT8 r, b, g, k; UINT8 level[] = { 0, 0x80, 0xff, 0xff }; /* off, half, full intensity */ @@ -591,7 +591,7 @@ PALETTE_INIT_MEMBER(mbee_state,mbeeic) PALETTE_INIT_MEMBER(mbee_state,mbeepc85b) { - const UINT8 *color_prom = machine().root_device().memregion("proms")->base(); + const UINT8 *color_prom = memregion("proms")->base(); UINT16 i; UINT8 r, b, g, k; UINT8 level[] = { 0, 0x80, 0x80, 0xff }; /* off, half, full intensity */ diff --git a/src/mess/video/nes.c b/src/mess/video/nes.c index c8f7de30d96..8ea20a2b949 100644 --- a/src/mess/video/nes.c +++ b/src/mess/video/nes.c @@ -42,7 +42,7 @@ UINT32 nes_state::screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, if (m_disk_expansion && m_pcb_id == NO_BOARD) { // latch this input so it doesn't go at warp speed - if ((machine().root_device().ioport("FLIPDISK")->read() & 0x01) && (!m_last_frame_flip)) + if ((ioport("FLIPDISK")->read() & 0x01) && (!m_last_frame_flip)) { m_last_frame_flip = 1; m_fds_current_side++; @@ -55,7 +55,7 @@ UINT32 nes_state::screen_update_nes(screen_device &screen, bitmap_ind16 &bitmap, popmessage("Disk set to side %d", m_fds_current_side); } - if (!(machine().root_device().ioport("FLIPDISK")->read() & 0x01)) + if (!(ioport("FLIPDISK")->read() & 0x01)) m_last_frame_flip = 0; } return 0; diff --git a/src/mess/video/rm380z.c b/src/mess/video/rm380z.c index a178a35bf99..de5eec77ac0 100644 --- a/src/mess/video/rm380z.c +++ b/src/mess/video/rm380z.c @@ -382,7 +382,7 @@ void rm380z_state::putChar(int charnum,int attribs,int x,int y,bitmap_ind16 &bit void rm380z_state::update_screen(bitmap_ind16 &bitmap) { - unsigned char* pChar=machine().root_device().memregion("chargen")->base(); + unsigned char* pChar=memregion("chargen")->base(); int lineWidth=0x80; int ncols=80; diff --git a/src/mess/video/ssystem3.c b/src/mess/video/ssystem3.c index f3e09acc2d7..dec974f6bf4 100644 --- a/src/mess/video/ssystem3.c +++ b/src/mess/video/ssystem3.c @@ -204,7 +204,7 @@ UINT32 ssystem3_state::screen_update_ssystem3(screen_device &screen, bitmap_ind1 ssystem3_draw_led(bitmap, m_lcd.data[3]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '3'); ssystem3_draw_led(bitmap, m_lcd.data[4]&1?1:0, ssystem3_led_pos[4].x, ssystem3_led_pos[4].y, '4'); - if (machine().root_device().ioport("Configuration")->read()&1) { // playfield(optional device) + if (ioport("Configuration")->read()&1) { // playfield(optional device) static const int lcd_signs_on[]={ 0, // empty 1, // bauer diff --git a/src/mess/video/super80.c b/src/mess/video/super80.c index 5ef5c9c817d..b23e35d0bf9 100644 --- a/src/mess/video/super80.c +++ b/src/mess/video/super80.c @@ -370,8 +370,8 @@ void super80_state::mc6845_cursor_configure() VIDEO_START_MEMBER(super80_state,super80v) { - m_p_pcgram = machine().root_device().memregion("maincpu")->base()+0xf000; - m_p_videoram = machine().root_device().memregion("videoram")->base(); + m_p_pcgram = memregion("maincpu")->base()+0xf000; + m_p_videoram = memregion("videoram")->base(); m_p_colorram = memregion("colorram")->base(); } diff --git a/src/mess/video/x68k.c b/src/mess/video/x68k.c index ec1f72d1872..31e8eba2217 100644 --- a/src/mess/video/x68k.c +++ b/src/mess/video/x68k.c @@ -190,7 +190,7 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_hsync) m_scanline_timer->adjust(hsync_time); if(scan != 0) { - if((machine().root_device().ioport("options")->read() & 0x04)) + if((ioport("options")->read() & 0x04)) { machine().primary_screen->update_partial(scan); } @@ -205,7 +205,7 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_hsync) m_scanline_timer->adjust(hsync_time); if(scan != 0) { - if((machine().root_device().ioport("options")->read() & 0x04)) + if((ioport("options")->read() & 0x04)) { machine().primary_screen->update_partial(scan); } @@ -244,7 +244,7 @@ TIMER_CALLBACK_MEMBER(x68k_state::x68k_hsync) m_scanline_timer->adjust(hsync_time); if(scan != 0) { - if((machine().root_device().ioport("options")->read() & 0x04)) + if((ioport("options")->read() & 0x04)) { machine().primary_screen->update_partial(scan); } @@ -1117,7 +1117,7 @@ VIDEO_START_MEMBER(x68k_state,x68000) break; /* create the char set (gfx will then be updated dynamically from RAM) */ - machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), x68k_pcg_8, machine().root_device().memregion("user1")->base(), 32, 0)); + machine().gfx[gfx_index] = auto_alloc(machine(), gfx_element(machine(), x68k_pcg_8, memregion("user1")->base(), 32, 0)); gfx_index++; @@ -1178,7 +1178,7 @@ UINT32 x68k_state::screen_update_x68000(screen_device &screen, bitmap_ind16 &bit rect.max_y = cliprect.max_y; // update tiles - //rom = machine().root_device().memregion("user1")->base(); + //rom = memregion("user1")->base(); for(x=0;x<256;x++) { if(m_video.tile16_dirty[x] != 0) |