Talk:Cheat Code

From Custom Mario Kart
Revision as of 07:12, 5 May 2016 by Leseratte (talk | contribs)
Jump to navigation Jump to search

Opcode format and masking.

Mainly @Leseratte, you changed the mask from (ba & 0xfe000000) + XXXXXX to ba + (X & 0x1ffffff) which as far as I know is completely wrong. Do you have some evidence that your modification is correct. I get what you're saying about X only being a 25 bit value (because the opcode is 7 bits) but is ba not masked? Is it not (ba & 0xfe000000) + (X & 0x1ffffff)?

Separately, you edited the article to present the opcode as 04/05, but this isn't really the case, as the article makes the point that the opcode is only 7 bits (displayed shifted left one place) so 04 = 05. I see what you mean though, that the first byte of the instruction is 04 or 05, but the 7 bit opcode is the same in each case (0x02) which shift left one place to give 0x04. It's a minor complaint, but it doesn’t make sense currently how it's written (to me), but I have a rather formal view on these things. Perhaps it would be better to reword the article in terms of bytes, but this is a wiki rather than a how-to so I felt a formal encyclopedic approach was more appropriate. Chadderz (talk) 21:59, 4 May 2016 (UTC)

Cite from gecko codes for 04: "For values of ______ >= 0x01000000, add one to the codetype." So "X & 0x1ffffff" is correct.
However, if looking into the source code, then I can find "rlwinm r3,r3,0,7,31" (r3 is the first word of the code line) and later "rlwinm r12,r12,0,0,29" → "X & 0x01fffffc" is correct if writing a 32 bit number.
-- Wiimm (talk) 22:48, 4 May 2016 (UTC)
The geckocodes page clearly states "04______ XXXXXXXX: Writes the value XXXXXXXX to ba+______". And if I recall correctly, I have tested this in the past by setting ba to 80______ and using "04000000 XXXXXXXX". Leseratte (talk) 07:12, 5 May 2016 (UTC)