Mercurial > repos > blastem
comparison backend.c @ 1771:e59045f781ce mame_interp
Fix a couple issues in manual memory map read/write functions
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 12 Mar 2019 21:57:35 -0700 |
parents | 8fe162bdb038 |
children | 374a5ae694e8 |
comparison
equal
deleted
inserted
replaced
1770:a81db00e171a | 1771:e59045f781ce |
---|---|
160 { | 160 { |
161 memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL); | 161 memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL); |
162 if (!chunk) { | 162 if (!chunk) { |
163 return; | 163 return; |
164 } | 164 } |
165 uint32_t offset = (address - chunk->start) & chunk->mask; | 165 uint32_t offset = address & chunk->mask; |
166 if (chunk->flags & MMAP_WRITE) { | 166 if (chunk->flags & MMAP_WRITE) { |
167 uint8_t *base; | 167 uint8_t *base; |
168 if (chunk->flags & MMAP_PTR_IDX) { | 168 if (chunk->flags & MMAP_PTR_IDX) { |
169 base = mem_pointers[chunk->ptr_index]; | 169 base = mem_pointers[chunk->ptr_index]; |
170 } else { | 170 } else { |
210 } | 210 } |
211 } else if (chunk->flags & MMAP_ONLY_ODD) { | 211 } else if (chunk->flags & MMAP_ONLY_ODD) { |
212 return 0xFF; | 212 return 0xFF; |
213 } | 213 } |
214 offset /= 2; | 214 offset /= 2; |
215 } else if(opts->byte_swap) { | |
216 offset ^= 1; | |
215 } | 217 } |
216 return base[offset]; | 218 return base[offset]; |
217 } | 219 } |
218 } | 220 } |
219 if ((!(chunk->flags & MMAP_READ) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->read_8) { | 221 if ((!(chunk->flags & MMAP_READ) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->read_8) { |
244 } | 246 } |
245 } else if (chunk->flags & MMAP_ONLY_ODD) { | 247 } else if (chunk->flags & MMAP_ONLY_ODD) { |
246 return; | 248 return; |
247 } | 249 } |
248 offset /= 2; | 250 offset /= 2; |
251 } else if(opts->byte_swap) { | |
252 offset ^= 1; | |
249 } | 253 } |
250 base[offset] = value; | 254 base[offset] = value; |
251 } | 255 } |
252 } | 256 } |
253 if ((!(chunk->flags & MMAP_WRITE) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->write_8) { | 257 if ((!(chunk->flags & MMAP_WRITE) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->write_8) { |