Gun Frontier/Advanced Rank

See Gun Frontier for the main page.

Overview
Most numbers given here are written in both decimal (base 10) and hexadecimal (base 16) for clarity. Numbers beginning with a $ symbol are in hexadecimal, otherwise they are decimal.

The rank value is ranged from $00 (0) to $FF (255), where $00 is the easiest and $FF is the hardest. The value changes dynamically, rather than with a formula, so this page will list the conditions which modify the rank value.

DIP Switches
The difficulty setting set by DIP switches affects the starting rank value of the game. This is not a lower bounds, and so it is possible to reduce the rank value below this amount.

Stage Limit
The stage number determines the lowest possible value for the rank. These values are not affected by the DIP switch setting. If the rank ever goes below the value for the current stage, it will be set to that value.

Although a value exists for Stage 6, rank has no effect on any behavior in that stage.

Timer Rank
The rank is increased periodically every 600 frames (~10 seconds). When this period has elapsed, the rank is increased by 1 plus the number of full bombs in stock. During a multi-player game, this value is taken from the player with the most number of full bombs.

Shot Button Presses
Probably the most misunderstood and over-discussed source of rank is the rank caused by shooting and autofire. The rank increase is entirely based on number of button presses in a short time, and is neither related to the number of shots wasted, nor the number of shots that actually are fired (that is, a button press that results in no shot coming out is still counted).

When a player presses the shot button, the game will start counting the duration until the next press. If the next press occurs within 8 frames, a counter is incremented. When this counter has incremented 42 times, the rank will increase by 1, and the counter will be reset. Player 1 and Player 2 have separate counters and timers.

So long as the player does not press the button again within 8 frames of the last press, there is no effect. Thus, an autofire rate of 6.6Hz (every 9 frames) will not affect the rank. Below is an effective table of rank increase rates for each autofire rate. These rates are the autofire interval multiplied by 42.

Bombing
Firing a full sized bomb increases rank by 4, as does firing a partial bomb with 6 or more fragments. Firing a partial bomb with 5 fragments or less only increases rank by 2.

Stage Clear
When a stage is cleared, the rank increases by 6 plus the number of remaining lives times 5. During a multi-player game, this value is taken from the player with the most number of remaining lives. Below is an effective table of rank increases per life count. When stage 5 is cleared, all lives are converted to score, so the rank increase for clearing stage 5 is always 6.

Secrets
Defeating the blue medium-sized planes in stage 2 with a bomb awards 10,000 points per plane destroyed, but also raises the rank by 5 for each plane destroyed. For example, destroying 4 planes with 1 bomb awards 40,000 points, but also increases rank by 24 (5 rank * 4 planes + 4 rank * 1 bomb).

Seemingly, this is the only secret that will increase rank.

Death
Dying will lower the rank by $0D (13) for the first death in a stage, and $20 (32) for any subsequent deaths. The number of remaining lives has no effect on this change. This rank change does not apply if you will respawn in-place, such as during multi-player games or during a boss battle.

When a continue is used in a single-player game, the rank is lowered by $3A (58). A player joining in mid-game or continuing during a multi-player game will lower rank by 8.

Memory Addresses
These addresses are provided for easy reference and verification of the above information.