1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover
\r
4 * This file is part of Project 16.
\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
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
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
25 #include "src/lib/16_head.h"
\r
26 #include "src/lib/16_tail.h"
\r
27 #include "src/lib/16_pm.h"
\r
28 #include "src/lib/16_ca.h"
\r
29 #include "src/lib/16_mm.h"
\r
30 #include "src/lib/16_hc.h"
\r
31 //#include "src/lib/16_vl.h"
\r
37 //file load or read definition
\r
39 //#define EXMMVERBOSE
\r
41 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv){}
\r
42 #define PRINTBB { printf("&main()= %Fp\n", argv[0]);printf("bigbuffer= %Fp\n", bigbuffer);printf("&bigbuffer= %Fp\n", &bigbuffer);printf("bigbuffer= %04x\n", bigbuffer);printf("&bigbuffer= %04x\n", &bigbuffer); }
\r
48 char __based( void ) * scrptr;
\r
52 printf( "Top left character is '%c'.\n", *(screen:>scrptr) );
\r
53 // printf("Next string is: [");
\r
54 // while(*scrptr<16)
\r
56 // printf("%c", *(screen:>scrptr));
\r
62 // printf("press any key to continue!\n");
\r
66 //static global_game_variables_t gvar;
\r
69 main(int argc, char *argv[])
\r
72 static global_game_variables_t gvar;
\r
73 //#ifdef __WATCOMC__
\r
78 //static byte bakapee[64];
\r
79 char *bakapee1, *bakapee2;
\r
86 bakapee1 = malloc(64);
\r
87 bakapee2 = malloc(64);
\r
90 gvar.mm.mmstarted=0;
\r
93 dbg_debugpm=1; //debug pm
\r
97 if(argv[1]){ bakapee1 = argv[1];
\r
98 if(argv[2]) bakapee2 = argv[2]; }
\r
100 //{ printf("filename!: "); scanf("%[^\n]", &bakapee); }
\r
101 bakapee1 = "data/koishi~.pcx";
\r
102 bakapee2 = "data/test.map";
\r
104 //printf("main()=%Fp start MM\n", *argv[0]);
\r
107 //#ifdef __WATCOMC__
\r
108 #ifdef __DEBUG_PM__
\r
113 //printf("pmstarted ok\n");
\r
114 //PM_CheckMainMem(&gvar);
\r
115 PM_UnlockMainMem(&gvar);
\r
116 #ifdef __DEBUG_PM__
\r
121 // printf(" done!\n");
\r
123 // printf("press any key to continue!\n");
\r
128 // bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);
\r
129 // printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
\r
130 // if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&gvar.mm))
\r
134 if(CA_ReadFile(bakapee2, &bigbuffer, &gvar)) baka=1; else baka=0;
\r
140 if(CA_LoadFile(bakapee1, &bigbuffer, &gvar)) baka=1; else baka=0;
\r
142 // close(bakapeehandle);
\r
143 //hmm functions in cache system use the buffered stuff
\r
144 //#ifdef __WATCOMC__
\r
145 // printf("\nsize of big buffer~=%u\n", _bmsize(sega, bigbuffer));
\r
148 printf("contents of the buffer\n[\n%s\n]\n", bigbuffer);
\r
149 //printf("dark purple = purgable\n");
\r
150 //printf("medium blue = non purgable\n");
\r
151 //printf("red = locked\n");
\r
152 // printf("press any key to continue!\n");
\r
153 // DebugMemory_(&gvar, 1);
\r
154 if(baka) printf("\nyay!\n");
\r
155 else printf("\npoo!\n");
\r
156 printf("press any key to continue!\n");
\r
161 DebugMemory_(&gvar, 1);
\r
162 MM_DumpData(&gvar);
\r
164 //printf("bakapee1=%s\n", bakapee1);
\r
165 //printf("bakapee2=%s\n", bakapee2);
\r
166 MM_FreePtr(&bigbuffer, &gvar);
\r
167 //#ifdef __WATCOMC__
\r
168 #ifdef __DEBUG_PM__
\r
171 PM_Shutdown(&gvar);
\r
173 CA_Shutdown(&gvar);
\r
174 MM_Shutdown(&gvar);
\r
175 free(bakapee1); free(bakapee2);
\r
176 printf("========================================\n");
\r
177 printf("near= %Fp ", gvar.mm.nearheap);
\r
178 printf("far= %Fp", gvar.mm.farheap);
\r
180 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
181 printf("&far= %Fp", &(gvar.mm.farheap));
\r
184 printf("bigb= %Fp ", bigbuffer);
\r
185 //printf("bigbr= %04x", bigbuffer);
\r
187 printf("&bigb=%Fp ", &bigbuffer);
\r
188 //printf("&bigb=%04x", &bigbuffer);
\r
190 printf("========================================\n");
\r
193 //this is far printf("Total free: %lu\n", (dword)(GetFreeSize()));
\r
194 printf("Total near free: %lub\n", (dword)(GetNearFreeSize()));
\r
195 printf("Total far free: %lub\n", (dword)(GetFarFreeSize()));
\r
199 printf("Project 16 exmmtest.exe. This is just a test file!\n");
\r
200 printf("version %s\n", VERSION);
\r
201 //printf("core left: %lu\n", (dword)_coreleft());
\r
202 //printf("far core left: %lu\n", (dword)_farcoreleft());
\r
203 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
204 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r