/
rabbit_rules.1
309 lines (269 loc) · 2.8 KB
/
rabbit_rules.1
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
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
ld a,h
or l
j%1 %2
ld hl,%3
=
bool hl
j%1 %2
ld hl,%3
push hl
ld hl,%1 ;const
pop de
=
ex de,hl
ld hl,%1 ;const
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
ld l,(hl)
ld h,0
=
ld hl,(sp+%1)
ld h,0
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
ld e,(hl)
inc hl
ld d,(hl)
ld hl,%2
=
ld hl,(sp+%1)
ex de,hl
ld hl,%2
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
call l_gint ;
=
ld hl,(sp+%1)
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
ld a,(hl)
inc hl
ld h,(hl)
ld l,a
=
ld hl,(sp+%1)
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
ld c,(hl)
inc hl
ld b,(hl)
ld hl,%2
=
ld hl,(sp+%1)
ld c,l
ld b,h
ld hl,%2
ld c,l
ld b,h
ld hl,%2 ;const
add hl,bc
=
ld bc,%2
add hl,bc
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
inc (hl)
ld a,(hl)
inc hl
jr nz,ASMPC+3
inc (hl)
ld h,(hl)
ld l,a
=
ld hl,(sp+%1)
inc hl
ld (sp+%1),hl
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
dec (hl)
ld a,(hl)
inc hl
cp 255
jr nz,ASMPC+3
dec (hl)
ld h,(hl)
ld l,a
=
ld hl,(sp+%1)
dec hl
ld (sp+%1),hl
%check 0 <= %1 <= 254
ld hl,%1 ;const
add hl,sp
ld de,%2
ex de,hl
call l_pint
=
ld hl,%2
ld (sp+%1),hl
%check 0 <= %1 <= 255
ld hl,%1 ;const
call l_gintspsp ;
=
ld hl,(sp+%1)
push hl
%check 0 <= %1 <= 251
ld hl,%1 ;const
add hl,sp
call l_glong
=
ld hl,(sp+%eval(%1 2 +))
ex de,hl
ld hl,(sp+%1)
%check 0 <= %1 <= 253
ld hl,%1 ;const
add hl,sp
call l_gint
=
ld hl,(sp+%1)
%check 0 <= %1 <= 127
ld hl,%1 ;const
add hl,sp
ld sp,hl
ret
=
add sp,%1
ret
%check 65408 <= %1 <= 65535
ld hl,%1 ;const
add hl,sp
ld sp,hl
ld hl,%2
=
add sp,+(%1 - 65536)
ld hl,%2
call l_or
=
or hl,de
call l_and
=
and hl,de
pop bc
push hl
=
ld (sp+0),hl
srl h
rr l
=
and a
rr hl
rr h
rr l
=
rr hl
srl d
rr e
=
and a
rr de
ld a,2
call l_long_aslo
=
add hl,hl
rl de
add hl,hl
rl de
rl e
rl d
=
rl de
%check -128 <= %1 <= 126
inc hl
ld hl,(hl + %1)
=
ld hl,(hl + %1 + 1)
inc hl
call l_gint ;
=
ld hl,(hl + 1)
%check -128 <= %1 <= 127
ld bc,%1
add hl,bc
call l_gint ;
=
ld hl,(hl+%1)
call l_gint ;
=
ld hl,(hl+0)
ld hl,0 ;const
=
bool hl
rr hl
pop hl
push hl
=
ld hl,(sp+0)
pop bc
ld hl,(sp+0)
push bc
=
ld hl,(sp+2)
; bool clears the carry flag
=
call l_lneg
jp c,%1 ;%8
=
bool hl
dec hl
bool hl
jp nz,%1 ;%8
call l_lneg
jp nc,%1 ;%8
=
bool hl
dec hl
bool hl
jp z,%1 ;%8
call l_lneg
call c,%1
=
bool hl
dec hl
bool hl
call nz,%1
call l_lneg
call nc,%1
=
bool hl
dec hl
bool hl
call z,%1
call l_lneg
ccf
call c,%1
=
bool hl
dec hl
bool hl
call nz,%1
call l_lneg
ccf
call nc,%1
=
bool hl
dec hl
bool hl
call z,%1
ld e,(hl)
inc hl
ld d,(hl)
ld hl,%1
=
ld hl,(hl+0)
ex de,hl
ld hl,%1
%check -127 <= %1 <= 126
ld bc,%1
add hl,bc
ld l,(hl)
ld h,0
=
ld hl,(hl+%1)
ld h,0