Under the microscope: Instruments of Chaos

What is Instruments of Chaos Starring Young Indiana Jones, a single-player game, doing checking for input from Controller 2? That’s what I wondered when I saw this code, which runs after you make a selection on the map screen…

check_stage_4:
    ; Check if Germany was selected.
    cmpi.w #0x4,D0w
    ; If it wasn't, skip down to the check for England.
    bne.w check_stage_1
    ; If it was, check to see whether A is being held down on Controller 2.
    btst.b #0x6,(p2_held_fffffce2).w
    ; If it is, launch Germany.
    bne.b launch_stage_4
    ; If it wasn't, load the "all clear" progress value, 0x35.
    move.b #0x35,D0b
    ; Compare the saved progress to the "all clear" progress value.
    cmp.b (progress_fffffd42).l,D0b
    ; If there's a match, launch Germany.
    beq.b launch_stage_4
    ; If there's no match, store the "not yet" message ID.
    move.w #0x7,(message_id_fffff33e).l

Let’s break that down…

The map screen

Normally, if you select Germany without having completed the other missions, you get a message telling you that you can’t go there yet.

Indy, your princess is in another castle

But if the memory address that stores your progress (fffffd42) has the value 0x35, the logical OR of the values for Egypt (0x10); India (0x20); England (0x01); and Tibet (0x04), you are allowed into Berlin.

Get in the zeppelin!

However, if you hold A on controller 2 while selecting Germany, the progress check is skipped. You can start playing that mission right away.

Playing in Germany

That’s not the only secret in this game. Here’s some code that runs on the main menu screen:

check_cheat:
    ; Load Controller 1's currently-held buttons.
    move.b     (p1_held_fffffcdf).w,D0b
    ; If no buttons are being pressed, skip ahead.
    beq.b      main_menu_controls
    ; Load the cheat sequence.
    lea        (cheat_buttons_00031d26).l,A0
    ; Load the index of the next button in the sequence.
    clr.w      D1w
    move.b     (cheat_counter_fffffd2d).w,D1b
    ; Check whether the controller button matches the target.
    cmp.b      (0x0,A0,D1w*0x1)=>cheat_buttons_00031d26
    ; If it doesn't, reset the progress counter.
    bne.b      reset_cheat
    ; If it does, increment the progress counter.
    addq.w     #0x1,D1w
    move.b     D1b,(cheat_counter_fffffd2d).w
    ; The end of the sequence is signaled by a zero value.
    move.b     (0x0,A0,D1w*0x1)=>cheat_buttons_00031d26
    ; If we haven't reached that, skip ahead.
    bne.b      main_menu_controls
    ; If we have reached the end, play a sound effect.
    moveq      #0x50,D0
    move.l     D0,-(SP)=>local_4
    jsr        play_sfx_0000b81c.l
    addq.l     #0x4,SP
    ; And set the cheat indicator.
    move.b     #0x1,(cheat_effect_fffffd2e).w

It’s a cheat code detector! It’s looking for this sequence of buttons from controller 1: Up, A, Down, B, Left, C, Right, A.

Enter that correctly, and you’ll hear a sound effect. When you start playing a stage, you’ll find that you have 99 lives and more weapons and ammunition than normal.

Playing in England with 99 lives

Furthermore, you can skip to the next scene by pressing A on controller 2. If you do this in the Germany mission, you will see the ending scene and credits.

Congratulations, Indiana Jones!

This game is fiendishly difficult, so the cheat effects are really helpful.


Outro

Thanks for reading! For more on Instruments of Chaos, see this episode of the SEGAbits podcast. I’ll be back to put another Genesis game under the microscope next week. Check out my blog for more retro game reverse engineering articles in the meantime.

Leave a Reply

Your email address will not be published. Required fields are marked *