]> 4ch.mooo.com Git - 16.git/blob - src/exmmtest.c
They now behave the same!! ^^ but there is a problem!! ><
[16.git] / src / exmmtest.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 /*\r
23         exmm test\r
24 */\r
25 //#include <stdio.h>\r
26 //#include <bios.h>\r
27 \r
28 #include "src/lib/16_head.h"\r
29 #include "src/lib/16_ca.h"\r
30 #include "src/lib/16_mm.h"\r
31 #include "src/lib/16_hc.h"\r
32 //#include "src/lib/modex16.h"\r
33 #pragma hdrstop\r
34 \r
35 #pragma warn -pro\r
36 #pragma warn -use\r
37 \r
38 //file load or read definition\r
39 #define FILERL\r
40 //#define FILEREAD\r
41 \r
42 void\r
43 main(int argc, char *argv[])\r
44 {\r
45         mminfo_t mm; mminfotype mmi;\r
46 #ifdef __WATCOMC__\r
47         __segment sega;\r
48         void __based(sega)* bigbuffer;\r
49 #endif\r
50 #ifdef __BORLANDC__\r
51         memptr bigbuffer;\r
52 #endif\r
53 #ifdef FILERL\r
54         char *bakapee;\r
55         word baka;\r
56 #endif\r
57         //static page_t screen;\r
58 \r
59 #ifdef __BORLANDC__\r
60         argc=argc;\r
61 #endif\r
62         printf("&main()=        %Fp\n", *argv[0]);\r
63         printf("bigbuffer=      %Fp\n", bigbuffer);\r
64         printf("&bigbuffer=     %Fp\n", &bigbuffer);\r
65         printf("bigbuffer=      %04x\n", bigbuffer);\r
66         printf("&bigbuffer=     %04x\n", &bigbuffer);\r
67 \r
68 #ifdef FILERL\r
69         bakapee = malloc(64);\r
70 #endif\r
71         mm.mmstarted=0;\r
72 \r
73 #ifdef FILERL\r
74         if(argv[1]) bakapee = argv[1];\r
75         else bakapee = "data/koishi~.pcx";\r
76 #endif\r
77 \r
78 //      textInit();\r
79 \r
80         /* setup camera and screen~ */\r
81         //bug!!!\r
82         //screen = modexDefaultPage();\r
83         /*screen.width += (16*2);\r
84         screen.height += (16*2);*/\r
85 \r
86         printf("main()=%Fp      start MM\n", *argv[0]);\r
87         MM_Startup(&mm, &mmi);\r
88         //PM_Startup();\r
89         //PM_UnlockMainMem();\r
90         CA_Startup();\r
91         printf("                done!\n");\r
92         printf("&main()=        %Fp\n", *argv[0]);\r
93         printf("bigbuffer=      %Fp\n", bigbuffer);\r
94         printf("&bigbuffer=     %Fp\n", &bigbuffer);\r
95         printf("bigbuffer=      %04x\n", bigbuffer);\r
96         printf("&bigbuffer=     %04x\n", &bigbuffer);\r
97 //      getch();\r
98 #ifdef FILERL\r
99 //      bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);\r
100 //      printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));\r
101 //      if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&mm))\r
102 #ifdef FILEREAD\r
103         printf("                read\n");\r
104         if(CA_ReadFile(bakapee, &bigbuffer, &mm))\r
105 #else\r
106         printf("                load\n");\r
107         if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi))\r
108 #endif\r
109                 baka=1;\r
110         else\r
111                 baka=0;\r
112 //      close(bakapeehandle);\r
113         //hmm functions in cache system use the buffered stuff\r
114 #ifdef __WATCOMC__\r
115         printf("size of big buffer~=%u\n", _bmsize(sega, bigbuffer));\r
116 #endif\r
117 #endif\r
118         printf("dark purple = purgable\n");\r
119         printf("medium blue = non purgable\n");\r
120         printf("red = locked\n");\r
121         getch();\r
122         //++++modexEnter();\r
123         //++++modexShowPage(&screen);\r
124         MM_ShowMemory(/*&screen, */&mm);\r
125         //getch();\r
126         MM_DumpData(&mm);\r
127         //++++modexLeave();\r
128         MM_Report(&mm, &mmi);\r
129         printf("                stop!\n");\r
130 #ifdef FILERL\r
131         MM_FreePtr(&bigbuffer, &mm);\r
132 #endif\r
133         //PM_Shutdown();\r
134         CA_Shutdown();\r
135         MM_Shutdown(&mm);\r
136         printf("                done!\n");\r
137 #ifdef FILERL\r
138         free(bakapee);\r
139         if(baka) printf("\nyay!\n");\r
140         else printf("\npoo!\n");\r
141 #endif\r
142         printf("bigbuffer=      %Fp\n", bigbuffer);\r
143         printf("&bigbuffer=     %Fp\n", &bigbuffer);\r
144         printf("bigbuffer=      %04x\n", bigbuffer);\r
145         printf("&bigbuffer=     %04x\n", &bigbuffer);\r
146         /*printf("\n\n");\r
147         printf("Total free:                     %lu\n", (dword)(GetFreeSize()));\r
148         printf("Total near free:                %lu\n", (dword)(GetNearFreeSize()));\r
149         printf("Total far free:                 %lu\n", (dword)(GetFarFreeSize()));\r
150         getch();*/\r
151         printf("\n");\r
152 #ifdef __WATCOMC__\r
153         heapdump();\r
154 #endif\r
155         //printf("core left:                    %lu\n", (dword)_coreleft());\r
156         //printf("far core left:                        %lu\n", (dword)_farcoreleft());\r
157         //printf("based core left:                      %lu\n", (dword)_basedcoreleft());\r
158         //printf("huge core left:                       %lu\n", (dword)_hugecoreleft());\r
159 }\r