diff options
author | Michael Pavone <pavone@retrodev.com> | 2019-02-12 09:58:04 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2019-02-12 09:58:04 -0800 |
commit | 84198d4ef6e5f311945ec6f6a8956426a52795af (patch) | |
tree | 7d14ca50af2f7e7404d6846e4bd6e334c7a133fc /backend.c | |
parent | 1b23425efd7606bf6cd509861d9b2d60e033e962 (diff) |
Integration of new Z80 core is sort of working now
Diffstat (limited to 'backend.c')
-rw-r--r-- | backend.c | 25 |
1 files changed, 25 insertions, 0 deletions
@@ -93,6 +93,31 @@ void * get_native_pointer(uint32_t address, void ** mem_pointers, cpu_options * 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); |