diff options
| author | Javier Degirolmo | 2012-08-14 22:49:32 -0300 |
|---|---|---|
| committer | Javier Degirolmo | 2012-08-14 22:49:32 -0300 |
| commit | 6ab75ecb612fbbe2ec939bd758bbbe620e6d5040 (patch) | |
| tree | 8122e6eeeacf4912b439dc77e48ea30181b48c01 /tester/input/joypad.68k | |
| parent | 416f24632deee748d4789982262063bda598a1ef (diff) | |
Renamed Echo Tester directory from src-68k to tester
Diffstat (limited to 'tester/input/joypad.68k')
| -rw-r--r-- | tester/input/joypad.68k | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tester/input/joypad.68k b/tester/input/joypad.68k new file mode 100644 index 0000000..f33d000 --- /dev/null +++ b/tester/input/joypad.68k @@ -0,0 +1,43 @@ +;**************************************************************************** +; InitJoypad +; Initializes the joypad +;**************************************************************************** + +InitJoypad: + move.b #$40, ($A10009) ; Initialize I/O ports + move.b #$40, ($A10003) + move.w #0, (RAM_JoyHold) ; Initialize status + rts ; End of subroutine + +;**************************************************************************** +; ReadJoypad +; Reads the joypad status +;**************************************************************************** + +ReadJoypad: + lea ($A10003), a6 ; I/O data port + + move.b #$40, (a6) ; Read D-pad, B and C + nop + nop + move.b (a6), d7 + move.b #$00, (a6) ; Read A and Start + nop + nop + move.b (a6), d6 + + and.b #$3F, d7 ; Process input + and.b #$30, d6 + add.b d6, d6 + add.b d6, d6 + or.b d6, d7 + not.b d7 + + lea (RAM_JoyHold), a6 ; Store new joypad status + move.b (a6), d6 + move.b d7, (a6)+ + not.b d6 + and.b d6, d7 + move.b d7, (a6) + + rts ; End of subroutine |
