From: sparky4 Date: Mon, 14 Mar 2016 17:30:11 +0000 (-0500) Subject: fps added to inputest.exe for efficiency testing of input wwww X-Git-Url: http://4ch.mooo.com/gitweb/?a=commitdiff_plain;h=b944e5a4e57c1a1ba44dff4ffafdee4edd5b5d99;p=16.git fps added to inputest.exe for efficiency testing of input wwww --- diff --git a/makefile b/makefile index 7bca89e3..46fa4168 100755 --- 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 diff --git a/src/16.c b/src/16.c index c4367aa9..5ee40aa9 100755 --- a/src/16.c +++ b/src/16.c @@ -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. * diff --git a/src/16.h b/src/16.h index 754184b1..aa8528df 100755 --- a/src/16.h +++ b/src/16.h @@ -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. * diff --git a/src/exmmtest.c b/src/exmmtest.c index 0c0346f1..b752ef21 100755 --- a/src/exmmtest.c +++ b/src/exmmtest.c @@ -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. * diff --git a/src/inputest.c b/src/inputest.c index 562f7f4e..03f7a331 100755 --- a/src/inputest.c +++ b/src/inputest.c @@ -1,5 +1,5 @@ /* Project 16 Source Code~ - * Copyright (C) 2012-2015 sparky4 & 0gwen & andrius4669 + * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 * * This file is part of Project 16. * @@ -27,6 +27,7 @@ void main(int argc, char *argv[]) { + global_game_variables_t gvar; player_t player[MaxPlayers]; //extern struct inconfig inpu; testkeyin=0; @@ -38,11 +39,12 @@ main(int argc, char *argv[]) player[0].d=2; player[0].persist_aniframe=0; player[0].speed=4; - //player[0].kd[0]=2; player[0].kd[1]=2; + start_timer(&gvar); while(!IN_KeyDown(sc_Escape)) { - #define INC_PER_FRAME if(player[0].q&1) player[0].persist_aniframe++; if(player[0].persist_aniframe>4) player[0].persist_aniframe = 1; + shinkutxt(&gvar); IN_ReadControl(0,&player); + #define INC_PER_FRAME if(player[0].q&1) player[0].persist_aniframe++; if(player[0].persist_aniframe>4) player[0].persist_aniframe = 1; switch(player[0].d) { //right movement @@ -84,6 +86,19 @@ main(int argc, char *argv[]) //printf("%u\n", IN_KeyDown(sc_Escape)); //if( IN_qb(sc_9);//>0) printf("IN_qb(sc_9)=%u\n", IN_qb(sc_9)); + if(IN_KeyDown(88)) //speed + { + switch(gvar.kurokku.fpscap) + { + case 0: + gvar.kurokku.fpscap=1; + break; + case 1: + gvar.kurokku.fpscap=0; + break; + } + //IN_Ack(); + } } IN_Shutdown(); //printf("%u\n", in.Keyboard[sc_Escape]); diff --git a/src/lib/16_head.c b/src/lib/16_head.c index 3b2d8a8a..d7de200f 100755 --- a/src/lib/16_head.c +++ b/src/lib/16_head.c @@ -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. * diff --git a/src/lib/16_head.h b/src/lib/16_head.h index d48f48f1..a3301f3f 100755 --- a/src/lib/16_head.h +++ b/src/lib/16_head.h @@ -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. * @@ -172,6 +172,8 @@ typedef void __based(__self) * memptr; typedef void _seg * memptr; #endif +#define INPUT_STATUS_1 0x03da + /* local function */ void wait(clock_t wait); diff --git a/src/lib/16_in.c b/src/lib/16_in.c index 05ea70c2..1337f5ed 100755 --- a/src/lib/16_in.c +++ b/src/lib/16_in.c @@ -855,7 +855,7 @@ register KeyboardDef *def; mx = motion_Left,my = motion_Down; else if (Keyboard[def->downright]) mx = motion_Right,my = motion_Down;*/ - if(DIRECTIONIFELSEGFXTEST) + if(DIRECTIONIFELSE) { if(!inpu.Keyboard[def->left] && !inpu.Keyboard[def->right]){ if((inpu.Keyboard[def->up] && !inpu.Keyboard[def->down])) diff --git a/src/lib/16_in.h b/src/lib/16_in.h index 183dbb24..bf0755e7 100755 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -29,7 +29,7 @@ #include #include "src/lib/16_head.h" -#include "src/lib/timer.h" +#include "src/lib/16_timer.h" #include "src/lib/bitmap.h" #include "src/lib/planar.h" @@ -47,8 +47,8 @@ extern byte testkeyin,testcontrolnoisy; //if else for gfxtesting and direction //player[pn].d == 2 || //player[pn].d != 2 || -#define DIRECTIONIFELSEGFXTEST (player[pn].info.dir == 2) -#define NDIRECTIONIFELSEGFXTEST (player[pn].info.dir != 2) +#define DIRECTIONIFELSE (player[pn].info.dir == 2) +//#define NDIRECTIONIFELSE (player[pn].info.dir != 2) #define KeyInt 9 // The keyboard ISR number diff --git a/src/lib/timer.c b/src/lib/16_timer.c similarity index 65% rename from src/lib/timer.c rename to src/lib/16_timer.c index b5edff98..c8416c79 100755 --- a/src/lib/timer.c +++ b/src/lib/16_timer.c @@ -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. * @@ -20,7 +20,7 @@ * */ -#include "src/lib/timer.h" +#include "src/lib/16_timer.h" clock_t start_timer(global_game_variables_t *gv) { @@ -65,3 +65,40 @@ double time_in_seconds(global_game_variables_t *gv) { return (in_t) / CLOCKS_PER_SEC; }*/ + +/* sync */ +void shinkutxt(global_game_variables_t *gv) +{ + //float t; + if(elapsed_timer(gv) >= (1.0 / gv->kurokku.frames_per_second)) + { + //t=(((*(gv->clock))-gv->clock_start) /18.2); + sprintf(gv->pee, "%f fps", (double)gv->kurokku.tiku/ticktock(gv)); + fprintf(stderr, "%s\n", gv->pee); + //(gv->clock_start)=*(gv->clock); + gv->kurokku.tiku=0; + } + gv->kurokku.tiku++; + switch(gv->kurokku.fpscap) + { + case 0: + gv->kurokku.frames_per_second=1; + break; + case 1: + //turn this off if XT + WaitPee(); + gv->kurokku.frames_per_second=60; + break; + } +} + +void WaitPee() +{ + while(inp(INPUT_STATUS_1) & 8) { + /* spin */ + } + + while(!(inp(INPUT_STATUS_1) & 8)) { + /* spin */ + } +} diff --git a/src/lib/timer.h b/src/lib/16_timer.h similarity index 88% rename from src/lib/timer.h rename to src/lib/16_timer.h index b4ca2e87..ffe08a43 100755 --- a/src/lib/timer.h +++ b/src/lib/16_timer.h @@ -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,5 +30,7 @@ double elapsed_timer(global_game_variables_t *gv); double ticktock(global_game_variables_t *gv); double time_in_seconds(global_game_variables_t *gv); //double time_in_seconds(time_t in_t); +void shinkutxt(global_game_variables_t *gv); +void WaitPee(void); #endif diff --git a/src/lib/16text.c b/src/lib/16text.c index 62b581e8..95b307ef 100755 --- a/src/lib/16text.c +++ b/src/lib/16text.c @@ -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. * diff --git a/src/lib/16text.h b/src/lib/16text.h index c946ae5e..47325e02 100755 --- a/src/lib/16text.h +++ b/src/lib/16text.h @@ -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. * diff --git a/src/lib/modex16.c b/src/lib/modex16.c index 97b894f4..ee2f1a86 100755 --- a/src/lib/modex16.c +++ b/src/lib/modex16.c @@ -1,11 +1,11 @@ /* 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. * * 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 + * the Free Software Foundation; either verson 3 of the License, or * (at your option) any later version. * * Project 16 is distributed in the hope that it will be useful, diff --git a/src/lib/modex16.h b/src/lib/modex16.h index c45aafbc..eae44931 100755 --- a/src/lib/modex16.h +++ b/src/lib/modex16.h @@ -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 */ diff --git a/src/lib/scroll16.c b/src/lib/scroll16.c index ec8c7d41..55122d14 100755 --- a/src/lib/scroll16.c +++ b/src/lib/scroll16.c @@ -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. * diff --git a/src/lib/scroll16.h b/src/lib/scroll16.h index 93936157..dbfb7930 100755 --- a/src/lib/scroll16.h +++ b/src/lib/scroll16.h @@ -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 diff --git a/src/scroll.c b/src/scroll.c index 162ce8e3..e7987762 100755 --- a/src/scroll.c +++ b/src/scroll.c @@ -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