Mercurial > repos > blastem
comparison musashi/m68kcpu.c @ 1770:a81db00e171a mame_interp
Fix a couple bugs in the integration of Musashi
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Tue, 12 Mar 2019 21:57:13 -0700 |
parents | 2e57910fd641 |
children | ddcd59a6122e |
comparison
equal
deleted
inserted
replaced
1769:8fe162bdb038 | 1770:a81db00e171a |
---|---|
684 /* Set tracing accodring to T1. (T0 is done inside instruction) */ | 684 /* Set tracing accodring to T1. (T0 is done inside instruction) */ |
685 m68ki_trace_t1(this); /* auto-disable (see m68kcpu.h) */ | 685 m68ki_trace_t1(this); /* auto-disable (see m68kcpu.h) */ |
686 | 686 |
687 /* Record previous program counter */ | 687 /* Record previous program counter */ |
688 REG_PPC(this) = REG_PC(this); | 688 REG_PPC(this) = REG_PC(this); |
689 | 689 printf("M68K: %X @ %d\n", this->pc, this->c.current_cycle); |
690 | 690 |
691 this->run_mode = RUN_MODE_NORMAL; | 691 this->run_mode = RUN_MODE_NORMAL; |
692 /* Read an instruction and call its handler */ | 692 /* Read an instruction and call its handler */ |
693 this->ir = m68ki_read_imm_16(this); | 693 this->ir = m68ki_read_imm_16(this); |
694 this->jump_table[this->ir](this); | 694 this->jump_table[this->ir](this); |
784 | 784 |
785 void m68ki_write_8(m68000_base_device *m68k, uint32_t address, uint8_t value) | 785 void m68ki_write_8(m68000_base_device *m68k, uint32_t address, uint8_t value) |
786 { | 786 { |
787 address &= 0xFFFFFF; | 787 address &= 0xFFFFFF; |
788 uint32_t base = address >> 16; | 788 uint32_t base = address >> 16; |
789 if (m68k->read_pointers[base]) { | 789 if (m68k->write_pointers[base]) { |
790 uint8_t *chunk = m68k->read_pointers[base]; | 790 uint8_t *chunk = m68k->write_pointers[base]; |
791 chunk[(address ^ 1) & 0xFFFF] = value; | 791 chunk[(address ^ 1) & 0xFFFF] = value; |
792 return; | 792 return; |
793 } | 793 } |
794 write_byte(address, value, (void **)m68k->c.mem_pointers, &m68k->c.options->gen, &m68k->c); | 794 write_byte(address, value, (void **)m68k->c.mem_pointers, &m68k->c.options->gen, &m68k->c); |
795 } | 795 } |
862 for (uint32_t address = 0; address < (24*1024*1024); address += 64*1024) | 862 for (uint32_t address = 0; address < (24*1024*1024); address += 64*1024) |
863 { | 863 { |
864 this->read_pointers[address >> 16] = NULL; | 864 this->read_pointers[address >> 16] = NULL; |
865 this->write_pointers[address >> 16] = NULL; | 865 this->write_pointers[address >> 16] = NULL; |
866 memmap_chunk const *chunk = find_map_chunk(address, &this->c.options->gen, 0, NULL); | 866 memmap_chunk const *chunk = find_map_chunk(address, &this->c.options->gen, 0, NULL); |
867 if (!chunk || chunk->end < (address + 64*1024) || (chunk->flags & (MMAP_ONLY_ODD | MMAP_ONLY_EVEN | MMAP_PTR_IDX)) || !chunk->buffer) { | 867 if (!chunk || chunk->end < (address + 64*1024) || (chunk->flags & (MMAP_ONLY_ODD | MMAP_ONLY_EVEN)) || !chunk->buffer) { |
868 continue; | 868 continue; |
869 } | 869 } |
870 void *ptr = get_native_pointer(address, (void **)this->c.mem_pointers, &this->c.options->gen); | 870 void *ptr = get_native_pointer(address, (void **)this->c.mem_pointers, &this->c.options->gen); |
871 if (!ptr) { | 871 if (!ptr) { |
872 continue; | 872 continue; |