diff --git a/src/mame/drivers/astrocde.c b/src/mame/drivers/astrocde.c index 6cbc7997eea..0ccc16027c2 100644 --- a/src/mame/drivers/astrocde.c +++ b/src/mame/drivers/astrocde.c @@ -417,6 +417,9 @@ static WRITE8_HANDLER( profpac_banksw_w ) { int bank = (data >> 5) & 3; + /* this is accessed from I/O space but modifies program space, so we normalize here */ + space = cpu_get_address_space(space->cpu, ADDRESS_SPACE_PROGRAM); + /* remember the banking bits for save state support */ profpac_bank = data; @@ -448,7 +451,7 @@ static WRITE8_HANDLER( profpac_banksw_w ) static STATE_POSTLOAD( profbank_banksw_restore ) { - const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); profpac_banksw_w(space, 0, profpac_bank); } @@ -1720,13 +1723,14 @@ static DRIVER_INIT( robby ) static DRIVER_INIT( profpac ) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); astrocade_video_config = AC_SOUND_PRESENT; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x14, 0x14, 0x0fff, 0xff00, profpac_io_1_r); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x15, 0x15, 0x77ff, 0xff00, profpac_io_2_r); + memory_install_read8_handler(iospace, 0x14, 0x14, 0x0fff, 0xff00, profpac_io_1_r); + memory_install_read8_handler(iospace, 0x15, 0x15, 0x77ff, 0xff00, profpac_io_2_r); /* reset banking */ - profpac_banksw_w(space, 0, 0); + profpac_banksw_w(iospace, 0, 0); state_save_register_postload(machine, profbank_banksw_restore, NULL); } @@ -1734,15 +1738,16 @@ static DRIVER_INIT( profpac ) static DRIVER_INIT( demndrgn ) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); astrocade_video_config = 0x00; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x14, 0x14, 0x1fff, 0xff00, demndrgn_io_r); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x1c, 0x1c, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREX")); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x1d, 0x1d, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREY")); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x97, 0x97, 0x0000, 0xff00, demndrgn_sound_w); + memory_install_read8_handler(iospace, 0x14, 0x14, 0x1fff, 0xff00, demndrgn_io_r); + memory_install_read8_handler(iospace, 0x1c, 0x1c, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREX")); + memory_install_read8_handler(iospace, 0x1d, 0x1d, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "FIREY")); + memory_install_write8_handler(iospace, 0x97, 0x97, 0x0000, 0xff00, demndrgn_sound_w); /* reset banking */ - profpac_banksw_w(space, 0, 0); + profpac_banksw_w(iospace, 0, 0); state_save_register_postload(machine, profbank_banksw_restore, NULL); } @@ -1750,20 +1755,21 @@ static DRIVER_INIT( demndrgn ) static DRIVER_INIT( tenpindx ) { const address_space *space = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_PROGRAM); + const address_space *iospace = cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO); astrocade_video_config = 0x00; - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x60, 0x60, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P60")); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x61, 0x61, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P61")); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x62, 0x62, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P62")); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x63, 0x63, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P63")); - memory_install_read8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x64, 0x64, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P64")); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x65, 0x66, 0x0000, 0xff00, tenpindx_lamp_w); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x67, 0x67, 0x0000, 0xff00, tenpindx_counter_w); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x68, 0x68, 0x0000, 0xff00, tenpindx_lights_w); - memory_install_write8_handler(cpu_get_address_space(machine->cpu[0], ADDRESS_SPACE_IO), 0x97, 0x97, 0x0000, 0xff00, tenpindx_sound_w); + memory_install_read8_handler(iospace, 0x60, 0x60, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P60")); + memory_install_read8_handler(iospace, 0x61, 0x61, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P61")); + memory_install_read8_handler(iospace, 0x62, 0x62, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P62")); + memory_install_read8_handler(iospace, 0x63, 0x63, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P63")); + memory_install_read8_handler(iospace, 0x64, 0x64, 0x0000, 0xff00, input_port_read_handler8(machine->portconfig, "P64")); + memory_install_write8_handler(iospace, 0x65, 0x66, 0x0000, 0xff00, tenpindx_lamp_w); + memory_install_write8_handler(iospace, 0x67, 0x67, 0x0000, 0xff00, tenpindx_counter_w); + memory_install_write8_handler(iospace, 0x68, 0x68, 0x0000, 0xff00, tenpindx_lights_w); + memory_install_write8_handler(iospace, 0x97, 0x97, 0x0000, 0xff00, tenpindx_sound_w); /* reset banking */ - profpac_banksw_w(space, 0, 0); + profpac_banksw_w(iospace, 0, 0); state_save_register_postload(machine, profbank_banksw_restore, NULL); }