-
Notifications
You must be signed in to change notification settings - Fork 1
/
JOYSTICK.ASM
129 lines (103 loc) · 1.4 KB
/
JOYSTICK.ASM
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
IDEAL
JUMPS
LOCALS
P286N
DOSSEG
MODEL LARGE
;à®æ¥¤ãàë ¨ äãªæ¨¨
PUBLIC _jstat ;áâ âãá ¤¦®©á⨪®¢
;¥à¥¬¥ë¥
PUBLIC _a_1
PUBLIC _a_2
PUBLIC _b_1
PUBLIC _b_2
PUBLIC _xa
PUBLIC _ya
PUBLIC _xb
PUBLIC _yb
;ðððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððð
SEGMENT CODE WORD
ASSUME cs:CODE
_a_1 db (?)
_a_2 db (?)
_b_1 db (?)
_b_2 db (?)
_xa dw (?)
_ya dw (?)
_xb dw (?)
_yb dw (?)
ENDS
ðððððððððððððððððððððððððððððððððððððððððððððððððð
SEGMENT CODE WORD
ASSUME cs:CODE
; jstat(void)
PROC _jstat FAR
push bp
mov bp,sp
PUSH DX
;mov AH,84h
;mov DX,1
mov CX,0 ;®¡ã«¨¬ ¯®«®¦¥¨ï àã窨
mov [_xa],CX
mov [_ya],CX
mov [_xb],CX
mov [_yb],CX
;cli
;int 15h
mov dx,201h
out dx,al
; mov cx,-1
@@gain:
in al,dx
inc cx
test al,1
jnz @@g1
cmp [_xa],0
jnz @@g1
mov [_xa],CX
@@g1:
test al,2
jnz @@g2
cmp [_ya],0
jnz @@g2
mov [_ya],CX
@@g2:
test al,4
jnz @@g3
cmp [_xb],0
jnz @@g3
mov [_xb],CX
@@g3:
test al,8
jnz @@g4
cmp [_yb],0
jnz @@g4
mov [_yb],CX
@@g4:
cmp CX,1000h
jne @@gain
;sti
mov DX,201h
out DX,AL
in AL,DX
mov bl,al
and bl,16
mov [_a_1],bl
mov bl,al
and bl,32
mov [_a_2],bl
mov bl,al
and bl,64
mov [_b_1],bl
mov bl,al
and bl,128
mov [_b_2],bl
pop DX
mov sp,bp
pop bp
ret
ENDP
ENDS
;ðððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððððð
END