aboutsummaryrefslogtreecommitdiffstats
path: root/src/uxn/devices/ppu.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-05-20 21:45:04 +0200
committerBad Diode <bd@badd10de.dev>2021-05-20 21:45:04 +0200
commit1d6395f1b6aafce4e2e05bcf60f335bec0a8d4b3 (patch)
tree8e86d61333826dd2271ab7e997b1578d54f696ec /src/uxn/devices/ppu.c
parent707b6dac805bcc4f2b5e297ff3ce4b82538bcff0 (diff)
downloaduxngba-1d6395f1b6aafce4e2e05bcf60f335bec0a8d4b3.tar.gz
uxngba-1d6395f1b6aafce4e2e05bcf60f335bec0a8d4b3.zip
Add datetime and control methods
Diffstat (limited to 'src/uxn/devices/ppu.c')
-rw-r--r--src/uxn/devices/ppu.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/uxn/devices/ppu.c b/src/uxn/devices/ppu.c
index d70afdd..e9a94a6 100644
--- a/src/uxn/devices/ppu.c
+++ b/src/uxn/devices/ppu.c
@@ -163,6 +163,9 @@ putcolors(Ppu *p, Uint8 *addr) {
163 163
164void 164void
165putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) { 165putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) {
166 if(x >= 30 * 8 || y >= 20 * 8) {
167 return;
168 }
166 size_t tile_x = x / 8; 169 size_t tile_x = x / 8;
167 size_t tile_y = y / 8; 170 size_t tile_y = y / 8;
168 size_t start_col = x % 8; 171 size_t start_col = x % 8;
@@ -176,6 +179,9 @@ putpixel(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 color) {
176void 179void
177puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, 180puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color,
178 Uint8 flipx, Uint8 flipy) { 181 Uint8 flipx, Uint8 flipy) {
182 if(x >= 30 * 8 || y >= 20 * 8) {
183 return;
184 }
179 size_t tile_x = x / 8; 185 size_t tile_x = x / 8;
180 size_t tile_y = y / 8; 186 size_t tile_y = y / 8;
181 size_t start_col = x % 8; 187 size_t start_col = x % 8;
@@ -227,6 +233,9 @@ puticn(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color,
227void 233void
228putchr(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color, 234putchr(Ppu *p, Uint32 *layer, Uint16 x, Uint16 y, Uint8 *sprite, Uint8 color,
229 Uint8 flipx, Uint8 flipy) { 235 Uint8 flipx, Uint8 flipy) {
236 if(x >= 30 * 8 || y >= 20 * 8) {
237 return;
238 }
230 Uint16 v, h; 239 Uint16 v, h;
231 for(v = 0; v < 8; v++) 240 for(v = 0; v < 8; v++)
232 for(h = 0; h < 8; h++) { 241 for(h = 0; h < 8; h++) {
@@ -284,8 +293,6 @@ initppu(Ppu *p, Uint8 hor, Uint8 ver, Uint8 pad) {
284 backbuffer_bg1 = malloc(30 * 20 * sizeof(Tile)); 293 backbuffer_bg1 = malloc(30 * 20 * sizeof(Tile));
285 294
286 // Clear tile memory. 295 // Clear tile memory.
287 p->fg = &TILE_MEM[cb_fg];
288 p->bg = &TILE_MEM[cb_bg];
289 p->fg = backbuffer_bg0; 296 p->fg = backbuffer_bg0;
290 p->bg = backbuffer_bg1; 297 p->bg = backbuffer_bg1;
291 for (size_t i = 0; i < 30 * 20 * 8; ++i) { 298 for (size_t i = 0; i < 30 * 20 * 8; ++i) {