Under the microscope: Shinobi Legions
A debug mode cheat code that stayed hidden for a pretty good reason
Here are instructions for entering a cheat code in Shinobi Legions (a.k.a. Shinobi X, a.k.a Shin Shinobi Den). I swear I’m not making these up:
Go to the Options screen
Navigate to Music and select Stage 2-3
Navigate to S.E. and select 06
Navigate to Audio, hold L, and put in the 40 button sequence shown below
Exit the Options screen and start a new game
Press start to pause, and then hold R
That’s a lot to do, but it’s worth it! Your reward is a debug menu with several cool features. In addition, you also get free movement and the ability to do special moves any time.
Here’s a video to prove that it works:
If you’d rather not attempt to enter such a long code, here’s a patch you can use to play with debug mode enabled by default.
Below is more information on what debug mode does, and technical details on how the code works.
Debug mode features
Most of the features listed on the menu are straightforward: Invincible makes you invincible, Stage lets you change stages, Shou credit is the number of lives you have, etc.
Debug Information: it shows you details about your position, the animations being displayed, what the sound system is doing, and more. It also displays hit boxes for the things you can interact with.
Ninjutu Name: it enables special moves. You can perform the selected move at any time by holding L and pressing X.
Bunshin makes shadow versions of yourself take damage for a while. Rairyu summons a dragon to hit your enemies with lightning. Bishamon calls forth a statue warrior to attack enemies for you.
Zoom rate: I’m not sure what this does. Tell me if you do!
Free movement: You can reposition Shou by holding R+Z and then moving the D-pad. You can’t go through walls, but you can attack while moving in mid-air.
Disable collision: If you hold R+Y, you can go through solid surfaces. But you have to be careful - unless you’re also holding Z, gravity applies and you’ll fall through the floor and die.
The technical details
We’ll examine the PAL version here, because it has better music1. The debug code also works on the NTSC-U version, and I imagine on the NTSC-J version too.
The usual technique of diffing memory snapshots reveals where the game stores controller input. Setting read breakpoints for those locations directs us to a function I call write_button_history
(at 06042310
). It records our button presses to a buffer that starts at 060dd0b4
.
If we check the references to that buffer, we’ll find a function that I call check_button_code
at 0604234c
. This compares our button history to a known sequence.
Shinobi Legions uses this encoding scheme for buttons:
If we look at the things that call check_button_code
, we’ll find that it’s called with several different parameters. The first is:
0200 # C button
0040 # X button
0100 # B button
0020 # Y button
0400 # A button
0010 # Z button
0800 # Start button
This matches the View all full motion videos code that’s been known for ages2. Similarly, by examining the other calls to check_button_code
, we’ll find other known cheats:
99 lives (
060439b4
): A, Z, B, Y, C, X StartOne hit death (
060438fa
): A, B, C, B, A, Start999 knives (
060439b4
): C, A, B
And then there’s the monster 40 button sequence from above. But where do you enter it?
The call for the 999 knives code provides a clue. For that one you have to be on the Options screen, highlighting the Knives item, and holding L+R. The call for the debug code is in the same neighborhood, in the section for Audio. It starts at 06040e7c
and translates to something like this in pseudo-Python:
# Check for the Audio item
if menu_index != 5:
return 0
# Check for the right music selection
if music_selected != 8:
return 0
# Check for the right sound selection
if sound_selected != 6:
return 0
# Check for L being held
if p1_held & 0x0088 == 0x0008:
write_button_history()
# Check the button history buffer. If it matches
# the code sequence, play a sound.
if check_button_code(DEBUG_BUTTON_SEQUENCE) == 1:
play_sfx(0x0108)
return 1
return 0
I have no idea why they made this so involved! I kind of wonder whether this whole thing was put here by Tose for me to find 29 years later.
Outro
Feel free to add this information and use these screenshots elsewhere - if you update TCRF and Sega Retro, I won’t have to!
For previous coverage of undiscovered cheat codes, see:
Also, send me suggestions - what games do you think have hidden secrets like this? I’m @memory_fallen on X/Twitter.
Thanks to Richard Jacques for that!
This one doesn’t work on the NTSC-U version because it lacks the opening FMV.
That's amazing. What a great find all these years later! I was wondering if you might look at the game Battle Monsters. In a hex editor, it looks like there might be a debug mode for the game maybe.