comparison backend.c @ 1130:8f14767661fa

Remove memory map assumptions from Z80 core and move a little bit of logic to the generic backend.c so it can be shared between CPU cores
author Michael Pavone <pavone@retrodev.com>
date Wed, 28 Dec 2016 20:39:27 -0800
parents 329ff62ea391
children 5c8b1c33ca10
comparison
equal deleted inserted replaced
1129:6b5c92b6205c 1130:8f14767661fa
49 cur = cur->next; 49 cur = cur->next;
50 } 50 }
51 } 51 }
52 } 52 }
53 53
54 memmap_chunk const *find_map_chunk(uint32_t address, cpu_options *opts, uint16_t flags, uint32_t *size_sum)
55 {
56 if (size_sum) {
57 *size_sum = 0;
58 }
59 address &= opts->address_mask;
60 for (memmap_chunk const *cur = opts->memmap, *end = opts->memmap + opts->memmap_chunks; cur != end; cur++)
61 {
62 if (address >= cur->start && address < cur->end) {
63 return cur;
64 } else if (size_sum && (cur->flags & flags) == flags) {
65 *size_sum += chunk_size(opts, cur);
66 }
67 }
68 return NULL;
69 }
70
54 void * get_native_pointer(uint32_t address, void ** mem_pointers, cpu_options * opts) 71 void * get_native_pointer(uint32_t address, void ** mem_pointers, cpu_options * opts)
55 { 72 {
56 memmap_chunk const * memmap = opts->memmap; 73 memmap_chunk const * memmap = opts->memmap;
57 address &= opts->address_mask; 74 address &= opts->address_mask;
58 for (uint32_t chunk = 0; chunk < opts->memmap_chunks; chunk++) 75 for (uint32_t chunk = 0; chunk < opts->memmap_chunks; chunk++)