The purpose of this page is to document all of the known tricks of the NES Contra game so far.
Because of the nature of this site, we concentrate here on tricks that are extremely difficult to execute in real play, but are useful in the making of tool-assisted speedruns. For most of the tricks, a frame advance feature in an emulator is a definite must-have.

Currently Published Movies
Published on 4/10/2022
Contra is a classic action game. Equipped with heavy artillery and infinite ammo, you must save the world by defeating the organization Red Falcon.
This time, Mars608 and aiqiyou improve the previous TAS by 0.44 seconds, thanks to better optimisation.
Game:
Contra

Genres:
Platformer
Shooter
Emulator Replay:
FCEUX 2.2.2

Published on 6/26/2022
Contra is a classic action game. Equipped with heavy artillery and infinite ammo, you must save the world by defeating the organization Red Falcon.
Mars608 and aiqiyou have saved nearly a second over their previous run thanks to tighter movement control and a different strategy for reviving the second player.

Published on 7/6/2022
Contra is a popular side-scrolling shooter game for the NES, infamous for its fragile protagonists. It's also known as 魂斗羅 (Kontora) in Japan, and Probotector in Europe. GryZor is also used in Europe on some other systems. This run focuses on a specific goal: do not kill enemies directly unless absolutely necessary to complete the game.
This is an improvement of 11 frames over the previous publication by the same authors.

See also Trax's disassembly (home page), especially contrarammap.txt. It is for the North American release.
Known enemy sprite codes:
7AArm segment of Gromaides (Level 3 boss)
7BHand segment of Gromaides (Level 3 boss)

The Jump Glitch


In Stage 3 it is possible to jump to ledges normally impossible by taking advantage of vertical scrolling. To perform it you jump, then press left, then hold right. It seems random, but if you press right at the right frame, you will stay in air for longer than usual and can land on ledges that would normally take 2 jumps.
Conversely, this can also be used to jump shorter than normal. This should be used on all other jumps in order to shave a frame from each one. (In reality many of them can not be shaved this way).

Spread Gun Optimization - Horizontal levels



Spread Gun optimization - 3D levels



Gradual Spread Gun pattern substitution



Boss Behavior

Boss HP can only drop 1 HP per frame. This means the strategy isn't as much about unloading bullets as fast as possible, but instead trying to make sure damage is registered every frame.

Gromaides (Level 3 Boss)

The arms of Gromaides occupy 10 enemy slots, one for each segment. The following enemy variable arrays have special meanings for this boss:
05A80x00 = segment belongs to the left arm, 0x01 = segment belongs to the right arm (relative to the screen).
05C8Frame counter for each segment. Counts up to 16; then spawns the next arm segment and becomes 0xFF.
05D8Enemy slot index of the next arm segment, moving inward. 0xFF if this is the innermost segment (the "shoulder").
05E8Enemy slot index of the next arm segment, moving outward. 0xFF if this is the outermost segment (the "hand").
The enemy variable arrays at 05D8 and 05E8 form doubly linked lists of arm segments, one list for each arm.
Some subroutine addresses:
9B7EUpdate function for initial arm extension. Has delay counters for spawning in each arm segment successively. Calls 9BDA to update the position of each spawned segment.
9BDAArm segment position update function during initial extension. Adds ±0x0.B5 pixels to the x-coordinate (depending on whether left or right arm) and −0x0.B5 pixels to the y-coordinate of each spawned arm segment.
9C11Stores the sprite code to use for an arm segment in the corresponding slot in the 030A enemy variable array: 0x7A for an "arm" segment or 0x7B for a "hand" segment.

RNG

The RNG variable at address 0034 is updated by repeatedly adding to it the current frame counter (and carry flag), in an infinite loop until an NMI (vblank) occurs.
07:F880: A5 1A    LDA $1A    ; frame counter
07:F882: 65 34    ADC $34    ; RNG
07:F884: 85 34    STA $34
07:F886: 4C 80 F8 JMP $F880
Series of articles by Allan Blomquist:
  1. Introduction – object model, level types, scrolling
  2. Levels – screens, supertiles, collision data, enemies
  3. Random Enemies – random enemy spawns, respawn counter, weapon levels
  4. Base Enemies – static enemies, sequenced enemies, power-up enemies
  5. Collision Detection – object vs. object, object vs. level, 3D collision
  6. Player Control – player physics, player states, control details
  7. Conclusion – RNG, structure of arrays, screen space coordinates, formulas for enemy HP and behavior, changes after multiple playthroughs
Contra - Behind the Code – Konami code, "R" weapon upgrade, player bullet speed


GameResources/NES/Contra last edited by Samsara on 7/18/2022 10:22 PM
Page History Latest diff List referrers View Source