static WRITE8_HANDLER(pcat_nit_rombank_w) { logerror( "rom bank #%02x at PC=%08X\n", data, cpu_get_pc(space->cpu) ); if ( data & 0x40 ) { // rom bank memory_install_read_bank(space, 0x000d8000, 0x000dffff, 0, 0, "rombank" ); memory_unmap_write(space, 0x000d8000, 0x000dffff, 0, 0); if ( data & 0x80 ) { memory_set_bank(space->machine, "rombank", (data & 0x3f) | 0x40 ); } else { memory_set_bank(space->machine, "rombank", data & 0x3f ); } } else { // nvram bank memory_unmap_read(space, 0x000d8000, 0x000dffff, 0, 0); memory_unmap_write(space, 0x000d8000, 0x000dffff, 0, 0); memory_install_read_bank(space, 0x000d8000, 0x000d9fff, 0, 0, "nvrambank" ); memory_install_write_bank(space, 0x000d8000, 0x000d9fff, 0, 0, "nvrambank" ); memory_set_bankptr(space->machine, "nvrambank", space->machine->generic.nvram.u8); } }
static WRITE16_HANDLER( arcadia_multibios_change_game ) { if (data == 0) memory_install_read_bank(space, 0x800000, 0x97ffff, 0, 0, "bank2"); else memory_nop_read(space, 0x800000, 0x97ffff, 0, 0); }
static DRIVER_INIT( ssf2mdb ) { memory_nop_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0xA130F0, 0xA130FF, 0, 0); // custom banking is disabled (!) memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x5fffff, 0, 0, "bank5"); memory_unmap_write(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x400000, 0x5fffff, 0, 0); memory_set_bankptr(machine, "bank5", machine->region( "maincpu" )->base() + 0x400000 ); memory_install_read16_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x770070, 0x770075, 0, 0, ssf2mdb_dsw_r ); megadrive_6buttons_pad = 1; DRIVER_INIT_CALL(megadrij); }
static void vendetta_video_banking( running_machine *machine, int select ) { vendetta_state *state = (vendetta_state *)machine->driver_data; const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); if (select & 1) { memory_install_read_bank(space, state->video_banking_base + 0x2000, state->video_banking_base + 0x2fff, 0, 0, "bank4" ); memory_install_write8_handler(space, state->video_banking_base + 0x2000, state->video_banking_base + 0x2fff, 0, 0, paletteram_xBBBBBGGGGGRRRRR_be_w ); memory_install_readwrite8_device_handler(space, state->k053246, state->video_banking_base + 0x0000, state->video_banking_base + 0x0fff, 0, 0, k053247_r, k053247_w ); memory_set_bankptr(machine, "bank4", machine->generic.paletteram.v); } else { memory_install_readwrite8_handler(space, state->video_banking_base + 0x2000, state->video_banking_base + 0x2fff, 0, 0, vendetta_K052109_r, vendetta_K052109_w ); memory_install_readwrite8_device_handler(space, state->k052109, state->video_banking_base + 0x0000, state->video_banking_base + 0x0fff, 0, 0, k052109_r, k052109_w ); } }
static DRIVER_INIT( cashquiz ) { UINT8 *ROM; int i; /* decrypt program code */ ROM = memory_region(machine, "maincpu"); for( i = 0; i < 0x4000; i++ ) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); /* decrypt questions */ ROM = memory_region(machine, "user1"); for( i = 0; i < 0x40000; i++ ) ROM[i] = BITSWAP8(ROM[i],0,1,2,3,4,5,6,7); /* questions banking handlers */ memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x4000, 0, 0, cashquiz_question_bank_high_w); memory_install_write8_handler(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4001, 0x4001, 0, 0, cashquiz_question_bank_low_w); // 8 independents banks for questions memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5000, 0x50ff, 0, 0, "bank1"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5100, 0x51ff, 0, 0, "bank2"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5200, 0x52ff, 0, 0, "bank3"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5300, 0x53ff, 0, 0, "bank4"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5400, 0x54ff, 0, 0, "bank5"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5500, 0x55ff, 0, 0, "bank6"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5600, 0x56ff, 0, 0, "bank7"); memory_install_read_bank(cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x5700, 0x57ff, 0, 0, "bank8"); // setup default banks memory_set_bankptr(machine, "bank1", memory_region(machine, "user1") + 0x100*0 ); memory_set_bankptr(machine, "bank2", memory_region(machine, "user1") + 0x100*1 ); memory_set_bankptr(machine, "bank3", memory_region(machine, "user1") + 0x100*2 ); memory_set_bankptr(machine, "bank4", memory_region(machine, "user1") + 0x100*3 ); memory_set_bankptr(machine, "bank5", memory_region(machine, "user1") + 0x100*4 ); memory_set_bankptr(machine, "bank6", memory_region(machine, "user1") + 0x100*5 ); memory_set_bankptr(machine, "bank7", memory_region(machine, "user1") + 0x100*6 ); memory_set_bankptr(machine, "bank8", memory_region(machine, "user1") + 0x100*7 ); }
void okim6295_device::set_bank_base(offs_t base) { // flush out anything pending stream_update(m_stream); // if we are setting a non-zero base, and we have no bank, allocate one if (!m_bank_installed && base != 0) { // override our memory map with a bank memory_install_read_bank(space(), 0x00000, 0x3ffff, 0, 0, tag()); m_bank_installed = true; } // if we have a bank number, set the base pointer if (m_bank_installed) { m_bank_offs = base; memory_set_bankptr(&m_machine, tag(), m_region->base() + base); } }
static void update_memory_mapping(running_machine *machine, struct memory_mapper_chip *chip, int decrypt) { int rgnum; if (LOG_MEMORY_MAP) mame_printf_debug("----\nRemapping:\n"); /* first reset everything back to the beginning */ memory_install_readwrite16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), 0x000000, 0xffffff, 0, 0, segaic16_memory_mapper_lsb_r, segaic16_memory_mapper_lsb_w); /* loop over the regions */ for (rgnum = 0; chip->map[rgnum].regbase != 0; rgnum++) { static const offs_t region_size_map[4] = { 0x00ffff, 0x01ffff, 0x07ffff, 0x1fffff }; const segaic16_memory_map_entry *rgn = &chip->map[rgnum]; offs_t region_size = region_size_map[chip->regs[rgn->regbase] & 3]; offs_t region_base = (chip->regs[rgn->regbase + 1] << 16) & ~region_size; offs_t region_mirror = rgn->mirror & region_size; offs_t region_start = region_base + (rgn->regoffs & region_size); offs_t region_end = region_start + ((rgn->length - 1 < region_size) ? rgn->length - 1 : region_size); const char *writebank = rgn->writebank; write16_space_func write = rgn->write; const char *readbank = rgn->readbank; read16_space_func read = rgn->read; /* ROM areas need extra clamping */ if (rgn->romoffset != ~0) { offs_t romsize = chip->cpu->region()->bytes(); if (region_start >= romsize) read = NULL; else if (region_start + rgn->length > romsize) region_end = romsize - 1; } /* map it */ if (read != NULL) memory_install_read16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), region_start, region_end, 0, region_mirror, read); else if (readbank != NULL) memory_install_read_bank(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), region_start, region_end, 0, region_mirror, readbank); if (write != NULL) memory_install_write16_handler(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), region_start, region_end, 0, region_mirror, write); else if (writebank != NULL) memory_install_write_bank(cpu_get_address_space(chip->cpu, ADDRESS_SPACE_PROGRAM), region_start, region_end, 0, region_mirror, writebank); /* set the bank pointer */ if (readbank != NULL) { if (rgn->base != NULL) { memory_configure_bank(machine, readbank, 0, 1, *rgn->base, 0); memory_set_bank(machine, readbank, 0); } else if (rgn->romoffset != ~0) { UINT8 *decrypted = NULL; if (decrypt) { decrypted = (UINT8 *)fd1094_get_decrypted_base(); if (!decrypted) decrypted = (UINT8 *)fd1089_get_decrypted_base(); } memory_configure_bank(machine, readbank, 0, 1, chip->cpu->region()->base() + region_start, 0); if (decrypted) memory_configure_bank_decrypted(machine, readbank, 0, 1, decrypted + region_start, 0); memory_set_bank(machine, readbank, 0); } } if (LOG_MEMORY_MAP) mame_printf_debug(" %06X-%06X (%06X) = %s\n", region_start, region_end, region_mirror, rgn->name); } }