by Daniel Marschall, 23 July 2009
This is a ROM hack for the GameBoy games Absolute Invincible Raijin-Oh (E) and Zettai Muteki Raijinou (J), which allows you to continue the game infinitely when you die, without returning to round 1. The story screen is only shown once at the beginning.
ROM offset | English ROM | Japanese ROM | ||
014Eh | Find | C1 31 | Find | F5 30 |
Replace | C9 DE | Replace | FD DD | |
0B51h | Find | AF CD A4 2F CD 16 05 3E 01 EA 04 D1 | Find | AF CD A4 2F CD 16 05 3E 01 EA 04 D1 |
Replace | CD 94 4E 00 00 00 00 00 00 00 00 00 | Replace | CD 94 4E 00 00 00 00 00 00 00 00 00 | |
8E92h | Find | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 | Find | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |
Replace | 18 0F FA 04 D1 FE 00 C0 CD ED 4E 3E 01 EA 04 D1 C9 | Replace | 18 0F FA 04 D1 FE 00 C0 CD ED 4E 3E 01 EA 04 D1 C9 | |
8EEBh | Find | 00 00 00 00 00 00 00 00 00 00 00 | Find | 00 00 00 00 00 00 00 00 00 00 00 |
Replace | 18 09 3E 00 CD A4 2F CD 16 05 C9 | Replace | 18 09 3E 00 CD A4 2F CD 16 05 C9 |
0B51h is called at two places and is the action after "Start" was pressed - so the game begins here.
ROM offset | BUS offset | Machine code | ASM code | Comment |
0B51h | 0B51h | AF | XOR A | Set A=0 (A = A XOR A = 0). If this is replaced with NOP (00h) then you'll hear a part of the winning melody when the story appears. |
0B52h | 0B52h | CD A4 2F | CALL 2FA4h | Stop the music |
0B55h | 0B55h | CD 16 05 | CALL 0516h | Show the story screen |
0B58h | 0B58h | 3E 01 | LD A,01h | Load value 01 |
0B5Ah | 0B5Ah | EA 04 D1 | LD (D104h),A | Set it as round counter |
The BUS areas 4E92h..4EA2h (ROM: 8E92h..8EA2h) and 4EEBh..4EF5h (ROM: 8EEBh..8EF5h) are filled with NOPs (00h). So we can insert some code there because there are no actions performed. But that does not mean, that the program counter will never reach these areas!
In the original code the sound is stopped (A=0), the story is shown and then the round counter at offset D104h is set to 1. We have to insert some code, but we have not enough space, so we make a CALL to a free space in the ROM.
ROM offset | BUS offset | Machine code | ASM code | Comment |
0B51h | 0B51h | CD 94 4E | CALL 4E94h | Jump to our inserted part and then return. |
0B54h | 0B54h | 00 | NOP | Do nothing. |
0B55h | 0B55h | 00 | NOP | Do nothing. |
0B56h | 0B56h | 00 | NOP | Do nothing. |
0B57h | 0B57h | 00 | NOP | Do nothing. |
0B58h | 0B58h | 00 | NOP | Do nothing. |
0B59h | 0B59h | 00 | NOP | Do nothing. |
0B5Ah | 0B5Ah | 00 | NOP | Do nothing. |
0B5Bh | 0B5Bh | 00 | NOP | Do nothing. |
0B5Ch | 0B5Ch | 00 | NOP | Do nothing. |
Now overwrite some hopefully unused NOPs for the insertion of the additional decision of the round counter. The round counter at offset D104h has the default value 0. If it is 0, initialize it with 1 and show the story screen. If it is not null, we go back and let the user play the game another time without story screen and without reset of the round counter.
ROM offset | BUS offset | Machine code | ASM code | Comment |
8E92h | 4E92h | 18 0F | JR 4EA3h | Just to be sure, jump over our inserted part. |
8E94h | 4E94h | FA 04 D1 | LD A,(D104h) | Load the round counter into the register. |
8E97h | 4E97h | FE 00 | CP 00h | Compare the round counter to 0 |
8E99h | 4E99h | C0 | RET NZ | If a round was set, we return! |
8E9Ah | 4E9Ah | CD ED 4E | CALL 4eed | Show the story screen only once at the beginning |
8E9Dh | 4E9Dh | 3E 01 | LD A,01h | Load value 01 |
8E9Fh | 4E9Fh | EA 04 D1 | LD (D104h),A | Set it as round counter |
8EA2h | 4EA2h | C9 | RET | Return to 0B54h |
Overwrite another hopefully unused NOPs for the story part only for the beginning.
ROM offset | BUS offset | Machine code | ASM code | Comment |
8EEBh | 4EEBh | 18 09 | JR 4EF6h | Just to be sure, jump over our inserted part. I believe this is really necessary since there were no RET (C9h) before this NOP section. |
8EEDh | 4EEDh | 3E 00 | LD A,00h | Equals our "XOR A" (A = A XOR A = 0) from the original code |
8EEFh | 4EEFh | CD A4 2F | CALL 2FA4h | Change music (Silence because A=0) |
8EF2h | 4EF2h | CD 16 05 | CALL 0516h | Show story screen |
8EF5h | 4EF5h | C9 | RET | Return to 4E9Dh |
Now change the CRC checksum from C131h to C9DEh (English ROM) or F530h to FDDDh (Japanese ROM) with the hex editor as seen in the table above. If your original ROM has another checksum, then you have to change it as shown in your emulator tool. If you had the same original checksum as I had, but another checksum after the changes, then you did probably something wrong.