DSPSpy: show register names instead of numbers
also print summed $prod and individual $sr bits
This commit is contained in:
parent
4c64e18b24
commit
3118a68246
|
@ -9,6 +9,7 @@
|
||||||
// Use Dolphin's dsptool to generate a new dsp_code.h.
|
// Use Dolphin's dsptool to generate a new dsp_code.h.
|
||||||
// Originally written by duddie and modified by FIRES. Then further modified by ector.
|
// Originally written by duddie and modified by FIRES. Then further modified by ector.
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
#include <fat.h>
|
#include <fat.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
@ -137,14 +138,11 @@ int curUcode = 0, runningUcode = 1;
|
||||||
|
|
||||||
int dsp_steps = 0;
|
int dsp_steps = 0;
|
||||||
|
|
||||||
// When comparing regs, ignore the loop stack registers.
|
constexpr std::array reg_names = {
|
||||||
bool regs_equal(int reg, u16 value1, u16 value2)
|
"ar0", "ar1", "ar2", "ar3", "ix0", "ix1", "ix2", "ix3", "wr0", "wr1", "wr2",
|
||||||
{
|
"wr3", "st0", "st1", "st2", "st3", "c0h", "c1h", "cr ", "sr ", "pl ", "pm1",
|
||||||
if (reg >= DSP_REG_ST0 && reg <= DSP_REG_ST3)
|
"ph ", "pm2", "x0l", "x1l", "x0h", "x1h", "c0l", "c1l", "c0m", "c1m",
|
||||||
return true;
|
};
|
||||||
else
|
|
||||||
return value1 == value2;
|
|
||||||
}
|
|
||||||
|
|
||||||
void print_reg_block(int x, int y, int sel, const u16* regs, const u16* compare_regs)
|
void print_reg_block(int x, int y, int sel, const u16* regs, const u16* compare_regs)
|
||||||
{
|
{
|
||||||
|
@ -155,18 +153,17 @@ void print_reg_block(int x, int y, int sel, const u16* regs, const u16* compare_
|
||||||
// Do not even display the loop stack registers.
|
// Do not even display the loop stack registers.
|
||||||
const int reg = j * 8 + i;
|
const int reg = j * 8 + i;
|
||||||
CON_SetColor(sel == reg ? CON_BRIGHT_YELLOW : CON_GREEN);
|
CON_SetColor(sel == reg ? CON_BRIGHT_YELLOW : CON_GREEN);
|
||||||
CON_Printf(x + j * 8, i + y, "%02x ", reg);
|
CON_Printf(x + j * 9, i + y, "%s ", reg_names[reg]);
|
||||||
if (j != 1 || i < 4)
|
if (j != 1 || i < 4)
|
||||||
{
|
{
|
||||||
u8 color1 =
|
u8 color1 = regs[reg] == compare_regs[reg] ? CON_BRIGHT_WHITE : CON_BRIGHT_RED;
|
||||||
regs_equal(reg, regs[reg], compare_regs[reg]) ? CON_BRIGHT_WHITE : CON_BRIGHT_RED;
|
|
||||||
for (int k = 0; k < 4; k++)
|
for (int k = 0; k < 4; k++)
|
||||||
{
|
{
|
||||||
if (sel == reg && k == small_cursor_x && ui_mode == UIM_EDIT_REG)
|
if (sel == reg && k == small_cursor_x && ui_mode == UIM_EDIT_REG)
|
||||||
CON_SetColor(CON_BRIGHT_CYAN);
|
CON_SetColor(CON_BRIGHT_CYAN);
|
||||||
else
|
else
|
||||||
CON_SetColor(color1);
|
CON_SetColor(color1);
|
||||||
CON_Printf(x + 3 + j * 8 + k, i + y, "%01x", (regs[reg] >> ((3 - k) * 4)) & 0xf);
|
CON_Printf(x + 4 + j * 9 + k, i + y, "%01x", (regs[reg] >> ((3 - k) * 4)) & 0xf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -177,8 +174,18 @@ void print_reg_block(int x, int y, int sel, const u16* regs, const u16* compare_
|
||||||
regs[DSP_REG_ACL0]);
|
regs[DSP_REG_ACL0]);
|
||||||
CON_Printf(x + 2, y + 10, "ACC1: %02x %04x %04x", regs[DSP_REG_ACH1] & 0xff, regs[DSP_REG_ACM1],
|
CON_Printf(x + 2, y + 10, "ACC1: %02x %04x %04x", regs[DSP_REG_ACH1] & 0xff, regs[DSP_REG_ACM1],
|
||||||
regs[DSP_REG_ACL1]);
|
regs[DSP_REG_ACL1]);
|
||||||
CON_Printf(x + 2, y + 11, "AX0: %04x %04x", regs[DSP_REG_AXH0], regs[DSP_REG_AXL0]);
|
CON_Printf(x + 2, y + 11, "AX0: %04x %04x", regs[DSP_REG_AXH0], regs[DSP_REG_AXL0]);
|
||||||
CON_Printf(x + 2, y + 12, "AX1: %04x %04x", regs[DSP_REG_AXH1], regs[DSP_REG_AXL1]);
|
CON_Printf(x + 2, y + 12, "AX1: %04x %04x", regs[DSP_REG_AXH1], regs[DSP_REG_AXL1]);
|
||||||
|
|
||||||
|
u64 prod = (u64(regs[DSP_REG_PRODH]) << 32) + (u64(regs[DSP_REG_PRODM]) << 16) +
|
||||||
|
(u64(regs[DSP_REG_PRODM2]) << 16) + u64(regs[DSP_REG_PRODL]);
|
||||||
|
CON_Printf(x + 2, y + 13, "PROD: %02x %04x %04x", (prod >> 32) & 0xff, (prod >> 16) & 0xffff,
|
||||||
|
prod & 0xffff);
|
||||||
|
|
||||||
|
CON_Printf(x + 2, y + 14, "SR:");
|
||||||
|
for (int i = 0; i < 16; ++i)
|
||||||
|
CON_Printf(x + 6 + i + i / 4, y + 14, "%c", regs[DSP_REG_SR] & (1 << (15 - i)) ? '1' : '0');
|
||||||
|
CON_Printf(x + 21, y + 15, "SZOC");
|
||||||
}
|
}
|
||||||
|
|
||||||
void print_regs(int _step, int _dsp_steps)
|
void print_regs(int _step, int _dsp_steps)
|
||||||
|
@ -187,7 +194,7 @@ void print_regs(int _step, int _dsp_steps)
|
||||||
const u16* regs2 = dspreg_out[_step];
|
const u16* regs2 = dspreg_out[_step];
|
||||||
|
|
||||||
print_reg_block(0, 2, _step == 0 ? cursor_reg : -1, regs, regs2);
|
print_reg_block(0, 2, _step == 0 ? cursor_reg : -1, regs, regs2);
|
||||||
print_reg_block(33, 2, -1, regs2, regs);
|
print_reg_block(38, 2, -1, regs2, regs);
|
||||||
|
|
||||||
CON_SetColor(CON_WHITE);
|
CON_SetColor(CON_WHITE);
|
||||||
CON_Printf(33, 17, "%i / %i ", _step + 1, _dsp_steps);
|
CON_Printf(33, 17, "%i / %i ", _step + 1, _dsp_steps);
|
||||||
|
|
Loading…
Reference in New Issue