comparison romdb.c @ 1103:22e87b739ad6

WIP split of ROM loading/argument parsing from Genesis emulation code. Compiles and doesn't crash, but nothing works. Still a few too many globals as well.
author Michael Pavone <pavone@retrodev.com>
date Fri, 09 Dec 2016 09:48:48 -0800
parents 9a74eb24e53c
children b8ba086b96ed
comparison
equal deleted inserted replaced
1102:c15896605bf2 1103:22e87b739ad6
1 #include <stdlib.h> 1 #include <stdlib.h>
2 #include <string.h> 2 #include <string.h>
3 #include "config.h" 3 #include "config.h"
4 #include "romdb.h" 4 #include "romdb.h"
5 #include "util.h" 5 #include "util.h"
6 #include "blastem.h" 6 #include "genesis.h"
7 #include "menu.h" 7 #include "menu.h"
8 8
9 #define DOM_TITLE_START 0x120 9 #define DOM_TITLE_START 0x120
10 #define DOM_TITLE_END 0x150 10 #define DOM_TITLE_END 0x150
11 #define TITLE_START DOM_TITLE_END 11 #define TITLE_START DOM_TITLE_END
285 { 285 {
286 context->mem_pointers[gen->mapper_start_index + i] = NULL; 286 context->mem_pointers[gen->mapper_start_index + i] = NULL;
287 } 287 }
288 } else { 288 } else {
289 //Used for games that only use the mapper for SRAM 289 //Used for games that only use the mapper for SRAM
290 context->mem_pointers[gen->mapper_start_index] = cart + 0x200000/2; 290 context->mem_pointers[gen->mapper_start_index] = gen->cart + 0x200000/2;
291 //For games that need more than 4MB 291 //For games that need more than 4MB
292 for (int i = 1; i < 8; i++) 292 for (int i = 1; i < 8; i++)
293 { 293 {
294 context->mem_pointers[gen->mapper_start_index + i] = cart + 0x40000*gen->bank_regs[i]; 294 context->mem_pointers[gen->mapper_start_index + i] = gen->cart + 0x40000*gen->bank_regs[i];
295 } 295 }
296 } 296 }
297 } else { 297 } else {
298 context->mem_pointers[gen->mapper_start_index + address] = cart + 0x40000*value; 298 context->mem_pointers[gen->mapper_start_index + address] = gen->cart + 0x40000*value;
299 } 299 }
300 return context; 300 return context;
301 } 301 }
302 302
303 m68k_context * write_bank_reg_b(uint32_t address, m68k_context * context, uint8_t value) 303 m68k_context * write_bank_reg_b(uint32_t address, m68k_context * context, uint8_t value)
541 info->map[1].ptr_index = info->mapper_start_index = 0; 541 info->map[1].ptr_index = info->mapper_start_index = 0;
542 info->map[1].read_16 = (read_16_fun)read_sram_w;//these will only be called when mem_pointers[2] == NULL 542 info->map[1].read_16 = (read_16_fun)read_sram_w;//these will only be called when mem_pointers[2] == NULL
543 info->map[1].read_8 = (read_8_fun)read_sram_b; 543 info->map[1].read_8 = (read_8_fun)read_sram_b;
544 info->map[1].write_16 = (write_16_fun)write_sram_area_w;//these will be called all writes to the area 544 info->map[1].write_16 = (write_16_fun)write_sram_area_w;//these will be called all writes to the area
545 info->map[1].write_8 = (write_8_fun)write_sram_area_b; 545 info->map[1].write_8 = (write_8_fun)write_sram_area_b;
546 info->map[1].buffer = cart + 0x200000 / sizeof(uint16_t); 546 info->map[1].buffer = rom + 0x200000 / sizeof(uint16_t);
547 547
548 memmap_chunk *last = info->map + info->map_chunks - 1; 548 memmap_chunk *last = info->map + info->map_chunks - 1;
549 memset(last, 0, sizeof(memmap_chunk)); 549 memset(last, 0, sizeof(memmap_chunk));
550 last->start = 0xA13000; 550 last->start = 0xA13000;
551 last->end = 0xA13100; 551 last->end = 0xA13100;