comparison 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
comparison
equal deleted inserted replaced
1752:d6d4c006a7b3 1753:33ec5df77fac
91 } 91 }
92 } 92 }
93 return NULL; 93 return NULL;
94 } 94 }
95 95
96 void * get_native_write_pointer(uint32_t address, void ** mem_pointers, cpu_options * opts)
97 {
98 memmap_chunk const * memmap = opts->memmap;
99 address &= opts->address_mask;
100 for (uint32_t chunk = 0; chunk < opts->memmap_chunks; chunk++)
101 {
102 if (address >= memmap[chunk].start && address < memmap[chunk].end) {
103 if (!(memmap[chunk].flags & (MMAP_WRITE))) {
104 return NULL;
105 }
106 uint8_t * base = memmap[chunk].flags & MMAP_PTR_IDX
107 ? mem_pointers[memmap[chunk].ptr_index]
108 : memmap[chunk].buffer;
109 if (!base) {
110 if (memmap[chunk].flags & MMAP_AUX_BUFF) {
111 return memmap[chunk].buffer + (address & memmap[chunk].aux_mask);
112 }
113 return NULL;
114 }
115 return base + (address & memmap[chunk].mask);
116 }
117 }
118 return NULL;
119 }
120
96 uint16_t read_word(uint32_t address, void **mem_pointers, cpu_options *opts, void *context) 121 uint16_t read_word(uint32_t address, void **mem_pointers, cpu_options *opts, void *context)
97 { 122 {
98 memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL); 123 memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL);
99 if (!chunk) { 124 if (!chunk) {
100 return 0xFFFF; 125 return 0xFFFF;