diff options
author | Michael Pavone <pavone@retrodev.com> | 2020-05-03 23:24:03 -0700 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2020-05-03 23:24:03 -0700 |
commit | 11667366054d2c76cfe55713210e7bb0b1d2f22b (patch) | |
tree | df39f31d9bd01a6aeed9d714c93c0539c7c674ed /backend.c | |
parent | 8adaf00407538f09d5d0cf306c4100611a5aa8af (diff) |
Apply fixes to helper functions in backend.c from interp branch
Diffstat (limited to 'backend.c')
-rw-r--r-- | backend.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -160,7 +160,7 @@ void write_word(uint32_t address, uint16_t value, void **mem_pointers, cpu_optio if (!chunk) { return; } - uint32_t offset = (address - chunk->start) & chunk->mask; + uint32_t offset = address & chunk->mask; if (chunk->flags & MMAP_WRITE) { uint8_t *base; if (chunk->flags & MMAP_PTR_IDX) { @@ -210,6 +210,8 @@ uint8_t read_byte(uint32_t address, void **mem_pointers, cpu_options *opts, void return 0xFF; } offset /= 2; + } else if(opts->byte_swap) { + offset ^= 1; } return base[offset]; } @@ -244,6 +246,8 @@ void write_byte(uint32_t address, uint8_t value, void **mem_pointers, cpu_option return; } offset /= 2; + } else if(opts->byte_swap) { + offset ^= 1; } base[offset] = value; } |