aboutsummaryrefslogtreecommitdiff
path: root/src/vga.c
diff options
context:
space:
mode:
authorJuan J. Martinez <jjm@usebox.net>2023-07-08 15:53:38 +0100
committerJuan J. Martinez <jjm@usebox.net>2023-07-08 15:53:38 +0100
commit5ae0b6490f5fd138f4cbf5c084680bb03b2fff05 (patch)
tree714ec4e7f040664ec5b68f3089f0fb14ca4c263d /src/vga.c
parentae4b80050c7f86ea9e6f20937a925f4a03c028c7 (diff)
downloadgold-mine-run-5ae0b6490f5fd138f4cbf5c084680bb03b2fff05.tar.gz
gold-mine-run-5ae0b6490f5fd138f4cbf5c084680bb03b2fff05.zip
Perhaps generates better code
Diffstat (limited to 'src/vga.c')
-rw-r--r--src/vga.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vga.c b/src/vga.c
index 8230880..ec56b60 100644
--- a/src/vga.c
+++ b/src/vga.c
@@ -93,9 +93,9 @@ void blit(const uint8_t *sprite, const Rect *dst)
{
uint8_t *dbuffer = buffer + dst->x + dst->y * 320;
- for (int16_t j = 0; j < dst->h; j++)
+ for (uint16_t j = dst->h; j > 0; j--)
{
- for (int16_t i = 0; i < dst->w; i++)
+ for (uint16_t i = dst->w; i > 0; i--)
{
uint8_t b = *sprite++;
@@ -116,9 +116,9 @@ void blit_c(const uint8_t *sprite, const Rect *dst, uint8_t c)
{
uint8_t *dbuffer = buffer + dst->x + dst->y * 320;
- for (int16_t j = 0; j < dst->h; j++)
+ for (uint16_t j = dst->h; j > 0; j--)
{
- for (int16_t i = 0; i < dst->w; i++)
+ for (uint16_t i = dst->w; i > 0; i--)
{
uint8_t b = *sprite++;
@@ -140,9 +140,9 @@ void blitrc(const uint8_t *sprite, const Rect *src, const Rect *dst)
uint8_t *dbuffer = buffer + dst->x + dst->y * 320;
sprite += src->x + src->y * src->w;
- for (int16_t j = 0; j < dst->h; j++)
+ for (uint16_t j = dst->h; j > 0; j--)
{
- for (int16_t i = 0; i < dst->w; i++)
+ for (uint16_t i = dst->w; i > 0; i--)
{
uint8_t b = *sprite++;
@@ -174,9 +174,9 @@ void read_buffer(uint8_t *dst, const Rect *src)
{
uint8_t *s = buffer + src->y * 320 + src->x;
- for (int8_t j = 0; j < src->h; j++)
+ for (uint16_t j = src->h; j > 0; j--)
{
- for (int8_t i = 0; i < src->w; i++)
+ for (uint16_t i = src->w; i > 0; i--)
*dst++ = *s++;
s += 320 - src->w;