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
40 //#ifdef __BORLANDC__
\r
44 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)
\r
46 printf("VGAmodeX dummy:\n %Fp %Fp %Fp\n", &vq, &cmem, gv);
\r
49 printf("&main()= %Fp\n", argv[0]);\
\r
50 printf("gvar.ca.tinf[0]:\n");\
\r
51 printf(" %Fp\t", gvar.ca.tinf[0]);\
\r
52 printf("&%Fp\n", &gvar.ca.tinf[0]);\
\r
53 printf(" %04x\t", gvar.ca.tinf[0]);\
\r
54 printf("& %04x\n", &gvar.ca.tinf[0]);\
\r
56 //printf("&main()= %Fp\n", *argv[0]);
\r
57 //printf("bigbuffer= %Fp\n", bigbuffer);
\r
58 //printf("&bigbuffer= %Fp\n", &bigbuffer);
\r
59 //printf("bigbuffer= %04x\n", bigbuffer);
\r
60 //printf("&bigbuffer= %04x\n", &bigbuffer);
\r
65 char __based( void ) * scrptr;
\r
69 printf( "Top left character is '%c'.\n", *(screen:>scrptr) );
\r
70 // printf("Next string is: [");
\r
71 // while(*scrptr<16)
\r
73 // printf("%c", *(screen:>scrptr));
\r
79 // printf("press any key to continue!\n");
\r
83 //static global_game_variables_t gvar;
\r
86 main(int argc, char *argv[])
\r
89 static global_game_variables_t gvar;
\r
90 //#ifdef __WATCOMC__
\r
93 //static byte bakapee[64];
\r
94 char *bakapee1, *bakapee2;
\r
101 bakapee1 = malloc(64);
\r
102 bakapee2 = malloc(64);
\r
106 #ifdef __DEBUG_PM__
\r
107 dbg_debugpm=1; //debug pm
\r
112 if(argv[1]){ bakapee1 = argv[1];
\r
113 if(argv[2]) bakapee2 = argv[2]; }
\r
115 //{ printf("filename!: "); scanf("%[^\n]", &bakapee); }
\r
116 bakapee1 = "data/koishi~.pcx";
\r
117 bakapee2 = "data/test.map";
\r
119 //printf("main()=%Fp start MM\n", *argv[0]);
\r
123 #ifdef __DEBUG_PM__
\r
127 PM_Startup(&gvar); PM_CheckMainMem(&gvar); PM_UnlockMainMem(&gvar);
\r
128 #ifdef __DEBUG_PM__
\r
133 // printf(" done!\n");
\r
135 // printf("press any key to continue!\n"); getch();
\r
139 // printf("size of big buffer~=%u\n", _bmsize(segu, gvar.ca.tinf[0]));
\r
143 if(CA_ReadFile(bakapee2, &gvar.ca.tinf[0], &gvar)) baka=1; else baka=0;
\r
149 if(CA_LoadFile(bakapee1, &gvar.ca.tinf[0], &gvar)) baka=1; else baka=0;
\r
151 //#ifdef __WATCOMC__
\r
152 // printf("\nsize of big buffer~=%u\n", _bmsize(sega, gvar.ca.tinf[0]));
\r
155 printf("contents of the buffer\n[\n%s\n]\n", (gvar.ca.tinf[0]));
\r
159 //printf("dark purple = purgable\n");
\r
160 //printf("medium blue = non purgable\n");
\r
161 //printf("red = locked\n");
\r
162 // printf("press any key to continue!\n");
\r
163 // DebugMemory_(&gvar, 1);
\r
164 if(baka) printf("\nyay!\n");
\r
165 else printf("\npoo!\n");
\r
166 printf("press any key to continue!\n");
\r
171 DebugMemory_(&gvar, 1);
\r
172 MM_DumpData(&gvar);
\r
174 //printf("bakapee1=%s\n", bakapee1);
\r
175 //printf("bakapee2=%s\n", bakapee2);
\r
176 MM_FreePtr(&gvar.ca.tinf[0], &gvar);
\r
178 #ifdef __DEBUG_PM__
\r
181 PM_Shutdown(&gvar);
\r
183 CA_Shutdown(&gvar);
\r
184 MM_Shutdown(&gvar);
\r
185 free(bakapee1); free(bakapee2);
\r
186 printf("========================================\n");
\r
187 printf("near= %Fp ", gvar.mm.nearheap);
\r
188 printf("far= %Fp", gvar.mm.farheap);
\r
190 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
191 printf("&far= %Fp", &(gvar.mm.farheap));
\r
194 printf("bigb= %Fp ", gvar.ca.tinf[0]);
\r
195 //printf("bigbr= %04x", gvar.ca.tinf[0]);
\r
197 printf("&bigb=%Fp ", &gvar.ca.tinf[0]);
\r
198 //printf("&bigb=%04x", &gvar.ca.tinf[0]);
\r
200 printf("========================================\n");
\r
204 //this is far printf("Total free: %lu\n", (dword)(GetFreeSize()));
\r
205 printf("Total near free: %lub\n", (dword)(GetNearFreeSize()));
\r
206 printf("Total far free: %lub\n", (dword)(GetFarFreeSize()));
\r
210 #ifdef __BORLANDC__
\r
211 //printf("core left: %lu\n", (dword)_coreleft());
\r
212 //printf("far core left: %lu\n", (dword)_farcoreleft());
\r
213 printf("core left: %lu\n", (dword)coreleft());
\r
214 printf("far core left: %lu\n", (dword)farcoreleft());
\r
216 printf("Project 16 exmmtest.exe. This is just a test file!\n");
\r
217 printf("version %s\n", VERSION);
\r
220 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
221 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r