OSDN Git Service

fixed an issue of bakapi.exe while in pan mode you cannot escape until you press...
[proj16/16.git] / src / bakapi.c
index 7724507..2d5837a 100755 (executable)
-/* 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 screen.heightould 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/bakapi.h"
-
-/*
- * BAKAPEE!
- */
-global_game_variables_t gvar;
-static bakapee_t bakapee;
-word key,d,xpos,ypos,xdir,ydir;
-int ch=0x0;
-
-void
-main(int argc, char *argvar[])
-{
-       // DOSLIB: check our environment
-       probe_dos();
-
-       // DOSLIB: what CPU are we using?
-       // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.
-       //      So this code by itself shouldn't care too much what CPU it's running on. Except that other
-       //      parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for
-       //      the CPU to carry out tasks. --J.C.
-       cpu_probe();
-
-       // DOSLIB: check for VGA
-       if (!probe_vga()) {
-               printf("VGA probe failed\n");
-               return;
-       }
-       // hardware must be VGA or higher!
-       if (!(vga_state.vga_flags & VGA_IS_VGA)) {
-               printf("This program requires VGA or higher graphics hardware\n");
-               return;
-       }
-
-       // main variables values
-       d=4; // switch variable
-       key=2; // default screensaver number
-       xpos=TILEWH*2;
-       ypos=TILEWH*2;
-       xdir=1;
-       ydir=1;
-
-#ifdef MXLIB
-       VGAmodeX(1, &gvar); // TODO: Suggestion: Instead of magic numbers for the first param, might I suggest defining an enum or some #define constants that are easier to remember? --J.C.
-#else
-# error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
-               // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
-#endif
-       bakapee.xx = rand()&0%gvar.video.page[0].width;
-       bakapee.yy = rand()&0%gvar.video.page[0].height;
-       bakapee.gq = 0;
-       bakapee.sx=0;
-       bakapee.sy=0;
-       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]);
-       gvar.video.page[0].width += (TILEWH*2);
-       gvar.video.page[0].height += (TILEWH*2);
-       textInit();
-
-       //modexPalUpdate(bmp.palette); //____
-       //modexDrawBmp(VGA, 0, 0, &bmp, 0); //____
-       //getch(); //____
-
-       modexShowPage(&gvar.video.page[0]);
-
-// screen savers
-#ifdef BOINK
-       while(d>0)      // on!
-       {
-               /* run screensaver routine until keyboard input */
-               while (key > 0) {
-                       if (kbhit()) {
-                               getch(); // eat keyboard input
-                               break;
-                       }
-
-                       ding(&gvar.video.page[0], &bakapee, key);
-               }
-
-               {
-                       int c;
-
-# ifndef MXLIB
-#  error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
-               // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
-# else
-                       VGAmodeX(0, &gvar);
-# endif
-                       // user imput switch
-                       fprintf(stderr, "xx=%d  yy=%d   tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);
-                       printf("Enter 1, 2, 3, 4, or 6 to run a screensaver, or enter 0 to quit.\n");
-
-                       c = getch();
-                       switch (c) {
-                               case 27: /* Escape key */
-                               case '0':
-                                       d=0;
-                                       break;
-                               case 'b': // test tile change
-                                       switch (bakapee.tile)
-                                       {
-                                               case 0:
-                                                       bakapee.tile=1;
-                                               break;
-                                               case 1:
-                                                       bakapee.tile=0;
-                                               break;
-                                       }
-                                       key=0;
-                                       break;
-                               case '1':
-                               case '2':
-                               case '3':
-                               case '4':
-                               case '5':
-                               case '6':
-                                       key = c - '0';
-# ifdef MXLIB
-                                       gvar.video.page[0] = modexDefaultPage(&gvar.video.page[0]);
-                                       gvar.video.page[0].width += (TILEWH*2);
-                                       gvar.video.page[0].height += (TILEWH*2);
-                                       VGAmodeX(1, &gvar);
-# else
-#  error REMOVED // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.
-               // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.
-# endif
-                                       modexShowPage(&gvar.video.page[0]);
-                                       break;
-                               default:
-                                       key=0;
-                                       break;
-                       }
-               }
-       }
-#else // !defined(BOINK)
-// FIXME: Does not compile. Do you want to remove this?
-       while(1)
-       { // conditions of screen saver
-               while(!kbhit())
-               {
-                       ding(&gvar.video.page[0], &bakapee, key);
-               }
-               //end of screen savers
-               /*for(int x = 0; x < gvar.video.page[0].width; ++x)
-               {
-                       modexputPixel(&page, x, 0, 15);
-                       mxPutPixel(x, gvar.video.page[0].height-1, 15);
-                       }
-               for (int y = 0; y < VH; ++y)
-                       {
-                               mxPutPixel(0, y, 15);
-                               mxPutPixel(gvar.video.page[0].width-1, y, 15);
-                       }
-               for (int x = 0; x < VW; ++x)
-                       {
-                               mxPutPixel(x, 0, 15);
-                               mxPutPixel(x, VH-1, 15);
-                       }
-               for (int y = 240; y < VH; ++y)
-                       {
-                               mxPutPixel(0, y, 15);
-                               mxPutPixel(VW-1, y, 15);
-                       }*/
-               pdump(&gvar.video.page[0]);
-               getch();
-               //text box
-               /*++++mxBitBlt(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, BS); //copy background
-               mxFillBox(xpos, ypos+(TILEWH*12), gvar.video.page[0].width, TILEWH*BUFFMX, 0, OP_SET); // background for text box
-               //+(QUADWH*6)
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");
-               mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");
-               mxFillBox(xpos+QUADWH, ypos+QUADWH+(TILEWH*12), TILEWH*2, TILEWH*2, 9, OP_SET); //portriat~
-               getch();
-               mxBitBlt(0, BS, gvar.video.page[0].width, TILEWH*BUFFMX, xpos, ypos+(TILEWH*12)); //copy background
-               getch();++++*/
-               while(!kbhit())
-               {
-                       //for(int i=0;i<TILEWH;i++){
-                               ding(&gvar.video.page[0], &bakapee, key);
-                               modexPanPage(&gvar.video.page[0], xpos, ypos);
-//++++mxFillBox(384, 304, 384, 304, 10, OP_SET);
-//mxBitBlt(xpos, ypos, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
-//++++mxBitBlt(TILEWH*2, TILEWH*2, gvar.video.page[0].width, gvar.video.page[0].height, 32, (gvar.video.page[0].height+64+32));
-                               //for(word o = 0; o<TILEWH; o++){
-                                       xpos+=xdir;
-                                       ypos+=ydir;
-                                       //if(ypos==1 || (ypos==(BH-gvar.video.page[0].height-1)))delay(500);
-                                       //if((xpos>(VW-gvar.video.page[0].width-1)) || (xpos<1))delay(500);
-                                       //mxWaitRetrace();
-//mxBitBlt(32, (gvar.video.page[0].height+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
-//++++mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
-//xpos=ypos=TILEWH*2;
-                                       //????modexPanPage(&gvar.video.page[0], 32, 32);
-                               //}
-                               if( (xpos>(VW-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}
-                               if( (ypos>(BH-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;} // { Hit a boundry, change
-                       //}//    direction!
-//mxBitBlt(32, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, xpos, ypos);
-//mxBitBlt(TILEWH*2, (gvar.video.page[0].height+64+32), gvar.video.page[0].width, gvar.video.page[0].height, TILEWH*2, TILEWH*2);
-               }
-       ch=getch();
-       if(ch==0x71)break; // 'q'
-       if(ch==0x1b)break; // 'ESC'
-       }
-//     VGAmodeX(0, &gvar);
-#endif // defined(BOINK)
-       printf("bakapi ver. 1.04.13.04\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");
-}
-//pee!
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2021 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\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 screen.heightould 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/bakapi.h"\r
+\r
+/*\r
+ * BAKAPEE!\r
+ */\r
+static bakapee_t bakapee;\r
+word key,d,xpos,ypos,xdir,ydir;\r
+sword vgamodex_mode = 1; //    1 = 320x240 with buffer\r
+void TL_VidInit(global_game_variables_t *gvar){}\r
+//int ch=0x0;\r
+\r
+\r
+void\r
+main(int argc, char *argvar[])\r
+{\r
+       static global_game_variables_t gvar;\r
+       struct glob_game_vars   *ggvv;\r
+       char *a;\r
+       int i,c;\r
+       word panq=1, pand=0,showding=0;\r
+       boolean panswitch=0,bptest=1,runding=1;\r
+\r
+       ggvv=&gvar;\r
+\r
+       // allow changing default mode from command line\r
+       for (i=1;i < argc;) {\r
+               a = argvar[i++];\r
+\r
+               if (*a == '-') {\r
+                       do { a++; } while (*a == '-');\r
+\r
+                       if (!strcmp(a,"mx")) {\r
+                               // (based on src/lib/modex16.c)\r
+                               // 1 = 320x240\r
+                               // 2 = 160x120\r
+                               // 3 = 320x200\r
+                               // 4 = 192x144\r
+                               // 5 = 256x192\r
+                               vgamodex_mode = (sword)strtoul(argvar[i++],NULL,0);\r
+                       }\r
+                       else {\r
+                               fprintf(stderr,"Unknown switch %s\n",a);\r
+                               return;\r
+                       }\r
+               }\r
+               else {\r
+                       fprintf(stderr,"Unknown command arg %s\n",a);\r
+                       return;\r
+               }\r
+       }\r
+\r
+       // initiate doslib //\r
+       TL_DosLibStartup(&gvar);\r
+\r
+       // main variables values\r
+       d=4; // switch variable\r
+       key=2; // default screensaver number\r
+       xpos=TILEWHD; ypos=TILEWHD; xdir=1; ydir=1;\r
+\r
+       VGAmodeX(vgamodex_mode, 0, &gvar); // TODO: Suggestion: Instead of magic numbers for the first param, might I suggest defining an enum or some #define constants that are easier to remember? --J.C.\r
+               // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.\r
+               // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.\r
+       bakapee.xx = rand()&0%gvar.video.page[0].width; bakapee.yy = rand()&0%gvar.video.page[0].height;\r
+       bakapee.gq = 0; bakapee.sx=bakapee.sy=0; bakapee.bakax=bakapee.bakay=0; bakapee.coor=0;\r
+       //once where #defines\r
+       bakapee.tile=0; bakapee.bonk=400; bakapee.lgq=32; bakapee.hgq=55;\r
+\r
+       switch(WCPU_detectcpu())\r
+       {\r
+               case 0:\r
+                       bakapee.tile=1;\r
+               break;\r
+               default:\r
+                       bakapee.tile=0;\r
+               break;\r
+       }\r
+\r
+       // setup camera and screen~ //\r
+       SETUPPAGEBAKAPI\r
+\r
+       VL_ShowPage(&gvar.video.page[0], 1, 0);\r
+       BAKAPIINITFIZZTEST\r
+\r
+       while (bptest)\r
+       {\r
+/*             if (key > 0)\r
+               {*/\r
+               while (!kbhit() && runding)\r
+                       {\r
+                               //{ word w; for(w=0;w<(gvar.video.page[0].width*gvar.video.page[0].height);w++) {}}\r
+                               ding(&gvar.video.page[showding], &bakapee, 4);\r
+                       }\r
+               if (kbhit())\r
+//                     {\r
+                       getch(); // eat keyboard input\r
+//                             break;\r
+//                     }\r
+//             }*/\r
+\r
+               {\r
+\r
+                       c = getch();\r
+                       switch (c)\r
+                       {\r
+                               case 27: // Escape key //\r
+                               case '0':\r
+                               default:\r
+                                       bptest = false;\r
+                               break;\r
+                               case 'b': // test tile change //\r
+                                       switch (bakapee.tile)\r
+                                       {\r
+                                               case 0:\r
+                                                       bakapee.tile=1;\r
+                                               break;\r
+                                               case 1:\r
+                                                       bakapee.tile=0;\r
+                                               break;\r
+                                       }\r
+                               break;\r
+                               case 'r':\r
+                                       runding = false;\r
+                                       BAKAPIINITFIZZTEST\r
+                               break;\r
+                               case 'e':\r
+                                       runding = 1;\r
+                               break;\r
+                               case 'z':\r
+                                       runding = false;\r
+                                       FIZZFADEFUN\r
+//                                     runding = true;\r
+                               break;\r
+                               case '3':\r
+                               case '4':\r
+                                       runding = 1;\r
+                                       showding = c - '0' - 3;\r
+                               break;\r
+                               case '1':\r
+                               case '2':\r
+       //                      case '5':\r
+       //                      case '6':\r
+       //                      case '9':\r
+                                       key = c - '0' - 1;\r
+                                       VL_ShowPage(&gvar.video.page[key], 1, 0);\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+\r
+\r
+//while(!kbhit()){}\r
+\r
+// screen savers\r
+//#ifdef BOINK\r
+       while(d>0)      // on!\r
+       {\r
+               /* run screensaver routine until keyboard input */\r
+               while (key > 0) {\r
+                       if (kbhit()) {\r
+                               if(!panswitch)\r
+                               {\r
+                                       getch(); // eat keyboard input\r
+                                       break;\r
+                               }else c=getch();\r
+                       }\r
+\r
+                       if(!panswitch){\r
+                               if(key==9)\r
+                               {\r
+                                       ding(&gvar.video.page[1], &bakapee, 4);\r
+                                       ding(&gvar.video.page[0], &bakapee, 4);\r
+                                       FIZZFADEFUN\r
+                               }else ding(&gvar.video.page[0], &bakapee, key); }\r
+                       else                    ding(&gvar.video.page[0], &bakapee, 2);\r
+                       if(panswitch!=0)\r
+                       {\r
+                               //right movement\r
+                               if((c==0x4d && pand == 0) || pand == 2)\r
+                               {\r
+                                       if(pand == 0){ pand = 2; }\r
+                                       if(panq<=(TILEWH/(4)))\r
+                                       {\r
+                                               gvar.video.page[0].dx++;\r
+                                               VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                                               panq++;\r
+                                       } else { panq = 1; pand = 0; }\r
+                               }\r
+                               //left movement\r
+                               if((c==0x4b && pand == 0) || pand == 4)\r
+                               {\r
+                                       if(pand == 0){ pand = 4; }\r
+                                       if(panq<=(TILEWH/(4)))\r
+                                       {\r
+                                               gvar.video.page[0].dx--;\r
+                                               VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                                               panq++;\r
+                                       } else { panq = 1; pand = 0; }\r
+                               }\r
+                               //down movement\r
+                               if((c==0x50 && pand == 0) || pand == 3)\r
+                               {\r
+                                       if(pand == 0){ pand = 3; }\r
+                                       if(panq<=(TILEWH/(4)))\r
+                                       {\r
+                                               gvar.video.page[0].dy++;\r
+                                               VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                                               panq++;\r
+                                       } else { panq = 1; pand = 0; }\r
+                               }\r
+                               //up movement\r
+                               if((c==0x48 && pand == 0) || pand == 1)\r
+                               {\r
+                                       if(pand == 0){ pand = 1; }\r
+                                       if(panq<=(TILEWH/(4)))\r
+                                       {\r
+                                               gvar.video.page[0].dy--;\r
+                                               VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                                               panq++;\r
+                                       } else { panq = 1; pand = 0; }\r
+                               }\r
+                               if((c==0x4d && pand == 0) || pand == 2)\r
+                               {\r
+                                       if(pand == 0){ pand = 2; }\r
+                                       if(panq<=(TILEWH/(4)))\r
+                                       {\r
+                                               gvar.video.page[0].dx++;\r
+                                               VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                                               panq++;\r
+                                       } else { panq = 1; pand = 0; }\r
+                               }\r
+                               if(c==0x01+1)\r
+                               {\r
+                                       VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                               }\r
+                               if(c==0x02+1)\r
+                               {\r
+                                       VL_ShowPage(&gvar.video.page[1], 0, 0);\r
+                               }\r
+                               if(c==27 || c==0x71 || c==0xb1 || c=='p')\r
+                               {\r
+                                       //getch(); // eat keyboard input\r
+                                       panswitch=0;\r
+                                       break; // 'q' or 'ESC' or 'p'\r
+                               }\r
+                       }\r
+               }\r
+\r
+               {\r
+\r
+               // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.\r
+               // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.\r
+                       VGAmodeX(0, 0, &gvar);\r
+                       clrscr();       //added to clear screen wwww\r
+                       // user imput switch\r
+                       //fprintf(stderr, "xx=%d        yy=%d   tile=%d\n", bakapee.xx, bakapee.yy, bakapee.tile);\r
+                       //fprintf(stderr, "dx=%d        dy=%d   ", gvar.video.page[0].dx, gvar.video.page[0].dy);\r
+                       printf("Tiled mode is ");\r
+                       switch (bakapee.tile)\r
+                       {\r
+                               case 0:\r
+                                       printf("off.    ");\r
+                               break;\r
+                               case 1:\r
+                                       printf("on.     ");\r
+                               break;\r
+                       }\r
+                       printf("Pan mode is ");\r
+                       switch (panswitch)\r
+                       {\r
+                               case 0:\r
+                                       printf("off.");\r
+                               break;\r
+                               case 1:\r
+                                       printf("on.");\r
+                               break;\r
+                       }\r
+                       printf("\n");\r
+                       printf("Incrementation of color happens at every %uth plot.\n", bakapee.bonk);\r
+                       printf("Enter 1, 2, 3, 4, 5, 6, 8, or 9 to run a screensaver, or enter 0 to quit.\n");\r
+pee:\r
+                       c = getch();\r
+                       switch (c) {\r
+                               case 27: /* Escape key */\r
+                               case '0':\r
+                                       d=0;\r
+                                       break;\r
+                               case 'p': // test pan\r
+                                       switch (panswitch)\r
+                                       {\r
+                                               case 0:\r
+                                                       panswitch=1;\r
+                                               break;\r
+                                               case 1:\r
+                                                       panswitch=0;\r
+                                               break;\r
+                                       }\r
+                                       key=0;\r
+                                       goto pee;\r
+                               break;\r
+                               case 'b': // test tile change\r
+                                       switch (bakapee.tile)\r
+                                       {\r
+                                               case 0:\r
+                                                       bakapee.tile=1;\r
+                                               break;\r
+                                               case 1:\r
+                                                       bakapee.tile=0;\r
+                                               break;\r
+                                       }\r
+                                       key=0;\r
+                               break;\r
+                               case '8':\r
+                                       c+=8;\r
+                               case '1':\r
+                               case '2':\r
+                               case '3':\r
+                               case '4':\r
+                               case '5':\r
+                               case '6':\r
+                               case '9':\r
+                                       key = c - '0';\r
+                                       VGAmodeX(vgamodex_mode, 0, &gvar);\r
+                                       SETUPPAGEBAKAPI\r
+               // this code is written around modex16 which so far is a better fit than using DOSLIB vga directly, so leave MXLIB code in.\r
+               // we'll integrate DOSLIB vga into that part of the code instead for less disruption. -- J.C.\r
+                                       VL_ShowPage(&gvar.video.page[0], 0, 0);\r
+                               break;\r
+                               case '-':\r
+                                       if(bakapee.bonk>0)\r
+                                               bakapee.bonk-=100;\r
+                               break;\r
+                               case '=':\r
+                               case '+':\r
+                                       if(bakapee.bonk<1000)\r
+                                               bakapee.bonk+=100;\r
+                               break;\r
+                               default:\r
+                                       key=0;\r
+                               break;\r
+                       }\r
+               }\r
+       }\r
+       clrscr();       //added to clear screen wwww\r
+#if 0\r
+//#else // !defined(BOINK)\r
+// FIXME: Does not compile. Do you want to remove this?\r
+// INFO: This is a testing section for textrendering and panning for project 16 --sparky4\r
+       while(1)\r
+       { // conditions of screen saver\r
+//             while(!kbhit())\r
+//             {\r
+//                     ding(&gvar.video.page[0], &bakapee, key);\r
+//             }\r
+               //end of screen savers\r
+               //pdump(&gvar.video.page[0]);\r
+\r
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-48, "========================================");\r
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-40, "|    |Chikyuu:$line1");\r
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-32, "|    |$line2");\r
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-24, "|    |$line3");\r
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-16, "|    |$line4");\r
+//             mxOutText(xpos+1, ypos+gvar.video.page[0].height-8,  "========================================");\r
+\r
+       ding(&gvar.video.page[0], &bakapee, key);\r
+       modexPanPage(&gvar.video.page[0], xpos, ypos);\r
+       c = getch();\r
+\r
+//     xpos+=xdir;\r
+//     ypos+=ydir;\r
+//     if( (xpos>(gvar.video.page[0].sw-gvar.video.page[0].width-1))  || (xpos<1)){xdir=-xdir;}\r
+//     if( (ypos>(gvar.video.page[0].sh-gvar.video.page[0].height-1)) || (ypos<1)){ydir=-ydir;}\r
+//     ch=getch();\r
+       if(ch==0x71)break; // 'q'\r
+       if(ch==0x1b)break; // 'ESC'\r
+       }\r
+       VGAmodeX(0, 1, &gvar);\r
+#endif // defined(BOINK)\r
+//     printf("page.width=%u   ", gvar.video.page[0].width); printf("page.height=%u\n", gvar.video.page[0].height);\r
+       printf("bakapi ver. 1.04.16.04\nis made by sparky4\81i\81\86\83Ö\81\85\81j feel free to use it ^^\nLicence: GPL v3\n");\r
+       printf("compiled on 2016/04/04\n");\r
+//     printf("[%u]%dx%d       [%dx%d] %u %u %u\n[%u   %u      %u]", key, bakapee.bakax, bakapee.bakay, bakapee.xx, bakapee.yy,\r
+//bakapee.coor, bakapee.tile, bakapee.gq, bakapee.bonk, bakapee.lgq, bakapee.hgq);\r
+}\r
+//pee!\r