# HG changeset patch # User David Boddie # Date 1395425425 -3600 # Node ID 94246db7b5e5fa51b3fa130af85c7469662a36e8 # Parent 2fbbf90956dbe4b0c4c5edea4e07269cab465d59 Added comments to help explain how the joystick routine works. diff -r 2fbbf90956db -r 94246db7b5e5 mapcode.oph --- a/mapcode.oph Thu Oct 11 19:58:19 2012 +0200 +++ b/mapcode.oph Fri Mar 21 19:10:25 2014 +0100 @@ -1715,8 +1715,10 @@ jsr plot_character rts -joystick_abs: - +joystick_abs: ; A=value for a joystick axis read from the ADC + ; Returns 0 for insufficiently large values, + ; Returns [32, 127] for right/up movement. + ; Returns [32, 128] for left/down movement. cmp #160 bcc joystick_abs_next1 @@ -1760,11 +1762,11 @@ sta $8d ; store the original horizontal value jsr joystick_abs - cmp #0 - beq read_joystick_vertical_check - cmp $8f - bcc read_joystick_vertical_check - + cmp #0 ; If no horizontal input then branch to + beq read_joystick_vertical_check ; the vertical check. + cmp $8f ; If the horizontal input is less than + bcc read_joystick_vertical_check ; the vertical input then branch to the + ; vertical check. lda $8d cmp #128 bcs read_joystick_left