# HG changeset patch # User Michael Pavone # Date 1552453033 25200 # Node ID a81db00e171a5c6985f497253957a80a5ea8c817 # Parent 8fe162bdb03890090d8c2708f9ec0fd49470fcd9 Fix a couple bugs in the integration of Musashi diff -r 8fe162bdb038 -r a81db00e171a musashi/m68kcpu.c --- a/musashi/m68kcpu.c Fri Mar 01 14:17:29 2019 -0800 +++ b/musashi/m68kcpu.c Tue Mar 12 21:57:13 2019 -0700 @@ -686,7 +686,7 @@ /* Record previous program counter */ REG_PPC(this) = REG_PC(this); - + printf("M68K: %X @ %d\n", this->pc, this->c.current_cycle); this->run_mode = RUN_MODE_NORMAL; /* Read an instruction and call its handler */ @@ -786,8 +786,8 @@ { address &= 0xFFFFFF; uint32_t base = address >> 16; - if (m68k->read_pointers[base]) { - uint8_t *chunk = m68k->read_pointers[base]; + if (m68k->write_pointers[base]) { + uint8_t *chunk = m68k->write_pointers[base]; chunk[(address ^ 1) & 0xFFFF] = value; return; } @@ -864,7 +864,7 @@ this->read_pointers[address >> 16] = NULL; this->write_pointers[address >> 16] = NULL; memmap_chunk const *chunk = find_map_chunk(address, &this->c.options->gen, 0, NULL); - if (!chunk || chunk->end < (address + 64*1024) || (chunk->flags & (MMAP_ONLY_ODD | MMAP_ONLY_EVEN | MMAP_PTR_IDX)) || !chunk->buffer) { + if (!chunk || chunk->end < (address + 64*1024) || (chunk->flags & (MMAP_ONLY_ODD | MMAP_ONLY_EVEN)) || !chunk->buffer) { continue; } void *ptr = get_native_pointer(address, (void **)this->c.mem_pointers, &this->c.options->gen);