junglejourney
changeset 242:94246db7b5e5
Added comments to help explain how the joystick routine works.
| author | David Boddie <david@boddie.org.uk> |
|---|---|
| date | Fri Mar 21 19:10:25 2014 +0100 |
| parents | 2fbbf90956db |
| children | dae2a8efc58f |
| files | mapcode.oph |
| diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line diff
1.1 --- a/mapcode.oph Thu Oct 11 19:58:19 2012 +0200 1.2 +++ b/mapcode.oph Fri Mar 21 19:10:25 2014 +0100 1.3 @@ -1715,8 +1715,10 @@ 1.4 jsr plot_character 1.5 rts 1.6 1.7 -joystick_abs: 1.8 - 1.9 +joystick_abs: ; A=value for a joystick axis read from the ADC 1.10 + ; Returns 0 for insufficiently large values, 1.11 + ; Returns [32, 127] for right/up movement. 1.12 + ; Returns [32, 128] for left/down movement. 1.13 cmp #160 1.14 bcc joystick_abs_next1 1.15 1.16 @@ -1760,11 +1762,11 @@ 1.17 sta $8d ; store the original horizontal value 1.18 1.19 jsr joystick_abs 1.20 - cmp #0 1.21 - beq read_joystick_vertical_check 1.22 - cmp $8f 1.23 - bcc read_joystick_vertical_check 1.24 - 1.25 + cmp #0 ; If no horizontal input then branch to 1.26 + beq read_joystick_vertical_check ; the vertical check. 1.27 + cmp $8f ; If the horizontal input is less than 1.28 + bcc read_joystick_vertical_check ; the vertical input then branch to the 1.29 + ; vertical check. 1.30 lda $8d 1.31 cmp #128 1.32 bcs read_joystick_left
