Mercurial > repos > blastem
comparison backend.c @ 1964:9d35ce5012a6
Apply fixes to helper functions in backend.c from interp branch
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 03 May 2020 23:24:03 -0700 |
parents | 42c12d141f6e |
children | a7b753e260a2 45c4b74e7676 |
comparison
equal
deleted
inserted
replaced
1963:495569c1dc61 | 1964:9d35ce5012a6 |
---|---|
158 { | 158 { |
159 memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL); | 159 memmap_chunk const *chunk = find_map_chunk(address, opts, 0, NULL); |
160 if (!chunk) { | 160 if (!chunk) { |
161 return; | 161 return; |
162 } | 162 } |
163 uint32_t offset = (address - chunk->start) & chunk->mask; | 163 uint32_t offset = address & chunk->mask; |
164 if (chunk->flags & MMAP_WRITE) { | 164 if (chunk->flags & MMAP_WRITE) { |
165 uint8_t *base; | 165 uint8_t *base; |
166 if (chunk->flags & MMAP_PTR_IDX) { | 166 if (chunk->flags & MMAP_PTR_IDX) { |
167 base = mem_pointers[chunk->ptr_index]; | 167 base = mem_pointers[chunk->ptr_index]; |
168 } else { | 168 } else { |
208 } | 208 } |
209 } else if (chunk->flags & MMAP_ONLY_ODD) { | 209 } else if (chunk->flags & MMAP_ONLY_ODD) { |
210 return 0xFF; | 210 return 0xFF; |
211 } | 211 } |
212 offset /= 2; | 212 offset /= 2; |
213 } else if(opts->byte_swap) { | |
214 offset ^= 1; | |
213 } | 215 } |
214 return base[offset]; | 216 return base[offset]; |
215 } | 217 } |
216 } | 218 } |
217 if ((!(chunk->flags & MMAP_READ) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->read_8) { | 219 if ((!(chunk->flags & MMAP_READ) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->read_8) { |
242 } | 244 } |
243 } else if (chunk->flags & MMAP_ONLY_ODD) { | 245 } else if (chunk->flags & MMAP_ONLY_ODD) { |
244 return; | 246 return; |
245 } | 247 } |
246 offset /= 2; | 248 offset /= 2; |
249 } else if(opts->byte_swap) { | |
250 offset ^= 1; | |
247 } | 251 } |
248 base[offset] = value; | 252 base[offset] = value; |
249 } | 253 } |
250 } | 254 } |
251 if ((!(chunk->flags & MMAP_WRITE) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->write_8) { | 255 if ((!(chunk->flags & MMAP_WRITE) || (chunk->flags & MMAP_FUNC_NULL)) && chunk->write_8) { |