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/exmmtest.h"
\r
27 ////////////////////////////////////////////////////////////////////////////
\r
29 void VL_Startup (global_game_variables_t *gvar){ gvar=gvar; }
\r
30 void VL_Shutdown (global_game_variables_t *gvar){ gvar=gvar; }
\r
31 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)
\r
33 printf("VGAmodeX dummy:\n %Fp %Fp %Fp\n", &vq, &cmem, gv);
\r
37 VL_modexPalOverscan(byte *p, word col)
\r
40 //modexWaitBorder();
\r
41 // vga_wait_for_vsync();
\r
42 outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
\r
43 for(i=col; i<(3+col); i++)
\r
45 outp(PAL_DATA_REG, p[i]);
\r
50 void TL_VidInit(global_game_variables_t *gvar)
\r
52 gvar->video.old_mode = 3;
\r
56 void VL_ShowPage(page_t *page, boolean vsync, boolean sr){}
\r
57 void modexClearRegion(page_t *page, int x, int y, int w, int h, byte color){}
\r
58 void modexprint(page_t *page, sword x, sword y, word t, boolean tlsw, word color, word bgcolor, boolean vidsw, const byte *str){ printf("%s\n", str); }
\r
59 void VL_print(const byte *str, nibble pagenum, global_game_variables_t *gvar){ printf("%s\n", str); }
\r
60 void modexpdump(nibble pagenum, global_game_variables_t *gvar){}
\r
68 char __based( void ) * scrptr;
\r
72 printf( "Top left character is '%c'.\n", *(screen:>scrptr) );
\r
73 // printf("Next string is: [");
\r
74 // while(*scrptr<16)
\r
76 // printf("%c", *(screen:>scrptr));
\r
87 #define FILENAME_1 "data/spri/chikyuu.vrs"
\r
88 #define FILENAME_2 "data/test.map"
\r
90 #define FILENAME_1 "data/koishi~.pcx"
\r
91 #define FILENAME_2 "data/test.map"
\r
94 //===========================================================================//
\r
96 //=======================================//
\r
100 //=======================================//
\r
102 main(int argc, char *argv[])
\r
104 static global_game_variables_t gvar;
\r
108 //0000mmblocktype far *scan;
\r
110 char bakapee1[64] = FILENAME_1;
\r
111 char bakapee2[64] = FILENAME_2;
\r
113 #ifdef __BORLANDC__
\r
118 //0000PRINTBB; KEYP
\r
121 #ifdef __DEBUG_PM__
\r
122 dbg_debugpm=1; //debug pm
\r
125 #ifdef __DEBUG_CA__
\r
128 #ifdef __DEBUG_MM__
\r
132 if(argv[1]){ strcpy(bakapee1, argv[1]);//bakapee1[] = *argv[1];
\r
133 if(argv[2]) strcpy(bakapee2, argv[2]); }//bakapee2[] = argv[2]; }
\r
135 printf("bakapee1[%s]\n", bakapee1);
\r
136 printf("bakapee2[%s]\n", bakapee2);
\r
137 #ifdef EXMMVERBOSE__
\r
138 printf("coreleft(): %u\n", coreleft());
\r
139 printf("farcoreleft(): %ld\n", farcoreleft());
\r
141 printf("stackavail()=%u\n", stackavail());
\r
146 // save the palette
\r
147 modexPalSave(&gvar.video.dpal); //modexFadeOff(4, &gvar.video.dpal); //modexPalBlack();
\r
149 StartupCAMMPM(&gvar);
\r
150 #endif //elsed NOVID
\r
156 IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar);
\r
157 IN_SetControlType(&gvar.player[0],ctrl_Keyboard1);
\r
162 #ifdef FILEREADLOAD
\r
166 // printf("size of big buffer~=%u\n", _bmsize(segu, BBUF));
\r
169 printf("======================================read=====================================\n");
\r
170 if(CA_ReadFile(bakapee2, BBUFPTR, &gvar)) baka=1; else baka=0;
\r
171 printf("====================================read end===================================\n");
\r
176 printf("======================================load=====================================\n");
\r
177 if(CA_LoadFile(bakapee1, BBUFPTR, &gvar)) baka=1; else baka=0;
\r
178 printf("====================================load end===================================\n");
\r
181 printf("contents of the buffer\n[\n%.*s\n]\n", strlen(BBUFSTRING), BBUFSTRING);
\r
184 scan = gvar.mm.mmhead;
\r
185 while (scan->useptr != &BBUFNAME && scan)
\r
189 printf("\n %Fp %Fp\n", scan->useptr, &BBUFNAME);
\r
190 printf("\nstrlen of buffer = %zu\n", strlen(BBUFSTRING));
\r
191 printf("length of buffer = %lu\n", scan->scan->length);
\r
198 //printf("dark purple = purgable\n");
\r
199 //printf("medium blue = non purgable\n");
\r
200 //printf("red = locked\n");
\r
202 // DebugMemory_(&gvar, 1);
\r
203 if(baka) printf("\nyay!\n");
\r
204 else printf("\npoo!\n");
\r
205 #ifdef BUFFDUMPPAUSE
\r
211 #endif //filereadload
\r
215 CA_loadmap(bakapee2, &gvar.map, &gvar); //BREAKS!
\r
216 // newloadmap(bakapee2, &gvar.map);
\r
217 VRS_LoadVRS(bakapee1, &gvar.player[0].enti, &gvar);
\r
218 // HC_heapdump(&gvar);
\r
220 #endif //scrollload
\r
223 VGAmodeX(8, 0, &gvar); VL_LoadPalFileCore(&gvar.video.palette, &gvar);
\r
225 modexHiganbanaPageSetup(&gvar);
\r
226 gvar.video.page[0].dx = gvar.video.page[0].dy = 0;
\r
227 // VL_modexPalScramble(&gvar.video.palette);
\r
228 // ShapeTest_(&gvar);
\r
230 MM_ShowMemory(&gvar);
\r
235 for (done = false;!done;)
\r
237 while (!(scan = gvar.in.inst->LastScan))
\r
245 // MM_ShowMemory(&gvar);
\r
247 //#ifdef __WATCOMC__
\r
249 VL_modexPalScramble(&gvar.video.palette); modexpdump(&gvar.video.page);
\r
252 modexpdump(&gvar.video.page[0]);
\r
255 VL_PatternDraw(&gvar.video, 0, 1, 1);
\r
267 if(gvar.video.VL_Started)
\r
268 VL_Shutdown (&gvar);//VGAmodeX(0, 0, gvar);
\r
269 modexFadeOn(4, gvar.video.dpal);
\r
271 DebugMemory_(&gvar, 1);
\r
272 MM_DumpData(&gvar);
\r
275 //printf("bakapee1=%s\n", bakapee1);
\r
276 //printf("bakapee2=%s\n", bakapee2);
\r
277 MM_FreePtr(BBUFPTR, &gvar);
\r
281 ShutdownCAMMPM(&gvar);
\r
283 IN_Shutdown(&gvar);
\r
284 printf("========================================\n");
\r
285 printf("near= %Fp ", gvar.mm.nearheap);
\r
286 printf("far= %Fp", gvar.mm.farheap);
\r
288 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
289 printf("&far= %Fp", &(gvar.mm.farheap));
\r
292 printf("bigb= %Fp ", BBUF);
\r
293 //printf("bigbr= %04x", BBUF);
\r
295 printf("&bigb=%Fp ", BBUFPTR);
\r
296 //printf("&bigb=%04x", BBUFPTR);
\r
299 printf("========================================\n");
\r
301 #ifdef EXMMVERBOSE__
\r
302 printf("coreleft(): %u\n", coreleft());
\r
303 printf("farcoreleft(): %ld\n", farcoreleft());
\r
306 //this is far printf("Total free: %lu\n", (dword)(HC_GetFreeSize()));
\r
307 //super buggy printf("HC_coreleft(): %u\n", HC_coreleft());
\r
308 // printf("HC_farcoreleft(): %lu\n", (dword)HC_farcoreleft());
\r
309 //printf("HC_GetNearFreeSize(): %u\n", HC_GetNearFreeSize());
\r
310 //printf("HC_GetFarFreeSize(): %lu\n", (dword)HC_GetFarFreeSize());
\r
313 #ifdef __BORLANDC__
\r
314 // printf("HC_coreleft: %lu\n", (dword)HC_coreleft());
\r
315 // printf("HC_farcoreleft: %lu\n", (dword)HC_farcoreleft());
\r
316 // printf("HC_Newfarcoreleft(): %lu\n", (dword)HC_Newfarcoreleft());
\r
318 HC_heapdump(&gvar);
\r
319 printf("Project 16 ");
\r
321 printf("exmmtest");
\r
323 #ifdef __BORLANDC__
\r
326 printf(".exe. This is just a test file!\n");
\r
327 printf("version %s\n", VERSION);
\r
332 #if defined(__DEBUG__) && ( defined(__DEBUG_PM__) || defined(__DEBUG_MM__) )
\r
333 #ifdef __DEBUG_MM__
\r
334 printf("debugmm: %u\t", dbg_debugmm);
\r
336 #ifdef __DEBUG_PM__
\r
337 printf("debugpm: %u", dbg_debugpm);
\r
341 // printf("curr_mode=%u\n", gvar.video.curr_mode);
\r
342 // VL_PrintmodexmemInfo(&gvar.video);
\r
343 //printf("old_mode=%u VL_Started=%u", gvar.video.old_mode, gvar.video.VL_Started);
\r
344 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
345 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r