src/mess/drivers/gba.c
| r9848 | r9849 | |
| 2046 | 2046 | state->windowOn = 0; |
| 2047 | 2047 | state->fxOn = 0; |
| 2048 | 2048 | |
| 2049 | state->bios_protected = 0; |
| 2050 | |
| 2049 | 2051 | timer_adjust_oneshot(state->scan_timer, machine->primary_screen->time_until_pos(0, 0), 0); |
| 2050 | 2052 | timer_adjust_oneshot(state->hbl_timer, attotime_never, 0); |
| 2051 | 2053 | timer_adjust_oneshot(state->dma_timer[0], attotime_never, 0); |
| r9848 | r9849 | |
| 2189 | 2191 | case EEP_READ: |
| 2190 | 2192 | if ((state->eeprom_bits == 0) && (state->eeprom_count)) |
| 2191 | 2193 | { |
| 2194 | if (state->eeprom_addr >= sizeof( state->gba_eeprom)) |
| 2195 | { |
| 2196 | fatalerror( "eeprom: invalid address (%x)", state->eeprom_addr); |
| 2197 | } |
| 2192 | 2198 | state->eep_data = state->gba_eeprom[state->eeprom_addr]; |
| 2193 | 2199 | // printf("EEPROM read @ %x = %x (%x)\n", state->eeprom_addr, state->eep_data, (state->eep_data & 0x80) ? 1 : 0); |
| 2194 | 2200 | state->eeprom_addr++; |
| r9848 | r9849 | |
| 2245 | 2251 | state->eeprom_command = EEP_WRITE; |
| 2246 | 2252 | } |
| 2247 | 2253 | state->eeprom_state = EEP_ADDR; |
| 2248 | | state->eeprom_count = 6; |
| 2254 | state->eeprom_count = state->eeprom_addr_bits; |
| 2249 | 2255 | state->eeprom_addr = 0; |
| 2250 | 2256 | break; |
| 2251 | 2257 | |
| r9848 | r9849 | |
| 2290 | 2296 | if (state->eeprom_bits == 0) |
| 2291 | 2297 | { |
| 2292 | 2298 | mame_printf_verbose("%08x: EEPROM: %02x to %x\n", cpu_get_pc(space->machine->device("maincpu")), state->eep_data, state->eeprom_addr ); |
| 2299 | if (state->eeprom_addr >= sizeof( state->gba_eeprom)) |
| 2300 | { |
| 2301 | fatalerror( "eeprom: invalid address (%x)", state->eeprom_addr); |
| 2302 | } |
| 2293 | 2303 | state->gba_eeprom[state->eeprom_addr] = state->eep_data; |
| 2294 | 2304 | state->eeprom_addr++; |
| 2295 | 2305 | state->eep_data = 0; |
| r9848 | r9849 | |
| 2343 | 2353 | state->nvptr = (UINT8 *)&state->gba_eeprom; |
| 2344 | 2354 | state->nvsize = 0x2000; |
| 2345 | 2355 | |
| 2356 | // "Bomberman Max 2" series use 14 bit addressing |
| 2357 | if ((!memcmp(game_code, "AMHE", 4)) || (!memcmp(game_code, "AMYJ", 4)) || (!memcmp(game_code, "AMYE", 4)) || |
| 2358 | (!memcmp(game_code, "AMHP", 4)) || (!memcmp(game_code, "AMHJ", 4)) || (!memcmp(game_code, "AMYP", 4))) |
| 2359 | { |
| 2360 | state->eeprom_addr_bits = 14; |
| 2361 | } |
| 2362 | else |
| 2363 | { |
| 2364 | state->eeprom_addr_bits = 6; |
| 2365 | } |
| 2366 | |
| 2346 | 2367 | if (cart_size <= (16 * 1024 * 1024)) |
| 2347 | 2368 | { |
| 2348 | 2369 | memory_install_read32_handler(cpu_get_address_space(image.device().machine->device("maincpu"), ADDRESS_SPACE_PROGRAM), 0xd000000, 0xdffffff, 0, 0, eeprom_r); |