From 84198d4ef6e5f311945ec6f6a8956426a52795af Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Tue, 12 Feb 2019 09:58:04 -0800 Subject: Integration of new Z80 core is sort of working now --- backend.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'backend.c') diff --git a/backend.c b/backend.c index e8bea75..f95e604 100644 --- a/backend.c +++ b/backend.c @@ -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); -- cgit v1.2.3