-
Notifications
You must be signed in to change notification settings - Fork 0
/
INPUT.S
62 lines (40 loc) · 1.08 KB
/
INPUT.S
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
; joystick byte: Fire x x x Right Left Down Up
ikbd_joy_on: equ $14 ; ikbd joystick reporting
ikbd_joy_off: equ $1a
ikbd_mouse_on: equ $08
ikbd_mouse_off: equ $12
ikbd_joy_offset: equ 24 ; joy vector
section text
even
init_joystick: move.l d0,-(sp)
move.w #ikbd_joy_on,-(sp)
move.w #0,-(sp) ; command length - 1
move.w #25,-(sp) ; XBIOS 25 = send to ikbd
trap #13 ; call XBIOS
addq.l #6,sp ; restore pointer
; XBIOS 34 results in a list of all ikbd vectors
move.w #34,-(sp)
trap #14
addq #2,sp
move.l d0,ikbd_vectors ; store vector addr
movea.l d0,a0
move.l 24(a0),joy_routine ; backup old routine addr
move.l #read_joystick,24(a0) ; set new routine
move.l (sp)+,d0
rts
restore_joystick:
move.l a0,-(sp) ; TEST THIS
move.l ikbd_vectors,a0 ; restore old joy routine
move.l joy_routine,24(a0)
move.l (sp)+,a0
rts
read_joystick: ;
; bclr #4,$fffffa03.w
move.b 1(a0),joy_data ; joystick 0
move.b 2(a0),joy_data+1 ; joystick 1
rts
section data
ikbd_vectors: dc.l 0
joy_routine: dc.l 0
section bss
joy_data: ds.b 2