Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- read_password:
- ; These passwords were cracked long ago.
- ; Essentially, row A corresponds to E-tanks,
- ; rows B-E correspond to robot defeated flags.
- ; Put a ball in row A to get 1 - column number E tanks.
- ;
- ; Each robot master has a set position for alive and defeated;
- ; these are encoded in the two password_flags tables.
- ; The positions are offset by how many E-tanks you have.
- ; All 8 robots must be accounted for in a password.
- 0D:A3E3: 20 E9 A8 JSR update_password_graphics
- ; Black out cursor
- 0D:A3E6: A9 0F LDA #$0F
- 0D:A3E8: 8D 6C 03 STA palette_mirror[16]
- ; Loop to determine which column in row A is filled.
- 0D:A3EB: A2 00 LDX #0
- row_A_check:
- 0D:A3ED: BD 20 04 LDA sprite_flags,X
- 0D:A3F0: D0 05 BNE row_A_slot_determined
- 0D:A3F2: E8 INX
- 0D:A3F3: E0 04 CPX #4
- 0D:A3F5: D0 F6 BNE row_A_check
- ; Interesting bug.
- ; If you don't put a ball in row A, it will assume
- ; one is in A5. This results in 256 * 12 unintended passwords.
- ; The only thing you can do is mark a robot as simultaneously
- ; alive and dead, which just means he counts as defeated
- ; in your savegame.
- ; Could add JMP password_invalid here to fix the bug.
- row_A_slot_determined:
- ; X = which slot it's in.
- ; $04 will now serve as number of E tanks.
- 0D:A3F7: 86 04 STX $04
- ; Increment X by 5 to start checking at the row below.
- ; e.g. A3 becomes B3
- 0D:A3F9: 8A TXA
- 0D:A3FA: 18 CLC
- 0D:A3FB: 69 05 ADC #5
- 0D:A3FD: AA TAX
- ; $01 = number of slots checked
- ; $02 = Robot masters beaten (will be written to weapons_unlocked)
- ; $03 = Robot masters NOT beaten (used for validation)
- 0D:A3FE: A9 00 LDA #0
- 0D:A400: 85 01 STA $01
- 0D:A402: 85 02 STA $02
- 0D:A404: 85 03 STA $03
- main_password_loop:
- ; Loops 20 times starting directly below the first
- ; filled row A slot. Guaranteed to hit B1 - E5.
- 0D:A406: BD 20 04 LDA sprite_flags,X
- 0D:A409: F0 11 BEQ no_ball_here
- ; Get flags and OR them into $02 or $03
- ; password_flags stores which robot master this slot corresponds to.
- ; password_flags_types indicates whether he's defeated (0)
- ; or undefeated (1)
- ; Many of the flags are 0, indicating this slot corresponds
- ; to nothing. You could actually jump straight to password_invalid
- ; if you see a 0 here.
- 0D:A40B: A4 01 LDY $01
- 0D:A40D: B9 C2 AF LDA password_flags,Y
- 0D:A410: 48 PHA
- 0D:A411: B9 D6 AF LDA password_flag_types,Y
- 0D:A414: A8 TAY
- 0D:A415: 68 PLA
- 0D:A416: 19 02 00 ORA $0002,Y
- 0D:A419: 99 02 00 STA $0002,Y
- no_ball_here:
- 0D:A41C: E8 INX
- 0D:A41D: E0 19 CPX #25
- 0D:A41F: D0 02 BNE +
- ; Past the end of the ball slots. Go back to B1.
- 0D:A421: A2 05 LDX #5
- +:
- 0D:A423: E6 01 INC $01
- 0D:A425: A5 01 LDA $01
- ; Loop 20 times.
- 0D:A427: C9 14 CMP #20
- 0D:A429: D0 DB BNE main_password_loop
- ; Check if password is valid.
- ; $02 is what weapons we have unlocked.
- ; $03 is what we DON'T have unlocked.
- ; All 8 robots must be accounted for.
- 0D:A42B: A5 02 LDA $02
- 0D:A42D: 05 03 ORA $03
- 0D:A42F: C9 FF CMP #$FF
- 0D:A431: D0 03 BNE password_invalid
- 0D:A433: 4C 7B A4 JMP password_valid
Add Comment
Please, Sign In to add comment