andb.s revision 1.1 1 1.1 christos # Hitachi H8 testcase 'and.b'
2 1.1 christos # mach(): all
3 1.1 christos # as(h8300): --defsym sim_cpu=0
4 1.1 christos # as(h8300h): --defsym sim_cpu=1
5 1.1 christos # as(h8300s): --defsym sim_cpu=2
6 1.1 christos # as(h8sx): --defsym sim_cpu=3
7 1.1 christos # ld(h8300h): -m h8300helf
8 1.1 christos # ld(h8300s): -m h8300self
9 1.1 christos # ld(h8sx): -m h8300sxelf
10 1.1 christos
11 1.1 christos .include "testutils.inc"
12 1.1 christos
13 1.1 christos # Instructions tested:
14 1.1 christos # and.b #xx:8, rd ; e rd xxxxxxxx
15 1.1 christos # and.b #xx:8, @erd ; 7 d rd ???? e ???? xxxxxxxx
16 1.1 christos # and.b #xx:8, @erd+ ; 0 1 7 4 6 c rd 1??? e ???? xxxxxxxx
17 1.1 christos # and.b #xx:8, @erd- ; 0 1 7 6 6 c rd 1??? e ???? xxxxxxxx
18 1.1 christos # and.b #xx:8, @+erd ; 0 1 7 5 6 c rd 1??? e ???? xxxxxxxx
19 1.1 christos # and.b #xx:8, @-erd ; 0 1 7 7 6 c rd 1??? e ???? xxxxxxxx
20 1.1 christos # and.b rs, rd ; 1 6 rs rd
21 1.1 christos # and.b reg8, @erd ; 7 d rd ???? 1 6 rs ????
22 1.1 christos # and.b reg8, @erd+ ; 0 1 7 9 8 rd 6 rs
23 1.1 christos # and.b reg8, @erd- ; 0 1 7 9 a rd 6 rs
24 1.1 christos # and.b reg8, @+erd ; 0 1 7 9 9 rd 6 rs
25 1.1 christos # and.b reg8, @-erd ; 0 1 7 9 b rd 6 rs
26 1.1 christos #
27 1.1 christos # andc #xx:8, ccr ; 0 6 xxxxxxxx
28 1.1 christos # andc #xx:8, exr ; 0 1 4 1 0 6 xxxxxxxx
29 1.1 christos
30 1.1 christos # Coming soon:
31 1.1 christos # ...
32 1.1 christos
33 1.1 christos .data
34 1.1 christos pre_byte: .byte 0
35 1.1 christos byte_dest: .byte 0xa5
36 1.1 christos post_byte: .byte 0
37 1.1 christos
38 1.1 christos start
39 1.1 christos
40 1.1 christos and_b_imm8_reg8:
41 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
42 1.1 christos ;; fixme set ccr
43 1.1 christos
44 1.1 christos ;; and.b #xx:8,Rd
45 1.1 christos and.b #0xaa, r0l ; Immediate 8-bit operand
46 1.1 christos
47 1.1 christos ;; fixme test ccr ; H=0 N=1 Z=0 V=0 C=0
48 1.1 christos test_h_gr16 0xa5a0 r0 ; and result: a5 & aa
49 1.1 christos .if (sim_cpu) ; non-zero means h8300h, s, or sx
50 1.1 christos test_h_gr32 0xa5a5a5a0 er0 ; and result: a5 & aa
51 1.1 christos .endif
52 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
53 1.1 christos test_gr_a5a5 2
54 1.1 christos test_gr_a5a5 3
55 1.1 christos test_gr_a5a5 4
56 1.1 christos test_gr_a5a5 5
57 1.1 christos test_gr_a5a5 6
58 1.1 christos test_gr_a5a5 7
59 1.1 christos
60 1.1 christos .if (sim_cpu == h8sx)
61 1.1 christos and_b_imm8_rdind:
62 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
63 1.1 christos set_ccr_zero
64 1.1 christos
65 1.1 christos ;; and.b #xx:8,@eRd
66 1.1 christos mov #byte_dest, er0
67 1.1 christos and.b #0xaa:8, @er0 ; Immediate 8-bit src, reg indirect dst
68 1.1 christos ;;; .word 0x7d00
69 1.1 christos ;;; .word 0xe0aa
70 1.1 christos
71 1.1 christos test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
72 1.1 christos test_ovf_clear
73 1.1 christos test_zero_clear
74 1.1 christos test_neg_set
75 1.1 christos
76 1.1 christos test_h_gr32 byte_dest, er0 ; er0 still contains address
77 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
78 1.1 christos test_gr_a5a5 2
79 1.1 christos test_gr_a5a5 3
80 1.1 christos test_gr_a5a5 4
81 1.1 christos test_gr_a5a5 5
82 1.1 christos test_gr_a5a5 6
83 1.1 christos test_gr_a5a5 7
84 1.1 christos
85 1.1 christos ;; Now check the result of the and to memory.
86 1.1 christos sub.b r0l, r0l
87 1.1 christos mov.b @byte_dest, r0l
88 1.1 christos cmp.b #0xa0, r0l
89 1.1 christos beq .L1
90 1.1 christos fail
91 1.1 christos .L1:
92 1.1 christos
93 1.1 christos and_b_imm8_rdpostinc:
94 1.1 christos mov #byte_dest, er0
95 1.1 christos mov.b #0xa5, r1l
96 1.1 christos mov.b r1l, @er0
97 1.1 christos
98 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
99 1.1 christos set_ccr_zero
100 1.1 christos
101 1.1 christos ;; and.b #xx:8,@eRd+
102 1.1 christos mov #byte_dest, er0
103 1.1 christos and.b #0x55:8, @er0+ ; Immediate 8-bit src, reg post-incr dest
104 1.1 christos ;;; .word 0x0174
105 1.1 christos ;;; .word 0x6c08
106 1.1 christos ;;; .word 0xe055
107 1.1 christos
108 1.1 christos test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
109 1.1 christos test_ovf_clear
110 1.1 christos test_zero_clear
111 1.1 christos test_neg_clear
112 1.1 christos
113 1.1 christos test_h_gr32 post_byte, er0 ; er0 contains address plus one
114 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
115 1.1 christos test_gr_a5a5 2
116 1.1 christos test_gr_a5a5 3
117 1.1 christos test_gr_a5a5 4
118 1.1 christos test_gr_a5a5 5
119 1.1 christos test_gr_a5a5 6
120 1.1 christos test_gr_a5a5 7
121 1.1 christos
122 1.1 christos ;; Now check the result of the and to memory.
123 1.1 christos sub.b r0l, r0l
124 1.1 christos mov.b @byte_dest, r0l
125 1.1 christos cmp.b #0x05, r0l
126 1.1 christos beq .L2
127 1.1 christos fail
128 1.1 christos .L2:
129 1.1 christos ;; special case same register
130 1.1 christos mov.l #byte_dest, er0
131 1.1 christos mov.b @er0, r1h
132 1.1 christos mov.b r0l, r1l
133 1.1 christos and.b r0l, @er0+
134 1.1 christos inc.b r1l
135 1.1 christos and.b r1h, r1l
136 1.1 christos mov.b @byte_dest, r0l
137 1.1 christos cmp.b r1l, r0l
138 1.1 christos beq .L22
139 1.1 christos fail
140 1.1 christos .L22:
141 1.1 christos
142 1.1 christos and_b_imm8_rdpostdec:
143 1.1 christos mov #byte_dest, er0
144 1.1 christos mov.b #0xa5, r1l
145 1.1 christos mov.b r1l, @er0
146 1.1 christos
147 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
148 1.1 christos set_ccr_zero
149 1.1 christos
150 1.1 christos ;; and.b #xx:8,@eRd-
151 1.1 christos mov #byte_dest, er0
152 1.1 christos and.b #0xaa:8, @er0- ; Immediate 8-bit src, reg post-decr dest
153 1.1 christos ;;; .word 0x0176
154 1.1 christos ;;; .word 0x6c08
155 1.1 christos ;;; .word 0xe0aa
156 1.1 christos
157 1.1 christos test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
158 1.1 christos test_ovf_clear
159 1.1 christos test_zero_clear
160 1.1 christos test_neg_set
161 1.1 christos
162 1.1 christos test_h_gr32 pre_byte, er0 ; er0 contains address minus one
163 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
164 1.1 christos test_gr_a5a5 2
165 1.1 christos test_gr_a5a5 3
166 1.1 christos test_gr_a5a5 4
167 1.1 christos test_gr_a5a5 5
168 1.1 christos test_gr_a5a5 6
169 1.1 christos test_gr_a5a5 7
170 1.1 christos
171 1.1 christos ;; Now check the result of the and to memory.
172 1.1 christos sub.b r0l, r0l
173 1.1 christos mov.b @byte_dest, r0l
174 1.1 christos cmp.b #0xa0, r0l
175 1.1 christos beq .L3
176 1.1 christos fail
177 1.1 christos .L3:
178 1.1 christos ;; special case same register
179 1.1 christos mov.l #byte_dest, er0
180 1.1 christos mov.b @er0, r1h
181 1.1 christos mov.b r0l, r1l
182 1.1 christos and.b r0l, @er0-
183 1.1 christos dec.b r1l
184 1.1 christos and.b r1h, r1l
185 1.1 christos mov.b @byte_dest, r0l
186 1.1 christos cmp.b r1l, r0l
187 1.1 christos beq .L23
188 1.1 christos fail
189 1.1 christos .L23:
190 1.1 christos
191 1.1 christos and_b_imm8_rdpreinc:
192 1.1 christos mov #byte_dest, er0
193 1.1 christos mov.b #0xa5, r1l
194 1.1 christos mov.b r1l, @er0
195 1.1 christos
196 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
197 1.1 christos set_ccr_zero
198 1.1 christos
199 1.1 christos ;; and.b #xx:8,@+eRd
200 1.1 christos mov #pre_byte, er0
201 1.1 christos and.b #0x55:8, @+er0 ; Immediate 8-bit src, reg pre-incr dest
202 1.1 christos ;;; .word 0x0175
203 1.1 christos ;;; .word 0x6c08
204 1.1 christos ;;; .word 0xe055
205 1.1 christos
206 1.1 christos test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
207 1.1 christos test_ovf_clear
208 1.1 christos test_zero_clear
209 1.1 christos test_neg_clear
210 1.1 christos
211 1.1 christos test_h_gr32 byte_dest, er0 ; er0 contains destination address
212 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
213 1.1 christos test_gr_a5a5 2
214 1.1 christos test_gr_a5a5 3
215 1.1 christos test_gr_a5a5 4
216 1.1 christos test_gr_a5a5 5
217 1.1 christos test_gr_a5a5 6
218 1.1 christos test_gr_a5a5 7
219 1.1 christos
220 1.1 christos ;; Now check the result of the and to memory.
221 1.1 christos sub.b r0l, r0l
222 1.1 christos mov.b @byte_dest, r0l
223 1.1 christos cmp.b #0x05, r0l
224 1.1 christos beq .L4
225 1.1 christos fail
226 1.1 christos .L4:
227 1.1 christos ;; special case same register
228 1.1 christos mov.l #pre_byte, er0
229 1.1 christos mov.b @byte_dest, r1h
230 1.1 christos mov.b r0l, r1l
231 1.1 christos and.b r0l, @+er0
232 1.1 christos inc.b r1l
233 1.1 christos and.b r1h, r1l
234 1.1 christos mov.b @byte_dest, r0l
235 1.1 christos cmp.b r1l, r0l
236 1.1 christos beq .L24
237 1.1 christos fail
238 1.1 christos .L24:
239 1.1 christos
240 1.1 christos and_b_imm8_rdpredec:
241 1.1 christos mov #byte_dest, er0
242 1.1 christos mov.b #0xa5, r1l
243 1.1 christos mov.b r1l, @er0
244 1.1 christos
245 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
246 1.1 christos set_ccr_zero
247 1.1 christos
248 1.1 christos ;; and.b #xx:8,@-eRd
249 1.1 christos mov #post_byte, er0
250 1.1 christos and.b #0xaa:8, @-er0 ; Immediate 8-bit src, reg pre-decr dest
251 1.1 christos ;;; .word 0x0177
252 1.1 christos ;;; .word 0x6c08
253 1.1 christos ;;; .word 0xe0aa
254 1.1 christos
255 1.1 christos test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
256 1.1 christos test_ovf_clear
257 1.1 christos test_zero_clear
258 1.1 christos test_neg_set
259 1.1 christos
260 1.1 christos test_h_gr32 byte_dest, er0 ; er0 contains destination address
261 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
262 1.1 christos test_gr_a5a5 2
263 1.1 christos test_gr_a5a5 3
264 1.1 christos test_gr_a5a5 4
265 1.1 christos test_gr_a5a5 5
266 1.1 christos test_gr_a5a5 6
267 1.1 christos test_gr_a5a5 7
268 1.1 christos
269 1.1 christos ;; Now check the result of the and to memory.
270 1.1 christos sub.b r0l, r0l
271 1.1 christos mov.b @byte_dest, r0l
272 1.1 christos cmp.b #0xa0, r0l
273 1.1 christos beq .L5
274 1.1 christos fail
275 1.1 christos .L5:
276 1.1 christos ;; special case same register
277 1.1 christos mov.l #post_byte, er0
278 1.1 christos mov.b @byte_dest, r1h
279 1.1 christos mov.b r0l, r1l
280 1.1 christos and.b r0l, @-er0
281 1.1 christos dec.b r1l
282 1.1 christos and.b r1h, r1l
283 1.1 christos mov.b @byte_dest, r0l
284 1.1 christos cmp.b r1l, r0l
285 1.1 christos beq .L25
286 1.1 christos fail
287 1.1 christos .L25:
288 1.1 christos
289 1.1 christos .endif ; h8sx
290 1.1 christos
291 1.1 christos and_b_reg8_reg8:
292 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
293 1.1 christos ;; fixme set ccr
294 1.1 christos
295 1.1 christos ;; and.b Rs,Rd
296 1.1 christos mov.b #0xaa, r0h
297 1.1 christos and.b r0h, r0l ; Register operand
298 1.1 christos
299 1.1 christos ;; fixme test ccr ; H=0 N=1 Z=0 V=0 C=0
300 1.1 christos test_h_gr16 0xaaa0 r0 ; and result: a5 & aa
301 1.1 christos .if (sim_cpu) ; non-zero means h8300h, s, or sx
302 1.1 christos test_h_gr32 0xa5a5aaa0 er0 ; and result: a5 & aa
303 1.1 christos .endif
304 1.1 christos test_gr_a5a5 1 ; Make sure other general regs not disturbed
305 1.1 christos test_gr_a5a5 2
306 1.1 christos test_gr_a5a5 3
307 1.1 christos test_gr_a5a5 4
308 1.1 christos test_gr_a5a5 5
309 1.1 christos test_gr_a5a5 6
310 1.1 christos test_gr_a5a5 7
311 1.1 christos
312 1.1 christos .if (sim_cpu == h8sx)
313 1.1 christos and_b_reg8_rdind:
314 1.1 christos mov #byte_dest, er0
315 1.1 christos mov.b #0xa5, r1l
316 1.1 christos mov.b r1l, @er0
317 1.1 christos
318 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
319 1.1 christos set_ccr_zero
320 1.1 christos
321 1.1 christos ;; and.b rs8,@eRd ; And to register indirect
322 1.1 christos mov #byte_dest, er0
323 1.1 christos mov #0x55, r1l
324 1.1 christos and.b r1l, @er0 ; reg8 src, reg indirect dest
325 1.1 christos ;;; .word 0x7d00
326 1.1 christos ;;; .word 0x1690
327 1.1 christos
328 1.1 christos test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
329 1.1 christos test_ovf_clear
330 1.1 christos test_zero_clear
331 1.1 christos test_neg_clear
332 1.1 christos
333 1.1 christos test_h_gr32 byte_dest er0 ; er0 still contains address
334 1.1 christos test_h_gr32 0xa5a5a555 er1 ; er1 has the test load
335 1.1 christos
336 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed
337 1.1 christos test_gr_a5a5 3
338 1.1 christos test_gr_a5a5 4
339 1.1 christos test_gr_a5a5 5
340 1.1 christos test_gr_a5a5 6
341 1.1 christos test_gr_a5a5 7
342 1.1 christos
343 1.1 christos ;; Now check the result of the and to memory.
344 1.1 christos sub.b r0l, r0l
345 1.1 christos mov.b @byte_dest, r0l
346 1.1 christos cmp.b #0x05, r0l
347 1.1 christos beq .L6
348 1.1 christos fail
349 1.1 christos .L6:
350 1.1 christos
351 1.1 christos and_b_reg8_rdpostinc:
352 1.1 christos mov #byte_dest, er0
353 1.1 christos mov.b #0xa5, r1l
354 1.1 christos mov.b r1l, @er0
355 1.1 christos
356 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
357 1.1 christos set_ccr_zero
358 1.1 christos
359 1.1 christos ;; and.b rs8,@eRd+ ; And to register post-incr
360 1.1 christos mov #byte_dest, er0
361 1.1 christos mov #0xaa, r1l
362 1.1 christos and.b r1l, @er0+ ; reg8 src, reg post-incr dest
363 1.1 christos ;;; .word 0x0179
364 1.1 christos ;;; .word 0x8069
365 1.1 christos
366 1.1 christos test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
367 1.1 christos test_ovf_clear
368 1.1 christos test_zero_clear
369 1.1 christos test_neg_set
370 1.1 christos
371 1.1 christos test_h_gr32 post_byte er0 ; er0 contains address plus one
372 1.1 christos test_h_gr32 0xa5a5a5aa er1 ; er1 has the test load
373 1.1 christos
374 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed
375 1.1 christos test_gr_a5a5 3
376 1.1 christos test_gr_a5a5 4
377 1.1 christos test_gr_a5a5 5
378 1.1 christos test_gr_a5a5 6
379 1.1 christos test_gr_a5a5 7
380 1.1 christos
381 1.1 christos ;; Now check the result of the and to memory.
382 1.1 christos sub.b r0l, r0l
383 1.1 christos mov.b @byte_dest, r0l
384 1.1 christos cmp.b #0xa0, r0l
385 1.1 christos beq .L7
386 1.1 christos fail
387 1.1 christos .L7:
388 1.1 christos
389 1.1 christos and_b_reg8_rdpostdec:
390 1.1 christos mov #byte_dest, er0
391 1.1 christos mov.b #0xa5, r1l
392 1.1 christos mov.b r1l, @er0
393 1.1 christos
394 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
395 1.1 christos set_ccr_zero
396 1.1 christos
397 1.1 christos ;; and.b rs8,@eRd- ; And to register post-decr
398 1.1 christos mov #byte_dest, er0
399 1.1 christos mov #0x55, r1l
400 1.1 christos and.b r1l, @er0- ; reg8 src, reg post-decr dest
401 1.1 christos ;;; .word 0x0179
402 1.1 christos ;;; .word 0xa069
403 1.1 christos
404 1.1 christos test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
405 1.1 christos test_ovf_clear
406 1.1 christos test_zero_clear
407 1.1 christos test_neg_clear
408 1.1 christos
409 1.1 christos test_h_gr32 pre_byte er0 ; er0 contains address minus one
410 1.1 christos test_h_gr32 0xa5a5a555 er1 ; er1 has the test load
411 1.1 christos
412 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed
413 1.1 christos test_gr_a5a5 3
414 1.1 christos test_gr_a5a5 4
415 1.1 christos test_gr_a5a5 5
416 1.1 christos test_gr_a5a5 6
417 1.1 christos test_gr_a5a5 7
418 1.1 christos
419 1.1 christos ;; Now check the result of the and to memory.
420 1.1 christos sub.b r0l, r0l
421 1.1 christos mov.b @byte_dest, r0l
422 1.1 christos cmp.b #0x05, r0l
423 1.1 christos beq .L8
424 1.1 christos fail
425 1.1 christos .L8:
426 1.1 christos
427 1.1 christos and_b_reg8_rdpreinc:
428 1.1 christos mov #byte_dest, er0
429 1.1 christos mov.b #0xa5, r1l
430 1.1 christos mov.b r1l, @er0
431 1.1 christos
432 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
433 1.1 christos set_ccr_zero
434 1.1 christos
435 1.1 christos ;; and.b rs8,@+eRd ; And to register post-incr
436 1.1 christos mov #pre_byte, er0
437 1.1 christos mov #0xaa, r1l
438 1.1 christos and.b r1l, @+er0 ; reg8 src, reg post-incr dest
439 1.1 christos ;;; .word 0x0179
440 1.1 christos ;;; .word 0x9069
441 1.1 christos
442 1.1 christos test_carry_clear ; H=0 N=1 Z=0 V=0 C=0
443 1.1 christos test_ovf_clear
444 1.1 christos test_zero_clear
445 1.1 christos test_neg_set
446 1.1 christos
447 1.1 christos test_h_gr32 byte_dest er0 ; er0 contains destination address
448 1.1 christos test_h_gr32 0xa5a5a5aa er1 ; er1 has the test load
449 1.1 christos
450 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed
451 1.1 christos test_gr_a5a5 3
452 1.1 christos test_gr_a5a5 4
453 1.1 christos test_gr_a5a5 5
454 1.1 christos test_gr_a5a5 6
455 1.1 christos test_gr_a5a5 7
456 1.1 christos
457 1.1 christos ;; Now check the result of the and to memory.
458 1.1 christos sub.b r0l, r0l
459 1.1 christos mov.b @byte_dest, r0l
460 1.1 christos cmp.b #0xa0, r0l
461 1.1 christos beq .L9
462 1.1 christos fail
463 1.1 christos .L9:
464 1.1 christos
465 1.1 christos and_b_reg8_rdpredec:
466 1.1 christos mov #byte_dest, er0
467 1.1 christos mov.b #0xa5, r1l
468 1.1 christos mov.b r1l, @er0
469 1.1 christos
470 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
471 1.1 christos set_ccr_zero
472 1.1 christos
473 1.1 christos ;; and.b rs8,@-eRd ; And to register post-decr
474 1.1 christos mov #post_byte, er0
475 1.1 christos mov #0x55, r1l
476 1.1 christos and.b r1l, @-er0 ; reg8 src, reg post-decr dest
477 1.1 christos ;;; .word 0x0179
478 1.1 christos ;;; .word 0xb069
479 1.1 christos
480 1.1 christos test_carry_clear ; H=0 N=0 Z=0 V=0 C=0
481 1.1 christos test_ovf_clear
482 1.1 christos test_zero_clear
483 1.1 christos test_neg_clear
484 1.1 christos
485 1.1 christos test_h_gr32 byte_dest er0 ; er0 contains destination address
486 1.1 christos test_h_gr32 0xa5a5a555 er1 ; er1 has the test load
487 1.1 christos
488 1.1 christos test_gr_a5a5 2 ; Make sure other general regs not disturbed
489 1.1 christos test_gr_a5a5 3
490 1.1 christos test_gr_a5a5 4
491 1.1 christos test_gr_a5a5 5
492 1.1 christos test_gr_a5a5 6
493 1.1 christos test_gr_a5a5 7
494 1.1 christos
495 1.1 christos ;; Now check the result of the and to memory.
496 1.1 christos sub.b r0l, r0l
497 1.1 christos mov.b @byte_dest, r0l
498 1.1 christos cmp.b #0x05, r0l
499 1.1 christos beq .L10
500 1.1 christos fail
501 1.1 christos .L10:
502 1.1 christos .endif ; h8sx
503 1.1 christos
504 1.1 christos andc_imm8_ccr:
505 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
506 1.1 christos set_ccr_zero
507 1.1 christos
508 1.1 christos ;; andc #xx:8,ccr
509 1.1 christos set_ccr 0xff
510 1.1 christos
511 1.1 christos test_neg_set
512 1.1 christos andc #0xf7, ccr ; Immediate 8-bit operand (neg flag)
513 1.1 christos test_neg_clear
514 1.1 christos
515 1.1 christos test_zero_set
516 1.1 christos andc #0xfb, ccr ; Immediate 8-bit operand (zero flag)
517 1.1 christos test_zero_clear
518 1.1 christos
519 1.1 christos test_ovf_set
520 1.1 christos andc #0xfd, ccr ; Immediate 8-bit operand (overflow flag)
521 1.1 christos test_ovf_clear
522 1.1 christos
523 1.1 christos test_carry_set
524 1.1 christos andc #0xfe, ccr ; Immediate 8-bit operand (carry flag)
525 1.1 christos test_carry_clear
526 1.1 christos
527 1.1 christos test_gr_a5a5 0 ; Make sure other general regs not disturbed
528 1.1 christos test_gr_a5a5 1
529 1.1 christos test_gr_a5a5 2
530 1.1 christos test_gr_a5a5 3
531 1.1 christos test_gr_a5a5 4
532 1.1 christos test_gr_a5a5 5
533 1.1 christos test_gr_a5a5 6
534 1.1 christos test_gr_a5a5 7
535 1.1 christos
536 1.1 christos .if (sim_cpu == h8300s || sim_cpu == h8sx) ; Earlier versions, no exr
537 1.1 christos andc_imm8_exr:
538 1.1 christos set_grs_a5a5 ; Fill all general regs with a fixed pattern
539 1.1 christos
540 1.1 christos ldc #0xff, exr
541 1.1 christos stc exr, r0l
542 1.1 christos test_h_gr8 0x87, r0l
543 1.1 christos
544 1.1 christos ;; andc #xx:8,exr
545 1.1 christos set_ccr_zero
546 1.1 christos andc #0x7f, exr
547 1.1 christos test_cc_clear
548 1.1 christos stc exr, r0l
549 1.1 christos test_h_gr8 0x7, r0l
550 1.1 christos
551 1.1 christos andc #0x3, exr
552 1.1 christos stc exr, r0l
553 1.1 christos test_h_gr8 0x3, r0l
554 1.1 christos
555 1.1 christos andc #0x1, exr
556 1.1 christos stc exr, r0l
557 1.1 christos test_h_gr8 0x1, r0l
558 1.1 christos
559 1.1 christos andc #0x0, exr
560 1.1 christos stc exr, r0l
561 1.1 christos test_h_gr8 0x0, r0l
562 1.1 christos
563 1.1 christos test_h_gr32 0xa5a5a500 er0
564 1.1 christos test_gr_a5a5 1
565 1.1 christos test_gr_a5a5 2
566 1.1 christos test_gr_a5a5 3
567 1.1 christos test_gr_a5a5 4
568 1.1 christos test_gr_a5a5 5
569 1.1 christos test_gr_a5a5 6
570 1.1 christos test_gr_a5a5 7
571 1.1 christos .endif ; not h8300 or h8300h
572 1.1 christos
573 1.1 christos pass
574 1.1 christos
575 1.1 christos exit 0
576