summaryrefslogtreecommitdiff
path: root/backend.c
diff options
context:
space:
mode:
authorMichael Pavone <pavone@retrodev.com>2019-02-12 09:58:04 -0800
committerMichael Pavone <pavone@retrodev.com>2019-02-12 09:58:04 -0800
commit84198d4ef6e5f311945ec6f6a8956426a52795af (patch)
tree7d14ca50af2f7e7404d6846e4bd6e334c7a133fc /backend.c
parent1b23425efd7606bf6cd509861d9b2d60e033e962 (diff)
Integration of new Z80 core is sort of working now
Diffstat (limited to 'backend.c')
-rw-r--r--backend.c25
1 files changed, 25 insertions, 0 deletions
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);