From: John Tsiombikas Date: Sun, 22 Dec 2019 23:32:57 +0000 (+0200) Subject: It seems that it was a mistake to OR the LFB flag to the video mode X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=commitdiff_plain;h=68f89fa06ae5cfacde9cf8310e97220e5fc05260 It seems that it was a mistake to OR the LFB flag to the video mode returned by the enumeration of VBE modes. Many of the graphics cards in PCem fail the call when it's present. Also renamed Makefile -> Makefile.wat and Makefile.dj -> Makefile since we're pretty much deprecating watcom at this point. --- diff --git a/.gitignore b/.gitignore index e5f03cc..ed1a77c 100644 --- a/.gitignore +++ b/.gitignore @@ -34,7 +34,7 @@ data /dosdemo.vcxproj.user *.dep *.DEP -*.cof +*.odj *.COF *.dja *.DJA diff --git a/Makefile b/Makefile index 1d0d7da..f3630fa 100644 --- a/Makefile +++ b/Makefile @@ -1,63 +1,85 @@ -obj = 3dgfx.obj bsptree.obj bump.obj cfgopt.obj demo.obj djdpmi.obj dynarr.obj & -fract.obj gfx.obj gfxutil.obj greets.obj grise.obj hairball.obj infcubes.obj & -keyb.obj logger.obj main.obj mesh.obj meshload.obj metaball.obj metasurf.obj & -mouse.obj music.obj noise.obj plasma.obj polyclip.obj polyfill.obj polytest.obj & -rbtree.obj sball.obj screen.obj smoketxt.obj thunder.obj tilemaze.obj timer.obj & -tinyfps.obj treestor.obj ts_text.obj tunnel.obj util.obj vbe.obj vga.obj - +src = $(wildcard src/*.c) $(wildcard src/scr/*.c) $(wildcard src/dos/*.c) +asmsrc = $(wildcard src/*.asm) $(wildcard src/scr/*.asm) $(wildcard src/dos/*.asm) +obj = $(src:.c=.odj) $(asmsrc:.asm=.odj) +dep = $(obj:.odj=.dep) bin = demo.exe -libs = imago.lib anim.lib - -def = -dM_PI=3.141592653589793 -opt = -5 -fp5 -otexan -oh -oi -ei -dbg = -d2 - -!ifdef __UNIX__ -incpath = -Isrc -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src -libpath = libpath libs/imago libpath libs/anim -RM = rm -f -!else -incpath = -Isrc -Isrc\dos -Ilibs -Ilibs\imago\src -Ilibs\anim\src -libpath = libpath libs\imago libpath libs\anim -RM = del -!endif - -AS = nasm -CC = wcc386 -CXX = wpp386 -ASFLAGS = -fobj -CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos $(incpath) -CXXFLAGS = $(CFLAGS) -LDFLAGS = option stack=16k option map $(libpath) library { $(libs) } -LD = wlink - -$(bin): cflags.occ $(obj) libs/imago/imago.lib - %write objects.lnk $(obj) - %write ldflags.lnk $(LDFLAGS) - $(LD) debug all name $@ system dos4g file { @objects } @ldflags - -.c: src;src/dos;src/scr -.cc: src;src/dos;src/scr -.asm: src;src/dos;src/scr - -cflags.occ: Makefile - %write $@ $(CFLAGS) - -cxxflags.occ: Makefile - %write $@ $(CXXFLAGS) - -.c.obj: .autodepend - $(CC) -fo=$@ @cflags.occ $[* - -.cc.obj: .autodepend - $(CXX) -fo=$@ @cxxflags.occ $[* - -.asm.obj: - $(AS) $(ASFLAGS) -o $@ $[*.asm - -clean: .symbolic - $(RM) *.obj - $(RM) *.occ - $(RM) *.lnk - $(RM) $(bin) +asmsrc += cspr/dbgfont.asm cspr/confont.asm + +ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) + hostsys = dos +else + hostsys = unix + TOOLPREFIX = i586-pc-msdosdjgpp- +endif + +inc = -Isrc -Isrc/scr -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src +opt = -O3 -ffast-math -fno-strict-aliasing +dbg = -g +#prof = -pg +warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable +def = -DNO_MUSIC + +CC = $(TOOLPREFIX)gcc +AR = $(TOOLPREFIX)ar +CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(prof) $(inc) $(def) +LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja + +ifneq ($(hostsys), dos) +.PHONY: all +all: data $(bin) +endif + +$(bin): $(obj) imago anim + $(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS) + +%.odj: %.asm + nasm -f coff -o $@ $< + +ifneq ($(hostsys), dos) +-include $(dep) +endif + +%.odj: %.c + $(CC) $(CFLAGS) -o $@ -c $< + +%.dep: %.c + @echo dep $@ + @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.odj) >$@ + +.PHONY: imago +imago: + $(MAKE) -C libs/imago -f Makefile + +.PHONY: anim +anim: + $(MAKE) -C libs/anim -f Makefile + +.PHONY: cleanlibs +cleanlibs: + $(MAKE) -C libs/imago -f Makefile clean + $(MAKE) -C libs/anim -f Makefile clean + +.PHONY: clean +.PHONY: cleandep + +ifeq ($(hostsys), dos) +clean: + del src\*.odj + del src\dos\*.odj + del $(bin) + +cleandep: + del src\*.dep + del src\dos\*.dep +else +clean: + rm -f $(obj) $(bin) + +cleandep: + rm -f $(dep) + +.PHONY: data +data: + @tools/procdata +endif diff --git a/Makefile.dj b/Makefile.dj deleted file mode 100644 index f2414dc..0000000 --- a/Makefile.dj +++ /dev/null @@ -1,85 +0,0 @@ -src = $(wildcard src/*.c) $(wildcard src/scr/*.c) $(wildcard src/dos/*.c) -asmsrc = $(wildcard src/*.asm) $(wildcard src/scr/*.asm) $(wildcard src/dos/*.asm) -obj = $(src:.c=.cof) $(asmsrc:.asm=.cof) -dep = $(obj:.cof=.dep) -bin = demo.exe - -asmsrc += cspr/dbgfont.asm cspr/confont.asm - -ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) - hostsys = dos -else - hostsys = unix - TOOLPREFIX = i586-pc-msdosdjgpp- -endif - -inc = -Isrc -Isrc/scr -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src -opt = -O3 -ffast-math -fno-strict-aliasing -dbg = -g -#prof = -pg -warn = -pedantic -Wall -Wno-unused-function -Wno-unused-variable -def = -DNO_MUSIC - -CC = $(TOOLPREFIX)gcc -AR = $(TOOLPREFIX)ar -CFLAGS = $(warn) -march=pentium $(dbg) $(opt) $(prof) $(inc) $(def) -LDFLAGS = libs/imago/imago.dja libs/anim/anim.dja - -ifneq ($(hostsys), dos) -.PHONY: all -all: data $(bin) -endif - -$(bin): $(obj) imago anim - $(CC) -o $@ -Wl,-Map=ld.map $(prof) $(obj) $(LDFLAGS) - -%.cof: %.asm - nasm -f coff -o $@ $< - -ifneq ($(hostsys), dos) --include $(dep) -endif - -%.cof: %.c - $(CC) $(CFLAGS) -o $@ -c $< - -%.dep: %.c - @echo dep $@ - @$(CPP) $(CFLAGS) $< -MM -MT $(@:.dep=.cof) >$@ - -.PHONY: imago -imago: - $(MAKE) -C libs/imago -f Makefile.dj - -.PHONY: anim -anim: - $(MAKE) -C libs/anim -f Makefile.dj - -.PHONY: cleanlibs -cleanlibs: - $(MAKE) -C libs/imago -f Makefile.dj clean - $(MAKE) -C libs/anim -f Makefile.dj clean - -.PHONY: clean -.PHONY: cleandep - -ifeq ($(hostsys), dos) -clean: - del src\*.cof - del src\dos\*.cof - del $(bin) - -cleandep: - del src\*.dep - del src\dos\*.dep -else -clean: - rm -f $(obj) $(bin) - -cleandep: - rm -f $(dep) - -.PHONY: data -data: - @tools/procdata -endif diff --git a/Makefile.wat b/Makefile.wat new file mode 100644 index 0000000..1d0d7da --- /dev/null +++ b/Makefile.wat @@ -0,0 +1,63 @@ +obj = 3dgfx.obj bsptree.obj bump.obj cfgopt.obj demo.obj djdpmi.obj dynarr.obj & +fract.obj gfx.obj gfxutil.obj greets.obj grise.obj hairball.obj infcubes.obj & +keyb.obj logger.obj main.obj mesh.obj meshload.obj metaball.obj metasurf.obj & +mouse.obj music.obj noise.obj plasma.obj polyclip.obj polyfill.obj polytest.obj & +rbtree.obj sball.obj screen.obj smoketxt.obj thunder.obj tilemaze.obj timer.obj & +tinyfps.obj treestor.obj ts_text.obj tunnel.obj util.obj vbe.obj vga.obj + +bin = demo.exe + +libs = imago.lib anim.lib + +def = -dM_PI=3.141592653589793 +opt = -5 -fp5 -otexan -oh -oi -ei +dbg = -d2 + +!ifdef __UNIX__ +incpath = -Isrc -Isrc/dos -Ilibs -Ilibs/imago/src -Ilibs/anim/src +libpath = libpath libs/imago libpath libs/anim +RM = rm -f +!else +incpath = -Isrc -Isrc\dos -Ilibs -Ilibs\imago\src -Ilibs\anim\src +libpath = libpath libs\imago libpath libs\anim +RM = del +!endif + +AS = nasm +CC = wcc386 +CXX = wpp386 +ASFLAGS = -fobj +CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos $(incpath) +CXXFLAGS = $(CFLAGS) +LDFLAGS = option stack=16k option map $(libpath) library { $(libs) } +LD = wlink + +$(bin): cflags.occ $(obj) libs/imago/imago.lib + %write objects.lnk $(obj) + %write ldflags.lnk $(LDFLAGS) + $(LD) debug all name $@ system dos4g file { @objects } @ldflags + +.c: src;src/dos;src/scr +.cc: src;src/dos;src/scr +.asm: src;src/dos;src/scr + +cflags.occ: Makefile + %write $@ $(CFLAGS) + +cxxflags.occ: Makefile + %write $@ $(CXXFLAGS) + +.c.obj: .autodepend + $(CC) -fo=$@ @cflags.occ $[* + +.cc.obj: .autodepend + $(CXX) -fo=$@ @cxxflags.occ $[* + +.asm.obj: + $(AS) $(ASFLAGS) -o $@ $[*.asm + +clean: .symbolic + $(RM) *.obj + $(RM) *.occ + $(RM) *.lnk + $(RM) $(bin) diff --git a/libs/anim/Makefile b/libs/anim/Makefile index 657e083..fd3b651 100644 --- a/libs/anim/Makefile +++ b/libs/anim/Makefile @@ -1,27 +1,30 @@ -obj = anim.obj track.obj -alib = anim.lib +src = $(wildcard src/*.c) +obj = $(src:.c=.odj) +alib = anim.dja -def = -dM_PI=3.141592653589793 -opt = -5 -fp5 -otexan -I.. -I../../src $(def) -dbg = -d1 +ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) + hostsys = dos +else + hostsys = unix + TOOLPREFIX = i586-pc-msdosdjgpp- +endif -!ifdef __UNIX__ -RM = rm -f -!else -RM = del -!endif - -CC = wcc386 -CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos +CC = $(TOOLPREFIX)gcc +AR = $(TOOLPREFIX)ar +CFLAGS = -Wno-main -march=pentium -g -O3 -ffast-math -I.. -I../../src $(alib): $(obj) - wlib -b -n $@ $(obj) - -.c: src + $(AR) rcs $@ $(obj) -.c.obj: .autodepend - $(CC) -fo=$@ $(CFLAGS) $[* +%.odj: %.c + $(CC) $(CFLAGS) -o $@ -c $< -clean: .symbolic - $(RM) *.obj - $(RM) $(alib) +.PHONY: clean +ifeq ($(hostsys), dos) +clean: + del src\*.odj + del $(alib) +else +clean: + rm -f $(obj) $(alib) +endif diff --git a/libs/anim/Makefile.dj b/libs/anim/Makefile.dj deleted file mode 100644 index e73b990..0000000 --- a/libs/anim/Makefile.dj +++ /dev/null @@ -1,30 +0,0 @@ -src = $(wildcard src/*.c) -obj = $(src:.c=.cof) -alib = anim.dja - -ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) - hostsys = dos -else - hostsys = unix - TOOLPREFIX = i586-pc-msdosdjgpp- -endif - -CC = $(TOOLPREFIX)gcc -AR = $(TOOLPREFIX)ar -CFLAGS = -Wno-main -march=pentium -g -O3 -ffast-math -I.. -I../../src - -$(alib): $(obj) - $(AR) rcs $@ $(obj) - -%.cof: %.c - $(CC) $(CFLAGS) -o $@ -c $< - -.PHONY: clean -ifeq ($(hostsys), dos) -clean: - del src\*.cof - del $(alib) -else -clean: - rm -f $(obj) $(alib) -endif diff --git a/libs/anim/Makefile.wat b/libs/anim/Makefile.wat new file mode 100644 index 0000000..657e083 --- /dev/null +++ b/libs/anim/Makefile.wat @@ -0,0 +1,27 @@ +obj = anim.obj track.obj +alib = anim.lib + +def = -dM_PI=3.141592653589793 +opt = -5 -fp5 -otexan -I.. -I../../src $(def) +dbg = -d1 + +!ifdef __UNIX__ +RM = rm -f +!else +RM = del +!endif + +CC = wcc386 +CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos + +$(alib): $(obj) + wlib -b -n $@ $(obj) + +.c: src + +.c.obj: .autodepend + $(CC) -fo=$@ $(CFLAGS) $[* + +clean: .symbolic + $(RM) *.obj + $(RM) $(alib) diff --git a/libs/imago/Makefile b/libs/imago/Makefile index 7959d19..3e11a8d 100644 --- a/libs/imago/Makefile +++ b/libs/imago/Makefile @@ -1,50 +1,36 @@ -libpng = png.obj pngerror.obj pngget.obj pngmem.obj pngpread.obj pngread.obj & -pngrio.obj pngrtran.obj pngrutil.obj pngset.obj pngtrans.obj pngwio.obj & -pngwrite.obj pngwtran.obj pngwutil.obj -zlib = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj & -inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj -jpeglib = jcapimin.obj jcapistd.obj jccoefct.obj jccolor.obj jcdctmgr.obj & -jchuff.obj jcinit.obj jcmainct.obj jcmarker.obj jcmaster.obj jcomapi.obj & -jcparam.obj jcphuff.obj jcprepct.obj jcsample.obj jctrans.obj jdapimin.obj & -jdapistd.obj jdatadst.obj jdatasrc.obj jdcoefct.obj jdcolor.obj jddctmgr.obj & -jdhuff.obj jdinput.obj jdmainct.obj jdmarker.obj jdmaster.obj jdmerge.obj & -jdphuff.obj jdpostct.obj jdsample.obj jdtrans.obj jerror.obj jfdctflt.obj & -jfdctfst.obj jfdctint.obj jidctflt.obj jidctfst.obj jidctint.obj jidctred.obj & -jmemmgr.obj jmemnobs.obj jquant1.obj jquant2.obj jutils.obj - -obj = conv.obj filejpeg.obj filepng.obj fileppm.obj filergbe.obj & -filetga.obj ftmodule.obj imago2.obj imago_gl.obj modules.obj & -$(libpng) $(zlib) $(jpeglib) - -alib = imago.lib - -opt = -5 -fp5 -otexan -dbg = -d1 -def = -DPNG_NO_SNPRINTF - -!ifdef __UNIX__ -RM = rm -f -!else -RM = del -!endif - -CC = wcc386 -CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos -Ilibpng -Izlib -Ijpeglib - -$(alib): cflags.occ $(obj) - %write objects.lbc $(obj) - wlib -b -n $@ @objects - -.c: src;libpng;jpeglib;zlib - -cflags.occ: Makefile - %write $@ $(CFLAGS) - -.c.obj: .autodepend - $(CC) -fo=$@ @cflags.occ $[* - -clean: .symbolic - $(RM) *.obj - $(RM) *.occ - $(RM) *.lbc - $(RM) $(alib) +src = $(wildcard src/*.c) \ + $(wildcard zlib/*.c) \ + $(wildcard libpng/*.c) \ + $(wildcard jpeglib/*.c) +obj = $(src:.c=.odj) +alib = imago.dja + +ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) + hostsys = dos +else + hostsys = unix + TOOLPREFIX = i586-pc-msdosdjgpp- +endif + +CC = $(TOOLPREFIX)gcc +AR = $(TOOLPREFIX)ar +CFLAGS = -Wno-main -march=pentium -g -O3 -ffast-math -Izlib -Ilibpng -Ijpeglib + +$(alib): $(obj) + $(AR) rcs $@ $(obj) + +%.odj: %.c + $(CC) $(CFLAGS) -o $@ -c $< + +.PHONY: clean +ifeq ($(hostsys), dos) +clean: + del src\*.odj + del zlib\*.odj + del libpng\*.odj + del jpeglib\*.odj + del $(alib) +else +clean: + rm -f $(obj) $(alib) +endif diff --git a/libs/imago/Makefile.dj b/libs/imago/Makefile.dj deleted file mode 100644 index 637c4f3..0000000 --- a/libs/imago/Makefile.dj +++ /dev/null @@ -1,36 +0,0 @@ -src = $(wildcard src/*.c) \ - $(wildcard zlib/*.c) \ - $(wildcard libpng/*.c) \ - $(wildcard jpeglib/*.c) -obj = $(src:.c=.cof) -alib = imago.dja - -ifeq ($(findstring COMMAND.COM, $(SHELL)), COMMAND.COM) - hostsys = dos -else - hostsys = unix - TOOLPREFIX = i586-pc-msdosdjgpp- -endif - -CC = $(TOOLPREFIX)gcc -AR = $(TOOLPREFIX)ar -CFLAGS = -Wno-main -march=pentium -g -O3 -ffast-math -Izlib -Ilibpng -Ijpeglib - -$(alib): $(obj) - $(AR) rcs $@ $(obj) - -%.cof: %.c - $(CC) $(CFLAGS) -o $@ -c $< - -.PHONY: clean -ifeq ($(hostsys), dos) -clean: - del src\*.cof - del zlib\*.cof - del libpng\*.cof - del jpeglib\*.cof - del $(alib) -else -clean: - rm -f $(obj) $(alib) -endif diff --git a/libs/imago/Makefile.wat b/libs/imago/Makefile.wat new file mode 100644 index 0000000..7959d19 --- /dev/null +++ b/libs/imago/Makefile.wat @@ -0,0 +1,50 @@ +libpng = png.obj pngerror.obj pngget.obj pngmem.obj pngpread.obj pngread.obj & +pngrio.obj pngrtran.obj pngrutil.obj pngset.obj pngtrans.obj pngwio.obj & +pngwrite.obj pngwtran.obj pngwutil.obj +zlib = adler32.obj compress.obj crc32.obj deflate.obj gzio.obj infback.obj & +inffast.obj inflate.obj inftrees.obj trees.obj uncompr.obj zutil.obj +jpeglib = jcapimin.obj jcapistd.obj jccoefct.obj jccolor.obj jcdctmgr.obj & +jchuff.obj jcinit.obj jcmainct.obj jcmarker.obj jcmaster.obj jcomapi.obj & +jcparam.obj jcphuff.obj jcprepct.obj jcsample.obj jctrans.obj jdapimin.obj & +jdapistd.obj jdatadst.obj jdatasrc.obj jdcoefct.obj jdcolor.obj jddctmgr.obj & +jdhuff.obj jdinput.obj jdmainct.obj jdmarker.obj jdmaster.obj jdmerge.obj & +jdphuff.obj jdpostct.obj jdsample.obj jdtrans.obj jerror.obj jfdctflt.obj & +jfdctfst.obj jfdctint.obj jidctflt.obj jidctfst.obj jidctint.obj jidctred.obj & +jmemmgr.obj jmemnobs.obj jquant1.obj jquant2.obj jutils.obj + +obj = conv.obj filejpeg.obj filepng.obj fileppm.obj filergbe.obj & +filetga.obj ftmodule.obj imago2.obj imago_gl.obj modules.obj & +$(libpng) $(zlib) $(jpeglib) + +alib = imago.lib + +opt = -5 -fp5 -otexan +dbg = -d1 +def = -DPNG_NO_SNPRINTF + +!ifdef __UNIX__ +RM = rm -f +!else +RM = del +!endif + +CC = wcc386 +CFLAGS = $(dbg) $(opt) $(def) -zq -bt=dos -Ilibpng -Izlib -Ijpeglib + +$(alib): cflags.occ $(obj) + %write objects.lbc $(obj) + wlib -b -n $@ @objects + +.c: src;libpng;jpeglib;zlib + +cflags.occ: Makefile + %write $@ $(CFLAGS) + +.c.obj: .autodepend + $(CC) -fo=$@ @cflags.occ $[* + +clean: .symbolic + $(RM) *.obj + $(RM) *.occ + $(RM) *.lbc + $(RM) $(alib) diff --git a/src/dos/gfx.c b/src/dos/gfx.c index bc763d3..5252cbc 100644 --- a/src/dos/gfx.c +++ b/src/dos/gfx.c @@ -65,7 +65,7 @@ void *set_video_mode(int xsz, int ysz, int bpp, int nbuf) mode = -1; nmodes = vbe_num_modes(&vbe); for(i=0; i