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
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, alex_ik ventures alone to destroy the alien base, saving 00:00.80 seconds compared to the previous TAS.
Published on 8/17/2021

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 is an improvement of 00:00.13 seconds (or 8 frames) from the previous publication.
Published on 8/24/2021

Contra completed fast, with an additional goal: do not kill enemies directly unless absolutely necessary to complete the game.
This is an improvement of 4 frames over the previous publication.

Note: This game was released under different names, such as 魂斗羅 (kontora) in Japan, and Probotector in Europe. GryZor is also used in Europe on some other systems.
Published on 9/26/2021

See also Trax's disassembly (home page), especially contrarammap.txt. It is for the North American release.
Contra
System: Nintendo Entertainment System
Domain Address Data Type Signed Endian Description
RAM 26 Byte Unsigned Host Frame counter
RAM 52 Byte Unsigned Host RNG
RAM 804 Byte Unsigned Host Enemy Y pixel coordinate (array of 16)
RAM 1224 Byte Unsigned Host Enemy Y subpixel coordinate (array of 16)
RAM 830 Byte Unsigned Host Enemy X pixel coordinate (array of 16)
RAM 1240 Byte Unsigned Host Enemy X subpixel coordinate (array of 16)
RAM 1400 Byte Signed Host Enemy HP (array of 16)
RAM 778 Byte Unsigned Host Enemy sprite code (array of 16)
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


GameResources/NES/Contra last edited by adelikat 23 days ago
Page History Latest diff List referrers View Source