- added rules for building asm code in the gcc makefiles
authorJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 10 Feb 2018 19:10:26 +0000 (21:10 +0200)
committerJohn Tsiombikas <nuclear@member.fsf.org>
Sat, 10 Feb 2018 19:10:26 +0000 (21:10 +0200)
- fixed missing parenthesis in PACK_RGB16

GNUmakefile
Makefile.dj
src/gfxutil.h

index de6b64a..d6c67d1 100644 (file)
@@ -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
index 4b3f7a7..c2ad183 100644 (file)
@@ -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
index 15f8b66..c0a1fde 100644 (file)
@@ -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)