Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DSP LLE: Rename CMPAR to CMPAXH #10702

Merged
merged 3 commits into from May 28, 2022
Merged

Conversation

Pokechu22
Copy link
Contributor

The old name implies that it works on the address registers (like DAR/IAR/SUBARN/ADDARN), while the new name is consistent with TSTAXH and MULAXH. This PR also adds a test that covers CMPAXH and TSTAXH. This PR is intended to be merged before #10692.


Note that CMPAR wasn't included in the manual until #10048 (specifically 211c2b5), but was described in some notes without giving it a name (on http://hitmen.c02.at/html/gc_tools.html for DSP Suite, look in the zip's gcdspsuite/doc/reverse.txt and reverse_new.txt):

0xc100 - 0xd100
|110r a001 ---- ----|
compare $acca with $(1a+r)
$acca < $(r1a)	28
$acca > $(r1a)	21
$acca = $(r1a)	25	// equal only if acc.1c == 0

In the initial megacommit, it existed in the table as CMPAXH and as cmpar in the actual implementation:

void dsp_opc_cmpar(uint16 opc)
{
uint8 rreg = ((opc >> 12) & 0x1) + 0x1a;
uint8 areg = (opc >> 11) & 0x1;
// we compare
sint64 rr = (sint16)g_dsp.r[rreg];
rr <<= 16;
sint64 ar = dsp_get_long_acc(areg);
Update_SR_Register(ar - rr);
}

{"CMPAXH", 0xc100, 0xe7ff, 1 | P_EXT, 2, {{P_ACCM, 1, 0, 12, 0x1000}, {P_REG1A, 1, 0, 11, 0x0800}},},

In 472e673 it was renamed to CMPAR in the table, but also commented out due to a separate bug. That bug was fixed in 8b6b8b6. There was an additional mistake that was fixed in 4747cc7.

@lioncash lioncash merged commit 2d6fe6a into dolphin-emu:master May 28, 2022
Pokechu22 added a commit to Pokechu22/ghidra-gcdsp-lang that referenced this pull request Jun 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants