/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * 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\r
*\r
* This file is part of Project 16.\r
*\r
/* 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.
*
/* 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.
*
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * 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\r
*\r
* This file is part of Project 16.\r
*\r
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)
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
#
# 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)
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
@$(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
@$(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)
@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/
getwww: .symbolic
@x4get.bat $(EXEC)
+##
+## External library management~ ^^
+##
#git submodule add <repo>
-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
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* 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.
*
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]);
#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]);
/* 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 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 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
-/* 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 <http://www.gnu.org/licenses/>, or
- * write to the Free Software Foundation, Inc., 51 Franklin Street,
- * Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-#include <stdio.h>
-#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~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+#include <stdio.h>\r
+#include "src/lib/16_head.h"\r
+#include "src/lib/16_ca.h"\r
+#include "src/lib/16_mm.h"\r
+#include "src/lib/types.h"\r
+\r
+void\r
main(int argc, char *argv[])\r
-{
- 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]);
-}
+{\r
+ int x=420;\r
+ int huge *ptr=&x;\r
+ int *ptr0=&x;\r
+ //void __based(__self) *pee;\r
+ memptr pee;\r
+ void __near *npee;\r
+ void __far *fpee;\r
+ void *dpee;\r
+ __segment segu;\r
+ //word csw=0,dsw=0,esw=0,ssw=0,ipw=0;\r
+\r
+ _nheapgrow();\r
+ _fheapgrow();\r
+ _heapgrow();\r
+ //ptr=&x;\r
+ printf("&main()=%Fp\n", *argv[0]);\r
+ printf("ptr0=%Fp\n", ptr0);\r
+ //printf("&ptr0=%Fp\n", &ptr0);\r
+ printf("*ptr0=%d\n", *ptr0);\r
+ printf("ptr=%Fp\n", ptr);\r
+ //printf("&ptr=%Fp\n", &ptr);\r
+ printf("*ptr=%d\n", *ptr);\r
+ printf("address of *ptr=%Fp\n", *ptr);\r
+ printf("&x=%Fp\n", &x);\r
+ printf("x=%d\n", x);\r
+ printf("\n");\r
+ /*__asm\r
+ {\r
+ //lea csw,cs\r
+ //lds DS,dsw\r
+ //les ES,esw\r
+// mov ss,ssw\r
+// mov ip,ipw\r
+ }*/\r
+ //printf("ip=%u\n", ipw);\r
+ //printf("ss=%u\n", ssw);\r
+ //printf("cs=%u\n", csw);\r
+ //printf("ds=%u\n", dsw);\r
+ //printf("es=%u\n", esw);\r
+ printf("memavl=%u\n", _memavl());\r
+ printf("size of based pee~=%u %FP\n", _bmsize(segu, pee), pee);\r
+ printf("size of default pee~=%u %FP\n", _msize(dpee), dpee);\r
+ printf("size of near pee~=%u %FP\n", _nmsize(npee), npee);\r
+ printf("size of far pee~=%u %FP\n", _fmsize(fpee), fpee);\r
+ printf("pee=%Fp\n", pee);\r
+ printf("npee=%Fp\n", npee);\r
+ printf("&main()=%Fp\n", *argv[0]);\r
+}\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
}\r
\r
// printf("*argv[1]=%d\n", *argv[1]);\r
-
+\r
printf("Font type: ");\r
- gets(&ct);
+ gets(&ct);\r
\r
printf("Character: ");\r
gets(&c);\r
if(ct!=1)\r
switch(ct)\r
{\r
- case 48:
+ case 48:\r
printf("type 0\n");\r
t=0;\r
w=14;\r
break;\r
- case 49:
+ case 49:\r
printf("type 1\n");\r
t=1;\r
w=8;\r
break;\r
- case 50:
+ case 50:\r
printf("type 2\n");\r
t=2;\r
w=8;\r
break;\r
- case 51:
+ case 51:\r
printf("type 3\n");\r
t=3;\r
w=16;\r
break;\r
- default:
+ default:\r
printf("type 3\n");\r
t=3;\r
w=16;\r
break;\r
}\r
else\r
- {
+ {\r
printf("type 3\n");\r
t=3;\r
- w=16; \r
+ w=16;\r
}\r
\r
\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* 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 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 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
mx = motion_Left;\r
if((inpu.Keyboard[def->right] && !inpu.Keyboard[def->left]))// || player[pn].pdir != 1)\r
mx = motion_Right;\r
- }else{ //2 keys pressed\r
+ }else\r
+ //if(mx+my!=1 && mx+my!=-1 && mx!=my!=0)\r
+ { //2 keys pressed\r
switch (player[pn].pdir)\r
{\r
case 0:\r
break;\r
}\r
if(testcontrolnoisy > 0){ printf("dir=%c ", dirchar(dir)); printf("pdir=%c ", dirchar(player[pn].pdir)); }\r
- }\r
+ }//else printf(" ");\r
}\r
//input from player\r
if (inpu.Keyboard[def->button0])\r
printf("cpee=%c ", dirchar(conpee));\r
//printf("(mx)=%d ", mx);\r
//printf("(my)=%d ", my);\r
+ //printf("[%d] ", mx+my);\r
printf("pdir=%c d=%c dir=%c ", dirchar(player[pn].pdir), dirchar(player[pn].d), dirchar(player[pn].info.dir));\r
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]);\r
}\r
-/* 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 <http://www.gnu.org/licenses/>, 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~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
+#include "src/lib/16_snd.h"\r
+\r
+void opl2out(word reg, word data)\r
{\r
- __asm
+ __asm\r
{\r
mov ax,reg\r
mov dx,word ptr [ADLIB_FM_ADDRESS]\r
mov cx,36\r
@@3: in al,dx\r
loop @@3\r
- }
+ }\r
}\r
\r
-void opl3out(word reg, word data)
+void opl3out(word reg, word data)\r
{\r
- __asm
+ __asm\r
{\r
mov ax,reg\r
mov dx,word ptr [ADLIB_FM_ADDRESS]\r
mov cx,26\r
@@2: in al,dx\r
loop @@2\r
- }
+ }\r
}\r
\r
-void opl3exp(word data)
+void opl3exp(word data)\r
{\r
- __asm
+ __asm\r
{\r
mov ax,data\r
mov dx,word ptr [ADLIB_FM_ADDRESS]\r
out dx,al\r
mov cx,36\r
@@2: in al,dx\r
- loop @@2
+ loop @@2\r
}\r
-}
-
+}\r
+\r
/* Function: FMResest *******************************************************\r
*\r
* Description: quick and dirty sound card reset (zeros all\r
* registers).\r
*\r
*/\r
-void FMReset(void/*int percusiveMode*/)
+void FMReset(void/*int percusiveMode*/)\r
{\r
int i;\r
\r
opl2out(0xBD, 0x20);\r
\r
//FMSetPercusiveMode(percusiveMode);\r
-} /* End of FMReset */
-
+} /* End of FMReset */\r
+\r
/* Function: FMKeyOff *******************************************************\r
*\r
* Parameters: voice - which voice to turn off.\r
* Description: turns off the specified voice.\r
*\r
*/\r
-void FMKeyOff(int voice)
+void FMKeyOff(int voice)\r
{\r
int regNum;\r
\r
* octave.\r
*\r
*/\r
-void FMKeyOn(int voice, int freq, int octave)
+void FMKeyOn(int voice, int freq, int octave)\r
{\r
int regNum, tmp;\r
\r
regNum = 0xA0 + voice % 11;//NUMVOICE;\r
opl2out(regNum, freq & 0xff);\r
regNum = 0xB0 + voice % 11;//NUMVOICE;\r
- tmp = (freq >> 8) | (octave << 2) | 0x20;
+ tmp = (freq >> 8) | (octave << 2) | 0x20;\r
opl2out(regNum, tmp);\r
-} /* End of FMKeyOn */
-
+} /* End of FMKeyOn */\r
+\r
/* Function: FMSetVoice *****************************************************\r
*\r
* Parameters: voiceNum - which voice to set.\r
/* set Feedback/Selectivity */\r
opCellNum = (byte)0xC0 + (byte)voiceNum;\r
opl2out(opCellNum, ins->Feedback);\r
-} /* End of FMSetVoice */
+} /* End of FMSetVoice */\r
-/* 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 <http://www.gnu.org/licenses/>, 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~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
+#ifndef __16_SND_H_\r
+#define __16_SND_H_\r
+\r
+#include "src/lib/16_head.h"\r
+\r
#define MIN_REGISTER 0x01\r
#define MAX_REGISTER 0xF5\r
#define ADLIB_FM_ADDRESS 0x388 /* adlib address/status register */\r
-#define ADLIB_FM_DATA 0x389 /* adlib data register */
-
+#define ADLIB_FM_DATA 0x389 /* adlib data register */\r
+\r
/*\r
* FM Instrument definition for .SBI files - SoundBlaster instrument\r
* - these are the important parts - we will skip the header, but since\r
byte WaveSelect[2]; /* output waveform distortion */\r
byte Feedback; /* feedback algorithm and strength */\r
} FMInstrument;\r
-
-
-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_*/
+\r
+\r
+void opl2out(word reg, word data);\r
+void opl3out(word reg, word data);\r
+void opl3exp(word data);\r
+\r
+void FMReset(void/*int percusiveMode*/);\r
+void FMKeyOff(int voice);\r
+void FMKeyOn(int voice, int freq, int octave);\r
+void FMSetVoice(int voiceNum, FMInstrument *ins);\r
+\r
+#endif /*__16_SND_H_*/\r
/* 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.
*
* 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 <http://www.gnu.org/licenses/>, or
* write to the Free Software Foundation, Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA.
//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
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++;
}
}
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);
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:
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
sword bakax, bakay;\r
sword xx, yy, sx, sy;\r
byte coor;\r
+ boolean tile;\r
} bakapee_t;\r
\r
void clrstdin();\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* 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 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* 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 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 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 <http://www.gnu.org/licenses/>, or
- * write to the Free Software Foundation, Inc., 51 Franklin Street,
- * Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
#include "src/lib/mapread.h"\r
-
-#define DUMP
-//#define DUMP_MAP
-
-void
+\r
+#define DUMP\r
+//#define DUMP_MAP\r
+\r
+void\r
main(int argc, char *argv[])\r
{\r
- 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;\r
+ short i;\r
+ loadmap("data/test.map", &map);\r
+ #ifdef DUMP\r
+ fprintf(stdout, "map.width= %d\n", map.width);\r
+ fprintf(stdout, "map.height= %d\n", map.height);\r
+ #ifdef DUMP_MAP\r
+ for(i=0; i<(map.width*map.height); i++)\r
+ {\r
+ fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
+ if(i && !(i%map.width)) fprintf(stdout, "\n");\r
+ }\r
+ fprintf(stdout, "\n");\r
+ #endif\r
+ fprintf(stdout, "&main()=%Fp\n", *argv[0]);\r
+ fprintf(stdout, "&map==%Fp\n", &map);\r
+ fprintf(stdout, "&map.tiles==%Fp\n", map.tiles);\r
+ fprintf(stdout, "&map.width==%Fp\n", map.width);\r
fprintf(stdout, "&map.height==%Fp\n", map.height);\r
- fprintf(stdout, "&map.data==%Fp\n", map.data);
- #endif
- fprintf(stdout, "okies~\n");
+ fprintf(stdout, "&map.data==%Fp\n", map.data);\r
+ #endif\r
+ fprintf(stdout, "okies~\n");\r
}\r
-/* 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 <http://www.gnu.org/licenses/>, or
- * write to the Free Software Foundation, Inc., 51 Franklin Street,
- * Fifth Floor, Boston, MA 02110-1301 USA.
- *
- */
-
-#include <conio.h>
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
+ *\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 3 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Project 16 is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program. If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
+ */\r
+\r
+#include <conio.h>\r
#include "src/lib/fmapread.h"\r
-
-#define DUMP
-//#define DUMP_MAP
-
-void
+\r
+#define DUMP\r
+//#define DUMP_MAP\r
+\r
+void\r
main(int argc, char *argv[])\r
{\r
- 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;\r
+ short i;\r
+ char *fmt = "Memory available = %u\n";\r
+ char *fmt0 = "Largest Contiguous Block of Memory available = %u\n";\r
+\r
+ fprintf(stderr, fmt, _memavl());\r
+ fprintf(stderr, fmt0, _memmax());\r
+ fprintf(stderr, "Size of map var = %u\n", _msize(&map));\r
+ fprintf(stderr, "program always crashes for some reason....");\r
+ getch();\r
+\r
+ fprintf(stderr, "loading~\n\n");\r
+ loadmap("data/tes0.map", &map);\r
+ fprintf(stderr, "\nokies~\n");\r
+ #ifdef DUMP\r
+ fprintf(stdout, "map.width= %d\n", map.width);\r
+ fprintf(stdout, "map.height= %d\n", map.height);\r
+ #ifdef DUMP_MAP\r
+ for(i=0; i<(map.width*map.height); i++)\r
+ {\r
+ fprintf(stdout, "%04d[%02d]", i, map.data[i]);\r
+ if(i && !(i%map.width)) fprintf(stdout, "\n");\r
+ }\r
+ fprintf(stdout, "\n");\r
+ #endif\r
+ fprintf(stdout, "&main()=%Fp\n", *argv[0]);\r
+ fprintf(stdout, "&map==%Fp\n", &map);\r
+ fprintf(stdout, "&map.tiles==%Fp\n", map.tiles);\r
+ fprintf(stdout, "&map.width==%Fp\n", map.width);\r
fprintf(stdout, "&map.height==%Fp\n", map.height);\r
- fprintf(stdout, "&map.data==%Fp\n", map.data);
- #endif
- fprintf(stdout, "okies~\n");
+ fprintf(stdout, "&map.data==%Fp\n", map.data);\r
+ #endif\r
+ fprintf(stdout, "okies~\n");\r
}\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* 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.
*
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
* write to the Free Software Foundation, Inc., 51 Franklin Street,\r
* Fifth Floor, Boston, MA 02110-1301 USA.\r
*\r
- */
-
-#include <stdio.h>
-
-#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 */
-};
-
+ */\r
+\r
+#include <stdio.h>\r
+\r
+#include "src/lib/16_in.h"\r
+//#include "src/lib/16_snd.h"\r
+#include "src/lib/doslib/adlib.h"\r
+#include "src/lib/doslib/8254.h" /* 8254 timer */\r
+\r
+static unsigned int musical_scale[18] = {\r
+ 0x1B0, /* E */\r
+ 0x1CA, /* F */\r
+ 0x1E5, /* f# */\r
+ 0x202, /* G */\r
+ 0x220, /* G# */\r
+ 0x241, /* A */\r
+ 0x263, /* A# */\r
+ 0x287, /* B */\r
+ 0x2AE, /* C */\r
+\r
+ 0x2B0, /* E */\r
+ 0x2CA, /* F */\r
+ 0x2E5, /* f# */\r
+ 0x302, /* G */\r
+ 0x320, /* G# */\r
+ 0x341, /* A */\r
+ 0x363, /* A# */\r
+ 0x387, /* B */\r
+ 0x3AE, /* C */\r
+};\r
+\r
void main(int argc, char near *argv[])\r
-{
- word i;
+{\r
+ word i;\r
// static FMInstrument testInst =\r
//{\r
//0x00, 0x01, /* modulator frequency multiple... 0x20 */\r
//0x73, 0x73, /* modulator sustain/release... 0x80 */\r
//0x03, 0x00, /* output waveform distortion 0xE0 */\r
//0x36, /* feedback algorithm and strength 0xC0 */\r
-//};
-
- 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");
+//};\r
+\r
+ IN_Startup();\r
+ //FMReset();\r
+ //FMSetVoice(0, &testInst);\r
+ if(!init_adlib())\r
+ {\r
+ printf("Cannot init library\n");\r
+ exit(-5);\r
+ }\r
+\r
+ if (adlib_fm_voices > 9)\r
+ printf("OPL3!\n");\r
+// vga_bios_set_80x50_text();\r
+\r
+ memset(adlib_fm,0,sizeof(adlib_fm));\r
+ memset(&adlib_reg_bd,0,sizeof(adlib_reg_bd));\r
+ for (i=0;i < adlib_fm_voices;i++) {\r
+ struct adlib_fm_operator *f;\r
+ f = &adlib_fm[i].mod;\r
+ f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1;\r
+ f = &adlib_fm[i].car;\r
+ f->ch_a = f->ch_b = f->ch_c = f->ch_d = 1;\r
+ }\r
+\r
+ for (i=0;i < /*adlib_fm_voices*/1;i++) {\r
+ struct adlib_fm_operator *f;\r
+\r
+ f = &adlib_fm[i].mod;\r
+ f->mod_multiple = 1;\r
+ f->total_level = 63 - 16;\r
+ f->attack_rate = 15;\r
+ f->decay_rate = 0;\r
+ f->sustain_level = 7;\r
+ f->release_rate = 7;\r
+ f->f_number = musical_scale[i%18];\r
+ f->octave = 4;\r
+ f->key_on = 0;\r
+\r
+ f = &adlib_fm[i].car;\r
+ f->mod_multiple = 1;\r
+ f->total_level = 63 - 16;\r
+ f->attack_rate = 15;\r
+ f->decay_rate = 0;\r
+ f->sustain_level = 7;\r
+ f->release_rate = 7;\r
+ f->f_number = 0;\r
+ f->octave = 0;\r
+ f->key_on = 0;\r
+ }\r
+\r
+ adlib_apply_all();\r
+\r
+ printf("press Z! to noise\npress ESC to quit");\r
+ printf("p");\r
+ while(!IN_qb(1))\r
+ {\r
+ if(IN_qb(44))\r
+ {\r
+ printf("e");\r
adlib_fm[0].mod.key_on = 1;\r
- //FMKeyOn(0, 0x106, 4);
- }
- else
- {
- adlib_fm[0].mod.key_on = 0;
- //FMKeyOff(0);
- }
+ //FMKeyOn(0, 0x106, 4);\r
+ }\r
+ else\r
+ {\r
+ adlib_fm[0].mod.key_on = 0;\r
+ //FMKeyOff(0);\r
+ }\r
adlib_update_groupA0(0,&adlib_fm[0]);\r
- }
- printf("!\n");
- shutdown_adlib();
- IN_Shutdown();
-}
+ }\r
+ printf("!\n");\r
+ shutdown_adlib();\r
+ IN_Shutdown();\r
+}\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r
-#include "src/tesuto.h"\r
-\r
-static unsigned char palette[768];\r
-\r
-int main(int argc,char **argv) {\r
- struct vrl1_vgax_header *vrl_header;\r
- vrl1_vgax_offset_t *vrl_lineoffs;\r
- unsigned char *buffer;\r
- unsigned int bufsz;\r
- int fd;\r
-\r
- if (argc < 3) {\r
- fprintf(stderr,"drawvrl <VRL file> <palette file>\n");\r
- return 1;\r
- }\r
-\r
- fd = open(argv[1],O_RDONLY|O_BINARY);\r
- if (fd < 0) {\r
- fprintf(stderr,"Unable to open '%s'\n",argv[1]);\r
- return 1;\r
- }\r
- {\r
- unsigned long sz = lseek(fd,0,SEEK_END);\r
- if (sz < sizeof(*vrl_header)) return 1;\r
- if (sz >= 65535UL) return 1;\r
-\r
- bufsz = (unsigned int)sz;\r
- buffer = malloc(bufsz);\r
- if (buffer == NULL) return 1;\r
-\r
- lseek(fd,0,SEEK_SET);\r
- if ((unsigned int)read(fd,buffer,bufsz) < bufsz) return 1;\r
-\r
- vrl_header = (struct vrl1_vgax_header*)buffer;\r
- if (memcmp(vrl_header->vrl_sig,"VRL1",4) || memcmp(vrl_header->fmt_sig,"VGAX",4)) return 1;\r
- if (vrl_header->width == 0 || vrl_header->height == 0) return 1;\r
- }\r
- close(fd);\r
-\r
- probe_dos();\r
- if (!probe_vga()) {\r
- printf("VGA probe failed\n");\r
- return 1;\r
- }\r
- int10_setmode(19);\r
- update_state_from_vga();\r
- vga_enable_256color_modex(); // VGA mode X\r
-\r
- /* load color palette */\r
- fd = open(argv[2],O_RDONLY|O_BINARY);\r
- if (fd >= 0) {\r
- unsigned int i;\r
-\r
- read(fd,palette,768);\r
- close(fd);\r
-\r
- vga_palette_lseek(0);\r
- for (i=0;i < 256;i++) vga_palette_write(palette[(i*3)+0]>>2,palette[(i*3)+1]>>2,palette[(i*3)+2]>>2);\r
- }\r
-\r
- /* preprocess the sprite to generate line offsets */\r
- vrl_lineoffs = vrl1_vgax_genlineoffsets(vrl_header,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- if (vrl_lineoffs == NULL) return 1;\r
-\r
- draw_vrl1_vgax_modex(0,0,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- while (getch() != 13);\r
-\r
- {\r
- unsigned int i;\r
-\r
- for (i=1;i < 320;i++)\r
- draw_vrl1_vgax_modex(i,0,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- }\r
- while (getch() != 13);\r
-\r
- {\r
- unsigned int i;\r
-\r
- for (i=1;i < 200;i++)\r
- draw_vrl1_vgax_modex(i,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- }\r
- while (getch() != 13);\r
-\r
- {\r
- unsigned int i;\r
-\r
- for (i=(2 << 6)/*200%*/;i >= (1 << 4)/*25%*/;i--)\r
- draw_vrl1_vgax_modexstretch(0,0,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- }\r
- while (getch() != 13);\r
- {\r
- unsigned int i;\r
-\r
- for (i=(2 << 6)/*200%*/;i >= (1 << 4)/*25%*/;i--)\r
- draw_vrl1_vgax_modexystretch(0,0,i,i,vrl_header,vrl_lineoffs,buffer+sizeof(*vrl_header),bufsz-sizeof(*vrl_header));\r
- }\r
- while (getch() != 13);\r
-\r
- int10_setmode(3);\r
- free(vrl_lineoffs);\r
- buffer = NULL;\r
- free(buffer);\r
- bufsz = 0;\r
- return 0;\r
-}\r
-\r
+#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 <VRL file> <palette file>\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;
+}
+
#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 <hw/cpu/cpu.h>
+#include <hw/dos/dos.h>
+#include <hw/vga/vga.h>
+#include <hw/vga/vrl.h>
+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
/* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123\r
*\r
* This file is part of Project 16.\r
*\r