2 A bug in gbz80 code generation when storing a value in l or h onto the stack.
10 typedef unsigned char UBYTE
;
11 typedef unsigned int UWORD
;
18 fly_coord_t flies
[3]; // = {{(14 * 8), (5 * 8)}, {(6 * 8), (9 * 8)}, {(22 * 8), (12 * 8)}};
19 fly_coord_t
* fly_ptr
;
21 UBYTE __temp_i
, __temp_j
, __temp_k
, __temp_l
, __temp_m
;
23 int my_puts(const char *s
)
25 ASSERT (!strcmp(s
, "ok"));
28 fly_coord_t
* find_firefly(UBYTE tile_x
, UBYTE tile_y
) {
29 UBYTE ff_tile_x
, ff_tile_y
;
30 for (__temp_i
= 0; __temp_i
< 3; __temp_i
++) {
31 fly_ptr
= &flies
[__temp_i
];
33 ff_tile_x
= fly_ptr
->x
>> 3, ff_tile_y
= fly_ptr
->y
>> 3;
35 if ((ff_tile_x
>= tile_x
) && (ff_tile_x
<= tile_x
+ 2) &&
36 (ff_tile_y
>= tile_y
) && (ff_tile_y
<= tile_y
+ 1)) return fly_ptr
;
41 UBYTE
dizzy_catches_firefly(UBYTE tile_x
, UBYTE tile_y
, UBYTE id
) {
43 fly_coord_t
* temp_fly
;
44 temp_fly
= find_firefly(tile_x
, tile_y
);
45 if (temp_fly
) my_puts("ok"); else my_puts("fail");
53 flies
[0].x
=7*8; flies
[0].y
=16*8+5;
54 flies
[1].x
=11*8+2; flies
[1].y
=14*8+3;
55 flies
[2].x
=18*8; flies
[2].y
=5*8+1;
56 dizzy_catches_firefly(10, 14, 0);