From: Jonathan Campbell Date: Thu, 24 Mar 2016 12:02:59 +0000 (-0700) Subject: Merge remote-tracking branch 'upstream/master' X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=535f618e80aa6546e61907026b2451e123655a5b;hp=540bebc69b391264746b29992cdc14f7287ec55b;p=16.git Merge remote-tracking branch 'upstream/master' --- diff --git a/16/16/src/inputest.c b/16/16/src/inputest.c index c12b19f1..fd8d3266 100755 --- a/16/16/src/inputest.c +++ b/16/16/src/inputest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 pngwen * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 andrius4669 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 joncampbell123 * * This file is part of Project 16. * diff --git a/16/16/src/lib/lib_head.c b/16/16/src/lib/lib_head.c index 4ca25c9c..1c9b916c 100755 --- a/16/16/src/lib/lib_head.c +++ b/16/16/src/lib/lib_head.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 pngwen * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 andrius4669 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 joncampbell123 * * This file is part of Project 16. * diff --git a/16/16/src/lib/lib_head.h b/16/16/src/lib/lib_head.h index cf50054d..0f26c1fc 100755 --- a/16/16/src/lib/lib_head.h +++ b/16/16/src/lib/lib_head.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 pngwen * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 andrius4669 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 joncampbell123 * * This file is part of Project 16. * diff --git a/16/16/src/lib/types.h b/16/16/src/lib/types.h index 2055c20c..b0213bc8 100755 --- a/16/16/src/lib/types.h +++ b/16/16/src/lib/types.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 pngwen * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 andrius4669 * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 joncampbell123 * * This file is part of Project 16. * diff --git a/data/aconita.pal b/data/aconita.pal new file mode 100755 index 00000000..ef215a29 Binary files /dev/null and b/data/aconita.pal differ diff --git a/data/aconita.vrl b/data/aconita.vrl new file mode 100755 index 00000000..2c5ef7de Binary files /dev/null and b/data/aconita.vrl differ diff --git a/makefile b/makefile index f1f1e808..4eebe67b 100755 --- a/makefile +++ b/makefile @@ -71,7 +71,7 @@ BAKAPIFLAGS=-fh=bakapi.hed SFLAGS=-sg -st -of+ -zu -zdf -zff -zgf -k55808#60000#32768 DFLAGS=-DTARGET_MSDOS=16 -DMSDOS=1 $(SFLAGS) ZFLAGS=-zk0 -zc -zp8 $(WCLQ) ## -zm -CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo##wwww +CFLAGS=$(AFLAGS) $(IFLAGS)-lr -l=dos -wo -i$(DOSLIB)##wwww OFLAGS=-obmiler -out -oh -ei -zp8 -fpi87 -onac -ol+ -ok####x FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS) @@ -84,29 +84,16 @@ DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ) GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ) -DOSLIBLIBS=dl_vga.lib dl_cpu.lib dl_dos.lib +DOSLIBLIBS=$(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib $(DOSLIBDIR)/hw/dos/dos86h/dos.lib $(DOSLIBDIR)/hw/vga/dos86h/vga.lib TESTEXEC = exmmtest.exe test.exe pcxtest.exe pcxtest2.exe test2.exe palettec.exe maptest.exe fmemtest.exe fonttest.exe fontgfx.exe scroll.exe vgmtest.exe inputest.exe palettel.exe planrpcx.exe # tsthimem.exe #testemm.exe testemm0.exe fonttes0.exe miditest.exe sega.exe sountest.exe EXEC = 16.exe bakapi.exe $(TESTEXEC) tesuto.exe -!include $(DOSLIBDIR)/extdep.mak - -all: $(EXEC) datatest - -cute.vrl: data/cute.pcx $(PCX2VRL) - $(PCX2VRL) -i data/cute.pcx -o cute.vrl -p cute.pal -tc 254 - # you can then test this against TESUTO.EXE by typing: TESUTO CUTE.VRL CUTE.PAL - -datatest: cute.vrl .symbolic - -# doslib PCX to VRL converter native host binary -$(PCX2VRL): $(DOSLIBDIR)/hw/vga/pcx2vrl.c - cd $(DOSLIBDIR)/hw/vga && make pcx2vrl +all: $(EXEC) #$(16LIBOBJS) => 16.lib bug.... - # #game and bakapi executables # @@ -125,12 +112,12 @@ scroll.$(OBJ): $(SRC)scroll.c # NOTE: dos86h = 16-bit huge memory model. memory model must match! -tesuto.exe: tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) +tesuto.exe: tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib # %write tmp.cmd option quiet option map=tesuto.map $(DOSLIB_LDFLAGS_DOS16H) file tesuto.obj name tesuto.exe # %write tmp.cmd library $(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib # %write tmp.cmd library $(DOSLIBDIR)/hw/dos/dos86h/dos.lib # @wlink @tmp.cmd - wcl $(FLAGS) $(WCLQ) tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) + wcl $(FLAGS) $(WCLQ) tesuto.$(OBJ) $(DOSLIBLIBS) 16_head.$(OBJ) gfx.lib tesuto.$(OBJ): $(SRC)tesuto.c wcl $(FLAGS) $(DOSLIB_CINCLUDE) $(WCLQ) -c $(SRC)tesuto.c #tesuto.exe: tesuto.$(OBJ) @@ -302,25 +289,26 @@ vgmtest.$(OBJ): $(SRC)vgmtest.c gfx.lib: $(GFXLIBOBJS) wlib -b $(WLIBQ) gfx.lib $(GFXLIBOBJS) -doslib.lib: $(DOSLIBOBJ) # $(SRCLIB)cpu.lib - wlib -b $(WLIBQ) doslib.lib $(DOSLIBOBJ) # $(SRCLIB)cpu.lib +#doslib.lib: $(DOSLIBOBJ) # $(SRCLIB)cpu.lib +# wlib -b $(WLIBQ) doslib.lib $(DOSLIBOBJ) # $(SRCLIB)cpu.lib vgmsnd.lib: $(VGMSNDOBJ) wlib -b $(WLIBQ) vgmsnd.lib $(VGMSNDOBJ) +# extdep: +# !include $(DOSLIBDIR)/extdep.mak # library deps 16-bit huge -dl_vga.lib: - cd $(DOSLIBDIR)/hw/vga && ./make.sh - cp $(DOSLIBDIR)/hw/vga/dos86h/vga.lib dl_vga.lib - -dl_cpu.lib: +$(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib: cd $(DOSLIBDIR)/hw/cpu && ./make.sh - cp $(DOSLIBDIR)/hw/cpu/dos86h/cpu.lib dl_cpu.lib - -dl_dos.lib: +$(DOSLIBDIR)/hw/dos/dos86h/dos.lib: cd $(DOSLIBDIR)/hw/dos && ./make.sh - cp $(DOSLIBDIR)/hw/dos/dos86h/dos.lib dl_dos.lib +$(DOSLIBDIR)/hw/vga/dos86h/vga.lib: + cd $(DOSLIBDIR)/hw/vga && ./make.sh +#$(DOSLIBLIBS): .symbolic +# @cd $(DOSLIB) +# @./buildall.sh +# @cd $(PDIR)$(PDIR)$(PDIR) modex16.$(OBJ): $(SRCLIB)modex16.h $(SRCLIB)modex16.c wcl $(FLAGS) -c $(SRCLIB)modex16.c @@ -436,13 +424,9 @@ clean: .symbolic @$(REMOVECOMMAND) 16.lib @$(REMOVECOMMAND) gfx.lib @$(REMOVECOMMAND) vgmsnd.lib - @$(REMOVECOMMAND) $(DOSLIBLIBS) @wlib -n $(WLIBQ) 16.lib @wlib -n $(WLIBQ) gfx.lib @wlib -n $(WLIBQ) vgmsnd.lib - @$(REMOVECOMMAND) dl_cpu.lib - @$(REMOVECOMMAND) dl_dos.lib - @$(REMOVECOMMAND) dl_vga.lib @$(REMOVECOMMAND) *.16 @$(REMOVECOMMAND) *.16W @$(REMOVECOMMAND) *.16B @@ -459,6 +443,7 @@ clean: .symbolic @$(REMOVECOMMAND) *.map @$(REMOVECOMMAND) *.err @$(COPYCOMMAND) .git/config git_con.fig + @$(COPYCOMMAND) .gitmodules git_modu.les # @$(COPYCOMMAND) $(SRC)exmmtest.c $(EXMMTESTDIR)$(SRC) # @$(COPYCOMMAND) $(SRCLIB)16_mm.* $(EXMMTESTDIR)$(SRCLIB) # @$(COPYCOMMAND) $(SRCLIB)16_head.* $(EXMMTESTDIR)$(SRCLIB) @@ -476,8 +461,8 @@ comq: .symbolic @upx -9 $(UPXQ) $(EXEC) www: .symbolic -# @rm /var/www/$(EXEC) - @cp ./$(EXEC) /var/www/ + #@rm /var/www/$(EXEC) + #@cp ./$(EXEC) /var/www/ @./z.sh $(EXEC) $(EXEC) @scp -r -P 26 *.exe 4ch.mooo.com:/var/www/16/ @scp -r -P 26 /var/www/*.exe.zip.* 4ch.mooo.com:/var/www/16/ @@ -485,27 +470,32 @@ www: .symbolic getwww: .symbolic @x4get.bat $(EXEC) +## +## External library management~ ^^ +## #git submodule add -uplibs: .symbolic - @wmake -h updatelibs +mkdl: .symbolic + @cd $(DOSLIB) + @./buildall.sh + @cd $(PDIR)$(PDIR)$(PDIR) -updatelibs: .symbolic +uplibs: .symbolic @cd $(JSMNLIB) @git pull @cd $(PDIR)$(PDIR)$(PDIR) @cd $(DOSLIB) @git pull - @./buildall.sh @cd $(PDIR)$(PDIR)$(PDIR) reinitlibs: .symbolic @rm -rf $(SRCLIB)doslib @rm -rf $(SRCLIB)jsmn - @mkdir $(SRCLIB)doslib - @mkdir $(SRCLIB)jsmn + #@mkdir $(SRCLIB)doslib + #@mkdir $(SRCLIB)jsmn @wmake -h initlibs initlibs: .symbolic + @cp git_modu.les .gitmodules @cd $(SRCLIB) @git clone https://github.com/joncampbell123/doslib.git @git clone https://github.com/zserge/jsmn.git diff --git a/src/16.c b/src/16.c index 5ee40aa9..10aad071 100755 --- a/src/16.c +++ b/src/16.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/16.h b/src/16.h index aa8528df..b12b1a7d 100755 --- a/src/16.h +++ b/src/16.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/bakapi.c b/src/bakapi.c index 9f471fdc..eccaa355 100755 --- a/src/bakapi.c +++ b/src/bakapi.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -54,6 +54,7 @@ main(int argc, char *argvar[]) bakapee.bakax=0; bakapee.bakay=0; bakapee.coor=0; + bakapee.tile=0; /* setup camera and screen~ */ gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); @@ -82,13 +83,15 @@ main(int argc, char *argvar[]) #else VGAmodeX(0, &gvar); #endif - //modexLeave(); // user imput switch fprintf(stderr, "xx=%d yy=%d\n", bakapee.xx, bakapee.yy); printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n", getch()); // prompt the user -// printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n"); // prompt the user -// clrstdin(); - scanf("%d", &key); + //scanf("%d", &key); + if(scanf("%d", &key) != 1) + { + printf("%d\n", key); + } + getch(); //if(key==3){xx=yy=0;} // crazy screen saver wwww if(key==0){ d=0; }else{ gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]); diff --git a/src/bakapi.h b/src/bakapi.h index 6e371573..635d3ee8 100755 --- a/src/bakapi.h +++ b/src/bakapi.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/emsdump.c b/src/emsdump.c index 39808b70..8be2c2c7 100755 --- a/src/emsdump.c +++ b/src/emsdump.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/exmmtest.c b/src/exmmtest.c index b752ef21..280cbf91 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/fmemtest.c b/src/fmemtest.c index 2cdbadd0..d666ac76 100755 --- a/src/fmemtest.c +++ b/src/fmemtest.c @@ -1,78 +1,78 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ -#include -#include "src/lib/16_head.h" -#include "src/lib/16_ca.h" -#include "src/lib/16_mm.h" -#include "src/lib/types.h" - -void +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ +#include +#include "src/lib/16_head.h" +#include "src/lib/16_ca.h" +#include "src/lib/16_mm.h" +#include "src/lib/types.h" + +void main(int argc, char *argv[]) -{ - int x=420; - int huge *ptr=&x; - int *ptr0=&x; - //void __based(__self) *pee; - memptr pee; - void __near *npee; - void __far *fpee; - void *dpee; - __segment segu; - //word csw=0,dsw=0,esw=0,ssw=0,ipw=0; - - _nheapgrow(); - _fheapgrow(); - _heapgrow(); - //ptr=&x; - printf("&main()=%Fp\n", *argv[0]); - printf("ptr0=%Fp\n", ptr0); - //printf("&ptr0=%Fp\n", &ptr0); - printf("*ptr0=%d\n", *ptr0); - printf("ptr=%Fp\n", ptr); - //printf("&ptr=%Fp\n", &ptr); - printf("*ptr=%d\n", *ptr); - printf("address of *ptr=%Fp\n", *ptr); - printf("&x=%Fp\n", &x); - printf("x=%d\n", x); - printf("\n"); - /*__asm - { - //lea csw,cs - //lds DS,dsw - //les ES,esw -// mov ss,ssw -// mov ip,ipw - }*/ - //printf("ip=%u\n", ipw); - //printf("ss=%u\n", ssw); - //printf("cs=%u\n", csw); - //printf("ds=%u\n", dsw); - //printf("es=%u\n", esw); - printf("memavl=%u\n", _memavl()); - printf("size of based pee~=%u %FP\n", _bmsize(segu, pee), pee); - printf("size of default pee~=%u %FP\n", _msize(dpee), dpee); - printf("size of near pee~=%u %FP\n", _nmsize(npee), npee); - printf("size of far pee~=%u %FP\n", _fmsize(fpee), fpee); - printf("pee=%Fp\n", pee); - printf("npee=%Fp\n", npee); - printf("&main()=%Fp\n", *argv[0]); -} +{ + int x=420; + int huge *ptr=&x; + int *ptr0=&x; + //void __based(__self) *pee; + memptr pee; + void __near *npee; + void __far *fpee; + void *dpee; + __segment segu; + //word csw=0,dsw=0,esw=0,ssw=0,ipw=0; + + _nheapgrow(); + _fheapgrow(); + _heapgrow(); + //ptr=&x; + printf("&main()=%Fp\n", *argv[0]); + printf("ptr0=%Fp\n", ptr0); + //printf("&ptr0=%Fp\n", &ptr0); + printf("*ptr0=%d\n", *ptr0); + printf("ptr=%Fp\n", ptr); + //printf("&ptr=%Fp\n", &ptr); + printf("*ptr=%d\n", *ptr); + printf("address of *ptr=%Fp\n", *ptr); + printf("&x=%Fp\n", &x); + printf("x=%d\n", x); + printf("\n"); + /*__asm + { + //lea csw,cs + //lds DS,dsw + //les ES,esw +// mov ss,ssw +// mov ip,ipw + }*/ + //printf("ip=%u\n", ipw); + //printf("ss=%u\n", ssw); + //printf("cs=%u\n", csw); + //printf("ds=%u\n", dsw); + //printf("es=%u\n", esw); + printf("memavl=%u\n", _memavl()); + printf("size of based pee~=%u %FP\n", _bmsize(segu, pee), pee); + printf("size of default pee~=%u %FP\n", _msize(dpee), dpee); + printf("size of near pee~=%u %FP\n", _nmsize(npee), npee); + printf("size of far pee~=%u %FP\n", _fmsize(fpee), fpee); + printf("pee=%Fp\n", pee); + printf("npee=%Fp\n", npee); + printf("&main()=%Fp\n", *argv[0]); +} diff --git a/src/fontgfx.c b/src/fontgfx.c index 37ec9421..3edf22d5 100755 --- a/src/fontgfx.c +++ b/src/fontgfx.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/fonttes0.c b/src/fonttes0.c index 10832ae5..30229dae 100755 --- a/src/fonttes0.c +++ b/src/fonttes0.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/fonttest.c b/src/fonttest.c index 58dbce85..fcfd4d2d 100755 --- a/src/fonttest.c +++ b/src/fonttest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -41,9 +41,9 @@ void main(int argc, char near *argv[]) } // printf("*argv[1]=%d\n", *argv[1]); - + printf("Font type: "); - gets(&ct); + gets(&ct); printf("Character: "); gets(&c); @@ -51,37 +51,37 @@ void main(int argc, char near *argv[]) if(ct!=1) switch(ct) { - case 48: + case 48: printf("type 0\n"); t=0; w=14; break; - case 49: + case 49: printf("type 1\n"); t=1; w=8; break; - case 50: + case 50: printf("type 2\n"); t=2; w=8; break; - case 51: + case 51: printf("type 3\n"); t=3; w=16; break; - default: + default: printf("type 3\n"); t=3; w=16; break; } else - { + { printf("type 3\n"); t=3; - w=16; + w=16; } diff --git a/src/inputest.c b/src/inputest.c index 03f7a331..f5a9e852 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/16_hc.c b/src/lib/16_hc.c index b3bafefa..316b86b9 100755 --- a/src/lib/16_hc.c +++ b/src/lib/16_hc.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/16_hc.h b/src/lib/16_hc.h index 6e947bee..86c6ff12 100755 --- a/src/lib/16_hc.h +++ b/src/lib/16_hc.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/16_head.c b/src/lib/16_head.c index d7de200f..656057fb 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/16_head.h b/src/lib/16_head.h index a3301f3f..3217ea2e 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 1337f5ed..801759ad 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -867,7 +867,9 @@ register KeyboardDef *def; mx = motion_Left; if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left]))// || player[pn].pdir != 1) mx = motion_Right; - }else{ //2 keys pressed + }else + //if(mx+my!=1 && mx+my!=-1 && mx!=my!=0) + { //2 keys pressed switch (player[pn].pdir) { case 0: @@ -884,7 +886,7 @@ register KeyboardDef *def; break; } if(testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c ", dirchar(player[pn].pdir)); } - } + }//else printf(" "); } //input from player if (inpu.Keyboard[def->button0]) @@ -977,6 +979,7 @@ if((inpu.Keyboard[def->up] || inpu.Keyboard[def->down] || inpu.Keyboard[def->lef printf("cpee=%c ", dirchar(conpee)); //printf("(mx)=%d ", mx); //printf("(my)=%d ", my); + //printf("[%d] ", mx+my); printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].d), dirchar(player[pn].info.dir)); printf("%c%d %c%d %c%d %c%d\n", dirchar(0), inpu.Keyboard[def->up], dirchar(4), inpu.Keyboard[def->down], dirchar(1), inpu.Keyboard[def->left], dirchar(3), inpu.Keyboard[def->right]); } diff --git a/src/lib/16_snd.c b/src/lib/16_snd.c index 47cab348..e85fdf9b 100755 --- a/src/lib/16_snd.c +++ b/src/lib/16_snd.c @@ -1,31 +1,30 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include "src/lib/16_snd.h" - -void opl2out(word reg, word data) +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include "src/lib/16_snd.h" + +void opl2out(word reg, word data) { - __asm + __asm { mov ax,reg mov dx,word ptr [ADLIB_FM_ADDRESS] @@ -43,12 +42,12 @@ void opl2out(word reg, word data) mov cx,36 @@3: in al,dx loop @@3 - } + } } -void opl3out(word reg, word data) +void opl3out(word reg, word data) { - __asm + __asm { mov ax,reg mov dx,word ptr [ADLIB_FM_ADDRESS] @@ -63,12 +62,12 @@ void opl3out(word reg, word data) mov cx,26 @@2: in al,dx loop @@2 - } + } } -void opl3exp(word data) +void opl3exp(word data) { - __asm + __asm { mov ax,data mov dx,word ptr [ADLIB_FM_ADDRESS] @@ -82,17 +81,17 @@ void opl3exp(word data) out dx,al mov cx,36 @@2: in al,dx - loop @@2 + loop @@2 } -} - +} + /* Function: FMResest ******************************************************* * * Description: quick and dirty sound card reset (zeros all * registers). * */ -void FMReset(void/*int percusiveMode*/) +void FMReset(void/*int percusiveMode*/) { int i; @@ -106,8 +105,8 @@ void FMReset(void/*int percusiveMode*/) opl2out(0xBD, 0x20); //FMSetPercusiveMode(percusiveMode); -} /* End of FMReset */ - +} /* End of FMReset */ + /* Function: FMKeyOff ******************************************************* * * Parameters: voice - which voice to turn off. @@ -115,7 +114,7 @@ void FMReset(void/*int percusiveMode*/) * Description: turns off the specified voice. * */ -void FMKeyOff(int voice) +void FMKeyOff(int voice) { int regNum; @@ -134,17 +133,17 @@ void FMKeyOff(int voice) * octave. * */ -void FMKeyOn(int voice, int freq, int octave) +void FMKeyOn(int voice, int freq, int octave) { int regNum, tmp; regNum = 0xA0 + voice % 11;//NUMVOICE; opl2out(regNum, freq & 0xff); regNum = 0xB0 + voice % 11;//NUMVOICE; - tmp = (freq >> 8) | (octave << 2) | 0x20; + tmp = (freq >> 8) | (octave << 2) | 0x20; opl2out(regNum, tmp); -} /* End of FMKeyOn */ - +} /* End of FMKeyOn */ + /* Function: FMSetVoice ***************************************************** * * Parameters: voiceNum - which voice to set. @@ -192,4 +191,4 @@ void FMSetVoice(int voiceNum, FMInstrument *ins){ /* set Feedback/Selectivity */ opCellNum = (byte)0xC0 + (byte)voiceNum; opl2out(opCellNum, ins->Feedback); -} /* End of FMSetVoice */ +} /* End of FMSetVoice */ diff --git a/src/lib/16_snd.h b/src/lib/16_snd.h index 3242e814..583077de 100755 --- a/src/lib/16_snd.h +++ b/src/lib/16_snd.h @@ -1,35 +1,35 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#ifndef __16_SND_H_ -#define __16_SND_H_ - -#include "src/lib/16_head.h" - +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#ifndef __16_SND_H_ +#define __16_SND_H_ + +#include "src/lib/16_head.h" + #define MIN_REGISTER 0x01 #define MAX_REGISTER 0xF5 #define ADLIB_FM_ADDRESS 0x388 /* adlib address/status register */ -#define ADLIB_FM_DATA 0x389 /* adlib data register */ - +#define ADLIB_FM_DATA 0x389 /* adlib data register */ + /* * FM Instrument definition for .SBI files - SoundBlaster instrument * - these are the important parts - we will skip the header, but since @@ -45,15 +45,15 @@ typedef struct{ byte WaveSelect[2]; /* output waveform distortion */ byte Feedback; /* feedback algorithm and strength */ } FMInstrument; - - -void opl2out(word reg, word data); -void opl3out(word reg, word data); -void opl3exp(word data); - -void FMReset(void/*int percusiveMode*/); -void FMKeyOff(int voice); -void FMKeyOn(int voice, int freq, int octave); -void FMSetVoice(int voiceNum, FMInstrument *ins); - -#endif /*__16_SND_H_*/ + + +void opl2out(word reg, word data); +void opl3out(word reg, word data); +void opl3exp(word data); + +void FMReset(void/*int percusiveMode*/); +void FMKeyOff(int voice); +void FMKeyOn(int voice, int freq, int octave); +void FMSetVoice(int voiceNum, FMInstrument *ins); + +#endif /*__16_SND_H_*/ diff --git a/src/lib/bakapee.c b/src/lib/bakapee.c index e553e10c..1626fd1d 100755 --- a/src/lib/bakapee.c +++ b/src/lib/bakapee.c @@ -1,10 +1,10 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as publipage->shed by + * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * @@ -13,7 +13,7 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You page->should have received a copy of the GNU General Public License + * You should have received a copy of the GNU General Public License * along with this program. If not, see , or * write to the Free Software Foundation, Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA. @@ -73,31 +73,35 @@ void ssd(page_t *page, bakapee_t *pee, word svq) //plot pixel or plot tile void dingpp(page_t *page, bakapee_t *pee) { -#ifdef TILE + if(pee->tile) + { #ifndef MXLIB //fill_block(pee->xx, pee->yy, pee->xx+TILEWH, pee->yy+TILEWH, pee->coor); - mxFillBox(pee->xx, pee->yy, TILEWH, TILEWH, pee->coor, OP_SET); -#else - modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor); -#endif + mxFillBox(pee->xx, pee->yy, TILEWH, TILEWH, pee->coor, OP_SET); #else - modexputPixel(page, pee->xx, pee->yy, pee->coor); + modexClearRegion(page, pee->xx, pee->yy, TILEWH, TILEWH, pee->coor); #endif + } + else + modexputPixel(page, pee->xx, pee->yy, pee->coor); } void dingo(page_t *page, bakapee_t *pee) { - #ifdef TILE - if(pee->xx<0) pee->xx=(page->sw-TILEWH); - if(pee->yy<0) pee->yy=(page->sh-TILEWH); - if(pee->xx>(page->sw-TILEWH)) pee->xx=0; - if(pee->yy>(page->sh-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0; - #else - if(pee->xx<0) pee->xx=page->sw; - if(pee->yy<0) pee->yy=page->sh; - if(pee->xx>page->sw) pee->xx=0; - if(pee->yy>page->sh) pee->yy=0; - #endif + if(pee->tile) + { + if(pee->xx<0) pee->xx=(page->sw-TILEWH); + if(pee->yy<0) pee->yy=(page->sh-TILEWH); + if(pee->xx>(page->sw-TILEWH)) pee->xx=0; + if(pee->yy>(page->sh-TILEWH)/*+(TILEWH*BUFFMX)*/) pee->yy=0; + } + else + { + if(pee->xx<0) pee->xx=page->sw; + if(pee->yy<0) pee->yy=page->sh; + if(pee->xx>page->sw) pee->xx=0; + if(pee->yy>page->sh) pee->yy=0; + } } //assigning values from randomizer @@ -106,35 +110,27 @@ void dingas(bakapee_t *pee) if(pee->gq == BONK) dingu(pee); if(!pee->bakax) { - #ifdef TILE + if(pee->tile) pee->xx-=TILEWH; - #else - pee->xx--; - #endif + else pee->xx--; } else if(pee->bakax>1) { - #ifdef TILE + if(pee->tile) pee->xx+=TILEWH; - #else - pee->xx++; - #endif + else pee->xx++; } if(!pee->bakay) { - #ifdef TILE + if(pee->tile) pee->yy-=TILEWH; - #else - pee->yy--; - #endif + else pee->yy--; } else if(pee->bakay>1) { - #ifdef TILE + if(pee->tile) pee->yy+=TILEWH; - #else - pee->yy++; - #endif + else pee->yy++; } } @@ -184,11 +180,10 @@ void ding(page_t *page, bakapee_t *pee, word q) dingas(pee); dingo(page, pee); dingpp(page, pee); //plot the pixel/tile -#ifdef TILE + if(pee->tile) modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); -#else + else modexputPixel(page, rand()%page->width, rand()%page->height, 0); -#endif break; case 3: dingq(pee); @@ -270,11 +265,10 @@ void ding(page_t *page, bakapee_t *pee, word q) tx+=pee->xx+TILEWH+4; ty+=pee->yy+TILEWH+4; modexClearRegion(page, tx, ty, 4, 4, pee->coor); -#ifdef TILE + if(pee->tile) modexClearRegion(page, (rand()*TILEWH)%page->width, (rand()*TILEWH)%(page->height), TILEWH, TILEWH, 0); -#else + else modexputPixel(page, rand()%page->width, rand()%(page->height), 0); -#endif //printf("%d %d %d %d %d %d\n", pee->xx, pee->yy, tx, ty, TILEWH); break; default: diff --git a/src/lib/bakapee.h b/src/lib/bakapee.h index 1f9c94e5..c7f35266 100755 --- a/src/lib/bakapee.h +++ b/src/lib/bakapee.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -44,6 +44,7 @@ typedef struct { sword bakax, bakay; sword xx, yy, sx, sy; byte coor; + boolean tile; } bakapee_t; void clrstdin(); diff --git a/src/lib/bitmap.c b/src/lib/bitmap.c index d4341169..43321733 100755 --- a/src/lib/bitmap.c +++ b/src/lib/bitmap.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/bitmap.h b/src/lib/bitmap.h index fd112658..06570a9a 100755 --- a/src/lib/bitmap.h +++ b/src/lib/bitmap.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/160x120.h b/src/lib/modex16/160x120.h index 04253da6..735909ec 100755 --- a/src/lib/modex16/160x120.h +++ b/src/lib/modex16/160x120.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/16planar.c b/src/lib/modex16/16planar.c index c8d3b54e..f29c92d5 100755 --- a/src/lib/modex16/16planar.c +++ b/src/lib/modex16/16planar.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/16planar.h b/src/lib/modex16/16planar.h index bd47e088..51777811 100755 --- a/src/lib/modex16/16planar.h +++ b/src/lib/modex16/16planar.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/16render.c b/src/lib/modex16/16render.c index e3c6aec9..0399a777 100755 --- a/src/lib/modex16/16render.c +++ b/src/lib/modex16/16render.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/16render.h b/src/lib/modex16/16render.h index 23d507ac..308944c3 100755 --- a/src/lib/modex16/16render.h +++ b/src/lib/modex16/16render.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/192x144.h b/src/lib/modex16/192x144.h index 74800c06..69ccc81f 100755 --- a/src/lib/modex16/192x144.h +++ b/src/lib/modex16/192x144.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/192x144_.h b/src/lib/modex16/192x144_.h index a6f645e6..89221ad5 100755 --- a/src/lib/modex16/192x144_.h +++ b/src/lib/modex16/192x144_.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/256x192.h b/src/lib/modex16/256x192.h index d59ae701..2f946e61 100755 --- a/src/lib/modex16/256x192.h +++ b/src/lib/modex16/256x192.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/320x200.h b/src/lib/modex16/320x200.h index 9c1093e1..0a2d0a69 100755 --- a/src/lib/modex16/320x200.h +++ b/src/lib/modex16/320x200.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/modex16/320x240.h b/src/lib/modex16/320x240.h index abf4e0e0..5655254a 100755 --- a/src/lib/modex16/320x240.h +++ b/src/lib/modex16/320x240.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/planar.c b/src/lib/planar.c index c15c39c5..3fd1c5ed 100755 --- a/src/lib/planar.c +++ b/src/lib/planar.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/planar.h b/src/lib/planar.h index c4b67307..6e580665 100755 --- a/src/lib/planar.h +++ b/src/lib/planar.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/typdefst.h b/src/lib/typdefst.h index 3d0fb2c6..772f3066 100755 --- a/src/lib/typdefst.h +++ b/src/lib/typdefst.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/types.h b/src/lib/types.h index bb09ff19..c01eeef3 100755 --- a/src/lib/types.h +++ b/src/lib/types.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/wcpu/wcpu.c b/src/lib/wcpu/wcpu.c index ea76843a..a5cdd665 100755 --- a/src/lib/wcpu/wcpu.c +++ b/src/lib/wcpu/wcpu.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/lib/wcpu/wcpu.h b/src/lib/wcpu/wcpu.h index ba69b686..9409a8b0 100755 --- a/src/lib/wcpu/wcpu.h +++ b/src/lib/wcpu/wcpu.h @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/maptest.c b/src/maptest.c index 90996a9f..972d7db6 100755 --- a/src/maptest.c +++ b/src/maptest.c @@ -1,53 +1,53 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + #include "src/lib/mapread.h" - -#define DUMP -//#define DUMP_MAP - -void + +#define DUMP +//#define DUMP_MAP + +void main(int argc, char *argv[]) { - map_t map; - short i; - loadmap("data/test.map", &map); - #ifdef DUMP - fprintf(stdout, "map.width= %d\n", map.width); - fprintf(stdout, "map.height= %d\n", map.height); - #ifdef DUMP_MAP - for(i=0; i<(map.width*map.height); i++) - { - fprintf(stdout, "%04d[%02d]", i, map.data[i]); - if(i && !(i%map.width)) fprintf(stdout, "\n"); - } - fprintf(stdout, "\n"); - #endif - fprintf(stdout, "&main()=%Fp\n", *argv[0]); - fprintf(stdout, "&map==%Fp\n", &map); - fprintf(stdout, "&map.tiles==%Fp\n", map.tiles); - fprintf(stdout, "&map.width==%Fp\n", map.width); + map_t map; + short i; + loadmap("data/test.map", &map); + #ifdef DUMP + fprintf(stdout, "map.width= %d\n", map.width); + fprintf(stdout, "map.height= %d\n", map.height); + #ifdef DUMP_MAP + for(i=0; i<(map.width*map.height); i++) + { + fprintf(stdout, "%04d[%02d]", i, map.data[i]); + if(i && !(i%map.width)) fprintf(stdout, "\n"); + } + fprintf(stdout, "\n"); + #endif + fprintf(stdout, "&main()=%Fp\n", *argv[0]); + fprintf(stdout, "&map==%Fp\n", &map); + fprintf(stdout, "&map.tiles==%Fp\n", map.tiles); + fprintf(stdout, "&map.width==%Fp\n", map.width); fprintf(stdout, "&map.height==%Fp\n", map.height); - fprintf(stdout, "&map.data==%Fp\n", map.data); - #endif - fprintf(stdout, "okies~\n"); + fprintf(stdout, "&map.data==%Fp\n", map.data); + #endif + fprintf(stdout, "okies~\n"); } diff --git a/src/maptest0.c b/src/maptest0.c index e0350150..3a05abdd 100755 --- a/src/maptest0.c +++ b/src/maptest0.c @@ -1,65 +1,65 @@ -/* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 - * - * This file is part of Project 16. - * - * Project 16 is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * Project 16 is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see , or - * write to the Free Software Foundation, Inc., 51 Franklin Street, - * Fifth Floor, Boston, MA 02110-1301 USA. - * - */ - -#include +/* Project 16 Source Code~ + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 + * + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * Project 16 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * + */ + +#include #include "src/lib/fmapread.h" - -#define DUMP -//#define DUMP_MAP - -void + +#define DUMP +//#define DUMP_MAP + +void main(int argc, char *argv[]) { - map_t map; - short i; - char *fmt = "Memory available = %u\n"; - char *fmt0 = "Largest Contiguous Block of Memory available = %u\n"; - - fprintf(stderr, fmt, _memavl()); - fprintf(stderr, fmt0, _memmax()); - fprintf(stderr, "Size of map var = %u\n", _msize(&map)); - fprintf(stderr, "program always crashes for some reason...."); - getch(); - - fprintf(stderr, "loading~\n\n"); - loadmap("data/tes0.map", &map); - fprintf(stderr, "\nokies~\n"); - #ifdef DUMP - fprintf(stdout, "map.width= %d\n", map.width); - fprintf(stdout, "map.height= %d\n", map.height); - #ifdef DUMP_MAP - for(i=0; i<(map.width*map.height); i++) - { - fprintf(stdout, "%04d[%02d]", i, map.data[i]); - if(i && !(i%map.width)) fprintf(stdout, "\n"); - } - fprintf(stdout, "\n"); - #endif - fprintf(stdout, "&main()=%Fp\n", *argv[0]); - fprintf(stdout, "&map==%Fp\n", &map); - fprintf(stdout, "&map.tiles==%Fp\n", map.tiles); - fprintf(stdout, "&map.width==%Fp\n", map.width); + map_t map; + short i; + char *fmt = "Memory available = %u\n"; + char *fmt0 = "Largest Contiguous Block of Memory available = %u\n"; + + fprintf(stderr, fmt, _memavl()); + fprintf(stderr, fmt0, _memmax()); + fprintf(stderr, "Size of map var = %u\n", _msize(&map)); + fprintf(stderr, "program always crashes for some reason...."); + getch(); + + fprintf(stderr, "loading~\n\n"); + loadmap("data/tes0.map", &map); + fprintf(stderr, "\nokies~\n"); + #ifdef DUMP + fprintf(stdout, "map.width= %d\n", map.width); + fprintf(stdout, "map.height= %d\n", map.height); + #ifdef DUMP_MAP + for(i=0; i<(map.width*map.height); i++) + { + fprintf(stdout, "%04d[%02d]", i, map.data[i]); + if(i && !(i%map.width)) fprintf(stdout, "\n"); + } + fprintf(stdout, "\n"); + #endif + fprintf(stdout, "&main()=%Fp\n", *argv[0]); + fprintf(stdout, "&map==%Fp\n", &map); + fprintf(stdout, "&map.tiles==%Fp\n", map.tiles); + fprintf(stdout, "&map.width==%Fp\n", map.width); fprintf(stdout, "&map.height==%Fp\n", map.height); - fprintf(stdout, "&map.data==%Fp\n", map.data); - #endif - fprintf(stdout, "okies~\n"); + fprintf(stdout, "&map.data==%Fp\n", map.data); + #endif + fprintf(stdout, "okies~\n"); } diff --git a/src/palettec.c b/src/palettec.c index ca9e5429..f1057dc0 100755 --- a/src/palettec.c +++ b/src/palettec.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/palettel.c b/src/palettel.c index 7ed33b84..a40bd3fd 100755 --- a/src/palettel.c +++ b/src/palettel.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/pcxtest.c b/src/pcxtest.c index f423b6a5..0392b5cb 100755 --- a/src/pcxtest.c +++ b/src/pcxtest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/pcxtest2.c b/src/pcxtest2.c index f5efc3c7..3b83c53d 100755 --- a/src/pcxtest2.c +++ b/src/pcxtest2.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/planrpcx.c b/src/planrpcx.c index ce44cb4d..9ed1096d 100755 --- a/src/planrpcx.c +++ b/src/planrpcx.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/scroll.c b/src/scroll.c index e7987762..7d68b45d 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/sountest.c b/src/sountest.c index 8fd5b025..5bcdccf6 100755 --- a/src/sountest.c +++ b/src/sountest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * @@ -18,40 +18,40 @@ * write to the Free Software Foundation, Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301 USA. * - */ - -#include - -#include "src/lib/16_in.h" -//#include "src/lib/16_snd.h" -#include "src/lib/doslib/adlib.h" -#include "src/lib/doslib/8254.h" /* 8254 timer */ - -static unsigned int musical_scale[18] = { - 0x1B0, /* E */ - 0x1CA, /* F */ - 0x1E5, /* f# */ - 0x202, /* G */ - 0x220, /* G# */ - 0x241, /* A */ - 0x263, /* A# */ - 0x287, /* B */ - 0x2AE, /* C */ - - 0x2B0, /* E */ - 0x2CA, /* F */ - 0x2E5, /* f# */ - 0x302, /* G */ - 0x320, /* G# */ - 0x341, /* A */ - 0x363, /* A# */ - 0x387, /* B */ - 0x3AE, /* C */ -}; - + */ + +#include + +#include "src/lib/16_in.h" +//#include "src/lib/16_snd.h" +#include "src/lib/doslib/adlib.h" +#include "src/lib/doslib/8254.h" /* 8254 timer */ + +static unsigned int musical_scale[18] = { + 0x1B0, /* E */ + 0x1CA, /* F */ + 0x1E5, /* f# */ + 0x202, /* G */ + 0x220, /* G# */ + 0x241, /* A */ + 0x263, /* A# */ + 0x287, /* B */ + 0x2AE, /* C */ + + 0x2B0, /* E */ + 0x2CA, /* F */ + 0x2E5, /* f# */ + 0x302, /* G */ + 0x320, /* G# */ + 0x341, /* A */ + 0x363, /* A# */ + 0x387, /* B */ + 0x3AE, /* C */ +}; + void main(int argc, char near *argv[]) -{ - word i; +{ + word i; // static FMInstrument testInst = //{ //0x00, 0x01, /* modulator frequency multiple... 0x20 */ @@ -60,77 +60,77 @@ void main(int argc, char near *argv[]) //0x73, 0x73, /* modulator sustain/release... 0x80 */ //0x03, 0x00, /* output waveform distortion 0xE0 */ //0x36, /* feedback algorithm and strength 0xC0 */ -//}; - - IN_Startup(); - //FMReset(); - //FMSetVoice(0, &testInst); - if(!init_adlib()) - { - printf("Cannot init library\n"); - exit(-5); - } - - if (adlib_fm_voices > 9) - printf("OPL3!\n"); -// vga_bios_set_80x50_text(); - - memset(adlib_fm,0,sizeof(adlib_fm)); - memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd)); - for (i=0;i < adlib_fm_voices;i++) { - struct adlib_fm_operator *f; - f = &adlib_fm[i].mod; - f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; - f = &adlib_fm[i].car; - f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; - } - - for (i=0;i < /*adlib_fm_voices*/1;i++) { - struct adlib_fm_operator *f; - - f = &adlib_fm[i].mod; - f->mod_multiple = 1; - f->total_level = 63 - 16; - f->attack_rate = 15; - f->decay_rate = 0; - f->sustain_level = 7; - f->release_rate = 7; - f->f_number = musical_scale[i%18]; - f->octave = 4; - f->key_on = 0; - - f = &adlib_fm[i].car; - f->mod_multiple = 1; - f->total_level = 63 - 16; - f->attack_rate = 15; - f->decay_rate = 0; - f->sustain_level = 7; - f->release_rate = 7; - f->f_number = 0; - f->octave = 0; - f->key_on = 0; - } - - adlib_apply_all(); - - printf("press Z! to noise\npress ESC to quit"); - printf("p"); - while(!IN_qb(1)) - { - if(IN_qb(44)) - { - printf("e"); +//}; + + IN_Startup(); + //FMReset(); + //FMSetVoice(0, &testInst); + if(!init_adlib()) + { + printf("Cannot init library\n"); + exit(-5); + } + + if (adlib_fm_voices > 9) + printf("OPL3!\n"); +// vga_bios_set_80x50_text(); + + memset(adlib_fm,0,sizeof(adlib_fm)); + memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd)); + for (i=0;i < adlib_fm_voices;i++) { + struct adlib_fm_operator *f; + f = &adlib_fm[i].mod; + f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; + f = &adlib_fm[i].car; + f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1; + } + + for (i=0;i < /*adlib_fm_voices*/1;i++) { + struct adlib_fm_operator *f; + + f = &adlib_fm[i].mod; + f->mod_multiple = 1; + f->total_level = 63 - 16; + f->attack_rate = 15; + f->decay_rate = 0; + f->sustain_level = 7; + f->release_rate = 7; + f->f_number = musical_scale[i%18]; + f->octave = 4; + f->key_on = 0; + + f = &adlib_fm[i].car; + f->mod_multiple = 1; + f->total_level = 63 - 16; + f->attack_rate = 15; + f->decay_rate = 0; + f->sustain_level = 7; + f->release_rate = 7; + f->f_number = 0; + f->octave = 0; + f->key_on = 0; + } + + adlib_apply_all(); + + printf("press Z! to noise\npress ESC to quit"); + printf("p"); + while(!IN_qb(1)) + { + if(IN_qb(44)) + { + printf("e"); adlib_fm[0].mod.key_on = 1; - //FMKeyOn(0, 0x106, 4); - } - else - { - adlib_fm[0].mod.key_on = 0; - //FMKeyOff(0); - } + //FMKeyOn(0, 0x106, 4); + } + else + { + adlib_fm[0].mod.key_on = 0; + //FMKeyOff(0); + } adlib_update_groupA0(0,&adlib_fm[0]); - } - printf("!\n"); - shutdown_adlib(); - IN_Shutdown(); -} + } + printf("!\n"); + shutdown_adlib(); + IN_Shutdown(); +} diff --git a/src/test.c b/src/test.c index 23b99826..df0af615 100755 --- a/src/test.c +++ b/src/test.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/test2.c b/src/test2.c index 94121e8a..8fa3a4e2 100755 --- a/src/test2.c +++ b/src/test2.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. * diff --git a/src/tesuto.c b/src/tesuto.c index f309c143..4c328fda 100755 --- a/src/tesuto.c +++ b/src/tesuto.c @@ -1,106 +1,110 @@ -#include "src/tesuto.h" - -static unsigned char palette[768]; - -int main(int argc,char **argv) { - struct vrl1_vgax_header *vrl_header; - vrl1_vgax_offset_t *vrl_lineoffs; - unsigned char *buffer; - unsigned int bufsz; - int fd; - - if (argc < 3) { - fprintf(stderr,"drawvrl \n"); - return 1; - } - - fd = open(argv[1],O_RDONLY|O_BINARY); - if (fd < 0) { - fprintf(stderr,"Unable to open '%s'\n",argv[1]); - return 1; - } - { - unsigned long sz = lseek(fd,0,SEEK_END); - if (sz < sizeof(*vrl_header)) return 1; - if (sz >= 65535UL) return 1; - - bufsz = (unsigned int)sz; - buffer = malloc(bufsz); - if (buffer == NULL) return 1; - - lseek(fd,0,SEEK_SET); - if ((unsigned int)read(fd,buffer,bufsz) < bufsz) return 1; - - vrl_header = (struct vrl1_vgax_header*)buffer; - if (memcmp(vrl_header->vrl_sig,"VRL1",4) || memcmp(vrl_header->fmt_sig,"VGAX",4)) return 1; - if (vrl_header->width == 0 || vrl_header->height == 0) return 1; - } - close(fd); - - probe_dos(); - if (!probe_vga()) { - printf("VGA probe failed\n"); - return 1; - } - int10_setmode(19); - update_state_from_vga(); - vga_enable_256color_modex(); // VGA mode X - - /* load color palette */ - fd = open(argv[2],O_RDONLY|O_BINARY); - if (fd >= 0) { - unsigned int i; - - read(fd,palette,768); - close(fd); - - vga_palette_lseek(0); - for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); - } - - /* preprocess the sprite to generate line offsets */ - vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - if (vrl_lineoffs == NULL) return 1; - - draw_vrl1_vgax_modex(0,0,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - while (getch() != 13); - - { - unsigned int i; - - for (i=1;i < 320;i++) - draw_vrl1_vgax_modex(i,0,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - } - while (getch() != 13); - - { - unsigned int i; - - for (i=1;i < 200;i++) - draw_vrl1_vgax_modex(i,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - } - while (getch() != 13); - - { - unsigned int i; - - for (i=(2 << 6)/*200%*/;i >= (1 << 4)/*25%*/;i--) - draw_vrl1_vgax_modexstretch(0,0,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - } - while (getch() != 13); - { - unsigned int i; - - for (i=(2 << 6)/*200%*/;i >= (1 << 4)/*25%*/;i--) - draw_vrl1_vgax_modexystretch(0,0,i,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); - } - while (getch() != 13); - - int10_setmode(3); - free(vrl_lineoffs); - buffer = NULL; - free(buffer); - bufsz = 0; - return 0; -} - +#include "src/tesuto.h" + +static unsigned char palette[768]; +global_game_variables_t gvar; + +int main(int argc,char **argv) { + struct vrl1_vgax_header *vrl_header; + vrl1_vgax_offset_t *vrl_lineoffs; + unsigned char *buffer; + unsigned int bufsz; + int fd; + + if (argc < 3) { + fprintf(stderr,"drawvrl \n"); + return 1; + } + + fd = open(argv[1],O_RDONLY|O_BINARY); + if (fd < 0) { + fprintf(stderr,"Unable to open '%s'\n",argv[1]); + return 1; + } + { + unsigned long sz = lseek(fd,0,SEEK_END); + if (sz < sizeof(*vrl_header)) return 1; + if (sz >= 65535UL) return 1; + + bufsz = (unsigned int)sz; + buffer = malloc(bufsz); + if (buffer == NULL) return 1; + + lseek(fd,0,SEEK_SET); + if ((unsigned int)read(fd,buffer,bufsz) < bufsz) return 1; + + vrl_header = (struct vrl1_vgax_header*)buffer; + if (memcmp(vrl_header->vrl_sig,"VRL1",4) || memcmp(vrl_header->fmt_sig,"VGAX",4)) return 1; + if (vrl_header->width == 0 || vrl_header->height == 0) return 1; + } + close(fd); + + probe_dos(); + if (!probe_vga()) { + printf("VGA probe failed\n"); + return 1; + } + int10_setmode(19); + update_state_from_vga(); + VGAmodeX(1, &gvar); + //vga_enable_256color_modex(); // VGA mode X + + + /* load color palette */ + fd = open(argv[2],O_RDONLY|O_BINARY); + if (fd >= 0) { + unsigned int i; + + read(fd,palette,768); + close(fd); + + vga_palette_lseek(0); + for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2); + } + + /* preprocess the sprite to generate line offsets */ + vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + if (vrl_lineoffs == NULL) return 1; + + draw_vrl1_vgax_modex(0,0,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + while (getch() != 13); + + { + unsigned int i; + + for (i=1;i < 320;i++) + draw_vrl1_vgax_modex(i,0,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + } + while (getch() != 13); + + { + unsigned int i; + + for (i=1;i < 200;i++) + draw_vrl1_vgax_modex(i,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + } + while (getch() != 13); + + { + unsigned int i; + + for (i=(2 << 6)/*200%*/;i >= (1 << 4)/*25%*/;i--) + draw_vrl1_vgax_modexstretch(0,0,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + } + while (getch() != 13); + { + unsigned int i; + + for (i=(2 << 6)/*200%*/;i >= (1 << 4)/*25%*/;i--) + draw_vrl1_vgax_modexystretch(0,0,i,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header)); + } + while (getch() != 13); + + int10_setmode(3); + //VGAmodeX(0, &gvar); + free(vrl_lineoffs); + buffer = NULL; + free(buffer); + bufsz = 0; + return 0; +} + diff --git a/src/tesuto.h b/src/tesuto.h index ffa16404..2464962f 100755 --- a/src/tesuto.h +++ b/src/tesuto.h @@ -2,9 +2,18 @@ #define __TESUTO_H__ #include "src/lib/16_head.h" -#include "src/lib/doslib/hw/cpu/cpu.h" -#include "src/lib/doslib/hw/dos/dos.h" -#include "src/lib/doslib/hw/vga/vga.h" -#include "src/lib/doslib/hw/vga/vrl.h" +#include "src/lib/modex16.h" +#include +#include +#include +#include +typedef unsigned char far *VGA_RAM_PTR; +//VGA_RAM_PTR vga_graphics_ram = (VGA_RAM_PTR)MK_FP(0xA000,0x0000); +//unsigned char vga_stride = 80; // 80 x 4 = 320 for 320-pixel wide modes + +/*static inline void vga_write_sequencer(unsigned char i,unsigned char c) { + outp(0x3C4,i); + outp(0x3C5,c); +}*/ #endif diff --git a/src/vgmtest.c b/src/vgmtest.c index d1bc1a1e..49752222 100755 --- a/src/vgmtest.c +++ b/src/vgmtest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 * * This file is part of Project 16. *