From 5ae0b6490f5fd138f4cbf5c084680bb03b2fff05 Mon Sep 17 00:00:00 2001 From: "Juan J. Martinez" Date: Sat, 8 Jul 2023 15:53:38 +0100 Subject: Perhaps generates better code --- src/Makefile | 2 +- src/vga.c | 16 ++++++++-------- 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; -- cgit v1.2.3