if (delay_dep_bk & BITMASK1(SHR_PC)) {
if (opd->op != OP_LOAD_POOL && opd->op != OP_MOVA) {
// can only be those 2 really..
- elprintf(EL_ANOMALY, "%csh2 drc: illegal slot insn %04x @ %08x?",
- sh2->is_slave ? 's' : 'm', op, pc - 2);
+ elprintf_sh2(sh2, EL_ANOMALY,
+ "drc: illegal slot insn %04x @ %08x?", op, pc - 2);
}
if (opd->imm != 0)
; // addr already resolved somehow
static int REGPARM(2) sh2_irq_cb(SH2 *sh2, int level)
{
if (sh2->pending_irl > sh2->pending_int_irq) {
- elprintf(EL_32X, "%csh2 ack/irl %d @ %08x",
- sh2->is_slave ? 's' : 'm', level, sh2->pc);
+ elprintf_sh2(sh2, EL_32X, "ack/irl %d @ %08x",
+ level, sh2_pc(sh2));
return 64 + sh2->pending_irl / 2;
} else {
- elprintf(EL_32X, "%csh2 ack/int %d/%d @ %08x",
- sh2->is_slave ? 's' : 'm', level, sh2->pending_int_vector, sh2->pc);
+ elprintf_sh2(sh2, EL_32X, "ack/int %d/%d @ %08x",
+ level, sh2->pending_int_vector, sh2_pc(sh2));
sh2->pending_int_irq = 0; // auto-clear
sh2->pending_level = sh2->pending_irl;
return sh2->pending_int_vector;
pevt_log_sh2_o(sh2, EVT_RUN_START);
sh2->state |= SH2_STATE_RUN;
cycles = C_M68K_TO_SH2(*sh2, m68k_cycles);
- elprintf(EL_32X, "%csh2 +run %u %d @%08x",
- sh2->is_slave?'s':'m', sh2->m68krcycles_done, cycles, sh2->pc);
+ elprintf_sh2(sh2, EL_32X, "+run %u %d @%08x",
+ sh2->m68krcycles_done, cycles, sh2->pc);
done = sh2_execute(sh2, cycles);
sh2->m68krcycles_done += C_SH2_TO_M68K(*sh2, done);
sh2->state &= ~SH2_STATE_RUN;
pevt_log_sh2_o(sh2, EVT_RUN_END);
- elprintf(EL_32X, "%csh2 -run %u %d",
- sh2->is_slave?'s':'m', sh2->m68krcycles_done, done);
+ elprintf_sh2(sh2, EL_32X, "-run %u %d",
+ sh2->m68krcycles_done, done);
}
// sync other sh2 to this one
return;
}
- elprintf(EL_32X, "%csh2 sync to %u %d",
- osh2->is_slave?'s':'m', m68k_target, m68k_cycles);
+ elprintf_sh2(osh2, EL_32X, "sync to %u %d",
+ m68k_target, m68k_cycles);
run_sh2(osh2, m68k_cycles);
if (a == sh2->poll_addr && sh2->poll_cycles - cycles_left <= 10) {
if (sh2->poll_cnt++ > maxcnt) {
if (!(sh2->state & flags))
- elprintf(EL_32X, "%csh2 state: %02x->%02x", sh2->is_slave?'s':'m',
+ elprintf_sh2(sh2, EL_32X, "state: %02x->%02x",
sh2->state, sh2->state | flags);
sh2->state |= flags;
void p32x_sh2_poll_event(SH2 *sh2, u32 flags, u32 m68k_cycles)
{
if (sh2->state & flags) {
- elprintf(EL_32X, "%csh2 state: %02x->%02x", sh2->is_slave?'s':'m',
- sh2->state, sh2->state & ~flags);
+ elprintf_sh2(sh2, EL_32X, "state: %02x->%02x", sh2->state,
+ sh2->state & ~flags);
if (sh2->m68krcycles_done < m68k_cycles)
sh2->m68krcycles_done = m68k_cycles;
// read8
static u32 sh2_read8_unmapped(u32 a, SH2 *sh2)
{
- elprintf(EL_UIO, "%csh2 unmapped r8 [%08x] %02x @%06x",
- sh2->is_slave ? 's' : 'm', a, 0, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "unmapped r8 [%08x] %02x @%06x",
+ a, 0, sh2_pc(sh2));
return 0;
}
else
d >>= 8;
- elprintf(EL_32X, "%csh2 r8 [%08x] %02x @%06x",
- sh2->is_slave ? 's' : 'm', a, d, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "r8 [%08x] %02x @%06x",
+ a, d, sh2_pc(sh2));
return d;
}
// read16
static u32 sh2_read16_unmapped(u32 a, SH2 *sh2)
{
- elprintf(EL_UIO, "%csh2 unmapped r16 [%08x] %04x @%06x",
- sh2->is_slave ? 's' : 'm', a, 0, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "unmapped r16 [%08x] %04x @%06x",
+ a, 0, sh2_pc(sh2));
return 0;
}
return sh2_read16_unmapped(a, sh2);
out:
- elprintf(EL_32X, "%csh2 r16 [%08x] %04x @%06x",
- sh2->is_slave ? 's' : 'm', a, d, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "r16 [%08x] %04x @%06x",
+ a, d, sh2_pc(sh2));
return d;
}
// write8
static void REGPARM(3) sh2_write8_unmapped(u32 a, u32 d, SH2 *sh2)
{
- elprintf(EL_UIO, "%csh2 unmapped w8 [%08x] %02x @%06x",
- sh2->is_slave ? 's' : 'm', a, d & 0xff, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "unmapped w8 [%08x] %02x @%06x",
+ a, d & 0xff, sh2_pc(sh2));
}
static void REGPARM(3) sh2_write8_cs0(u32 a, u32 d, SH2 *sh2)
{
- elprintf(EL_32X, "%csh2 w8 [%08x] %02x @%06x",
- sh2->is_slave ? 's' : 'm', a, d & 0xff, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "w8 [%08x] %02x @%06x",
+ a, d & 0xff, sh2_pc(sh2));
if (Pico32x.regs[0] & P32XS_FM) {
if ((a & 0x3ff00) == 0x4100) {
// write16
static void REGPARM(3) sh2_write16_unmapped(u32 a, u32 d, SH2 *sh2)
{
- elprintf(EL_UIO, "%csh2 unmapped w16 [%08x] %04x @%06x",
- sh2->is_slave ? 's' : 'm', a, d & 0xffff, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "unmapped w16 [%08x] %04x @%06x",
+ a, d & 0xffff, sh2_pc(sh2));
}
static void REGPARM(3) sh2_write16_cs0(u32 a, u32 d, SH2 *sh2)
{
if (((EL_LOGMASK & EL_PWM) || (a & 0x30) != 0x30)) // hide PWM
- elprintf(EL_32X, "%csh2 w16 [%08x] %04x @%06x",
- sh2->is_slave ? 's' : 'm', a, d & 0xffff, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32X, "w16 [%08x] %04x @%06x",
+ a, d & 0xffff, sh2_pc(sh2));
if (Pico32x.regs[0] & P32XS_FM) {
if ((a & 0x3ff00) == 0x4100) {
// DMA trigger by SH2 register write
static void dmac_trigger(SH2 *sh2, struct dma_chan *chan)
{
- elprintf(EL_32XP, "sh2 DMA %08x->%08x, cnt %d, chcr %04x @%06x",
+ elprintf_sh2(sh2, EL_32XP, "DMA %08x->%08x, cnt %d, chcr %04x @%06x",
chan->sar, chan->dar, chan->tcr, chan->chcr, sh2->pc);
chan->tcr &= 0xffffff;
if (PREG8(r, 2) & 0x80) { // TIE - tx irq enabled
int level = PREG8(oregs, 0x60) >> 4;
int vector = PREG8(oregs, 0x64) & 0x7f;
- elprintf(EL_32XP, "SCI tx irq (%d, %d)",
+ elprintf_sh2(sh2, EL_32XP, "SCI tx irq (%d, %d)",
level, vector);
sh2_internal_irq(sh2, level, vector);
}
if (PREG8(oregs, 2) & 0x40) { // RIE - rx irq enabled
int level = PREG8(oregs, 0x60) >> 4;
int vector = PREG8(oregs, 0x63) & 0x7f;
- elprintf(EL_32XP, "SCI rx irq (%d, %d)",
+ elprintf_sh2(sh2->other_sh2, EL_32XP, "SCI rx irq (%d, %d)",
level, vector);
sh2_internal_irq(sh2->other_sh2, level, vector);
}
u8 *r = (void *)sh2->peri_regs;
u8 old;
- elprintf(EL_32XP, "%csh2 peri w8 [%08x] %02x @%06x",
- sh2->is_slave ? 's' : 'm', a, d, sh2_pc(sh2));
+ elprintf_sh2(sh2, EL_32XP, "peri w8 [%08x] %02x @%06x",
+ a, d, sh2_pc(sh2));
a &= 0x1ff;
old = PREG8(r, a);
sh2->state |= SH2_STATE_SLEEP;
for (i = 0; i < Pico32x.dmac0_fifo_ptr && chan->tcr > 0; i++) {
- elprintf(EL_32XP, "dreq0 [%08x] %04x, dreq_len %d",
+ elprintf_sh2(sh2, EL_32XP, "dreq0 [%08x] %04x, dreq_len %d",
chan->dar, Pico32x.dmac_fifo[i], dreqlen);
p32x_sh2_write16(chan->dar, Pico32x.dmac_fifo[i], sh2);
chan->dar += 2;
#define sh2_set_vbr(c, v) \\r
{ if (c) ssh2.vbr = v; else msh2.vbr = v; }\r
\r
+#define elprintf_sh2(sh2, w, f, ...) \\r
+ elprintf(w,"%csh2 "f,(sh2)->is_slave?'s':'m',##__VA_ARGS__)\r
+\r
// ---------------------------------------------------------\r
\r
// main oscillator clock which controls timing\r