OSDN Git Service

fps added to inputest.exe for efficiency testing of input wwww
authorsparky4 <sparky4@cock.li>
Mon, 14 Mar 2016 17:30:11 +0000 (12:30 -0500)
committersparky4 <sparky4@cock.li>
Mon, 14 Mar 2016 17:30:11 +0000 (12:30 -0500)
18 files changed:
makefile
src/16.c
src/16.h
src/exmmtest.c
src/inputest.c
src/lib/16_head.c
src/lib/16_head.h
src/lib/16_in.c
src/lib/16_in.h
src/lib/16_timer.c [moved from src/lib/timer.c with 65% similarity]
src/lib/16_timer.h [moved from src/lib/timer.h with 88% similarity]
src/lib/16text.c
src/lib/16text.h
src/lib/modex16.c
src/lib/modex16.h
src/lib/scroll16.c
src/lib/scroll16.h
src/scroll.c

index 7bca89e..46fa416 100755 (executable)
--- a/makefile
+++ b/makefile
@@ -78,7 +78,7 @@ FLAGS=$(CFLAGS) $(OFLAGS) $(DFLAGS) $(ZFLAGS)
 DOSLIBEXMMOBJ = himemsys.$(OBJ) emm.$(OBJ)
 VGMSNDOBJ = vgmSnd.$(OBJ) 16_snd.$(OBJ)
 DOSLIBOBJ = adlib.$(OBJ) 8254.$(OBJ) 8259.$(OBJ) dos.$(OBJ) cpu.$(OBJ)
-16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) timer.$(OBJ)
+16LIBOBJS = 16_in.$(OBJ) 16_mm.$(OBJ) wcpu.$(OBJ) 16_head.$(OBJ) 16_ca.$(OBJ) kitten.$(OBJ) 16_hc.$(OBJ) 16_timer.$(OBJ)
 
 GFXLIBOBJS = modex16.$(OBJ) bitmap.$(OBJ) planar.$(OBJ) 16text.$(OBJ) bakapee.$(OBJ) scroll16.$(OBJ) 16render.$(OBJ) 16planar.$(OBJ)
 
@@ -312,8 +312,8 @@ wcpu.$(OBJ): $(WCPULIB)wcpu.h $(WCPULIB)wcpu.c
 mapread.$(OBJ): $(SRCLIB)mapread.h $(SRCLIB)mapread.c
        wcl $(FLAGS) -c $(SRCLIB)mapread.c
 
-timer.$(OBJ): $(SRCLIB)timer.h $(SRCLIB)timer.c
-       wcl $(FLAGS) -c $(SRCLIB)timer.c
+16_timer.$(OBJ): $(SRCLIB)16_timer.h $(SRCLIB)16_timer.c
+       wcl $(FLAGS) -c $(SRCLIB)16_timer.c
 
 16_in.$(OBJ): $(SRCLIB)16_in.h $(SRCLIB)16_in.c
        wcl $(FLAGS) -c $(SRCLIB)16_in.c
index c4367aa..5ee40aa 100755 (executable)
--- a/src/16.c
+++ b/src/16.c
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
index 754184b..aa8528d 100755 (executable)
--- a/src/16.h
+++ b/src/16.h
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
index 0c0346f..b752ef2 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
index 562f7f4..03f7a33 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & 0gwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -27,6 +27,7 @@
 void\r
 main(int argc, char *argv[])\r
 {\r
+       global_game_variables_t gvar;\r
        player_t player[MaxPlayers];\r
        //extern struct inconfig inpu;\r
        testkeyin=0;\r
@@ -38,11 +39,12 @@ main(int argc, char *argv[])
        player[0].d=2;\r
        player[0].persist_aniframe=0;\r
        player[0].speed=4;\r
-       //player[0].kd[0]=2;    player[0].kd[1]=2;\r
+       start_timer(&gvar);\r
        while(!IN_KeyDown(sc_Escape))\r
        {\r
-               #define INC_PER_FRAME if(player[0].q&1) player[0].persist_aniframe++; if(player[0].persist_aniframe>4) player[0].persist_aniframe = 1;\r
+               shinkutxt(&gvar);\r
                IN_ReadControl(0,&player);\r
+               #define INC_PER_FRAME if(player[0].q&1) player[0].persist_aniframe++; if(player[0].persist_aniframe>4) player[0].persist_aniframe = 1;\r
                switch(player[0].d)\r
                {\r
                //right movement\r
@@ -84,6 +86,19 @@ main(int argc, char *argv[])
                //printf("%u\n", IN_KeyDown(sc_Escape));\r
                //if(\r
                IN_qb(sc_9);//>0) printf("IN_qb(sc_9)=%u\n", IN_qb(sc_9));\r
+               if(IN_KeyDown(88))      //speed\r
+               {\r
+                       switch(gvar.kurokku.fpscap)\r
+                       {\r
+                               case 0:\r
+                                       gvar.kurokku.fpscap=1;\r
+                               break;\r
+                               case 1:\r
+                                       gvar.kurokku.fpscap=0;\r
+                               break;\r
+                       }\r
+                       //IN_Ack();\r
+               }\r
        }\r
        IN_Shutdown();\r
        //printf("%u\n", in.Keyboard[sc_Escape]);\r
index 3b2d8a8..d7de200 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
index d48f48f..a3301f3 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -172,6 +172,8 @@ typedef void __based(__self) * memptr;
 typedef void _seg * memptr;\r
 #endif\r
 \r
+#define INPUT_STATUS_1         0x03da\r
+\r
 /* local function */\r
 void wait(clock_t wait);\r
 \r
index 05ea70c..1337f5e 100755 (executable)
@@ -855,7 +855,7 @@ register    KeyboardDef     *def;
                                mx = motion_Left,my = motion_Down;\r
                        else if (Keyboard[def->downright])\r
                                mx = motion_Right,my = motion_Down;*/\r
-                       if(DIRECTIONIFELSEGFXTEST)\r
+                       if(DIRECTIONIFELSE)\r
                        {\r
                        if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){\r
                                if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down]))\r
index 183dbb2..bf0755e 100755 (executable)
@@ -29,7 +29,7 @@
 \r
 #include <string.h>\r
 #include "src/lib/16_head.h"\r
-#include "src/lib/timer.h"\r
+#include "src/lib/16_timer.h"\r
 #include "src/lib/bitmap.h"\r
 #include "src/lib/planar.h"\r
 \r
@@ -47,8 +47,8 @@ extern byte testkeyin,testcontrolnoisy;
 //if else for gfxtesting and direction\r
 //player[pn].d == 2 ||\r
 //player[pn].d != 2 ||\r
-#define DIRECTIONIFELSEGFXTEST (player[pn].info.dir == 2)\r
-#define NDIRECTIONIFELSEGFXTEST        (player[pn].info.dir != 2)\r
+#define DIRECTIONIFELSE        (player[pn].info.dir == 2)\r
+//#define NDIRECTIONIFELSE     (player[pn].info.dir != 2)\r
 \r
 #define        KeyInt  9       // The keyboard ISR number\r
 \r
similarity index 65%
rename from src/lib/timer.c
rename to src/lib/16_timer.c
index b5edff9..c8416c7 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -20,7 +20,7 @@
  *\r
  */\r
 \r
-#include "src/lib/timer.h"\r
+#include "src/lib/16_timer.h"\r
 \r
 clock_t start_timer(global_game_variables_t *gv)\r
 {\r
@@ -65,3 +65,40 @@ double time_in_seconds(global_game_variables_t *gv)
 {\r
        return (in_t) / CLOCKS_PER_SEC;\r
 }*/\r
+\r
+/*     sync    */\r
+void shinkutxt(global_game_variables_t *gv)\r
+{\r
+       //float t;\r
+       if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second))\r
+       {\r
+               //t=(((*(gv->clock))-gv->clock_start) /18.2);\r
+               sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv));\r
+               fprintf(stderr, "%s\n", gv->pee);\r
+               //(gv->clock_start)=*(gv->clock);\r
+               gv->kurokku.tiku=0;\r
+       }\r
+       gv->kurokku.tiku++;\r
+       switch(gv->kurokku.fpscap)\r
+       {\r
+               case 0:\r
+                       gv->kurokku.frames_per_second=1;\r
+               break;\r
+               case 1:\r
+                       //turn this off if XT\r
+                       WaitPee();\r
+                       gv->kurokku.frames_per_second=60;\r
+               break;\r
+       }\r
+}\r
+\r
+void WaitPee()\r
+{\r
+    while(inp(INPUT_STATUS_1)  & 8)  {\r
+       /* spin */\r
+    }\r
+\r
+    while(!(inp(INPUT_STATUS_1)  & 8))  {\r
+       /* spin */\r
+    }\r
+}\r
similarity index 88%
rename from src/lib/timer.h
rename to src/lib/16_timer.h
index b4ca2e8..ffe08a4 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
@@ -30,5 +30,7 @@ double elapsed_timer(global_game_variables_t *gv);
 double ticktock(global_game_variables_t *gv);\r
 double time_in_seconds(global_game_variables_t *gv);\r
 //double time_in_seconds(time_t in_t);\r
+void shinkutxt(global_game_variables_t *gv);\r
+void WaitPee(void);\r
 \r
 #endif\r
index 62b581e..95b307e 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
index c946ae5..47325e0 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\r
  *\r
  * This file is part of Project 16.\r
  *\r
index 97b894f..ee2f1a8 100755 (executable)
@@ -1,11 +1,11 @@
 /* Project 16 Source Code~\r
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669\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
+ * the Free Software Foundation; either verson 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
index c45aafb..eae4493 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669
  *
  * This file is part of Project 16.
  *
@@ -145,7 +145,7 @@ extern byte far*  VGA;  /* The VGA Memory */
 #define HIGH_ADDRESS           0x0C
 #define LOW_ADDRESS            0x0D
 #define VRETRACE               0x08
-#define INPUT_STATUS_1         0x03da
+//#define INPUT_STATUS_1               0x03da  defined in 16_head
 #define DISPLAY_ENABLE         0x01
 #define MAP_MASK               0x02
 #define PAL_READ_REG                   0x03C7   /* Color register, read address */
index ec8c7d4..55122d1 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669
  *
  * This file is part of Project 16.
  *
index 9393615..dbfb793 100755 (executable)
@@ -1,5 +1,5 @@
 /* Project 16 Source Code~
- * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
+ * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669
  *
  * This file is part of Project 16.
  *
@@ -30,7 +30,7 @@
 #include "src/lib/bitmap.h"
 #include "src/lib/planar.h"
 #include "src/lib/mapread.h"
-#include "src/lib/timer.h"
+#include "src/lib/16_timer.h"
 #include "src/lib/wcpu/wcpu.h"
 
 //#define SPRITE
index 162ce8e..e798776 100755 (executable)
@@ -21,7 +21,7 @@
  */
 
 #include "src/lib/scroll16.h"
-#include "src/lib/timer.h"
+#include "src/lib/16_timer.h"
 #include "src/lib/wcpu/wcpu.h"
 
 //#define FADE