data/claims/mega-man-2-save.yamlMega Man 2's password (lsmmega's disassembly)
Game: Mega Man 2.
Mega Man 2's password is 9 dots on a 5 by 5 grid; the entry screen counts down from 9 as the player places dots with A and takes them back with B, and reads the password when the ninth is placed. mega-man-2-save/grid
About: Mega Man 2 Password and battery save
Value
{
"cells": 25,
"rows": 5,
"columns": 5,
"dots": 9
}engine/password.asm#L105-L108LDA #$09
STA aobject_frameset_lower_timermm2: Mega Man 2 disassembly (lsmmega/mm2) · engine/password.asm#L162-L189AND #a_button
BEQ @b_pressed
LDA aobject_flag, X
BNE @skip
track_queue track_1up
INC aobject_flag, X
DEC aobject_frameset_lower_timer
BEQ @all_ball_set
…
@b_pressed:
LDA aobject_flag, X
BEQ @skip
…mm2: Mega Man 2 disassembly (lsmmega/mm2) · data/password/password_oam.asm#L18-L30password_oamycoord:
.BYTE $40, $40, $40, $40, $40
…
password_oamxcoord:
.BYTE $41, $51, $61, $71, $81Checked by claude, 2026-10-22 — read the dot-placing loop in _password and the cursor's coordinate tables at the pinned commitThe cursor tables give cell n the row n / 5 and the column n mod 5, so cells 0-4 are the top row. The lsmmega/mm2 build is the atlas's Mega Man 2 (USA) ROM with an iNES header.
Cited by: Mega Man 2, Password and battery save
Mega Man 2's password holds the E-tank count and, for each of the 8 Robot Masters, whether he is beaten; a dot in the top row's first five cells gives 0-4 E-tanks, and each Robot Master has one "beaten" cell and one "not beaten" cell among the other 20, which also include 4 cells that mean nothing. mega-man-2-save/layout
About: Mega Man 2 Password and battery save
Value
{
"etankRow": [
0,
1,
2,
3,
4
],
"slots": [
{
"i": 0,
"boss": "none"
},
{
"i": 1,
"boss": "Heat Man",
"beaten": true
},
{
"i": 2,
"boss": "none"
},
{
"i": 3,
"boss": "Quick Man",
"beaten": true
},
{
"i": 4,
"boss": "Wood Man",
"beaten": false
},
{
"i": 5,
"boss": "Flash Man",
"beaten": true
},
{
"i": 6,
"boss": "none"
},
{
"i": 7,
"boss": "Bubble Man",
"beaten": false
},
{
"i": 8,
"boss": "Quick Man",
"beaten": false
},
{
"i": 9,
"boss": "Crash Man",
"beaten": true
},
{
"i": 10,
"boss": "Bubble Man",
"beaten": true
},
{
"i": 11,
"boss": "Air Man",
"beaten": false
},
{
"i": 12,
"boss": "Wood Man",
"beaten": true
},
{
"i": 13,
"boss": "none"
},
{
"i": 14,
"boss": "Heat Man",
"beaten": false
},
{
"i": 15,
"boss": "Metal Man",
"beaten": false
},
{
"i": 16,
"boss": "Crash Man",
"beaten": false
},
{
"i": 17,
"boss": "Air Man",
"beaten": true
},
{
"i": 18,
"boss": "Flash Man",
"beaten": false
},
{
"i": 19,
"boss": "Metal Man",
"beaten": true
}
],
"cell": "5 + (etanks + i) mod 20"
}data/password/password.asm#L1-L11password_boss_clear_set:
.BYTE no_boss_clear, boss_heatman_clear, no_boss_clear, boss_quickman_clear, boss_woodman_clear
…
password_boolean:
.BYTE boss_clear_yes, boss_clear_yes, boss_clear_yes, boss_clear_yes, boss_clear_nomm2: Mega Man 2 disassembly (lsmmega/mm2) · constants/flags.asm#L30-L46;boss clear flags
no_boss_clear = 0
boss_heatman_clear = 1 << 0
…
;boss clear in password
.ENUM
boss_clear_yes
boss_clear_nomm2: Mega Man 2 disassembly (lsmmega/mm2) · engine/show_password.asm#L29-L60LDA z:zgot_weapon_flag
STA z:z00
EOR #%11111111
STA z:z01
CLC
LDA z:ze_tank
TAX
ADC #$05
STA z:z03
INC aobject_flag, X
…
LDY password_boolean, X
…Checked by claude, 2026-10-22 — read _show_password, the two 20-entry tables, and the flag constants at the pinned commit, and paired each table entry with its boss and its yes or no by hand_show_password sets the cell numbered by the E-tank count, then walks the 20 table entries, setting a dot where a boss's flag in the beaten byte (z00) or in its complement (z01) is set. The value's i is the table index; the cells 5-24 it lands on depend on the E-tank count.
Cited by: Mega Man 2, Password and battery save
Mega Man 2 shifts the 20 boss cells by the E-tank count; table entry i goes to cell 5 + (E-tanks + i) mod 20, wrapping from the last cell back to the first cell of the second row, so the same bosses beaten give a different grid for each E-tank count. mega-man-2-save/shift
About: Mega Man 2 Password and battery save
Value: 5 + (etanks + i) mod 20
Codemm2: Mega Man 2 disassembly (lsmmega/mm2) ·engine/show_password.asm#L33-L57LDA z:ze_tank
TAX
ADC #$05
STA z:z03
…
INY
CPY #$19
BNE @next_1
LDY #$05mm2: Mega Man 2 disassembly (lsmmega/mm2) · engine/password.asm#L202-L235@get_e_tank:
STX z:z04
TXA
CLC
ADC #$05
TAX
…
INX
CPX #$19
BNE @check_continue
LDX #$05Checked by claude, 2026-10-22 — read the cell index arithmetic in _show_password and in _password's decoder at the pinned commitThe encoder and the decoder use the same start (E-tanks + 5) and the same wrap (25 to 5).
Cited by: Mega Man 2, Password and battery save
Mega Man 2 reads the E-tank count as the first dot in the top row's first four cells, or 4 if none of them holds one, without looking at the fifth; it then ORs each dotted cell's boss into a beaten byte or a not-beaten byte and accepts the password only if the two together cover all 8 bosses, else it writes PASSWORD ERROR ! and, after two waits of 125 frames, returns to the menu of START and PASSWORD. mega-man-2-save/reject
About: Mega Man 2 Password and battery save
Codemm2: Mega Man 2 disassembly (lsmmega/mm2) ·engine/password.asm#L189-L273@loop_6:
LDA aobject_flag, X
BNE @get_e_tank
INX
CPX #$04
BNE @loop_6
…
@loop_7:
LDA aobject_flag, X
BEQ @ball_not_set
LDY z:z01
LDA password_boss_clear_set, Y
…mm2: Mega Man 2 disassembly (lsmmega/mm2) · data/password/strings.asm#L1-L37.BYTE "@START@@@"
…
.BYTE "@PASSWORD@"
…
.BYTE "PASSWORD@"
…
.BYTE "ERROR@!@@@"Checked by claude, 2026-10-22 — read the decoder from @all_ball_set to @incorrect's return at the pinned commit; @incorrect ends by loading strings 0 and 1, START and PASSWORD, and jumping to @back, the menu loopA boss with dots in both its cells counts as beaten, since the beaten byte is what the game loads. The check needs at least one cell per boss, not exactly one; with 9 dots and an E-tank dot in the top row, 8 dots are left for 8 bosses, so each gets exactly one. A dot in a cell that means nothing leaves a boss uncovered.
Cited by: Mega Man 2, Password and battery save
A correct Mega Man 2 password gives Mega Man the weapon of every boss in its beaten byte, Item 1 if Heat Man is beaten, Item 2 if Air Man is, and Item 3 if Flash Man is, plus its E-tank count; the password holds nothing else. mega-man-2-save/items
About: Mega Man 2 Password and battery save
Codemm2: Mega Man 2 disassembly (lsmmega/mm2) ·engine/password.asm#L275-L288@correct:
LDA z:z02
STA z:zgot_weapon_flag
AND #%00000011
STA z:zgot_item_flag
LDA z:zgot_weapon_flag
AND #%00100000
LSR
LSR
LSR
ORA z:zgot_item_flag
STA z:zgot_item_flag
…mm2: Mega Man 2 disassembly (lsmmega/mm2) · constants/flags.asm#L30-L39boss_heatman_clear = 1 << 0
boss_airman_clear = 1 << 1
…
boss_flashman_clear = 1 << 5Checked by claude, 2026-10-22 — read @correct in _password and the boss flag constants at the pinned commitBits 0, 1, and 5 of the beaten byte (Heat, Air, Flash) become item bits 0, 1, and 2. Which item each bit is comes from _show_password's sprite list (item 1, item 2, item 3).
Cited by: Mega Man 2, Password and battery save