From f35702a2d363b2f129796f2464fbe552edf393c2 Mon Sep 17 00:00:00 2001 From: John Tsiombikas Date: Tue, 18 May 2021 01:28:13 +0300 Subject: [PATCH] blank dos build --- Makefile.dj | 41 +++++++++++++++++++++++++++++++++++ src/dos/main.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/rbench.c | 1 - src/util.h | 11 ++++++++++ tools/lutgen.c | 2 ++ tools/pack.bat | 13 +++++++++++ 6 files changed, 133 insertions(+), 1 deletion(-) create mode 100644 Makefile.dj create mode 100644 src/dos/main.c create mode 100644 tools/pack.bat diff --git a/Makefile.dj b/Makefile.dj new file mode 100644 index 0000000..fc59199 --- /dev/null +++ b/Makefile.dj @@ -0,0 +1,41 @@ +src = $(wildcard src/*.c) $(wildcard src/dos/*.c) +ssrc = sinlut.s +obj = $(src:.c=.o) $(ssrc:.s=.o) +dep = $(src:.c=.d) +bin = rbench.exe + +LUTGEN = tools/lutgen.exe + +warn = -pedantic -Wall -Wno-deprecated-declarations +dbg = -g +opt = -O3 -ffast-math +inc = -Isrc +def = -DNO_STDINT_H + +CFLAGS = -pedantic $(warn) $(dbg) $(opt) $(def) $(inc) -MMD + +$(bin): $(obj) + $(CC) -o $@ $(obj) $(LDFLAGS) + +sinlut.s: $(LUTGEN) + $(LUTGEN) >$@ + +-include $(dep) +-include *.d + +.PHONY: clean +clean: + del src\*.o + del src\dos\*.o + del *.o + del $(bin) + del sinlut.s + +.PHONY: cleandep +cleandep: + del src\*.d + del src\dos\*.d + del *.d + +$(LUTGEN): tools/lutgen.c + $(CC) -o $@ $< -lm diff --git a/src/dos/main.c b/src/dos/main.c new file mode 100644 index 0000000..5a1a13a --- /dev/null +++ b/src/dos/main.c @@ -0,0 +1,66 @@ +#include +#include +#include "rbench.h" + +static int parse_args(int argc, char **argv); + +int main(int argc, char **argv) +{ + read_config("rbench.cfg"); + + if(parse_args(argc, argv) == -1) { + return 1; + } + + printf("foo %dx%d %dbpp\n", opt.width, opt.height, opt.bpp); + + return 0; +} + + +static const char *usage_str = + "Usage: %s [options]\n" + "Options:\n" + " -s : resolution\n" + " -b : color depth\n" + " -h: print usage and exit\n"; + +static int parse_args(int argc, char **argv) +{ + int i; + + for(i=1; i #include -#include #include #include "rbench.h" #include "treestor.h" diff --git a/src/util.h b/src/util.h index 9b04f0d..9f0eb4d 100644 --- a/src/util.h +++ b/src/util.h @@ -1,6 +1,17 @@ #ifndef UTIL_H_ #define UTIL_H_ +#ifdef NO_STDINT_H +typedef char int8_t; +typedef unsigned char uint8_t; +typedef short int16_t; +typedef unsigned short uint16_t; +typedef int int32_t; +typedef unsigned int uint32_t; +#else +#include +#endif + extern int sinlut[]; #define SIN(x) sinlut[(x) & 0xff] diff --git a/tools/lutgen.c b/tools/lutgen.c index b4f2645..a573de1 100644 --- a/tools/lutgen.c +++ b/tools/lutgen.c @@ -6,7 +6,9 @@ int main(void) int i; puts("\t.data"); + puts("\t.globl _sinlut"); puts("\t.globl sinlut"); + puts("_sinlut:"); puts("sinlut:"); for(i=0; i<256; i++) { float x = sin((float)i / 128.0f * M_PI); diff --git a/tools/pack.bat b/tools/pack.bat new file mode 100644 index 0000000..7fddfeb --- /dev/null +++ b/tools/pack.bat @@ -0,0 +1,13 @@ +deltree /y c:\tmp\rbench +mkdir c:\tmp\rbench +mkdir c:\tmp\rbench\src +mkdir c:\tmp\rbench\src\dos +mkdir c:\tmp\rbench\tools + +copy Makefile.dos c:\tmp\rbench +copy tools\lutgen.c c:\tmp\rbench\tools +copy src\*.c c:\tmp\rbench\src +copy src\*.h c:\tmp\rbench\src +copy src\dos\*.c c:\tmp\rbench\src\dos +copy src\dos\*.h c:\tmp\rbench\src\dos +copy pack.bat c:\tmp\rbench -- 1.7.10.4