David wrote:
In case the ROM hides these, I could manually try combinations.
If it's the same as the EU version, there are only (3^8=) 6561 combinations possible, right?
"only" eh?
You could, but it would be quite long and boring...
Instead I looked into the disassembly. (Europe version)
I found the checks in the Europe version by searching for code that calls potion effects, since I knew that some codes do that.
This is the code that collects the pressed buttons:
Code: Select all
000563DE 3400 MOVE.W D0,D2
000563E0 e84a LSR.W #4,D2
000563E2 0242 0007 AND.W #0x7,D2
000563E6 4a42 TST.W D2
000563E8 6600 000c BNE.L B_563f6
000563EC 33fc 0000 00ff 1f98 MOVE.W #0x0000,A_00ff1f98 ; is_pressed
000563F4 4e75 RTS
000563F6 4a79 00ff 1f98 TST.W A_00ff1f98 ; is_pressed
000563FC 6700 0004 BEQ.L B_56402
00056400 4e75 RTS
00056402 33fc ffff 00ff 1f98 MOVE.W #0xffff,A_00ff1f98 ; is_pressed
0005640A 0c42 0004 CMP.W #0x4,D2 ; (A) button?
0005640E 6600 0006 BNE.L B_56416
00056412 343c 0000 MOVE.W #0x0000,D2
00056416 7200 MOVEQ #0x0,D1
00056418 3239 00ff 1f94 MOVE.W A_00ff1f94,D1 ; buffer?
0005641E c3fc 0003 MULS.W #0x0003,D1
00056422 d242 ADD.W D2,D1
00056424 83fc 19a1 DIVS.W #0x19A1,D1 ; = 3**8
00056428 4841 SWAP D1 ; mod
0005642A 33c1 00ff 1f94 MOVE.W D1,A_00ff1f94 ; buffer?
00056430 c3fc 0515 MULS.W #0x0515,D1
00056434 83fc 19a1 DIVS.W #0x19A1,D1 ; = 3**8
00056438 4841 SWAP D1 ; mod
C equivalent:
Code: Select all
short buffer; /*A_00ff1f94*/
short is_pressed; /*A_00ff1f98*/
void process(short input /*D0*/) {
short button /*D2*/ = (input >> 4) & 7;
if (button == 0) { is_pressed = 0; return; }
// Ignore pressed buttons until all buttons are released:
if (is_pressed != 0) return;
is_pressed = -1;
if (button == 4) button = 0; // (A) button?
// A=0, B=1, C=2
buffer = (buffer * 3 + button) % 0x19A1;
switch ((buffer * 0x0515) % 0x19A1) {
// ... see recognized codes below ...
}
}
BASH script to convert ABC strings into numbers:
Code: Select all
#! /bin/bash
x=$(echo "$1" | tr ABC 012)
((x = 3#$x))
((x = (x * 0x515) % (3 ** 8) ))
printf "%#x" $x
And here are the recognized codes:
Code: Select all
0005643A 0c41 1216 CMP.W #0x1216,D1 ; CACBBACC
0005643E 6700 003c BEQ.L B_5647c ; heal
00056442 0c41 0dac CMP.W #0xdac,D1 ; BBAABCCB
00056446 6700 0046 BEQ.L B_5648e ; life
0005644A 0c41 0edb CMP.W #0xedb,D1 ; CBAACBAB
0005644E 6700 0050 BEQ.L B_564a0 ; skip level
00056452 0c41 076c CMP.W #0x76c,D1 ; AABACAAC
00056456 6700 0090 BEQ.L B_564e8 ; open gates
0005645A 0c41 07be CMP.W #0x7be,D1 ; AACABBBB
0005645E 6700 00dc BEQ.L B_5653c ; slow-fall
00056462 0c41 13dc CMP.W #0x13dc,D1 ; ABACCACB
00056466 6700 00fc BEQ.L B_56564 ; kill guard
0005646A 0c41 005c CMP.W #0x5c,D1 ; BAABCBBB
0005646E 6700 013a BEQ.L B_565aa ; shake
00056472 0c41 1380 CMP.W #0x1380,D1 ; CBAACCBA
00056476 6700 0142 BEQ.L B_565ba ; stop time
0005647A 4e75 RTS
So the codes are:
Code: Select all
CACBBACC = heal
BBAABCCB = life
CBAACBAB = skip level
AABACAAC = open gates (but not the exit door)
AACABBBB = slow-fall
ABACCACB = kill guard
BAABCBBB = shake/earthquake
CBAACCBA = stop time
All of these were included in at least one of the lists that I linked from my first post, so it looks like I didn't find any new codes.
Notes:
"kill guard" will not close the paused menu if there is no guard to kill.
"skip level" does not work on level 16 (tower/Jaffar), but on level 17 (princess) it will go to the ending.
Also, it takes time away!
It takes away somewhat less than 5 minutes, unless this would make the remaining time less than 6 minutes.
Code: Select all
000564A0 0c79 000f 00ff 0fe0 CMP.W #0xf,A_00ff0fe0 ; level number - 1
000564A8 67d0 BEQ B_5647a ; return without accepting
000564AA 2039 00ff 0d5c MOVE A_00ff0d5c,D0 ; Time
000564B0 04b9 0000 3840 00ff 0d5c SUB #0x3840,A_00ff0d5c ; 0x3840 = 14400 = 4,8 * 60 * 50 (4:48)
000564BA 0cb9 0000 4650 00ff 0d5c CMP #0x4650,A_00ff0d5c ; 0x4650 = 18000 = 6 * 60 * 50 (6:00)
000564C4 6e00 0008 BGT.L B_564ce
000564C8 23c0 00ff 0d5c MOVE D0,A_00ff0d5c ; Time
As for the USA version:
* I didn't find any code that would call any of the potion effects (except when drinking a potion, obviously).
* Neither did I find any place in RAM (savestates) that stores collected button presses.