aboutsummaryrefslogtreecommitdiff
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
parentae4b80050c7f86ea9e6f20937a925f4a03c028c7 (diff)
downloadgold-mine-run-5ae0b6490f5fd138f4cbf5c084680bb03b2fff05.tar.gz
gold-mine-run-5ae0b6490f5fd138f4cbf5c084680bb03b2fff05.zip
Perhaps generates better code
-rw-r--r--src/Makefile2
-rw-r--r--src/vga.c16
2 files changed, 9 insertions, 9 deletions
diff --git a/src/Makefile b/src/Makefile
index 577d9e0..4870f10 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -4,7 +4,7 @@ endif
BIN := ../game.exe
CC := i586-pc-msdosdjgpp-gcc
-CFLAGS := -I. -I$(LIBMIKMOD_BASE)/include -c -Wall -Werror -pedantic -O2 -fomit-frame-pointer -ffast-math -march=i386 -DDEBUG
+CFLAGS := -I. -I$(LIBMIKMOD_BASE)/include -g -c -Wall -Werror -pedantic -O2 -fomit-frame-pointer -ffast-math -march=i386 -DDEBUG
LDFLAGS := -s -L$(LIBMIKMOD_BASE)/dos
LIBS := -lmikmod
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;