-/* 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.
- *
- */
-/*
- input test
-*/
-#include "src/lib/16_ca.h"
-#include "src/lib/16_mm.h"
-#include "src/lib/modex16.h"
-
-#define FILERL
-
-void
-main(int argc, char *argv[])
-{
- mminfo_t mm; mminfotype mmi;
- memptr bigbuffer;
- __segment segu;
- char *bakapee;
- word baka;
- page_t screen;
-
- bakapee = malloc(64);
-// memset(bakapee, 0, 64);
- mm.mmstarted=0;
-
- if(argv[1]) bakapee = argv[1];
- else bakapee = "data/koishi~~.pcx";
- //if(argv[2])
-// #define FILEINIT
-
- textInit();\r
-
- /* setup camera and screen~ */\r
- screen = modexDefaultPage();\r
- screen.width += (16*2);\r
- screen.height += (16*2);
-
- printf(" start!\n");
- MM_Startup(&mm, &mmi);
- printf(" done!\n");
- printf("&main()=%Fp\n", *argv[0]);
-#ifdef FILERL
-#ifdef FILEINIT
- printf(" read\n");
- if(CA_ReadFile(bakapee, &bigbuffer, &mm/*, &mmi*/))
-#else
- printf(" load\n");
- if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi))
-#endif
- baka=1;
- else
- baka=0;
-#endif
- //MM_GetPtr(&bigbuffer, mmi.nearheap, &mm, &mmi);
- //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(&screen, &mm, &mmi);
- printf(" stop!\n");
- MM_FreePtr(&bigbuffer, &mm);
- MM_Shutdown(&mm);
- printf(" done!\n");
-#ifdef FILERL
- free(bakapee);
- //printf("_bios_memsize=%u\n", _bios_memsize());
- if(baka) printf("\nyay!\n");
- else printf("\npoo!\n");
-#endif
-}
+/* Project 16 Source Code~\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
+ * (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
+ exmm test\r
+*/\r
+//#include <stdio.h>\r
+//#include <bios.h>\r
+\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/16_hc.h"\r
+//#include "src/lib/modex16.h"\r
+#pragma hdrstop\r
+\r
+#pragma warn -pro\r
+#pragma warn -use\r
+\r
+//file load or read definition\r
+#define FILERL\r
+//#define FILEREAD\r
+\r
+global_game_variables_t gvar;\r
+\r
+void\r
+main(int argc, char *argv[])\r
+{\r
+ mminfo_t mm; mminfotype mmi;\r
+#ifdef __WATCOMC__\r
+ __segment sega;\r
+ void __based(sega)* bigbuffer;\r
+#endif\r
+#ifdef __BORLANDC__\r
+ memptr bigbuffer;\r
+#endif\r
+#ifdef FILERL\r
+ //static byte bakapee[64];\r
+ char *bakapee;\r
+ word baka;\r
+#endif\r
+ //static page_t screen;\r
+\r
+#ifdef __BORLANDC__\r
+ argc=argc;\r
+#endif\r
+ //printf("&main()= %Fp\n", *argv[0]);\r
+ //printf("bigbuffer= %Fp\n", bigbuffer);\r
+ //printf("&bigbuffer= %Fp\n", &bigbuffer);\r
+ //printf("bigbuffer= %04x\n", bigbuffer);\r
+ //printf("&bigbuffer= %04x\n", &bigbuffer);\r
+\r
+#ifdef FILERL\r
+ bakapee = malloc(64);\r
+#endif\r
+ mm.mmstarted=0;\r
+\r
+#ifdef FILERL\r
+// printf("filename!: ");\r
+// scanf("%[^\n]", &bakapee);\r
+ if(argv[1]) bakapee = argv[1];\r
+ else bakapee = "data/koishi~.pcx";\r
+#endif\r
+\r
+// textInit();\r
+\r
+ // setup camera and screen~\r
+ //bug!!!\r
+ //screen = modexDefaultPage();\r
+ //screen.width += (16*2);\r
+ //screen.height += (16*2);\r
+\r
+// printf("main()=%Fp start MM\n", *argv[0]);\r
+ MM_Startup(&mm, &mmi);\r
+ //PM_Startup();\r
+ //PM_UnlockMainMem();\r
+ CA_Startup(&gvar);\r
+// printf(" done!\n");\r
+ //printf("&main()= %Fp\n", *argv[0]);\r
+ //printf("bigbuffer= %Fp\n", bigbuffer);\r
+ //printf("&bigbuffer= %Fp\n", &bigbuffer);\r
+ //printf("bigbuffer= %04x\n", bigbuffer);\r
+ //printf("&bigbuffer= %04x\n", &bigbuffer);\r
+// getch();\r
+#ifdef FILERL\r
+// bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);\r
+// printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));\r
+// if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&mm))\r
+#ifdef FILEREAD\r
+ printf(" read\n");\r
+ if(CA_ReadFile(bakapee, &bigbuffer, &mm))\r
+#else\r
+ printf(" load\n");\r
+ if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi))\r
+#endif\r
+ baka=1;\r
+ else\r
+ baka=0;\r
+// close(bakapeehandle);\r
+ //hmm functions in cache system use the buffered stuff\r
+#ifdef __WATCOMC__\r
+ printf("size of big buffer~=%u\n", _bmsize(sega, bigbuffer));\r
+#endif\r
+#endif\r
+ printf("press any key to continue!\n");\r
+ getch();\r
+ printf("[\n%s\n]\n", bigbuffer);\r
+ //printf("dark purple = purgable\n");\r
+ //printf("medium blue = non purgable\n");\r
+ //printf("red = locked\n");\r
+ printf("press any key to continue!\n");\r
+ getch();\r
+ //++++modexEnter();\r
+ //++++modexShowPage(&screen);\r
+ MM_ShowMemory(&gvar, &mm);\r
+ //getch();\r
+ MM_DumpData(&mm);\r
+ //++++modexLeave();\r
+ //++++MM_Report(&mm, &mmi);\r
+// printf(" stop!\n");\r
+#ifdef FILERL\r
+ MM_FreePtr(&bigbuffer, &mm);\r
+#endif\r
+ //PM_Shutdown();\r
+ CA_Shutdown(&gvar);\r
+ MM_Shutdown(&mm);\r
+// printf(" done!\n");\r
+#ifdef FILERL\r
+ free(bakapee);\r
+ if(baka) printf("\nyay!\n");\r
+ else printf("\npoo!\n");\r
+#endif\r
+ printf("========================================\n");\r
+ printf("near= %Fp ", mm.nearheap);\r
+ printf("far= %Fp", mm.farheap);\r
+ printf("\n");\r
+ printf("&near= %Fp ", &(mm.nearheap));\r
+ printf("&far= %Fp", &(mm.farheap));\r
+ printf("\n");\r
+ printf("bigb= %Fp ", bigbuffer);\r
+ //printf("bigbr= %04x", bigbuffer);\r
+ //printf("\n");\r
+ printf("&bigb=%Fp ", &bigbuffer);\r
+ //printf("&bigb=%04x", &bigbuffer);\r
+ printf("\n");\r
+ printf("========================================\n");\r
+#ifdef __WATCOMC__\r
+ printf("Total free: %lu\n", (dword)(GetFreeSize()));\r
+ printf("Total near free: %lu\n", (dword)(GetNearFreeSize()));\r
+ printf("Total far free: %lu\n", (dword)(GetFarFreeSize()));\r
+ heapdump(&gvar);\r
+ printf("Project 16 emmtest.exe. This is just a test file!\n");\r
+ printf("version %s\n", VERSION);\r
+#endif\r
+ //printf("core left: %lu\n", (dword)_coreleft());\r
+ //printf("far core left: %lu\n", (dword)_farcoreleft());\r
+ //printf("based core left: %lu\n", (dword)_basedcoreleft());\r
+ //printf("huge core left: %lu\n", (dword)_hugecoreleft());\r
+}\r