Mercurial > repos > blastem
diff backend.c @ 1753:33ec5df77fac
Integration of new Z80 core is sort of working now
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 12 Feb 2019 09:58:04 -0800 |
parents | 49a52c737bf0 |
children | 8fe162bdb038 0c1491818f4b |
line wrap: on
line diff
--- a/backend.c Sun Feb 10 11:58:23 2019 -0800 +++ b/backend.c Tue Feb 12 09:58:04 2019 -0800 @@ -93,6 +93,31 @@ return NULL; } +void * get_native_write_pointer(uint32_t address, void ** mem_pointers, cpu_options * opts) +{ + memmap_chunk const * memmap = opts->memmap; + address &= opts->address_mask; + for (uint32_t chunk = 0; chunk < opts->memmap_chunks; chunk++) + { + if (address >= memmap[chunk].start && address < memmap[chunk].end) { + if (!(memmap[chunk].flags & (MMAP_WRITE))) { + return NULL; + } + uint8_t * base = memmap[chunk].flags & MMAP_PTR_IDX + ? mem_pointers[memmap[chunk].ptr_index] + : memmap[chunk].buffer; + if (!base) { + if (memmap[chunk].flags & MMAP_AUX_BUFF) { + return memmap[chunk].buffer + (address & memmap[chunk].aux_mask); + } + return NULL; + } + return base + (address & memmap[chunk].mask); + } + } + return NULL; +} + uint16_t read_word(uint32_t address, void **mem_pointers, cpu_options *opts, void *context) { memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL);