-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller-button-line-generator-simple.s
193 lines (179 loc) · 5.98 KB
/
controller-button-line-generator-simple.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
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# Fill in the symbol that represents the controller. Lowercase letters can also be used.
.set controller, ''
# W = Wii Wheel
# N = Nunchuk
# C = Classic Controller
# G = GCN Controller
# Fill in the symbol that represents the button states. Lowercase letters can also be used.
.set button_states, ''
# J = Just that buttons pressed
# L = At least that buttons pressed
# Fill in the symbol that represents the button. Lowercase letters can also be used.
.set button, ''
# N = Not press anything
# 3 = Up
# 4 = Down
# 5 = Left
# 6 = Right
# A = A
# B = B
# X = X
# Y = Y
# L = L
# R = R
# H = Home
# + = +
# - = -
# 1 = 1
# 2 = 2
# C = C (Nunchuk only)
# Z = Z (Nunchuk only)
# 7 = ZL (Classic only)
# 8 = ZR (Classic only)
# S = Start (GCN only)
#Set button states
.if (button_states == 'J' || button_states == 'j') #Just that button(s) pressed
.set button_blank, 0x0
.elseif (button_states == 'L' || button_states == 'l') #At least that button(s) pressed
.set button_blank, 0xFFFF - button_address
.else #Invalid Region
.abort
.endif
#Set controller and button
.if (controller == 'W' || controller == 'w') #Wii Wheel
.set controller_address, 0x5162
.if (button == 'N' || button == 'n') #Not press anything
.set button_address, 0x0
.elseif (button == '3') #Up
.set button_address, 0x2
.elseif (button == '4') #Down
.set button_address, 0x1
.elseif (button == '5') #Left
.set button_address, 0x8
.elseif (button == '6') #Right
.set button_address, 0x4
.elseif (button == 'A') #A
.set button_address, 0x800
.elseif (button == 'B') #B
.set button_address, 0x400
.elseif (button == '+') #Plus
.set button_address, 0x10
.elseif (button == '-') #Minus
.set button_address, 0x1000
.elseif (button == '1') #1
.set button_address, 0x200
.elseif (button == '2') #2
.set button_address, 0x100
.elseif (controller == 'H' || controller == 'h') #Home
.set button_address, 0x8000
.else # Invalid Region
.abort
.endif
.elseif (controller == 'N' || controller == 'n') #Nunchuk
.set controller_address, 0x5162
.if (button == 'N' || button == 'n') #Not press anything
.set button_address, 0x0
.elseif (button == '3') #Up
.set button_address, 0x8
.elseif (button == '4') #Down
.set button_address, 0x4
.elseif (button == '5') #Left
.set button_address, 0x1
.elseif (button == '6') #Right
.set button_address, 0x2
.elseif (button == 'A') #A
.set button_address, 0x800
.elseif (button == 'B') #B
.set button_address, 0x400
.elseif (button == '+') #Plus
.set button_address, 0x10
.elseif (button == '-') #Minus
.set button_address, 0x1000
.elseif (button == '1') #1
.set button_address, 0x200
.elseif (button == '2') #2
.set button_address, 0x100
.elseif (controller == 'C' || controller == 'c') #C
.set button_address, 0x4000
.elseif (controller == 'Z' || controller == 'z') #Z
.set button_address, 0x2000
.elseif (controller == 'H' || controller == 'h') #Home
.set button_address, 0x8000
.else # Invalid Region
.abort
.endif
.elseif (controller == 'C' || controller == 'c') #Classic Controller
.set controller_address, 0x51C2
.if (button == 'N' || button == 'n') #Not press anything
.set button_address, 0x0
.elseif (button == '3') #Up
.set button_address, 0x1
.elseif (button == '4') #Down
.set button_address, 0x4000
.elseif (button == '5') #Left
.set button_address, 0x2
.elseif (button == '6') #Right
.set button_address, 0x8000
.elseif (controller == 'A' || controller == 'a') #A
.set button_address, 0x10
.elseif (controller == 'B' || controller == 'b') #B
.set button_address, 0x40
.elseif (controller == 'X' || controller == 'x') #X
.set button_address, 0x8
.elseif (controller == 'Y' || controller == 'y') #Y
.set button_address, 0x20
.elseif (button == '+') #Plus
.set button_address, 0x400
.elseif (button == '-') #Minus
.set button_address, 0x1000
.elseif (controller == 'L' || controller == 'l') #L
.set button_address, 0x2000
.elseif (controller == 'R' || controller == 'r') #R
.set button_address, 0x200
.elseif (controller == '7') #ZL
.set button_address, 0x80
.elseif (controller == '8') #ZR
.set button_address, 0x4
.elseif (controller == 'H' || controller == 'h') #Home
.set button_address, 0x800
.else # Invalid Region
.abort
.endif
.elseif (controller == 'G' || controller == 'g') #GCN Controller
.set controller_address, 0x7B80
.if (button == 'N' || button == 'n') #Not press anything
.set button_address, 0x0
.elseif (button == '3') #Up
.set button_address, 0x88
.elseif (button == '4') #Down
.set button_address, 0x84
.elseif (button == '5') #Left
.set button_address, 0x81
.elseif (button == '6') #Right
.set button_address, 0x82
.elseif (controller == 'A' || controller == 'a') #A
.set button_address, 0x180
.elseif (controller == 'B' || controller == 'b') #B
.set button_address, 0x280
.elseif (controller == 'X' || controller == 'x') #X
.set button_address, 0x480
.elseif (controller == 'Y' || controller == 'y') #Y
.set button_address, 0x880
.elseif (controller == 'S' || controller == 's') #Start
.set button_address, 0x400
.elseif (controller == 'L' || controller == 'l') #L
.set button_address, 0xC0
.elseif (controller == 'R' || controller == 'r') #R
.set button_address, 0xA0
.elseif (controller == 'Z' || controller == 'z') #Z
.set button_address, 0x80
.else # Invalid Region
.abort
.endif
.else # Invalid Region
.abort
.endif
.short 0x2834
.short controller_address
.short button_blank
.short button_address