From e61875cfadc6ac33302d69474209fd215b9f6842 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Sat, 10 Feb 2018 21:10:26 +0200 Subject: [PATCH] - added rules for building asm code in the gcc makefiles - fixed missing parenthesis in PACK_RGB16 --- GNUmakefile | 3 +++ Makefile.dj | 3 +++ src/gfxutil.h | 4 +++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/GNUmakefile b/GNUmakefile index de6b64a..d6c67d1 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -11,6 +11,9 @@ LDFLAGS = -Llibs/imago -Llibs/mikmod -limago -lmikmod `sdl-config --libs` -lm $(bin): $(obj) imago mikmod $(CC) -o $@ $(obj) $(LDFLAGS) +%.o: %.asm + nasm -f elf -o $@ $< + -include $(dep) %.d: %.c diff --git a/Makefile.dj b/Makefile.dj index 4b3f7a7..c2ad183 100644 --- a/Makefile.dj +++ b/Makefile.dj @@ -22,6 +22,9 @@ LDFLAGS = libs/imago/imago.dja libs/oldmik/mikmod.dja $(bin): $(obj) imago mikmod $(CC) -o $@ -Wl,-Map=ld.map $(obj) $(LDFLAGS) +%.cof: %.asm + nasm -f coff -o $@ $< + -include $(dep) %.cof: %.c diff --git a/src/gfxutil.h b/src/gfxutil.h index 15f8b66..c0a1fde 100644 --- a/src/gfxutil.h +++ b/src/gfxutil.h @@ -4,7 +4,9 @@ #include "inttypes.h" #define PACK_RGB16(r, g, b) \ - (((r) << 8) & 0xf800) | (((g) << 3) & 0x7e0) | (((b) >> 3) & 0x1f) + ((((uint16_t)(r) << 8) & 0xf800) | \ + (((uint16_t)(g) << 3) & 0x7e0) | \ + (((uint16_t)(b) >> 3) & 0x1f)) #define UNPACK_R16(c) (((c) >> 8) & 0xf8) #define UNPACK_G16(c) (((c) >> 3) & 0xfc) -- 1.7.10.4