for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i++) {
if (cfg->map_type[i] == MAPTYPE_NONE || !cfg->map_data[i])
continue;
- if (address >= cfg->map_offset[i] && address < cfg->map_high[i])
- return i;
+ else if (address >= cfg->map_offset[i] && address < cfg->map_high[i]) {
+ if (cfg->map_type[i] == MAPTYPE_RAM || cfg->map_type[i] == MAPTYPE_RAM_NOALLOC || cfg->map_type[i] == MAPTYPE_ROM)
+ return i;
+ }
}
return -1;
for (int i = 0; i < MAX_NUM_MAPPED_ITEMS; i++) {
if (cfg->map_type[i] == MAPTYPE_NONE || !cfg->map_data[i])
continue;
- if (address >= cfg->map_offset[i] && address < cfg->map_high[i]) {
- if (cfg->map_type[i] == MAPTYPE_RAM || cfg->map_type[i] == MAPTYPE_RAM_NOALLOC) {
+ else if (address >= cfg->map_offset[i] && address < cfg->map_high[i]) {
+ if (cfg->map_type[i] == MAPTYPE_RAM || cfg->map_type[i] == MAPTYPE_RAM_NOALLOC || cfg->map_type[i] == MAPTYPE_ROM)
return cfg->map_data[i] + (address - cfg->map_offset[i]);
- } else {
- return NULL;
- }
}
}