From: John Tsiombikas Date: Thu, 19 Dec 2019 02:12:31 +0000 (+0200) Subject: - fixed typos in csprite's code generator for nasm X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=4b1cef5f03023a4977c1a0dd0e7464fd4cc1044c - fixed typos in csprite's code generator for nasm - integrated (in the UNIX build only) automatic generation of compiled sprites with csprite - converted the UNIX build to 32bit, to allow using the same assembly code as with the DOS version (again for compiled sprites mostly) --- diff --git a/.gitignore b/.gitignore index 33467bd..afb00f8 100644 --- a/.gitignore +++ b/.gitignore @@ -38,3 +38,5 @@ data *.COF *.dja *.DJA +tools/csprite/csprite +font.asm diff --git a/GNUmakefile b/GNUmakefile index 199fc30..1ee0a1e 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -3,11 +3,20 @@ obj = $(src:.c=.o) $(asmsrc:.asm=.o) dep = $(obj:.o=.d) bin = demo +asmsrc += font.asm + inc = -I/usr/local/include -Isrc -Isrc/scr -Isrc/sdl -Ilibs -Ilibs/imago/src -Ilibs/mikmod/include warn = -pedantic -Wall -Wno-unused-variable -Wno-unused-function -CFLAGS = $(warn) -g $(inc) `sdl-config --cflags` -LDFLAGS = -Llibs/imago -Llibs/mikmod -limago -lmikmod `sdl-config --libs` -lm +CFLAGS = $(arch) $(warn) -g $(inc) `sdl-config --cflags` +LDFLAGS = $(arch) -Llibs/imago -Llibs/mikmod -limago -lmikmod $(sdl_ldflags) -lm + +ifneq ($(shell uname -m), i386) + arch = -m32 + sdl_ldflags = -L/usr/lib/i386-linux-gnu -lSDL +else + sdl_ldflags = `sdl-config --libs` +endif $(bin): $(obj) imago mikmod $(CC) -o $@ $(obj) $(LDFLAGS) @@ -18,6 +27,7 @@ $(bin): $(obj) imago mikmod -include $(dep) %.d: %.c + @echo dep $@ @$(CPP) $(CFLAGS) $< -MM -MT $(@:.d=.o) >$@ .PHONY: imago @@ -40,3 +50,9 @@ clean: .PHONY: cleandep cleandep: rm -f $(dep) + +tools/csprite/csprite: + $(MAKE) -C tools/csprite + +font.asm: data/font.png tools/csprite/csprite + tools/csprite/csprite -n font -s 16x16 -r 288x32+32+17 -conv565 -nasm $< >$@ diff --git a/libs/anim/GNUmakefile b/libs/anim/GNUmakefile index b795392..55fe6c0 100644 --- a/libs/anim/GNUmakefile +++ b/libs/anim/GNUmakefile @@ -2,7 +2,7 @@ src = $(wildcard src/*.c) obj = $(src:.c=.o) alib = libanim.a -CFLAGS = -Wno-main -g -I.. -I../../src +CFLAGS = -m32 -Wno-main -g -I.. -I../../src $(alib): $(obj) $(AR) rcs $@ $(obj) diff --git a/libs/imago/GNUmakefile b/libs/imago/GNUmakefile index 2c73904..8940d2a 100644 --- a/libs/imago/GNUmakefile +++ b/libs/imago/GNUmakefile @@ -5,7 +5,7 @@ src = $(wildcard src/*.c) \ obj = $(src:.c=.o) alib = libimago.a -CFLAGS = -Wno-main -g -Izlib -Ilibpng -Ijpeglib +CFLAGS = -m32 -Wno-main -g -Izlib -Ilibpng -Ijpeglib $(alib): $(obj) $(AR) rcs $@ $(obj) diff --git a/libs/mikmod/GNUmakefile b/libs/mikmod/GNUmakefile index a6f162b..9f472ff 100644 --- a/libs/mikmod/GNUmakefile +++ b/libs/mikmod/GNUmakefile @@ -10,7 +10,7 @@ alib = libmikmod.a def = -DHAVE_CONFIG_H -DMIKMOD_BUILD inc = -I. -Iinclude warn = -pedantic -Wall -Wno-unused-variable -Wno-unused-function -CFLAGS = $(warn) -g $(def) $(inc) `pkg-config --cflags sdl` +CFLAGS = -m32 $(warn) -g $(def) $(inc) `pkg-config --cflags sdl` $(alib): $(obj) $(AR) rcs $@ $(obj) diff --git a/tools/csprite/src/main.c b/tools/csprite/src/main.c index f0880b8..5bece2d 100644 --- a/tools/csprite/src/main.c +++ b/tools/csprite/src/main.c @@ -126,10 +126,10 @@ const char *prefixfmt[] = { "tiletab:\n", /* NASM template */ - "\tglobl %s\n" + "\tglobal %s\n" "%s:\n" "\tmov eax, [esp + 12]\n" - "\tmov ecx. %d\n" + "\tmov ecx, %d\n" "\tmul ecx\n" "\tadd eax, [esp + 8]\n" "\tadd eax, [esp + 4]\n"