Mercurial > repos > blastem
comparison m68k_util.c @ 2590:e602dbf776d8
Fix abcd and implement sbcd and nbcd in new 68K core
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 09 Feb 2025 02:57:37 -0800 |
parents | e04c7e753bf6 |
children | 1c493b8c513b |
comparison
equal
deleted
inserted
replaced
2589:6bca3c28e2ad | 2590:e602dbf776d8 |
---|---|
4 { | 4 { |
5 context->cycles += 4 * context->opts->gen.clock_divider; | 5 context->cycles += 4 * context->opts->gen.clock_divider; |
6 context->scratch1 = read_byte(context->scratch1, context->mem_pointers, &context->opts->gen, context); | 6 context->scratch1 = read_byte(context->scratch1, context->mem_pointers, &context->opts->gen, context); |
7 } | 7 } |
8 | 8 |
9 #ifdef DEBUG_DISASM | |
10 #include "68kinst.h" | |
11 static uint16_t debug_disasm_fetch(uint32_t address, void *vcontext) | |
12 { | |
13 m68k_context *context = vcontext; | |
14 return read_word(address, context->mem_pointers, &context->opts->gen, context); | |
15 } | |
16 #endif | |
9 void m68k_read_16(m68k_context *context) | 17 void m68k_read_16(m68k_context *context) |
10 { | 18 { |
11 context->cycles += 4 * context->opts->gen.clock_divider; | 19 context->cycles += 4 * context->opts->gen.clock_divider; |
20 #ifdef DEBUG_DISASM | |
12 uint32_t tmp = context->scratch1; | 21 uint32_t tmp = context->scratch1; |
22 #endif | |
13 context->scratch1 = read_word(context->scratch1, context->mem_pointers, &context->opts->gen, context); | 23 context->scratch1 = read_word(context->scratch1, context->mem_pointers, &context->opts->gen, context); |
24 #ifdef DEBUG_DISASM | |
25 if (tmp == context->pc) { | |
26 m68kinst inst; | |
27 m68k_decode(debug_disasm_fetch, context, &inst, tmp); | |
28 static char disasm_buf[256]; | |
29 m68k_disasm(&inst, disasm_buf); | |
30 printf("Fetch %05X: %04X - %s, d2 = %X, d3 = %X, d4 = %X, d6 = %X, xflag = %d\n", tmp, context->scratch1, disasm_buf, context->dregs[2], context->dregs[3], context->dregs[4], context->dregs[6], context->xflag); | |
31 } | |
32 #endif | |
14 } | 33 } |
15 | 34 |
16 void m68k_write_8(m68k_context *context) | 35 void m68k_write_8(m68k_context *context) |
17 { | 36 { |
18 context->cycles += 4 * context->opts->gen.clock_divider; | 37 context->cycles += 4 * context->opts->gen.clock_divider; |