-/* 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.
- *
- */
-/*
- exmm test
-*/
-#include "src/lib/16_head.h"
-//#include "src/lib/16_ca.h"
-//#include "src/lib/16_mm.h"
-//#include "src/lib/modex16.h"
-
-//#define FILERL
-//#define FILEINIT
-
-void
-main(int argc, char *argv[])
-{
- //mminfo_t mm; mminfotype mmi;
- //memptr bigbuffer;
- //__segment segu;
- //char *bakapee;
- //word baka;
- //static page_t screen;
-
- printf("&main()=%Fp\n", *argv[0]);
- printf("&argc=%Fp\n", FP_SEG(&argc));
-//++++ printf("&segu=%Fp\n", segu);
-
- //++++bakapee = malloc(64);
-// memset(bakapee, 0, 64);
-//++++ mm.mmstarted=0;
-
- /*if(argv[1]) bakapee = argv[1];
- else bakapee = "data/koishi~~.pcx";*/
-
-//++++ textInit();\r
-
- /* setup camera and screen~ */
- //bug!!!\r
- //screen = modexDefaultPage();\r
- /*screen.width += (16*2);\r
- screen.height += (16*2);*/
-
- printf("&main()=%Fp start MM\n", *argv[0]);
-//++++ MM_Startup(&mm, &mmi);
- printf(" done!\n");
- /*if(FP_SEG(*argv[0])==0)
- {
- MM_Report(&screen, &mm, &mmi);
- MM_Shutdown(&mm);
- printf("&main()=%Fp\n", *argv[0]);
- printf("&main() == %u\n", FP_SEG(*argv[0]));
- exit(-5);
- }*/
- printf("&main()=%Fp\n", *argv[0]);
- printf("&argc=%Fp\n", FP_SEG(&argc));
-//++++ printf("&segu=%Fp\n", segu);
-/*++++#ifdef FILERL
-#ifdef FILEINIT
- printf(" read\n");
- if(CA_ReadFile(bakapee, &bigbuffer, &mm))
-#else
- printf(" load\n");
- if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi))
-#endif
- baka=1;
- else
- baka=0;
-#endif*/
- //hmm functions in cache system use the buffered stuff
-//++++ printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
- printf("dark purple = purgable\n");
- printf("medium blue = non purgable\n");
- printf("red = locked\n");
- //++++getch();
- //++++modexEnter();
- //++++modexShowPage(&screen);
- //++++MM_ShowMemory(/*&screen, */&mm);
- //++++getch();
- //++++MM_DumpData(&mm);
- //++++modexLeave();
- //++++MM_Report(&mm, &mmi);
- printf(" stop!\n");
-//++++ MM_FreePtr(&bigbuffer, &mm);
-//++++ MM_Shutdown(&mm);
- printf(" done!\n");
-/*#ifdef FILERL
- //++++free(bakapee);
- if(baka) printf("\nyay!\n");
- else printf("\npoo!\n");
-#endif*/
-}
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2022 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 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
+ simple mm test\r
+*/\r
+#include "src/exmmtest.h"\r
+\r
+////////////////////////////////////////////////////////////////////////////\r
+\r
+#ifdef BBUFNAME\r
+#undef BBUFNAME\r
+#endif\r
+#define BBUFNAME bufferseg\r
+\r
+#ifdef SCROLLLOAD\r
+#define FILENAME_1 "data/spri/chikyuu.vrs"\r
+#define FILENAME_2 "data/test.map"\r
+#else\r
+#define FILENAME_1 "data/spri/chikyuu.sht"\r
+#define FILENAME_2 "data/test.map"\r
+#endif\r
+\r
+//===========================================================================//\r
+\r
+//=======================================//\r
+\r
+// main\r
+\r
+//=======================================//\r
+void\r
+main(int argc, char *argv[])\r
+{\r
+ static global_game_variables_t gvar;\r
+ static memptr BBUFNAME;\r
+\r
+ char bakapee1[64] = FILENAME_1;\r
+ char bakapee2[64] = FILENAME_2;\r
+\r
+ #ifdef __BORLANDC__\r
+ argc=argc;\r
+ #endif\r
+\r
+#ifdef __16_PM__\r
+#ifdef __DEBUG_PM__\r
+ dbg_debugpm=1; //debug pm\r
+#endif\r
+#endif\r
+#ifdef __DEBUG_CA__\r
+ dbg_debugca=1;\r
+#endif\r
+#ifdef __DEBUG_MM__\r
+ dbg_debugmm=1;\r
+#endif\r
+\r
+ if(argv[1]){ strcpy(bakapee1, argv[1]);//bakapee1[] = *argv[1];\r
+ if(argv[2]) strcpy(bakapee2, argv[2]); }//bakapee2[] = argv[2]; }\r
+\r
+ printf("bakapee1[%s]\n", bakapee1);\r
+ printf("bakapee2[%s]\n", bakapee2);\r
+ #ifdef EXMMVERBOSE__\r
+ printf("coreleft(): %u\n", coreleft());\r
+ printf("farcoreleft(): %ld\n", farcoreleft());\r
+ #endif\r
+ printf("stackavail()=%u\n", stackavail());\r
+ KEYP\r
+\r
+ StartupCAMMPM(&gvar);\r
+ #ifdef PRINTBBDUMP\r
+ //0000\r
+PRINTBB; KEYP\r
+ #endif\r
+\r
+ IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar);\r
+ IN_SetControlType(&gvar.player[0],ctrl_Keyboard1);\r
+\r
+ {\r
+ byte w; word baka;\r
+ w=0;\r
+ #ifdef FILEREADLOAD\r
+ #ifdef FILEREAD\r
+ for(;w<2;w++)\r
+ {\r
+ // printf("size of big buffer~=%u\n", _bmsize(segu, BBUF));\r
+ if(w>0)\r
+ {\r
+ printf("======================================read=====================================\n");\r
+ if(CA_ReadFile(bakapee2, BBUFPTR, &gvar)) baka=1; else baka=0;\r
+ printf("====================================read end===================================\n");\r
+ }\r
+ #endif //FILEREAD\r
+ if(w==0)\r
+ {\r
+ printf("======================================load=====================================\n");\r
+ if(CA_LoadFile(bakapee1, BBUFPTR, &gvar)) baka=1; else baka=0;\r
+ printf("====================================load end===================================\n");\r
+ }\r
+ #ifdef BUFFDUMP\r
+ {\r
+ size_t file_s;\r
+ FILE *fh;\r
+\r
+ if(!w) fh = fopen(bakapee1, "r");\r
+ else fh = fopen(bakapee2, "r");\r
+ file_s = filesize(fh);\r
+ fclose(fh);\r
+ printf("contents of the buffer\n[\n%.*s\n]\n", file_s, BBUFSTRING);\r
+#if 0\r
+//0000\r
+// mmblocktype far *scan;\r
+// scan = gvar.mm.mmhead;\r
+// while (scan->useptr != &BBUFNAME && scan)\r
+// {\r
+// scan = scan->next;\r
+// }\r
+// printf("\n %Fp %Fp\n", scan->useptr, &BBUFNAME);\r
+ printf("\nstrlen of buffer = %zu\n", strlen(BBUFSTRING));\r
+ printf("length of buffer = %zu\n", file_s);\r
+// printf("length of buffer = %lu\n", scan->length);\r
+#endif\r
+ }\r
+ #endif\r
+ #ifdef PRINTBBDUMP\r
+ PRINTBB;\r
+ #endif\r
+\r
+ //printf("dark purple = purgable\n");\r
+ //printf("medium blue = non purgable\n");\r
+ //printf("red = locked\n");\r
+ // KEYP\r
+ // DebugMemory_(&gvar, 1);\r
+ if(baka) printf("\nyay!\n");\r
+ else printf("\npoo!\n");\r
+ #ifdef BUFFDUMPPAUSE\r
+ KEYP\r
+ #endif\r
+ #ifdef FILEREAD\r
+ }\r
+ #endif\r
+ #endif //filereadload\r
+ }\r
+\r
+//0000++++\r
+ MM_ShowMemory(&gvar);\r
+\r
+ DebugMemory_(&gvar, 1);\r
+ MM_DumpData(&gvar);\r
+ KEYP\r
+ MM_Report_(&gvar);\r
+ //printf("bakapee1=%s\n", bakapee1);\r
+ //printf("bakapee2=%s\n", bakapee2);\r
+ MM_FreePtr(BBUFPTR, &gvar);\r
+ ShutdownCAMMPM(&gvar);\r
+ IN_Shutdown(&gvar);\r
+ printf("========================================\n");\r
+ printf("near= %Fp ", gvar.mm.nearheap);\r
+ printf("far= %Fp", gvar.mm.farheap);\r
+ printf("\n");\r
+ printf("&near= %Fp ", &(gvar.mm.nearheap));\r
+ printf("&far= %Fp", &(gvar.mm.farheap));\r
+ printf("\n");\r
+ #ifdef EXMMVERBOSE\r
+ printf("bigb= %Fp ", BBUF);\r
+ //printf("bigbr= %04x", BBUF);\r
+ //printf("\n");\r
+ printf("&bigb=%Fp ", BBUFPTR);\r
+ //printf("&bigb=%04x", BBUFPTR);\r
+ printf("\n");\r
+ #endif\r
+ printf("========================================\n");\r
+\r
+ #ifdef EXMMVERBOSE__\r
+ printf("coreleft(): %u\n", coreleft());\r
+ printf("farcoreleft(): %ld\n", farcoreleft());\r
+ #endif\r
+\r
+ HC_heapdump(&gvar);\r
+ printf("Project 16 ");\r
+#ifdef __WATCOMC__\r
+ printf("mmtest");\r
+#endif\r
+#ifdef __BORLANDC__\r
+ printf("bcmm");\r
+#endif\r
+ printf(".exe. This is just a test file!\n");\r
+ printf("version %s\n", VERSION);\r
+\r
+//end of program\r
+\r
+\r
+#if defined(__DEBUG__) && ( defined(__DEBUG_PM__) || defined(__DEBUG_MM__) )\r
+#ifdef __DEBUG_MM__\r
+ printf("debugmm: %u\t", dbg_debugmm);\r
+#endif\r
+#ifdef __DEBUG_PM__\r
+ printf("debugpm: %u", dbg_debugpm);\r
+#endif\r
+ printf("\n");\r
+#endif\r
+// printf("curr_mode=%u\n", gvar.video.curr_mode);\r
+// VL_PrintmodexmemInfo(&gvar.video);\r
+ //printf("old_mode=%u VL_Started=%u", gvar.video.old_mode, gvar.video.VL_Started);\r
+ //printf("based core left: %lu\n", (dword)_basedcoreleft());\r
+ //printf("huge core left: %lu\n", (dword)_hugecoreleft());\r
+}\r