Mercurial > repos > blastem
changeset 2651:1072cc337822
Implement TAS in new 68K core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 02 Mar 2025 01:01:57 -0800 |
parents | 9263d064294c |
children | 224c7c1730fd |
files | m68k.cpu m68k_util.c |
diffstat | 2 files changed, 52 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/m68k.cpu Sat Mar 01 23:46:22 2025 -0800 +++ b/m68k.cpu Sun Mar 02 01:01:57 2025 -0800 @@ -2547,6 +2547,25 @@ update_flags NZV0C0 m68k_prefetch +0100101011MMMRRR tas + invalid M 1 + invalid M 7 R 2 + invalid M 7 R 3 + invalid M 7 R 4 + invalid M 7 R 5 + invalid M 7 R 6 + invalid M 7 R 7 + + m68k_fetch_dst_ea M R 0 + cmp 0 dst 0 + update_flags NZV0C0 + dst |= 0x80 + if M + cycles 2 + ocall rmw_writeback + end + m68k_prefetch + 010011100100VVVV trap local vector 32 scratch1 = pc
--- a/m68k_util.c Sat Mar 01 23:46:22 2025 -0800 +++ b/m68k_util.c Sun Mar 02 01:01:57 2025 -0800 @@ -3,7 +3,15 @@ void m68k_read_8(m68k_context *context) { context->cycles += 4 * context->opts->gen.clock_divider; +#ifdef DEBUG_DISASM + uint32_t tmp = context->scratch1; +#endif context->scratch1 = read_byte(context->scratch1, (void**)context->mem_pointers, &context->opts->gen, context); +#ifdef DEBUG_DISASM + if (context->pc >= 0x3F48 && context->pc < 0x3FCE) { + printf("Read.b %05X: %02X\n", tmp, context->scratch1); + } +#endif } #ifdef DEBUG_DISASM @@ -22,15 +30,20 @@ #endif context->scratch1 = read_word(context->scratch1, (void**)context->mem_pointers, &context->opts->gen, context); #ifdef DEBUG_DISASM + if (context->pc >= 0x3F48 && context->pc < 0x3FCE) { if (tmp == context->pc) { m68kinst inst; m68k_decode(debug_disasm_fetch, context, &inst, tmp); static char disasm_buf[256]; m68k_disasm(&inst, disasm_buf); - printf("Fetch %05X: %04X - %s, d0=%X, d1=%X, d2=%X, d3=%X, d4=%X, d6=%X, a7=%X, xflag=%d\n", tmp, context->scratch1, disasm_buf, context->dregs[0], context->dregs[1], context->dregs[2], context->dregs[3], context->dregs[4], context->dregs[6], context->aregs[7], context->xflag); + printf("Fetch %05X: %04X - %s, d0=%X, d1=%X, d2=%X, d3=%X, d4=%X, d6=%X, d7=%X, a3=%X, a7=%X, xflag=%d\n", + tmp, context->scratch1, disasm_buf, context->dregs[0], context->dregs[1], context->dregs[2], context->dregs[3], + context->dregs[4], context->dregs[6], context->dregs[7], context->aregs[3], context->aregs[7], context->xflag + ); } else { printf("Read %05X: %04X\n", tmp, context->scratch1); } + } #endif } @@ -38,12 +51,31 @@ { context->cycles += 4 * context->opts->gen.clock_divider; write_byte(context->scratch2, context->scratch1, (void**)context->mem_pointers, &context->opts->gen, context); +#ifdef DEBUG_DISASM + if (context->pc >= 0x3F48 && context->pc < 0x3FCE) { + printf("Write.b %05X: %02X\n", context->scratch2, context->scratch1); + } +#endif +} + +void m68k_rmw_writeback(m68k_context *context) +{ + if (context->opts->gen.flags & M68K_OPT_BROKEN_READ_MODIFY) { + context->cycles += 4 * context->opts->gen.clock_divider; + } else { + write_byte(context->scratch2, context->scratch1, (void**)context->mem_pointers, &context->opts->gen, context); + } } void m68k_write_16(m68k_context *context) { context->cycles += 4 * context->opts->gen.clock_divider; write_word(context->scratch2, context->scratch1, (void**)context->mem_pointers, &context->opts->gen, context); +#ifdef DEBUG_DISASM + if (context->pc >= 0x3F48 && context->pc < 0x3FCE) { + printf("Write %05X: %04X\n", context->scratch2, context->scratch1); + } +#endif } void m68k_sync_cycle(m68k_context *context, uint32_t target_cycle)