2 A bug in rematerialization in the z80 backend.
7 typedef unsigned char uint8
;
10 #define COL_MAX_HEIGHT 64
11 #define COL_TEX_HEIGHT 32
13 #ifndef __SDCC_pdk14 // Lack of memory
14 uint8 single_column
[COL_MAX_HEIGHT
];
16 void initSingleColumn(int16 height
)
25 y0
= (COL_MAX_HEIGHT
- height
) >> 1;
26 y1
= COL_MAX_HEIGHT
- y0
;
30 dv
= (COL_TEX_HEIGHT
<< 8) / dy
;
38 if (y1
> COL_MAX_HEIGHT
) y1
= COL_MAX_HEIGHT
;
40 for (y
= 0; y
<y0
; y
++)
42 single_column
[y
] = 128;
43 single_column
[COL_MAX_HEIGHT
- y
- 1] = 64; // Bug resulted in wrong address calculation here.
46 for (y
= y0
; y
< y1
; y
++)
48 if (v
> (31 << 8)) v
= 31 << 8;
49 single_column
[y
] = (v
>> 8);
57 #ifndef __SDCC_pdk14 // Lack of memory
60 ASSERT (single_column
[0x00] == 0x80);
61 ASSERT (single_column
[0x1f] == 0x80);
62 ASSERT (single_column
[0x20] == 0x40);
63 ASSERT (single_column
[0x3f] == 0x40);