4 Dead code elimination fails here, resulting in unconnected CFG and live-ranges.
5 Those, in turn did mess up register allocation, which, then resulted in code-generation
6 failing. Fixed by workarounds in register allocation.
18 struct cv_controller_state
29 typedef uint16_t cv_vmemp
;
31 #pragma disable_warning 85
33 extern void cvu_memtovmemcpy(cv_vmemp dest
, const void * src
, size_t n
)
37 extern void cvu_vmemtomemcpy(void *dest
, cv_vmemp src
, size_t n
)
41 uint8_t *get_tile_data(uint16_t x
, uint16_t y
)
45 #define IMAGE ((const cv_vmemp)0x1c00)
47 volatile struct cv_controller_state cs
;
49 #ifndef __SDCC_pdk14 // Lack of memory
50 #if !(defined (__SDCC_pdk15) && defined(__SDCC_STACK_AUTO)) // Lack of code memory
55 unsigned char i
, j
, k
;
69 if(cs
.joystick
& CV_RIGHT
)
71 if(cs
.joystick
& CV_DOWN
)
73 if(cs
.joystick
& CV_LEFT
&& x
> 8)
75 if(cs
.joystick
& CV_UP
&& y
> 8)
80 for(i
= 0; i
< 24; i
++)
82 cvu_vmemtomemcpy(buffer
, IMAGE
+ i
* 32 + 8, 24);
83 cvu_memtovmemcpy(IMAGE
+ i
* 32, buffer
, 24);
86 b
= get_tile_data(mapx
+ 24, mapy
);
87 for(i
= 0; i
< 8; i
++)
89 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 24, b
+ i
* 8, 8);
91 b
= get_tile_data(mapx
+ 24, mapy
+ 8);
92 for(i
= 0; i
< 8; i
++)
94 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 32 * 8 + 24, b
+ i
* 8, 8);
96 b
= get_tile_data(mapx
+ 24, mapy
+ 16);
97 for(i
= 0; i
< 8; i
++)
99 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 32 * 16 + 24, b
+ i
* 8, 8);
104 for(i
= 0; i
< 24; i
++)
106 cvu_vmemtomemcpy(buffer
, IMAGE
+ i
* 32, 24);
107 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 8, buffer
, 24);
110 b
= get_tile_data(mapx
, mapy
);
111 for(i
= 0; i
< 8; i
++)
113 cvu_memtovmemcpy(IMAGE
+ i
* 32, b
+ i
* 8, 8);
115 b
= get_tile_data(mapx
, mapy
+ 8);
116 for(i
= 0; i
< 8; i
++)
118 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 32 * 8, b
+ i
* 8, 8);
120 b
= get_tile_data(mapx
, mapy
+ 16);
121 for(i
= 0; i
< 8; i
++)
123 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 32 * 16, b
+ i
* 8, 8);
128 for(i
= 0; i
< 16; i
++)
130 cvu_vmemtomemcpy(buffer
, IMAGE
+ i
* 32 + 8 * 32, 32);
131 cvu_memtovmemcpy(IMAGE
+ i
* 32, buffer
, 32);
134 for(j
= 0; j
< 32; j
+= 8)
136 b
= get_tile_data(mapx
+ j
, mapy
+ 16);
137 for(i
= 0; i
< 8; i
++)
139 cvu_memtovmemcpy(IMAGE
+ i
* 32 + 16 * 32 + j
, b
+ i
* 8, 8);
146 for(i
= 23; i
>= 8; i
--)
148 cvu_vmemtomemcpy(buffer
, IMAGE
+ i
* 32 - 8 * 32, 32);
149 cvu_memtovmemcpy(IMAGE
+ i
* 32, buffer
, 32);
152 for(j
= 0; j
< 32; j
+= 8)
154 b
= get_tile_data(mapx
+ j
, mapy
);
155 for(i
= 0; i
< 8; i
++)
157 cvu_memtovmemcpy(IMAGE
+ i
* 32 + j
, b
+ i
* 8, 8);