Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- password_runner_loop:
- 0D:A357: A5 27 LDA p1_buttons_pressed
- ; Mask for only D-pad buttons
- 0D:A359: 29 F0 AND #$F0
- 0D:A35B: D0 18 BNE arrows_pressed
- 0D:A35D: A5 23 LDA p1_buttons_held
- ; Mask for only D-pad buttons
- 0D:A35F: 29 F0 AND #$F0
- 0D:A361: F0 45 BEQ no_arrows_held
- ; Is this a bug?
- ; The intent here is to ignore inputs if at least one arrow
- ; was released this frame.
- ; p1_buttons_prev is used during the buttons pressed
- ; calculation, but afterwards it's always equal to the current
- ; frame's buttons. So this check always passes.
- 0D:A363: A5 25 LDA p1_buttons_held_prev
- 0D:A365: C5 23 CMP p1_buttons_held
- 0D:A367: D0 3F BNE no_arrows_held
- ; An arrow is being held but was not pressed on this frame.
- ; Do delayed autorepeat logic.
- 0D:A369: E6 FE INC password_cursor_timer
- 0D:A36B: A5 FE LDA password_cursor_timer
- 0D:A36D: C9 18 CMP #$18
- 0D:A36F: 90 3B BCC check_AB
- ; Write back a higher value so the subsequent autorepeats are
- ; shorter than the initial delay. Pattern looks like 25, 17, 17, 17...
- 0D:A371: A9 08 LDA #$08
- 0D:A373: 85 FE STA password_cursor_timer
- arrows_pressed:
- 0D:A375: A9 2F LDA #$2F
- 0D:A377: 20 51 C0 JSR add_sfx_to_queue
- 0D:A37A: AE A0 06 LDX password_cursor_position
- ; Check if left or right is pressed, with a bit of a bug.
- ; We know an arrow was PRESSED, but we're looking
- ; at all the ones that are HELD to determine which one.
- ; It's subtle, but it allows you to convert
- ; an arrow press into another direction,
- ; with the following priorities: right > left > up > down
- ; e.g. if you are holding right and press down, it counts as
- ; an extra right press.
- ; You might think the fix is to use p1_buttons_pressed here,
- ; but this logic is used for delayed autorepeat as well, so
- ; that won't work.
- 0D:A37D: A5 23 LDA p1_buttons_held
- 0D:A37F: 29 C0 AND #$C0
- 0D:A381: F0 10 BEQ up_down_check
- ; $80 = right
- 0D:A383: 29 80 AND #$80
- 0D:A385: F0 06 BEQ left_pressed
- 0D:A387: BD 46 AF LDA cursor_right_pos,X
- 0D:A38A: 4C A2 A3 JMP move_cursor
- left_pressed:
- 0D:A38D: BD 5F AF LDA cursor_left_pos,X
- 0D:A390: 4C A2 A3 JMP move_cursor
- up_down_check:
- ; The same quirk applies here.
- 0D:A393: A5 23 LDA p1_buttons_held
- ; $10 = up
- 0D:A395: 29 10 AND #$10
- 0D:A397: F0 06 BEQ down_pressed
- 0D:A399: BD 78 AF LDA cursor_up_pos,X
- 0D:A39C: 4C A2 A3 JMP move_cursor
- down_pressed:
- 0D:A39F: BD 91 AF LDA cursor_down_pos,X
- move_cursor:
- ; A = pos for cursor to move to
- 0D:A3A2: 8D A0 06 STA password_cursor_position
- 0D:A3A5: 4C AC A3 JMP check_AB
- no_arrows_held:
- ; Reset autorepeat timer
- 0D:A3A8: A9 00 LDA #$00
- 0D:A3AA: 85 FE STA password_cursor_timer
- check_AB:
- 0D:A3AC: A5 27 LDA p1_buttons_pressed
- ; Mask for A and B
- 0D:A3AE: 29 03 AND #$03
- 0D:A3B0: F0 28 BEQ wait_for_next_frame
- ; No autorepeat for A/B, so no problems here.
- 0D:A3B2: A5 27 LDA p1_buttons_pressed
- 0D:A3B4: AE A0 06 LDX password_cursor_position
- ; 1 = A button
- 0D:A3B7: 29 01 AND #$01
- 0D:A3B9: F0 14 BEQ $A3CF b_pressed
- ; A was pressed.
- ; Sprite flags are used to indicate whether the slot is full or empty.
- 0D:A3BB: BD 20 04 LDA sprite_flags,X
- 0D:A3BE: D0 1A BNE wait_for_next_frame
- 0D:A3C0: A9 42 LDA #$42
- 0D:A3C2: 20 51 C0 JSR add_sfx_to_queue
- 0D:A3C5: FE 20 04 INC sprite_flags,X
- 0D:A3C8: CE 80 06 DEC balls_remaining
- 0D:A3CB: F0 16 BEQ read_password
- 0D:A3CD: D0 0B BNE wait_for_next_frame
- b_pressed:
- 0D:A3CF: BD 20 04 LDA sprite_flags,X
- 0D:A3D2: F0 06 BEQ wait_for_next_frame
- 0D:A3D4: DE 20 04 DEC sprite_flags,X
- 0D:A3D7: EE 80 06 INC balls_remaining
- wait_for_next_frame:
- 0D:A3DA: 20 E9 A8 JSR update_password_graphics
- 0D:A3DD: 20 AB C0 JSR menu_wait_routine
- 0D:A3E0: 4C 57 A3 JMP password_runner_loop
- read_password:
- ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement