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/spri/chikyuu.sht"
\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
109 char bakapee1[64] = FILENAME_1;
\r
110 char bakapee2[64] = FILENAME_2;
\r
112 #ifdef __BORLANDC__
\r
117 //0000PRINTBB; KEYP
\r
120 #ifdef __DEBUG_PM__
\r
121 dbg_debugpm=1; //debug pm
\r
124 #ifdef __DEBUG_CA__
\r
127 #ifdef __DEBUG_MM__
\r
131 if(argv[1]){ strcpy(bakapee1, argv[1]);//bakapee1[] = *argv[1];
\r
132 if(argv[2]) strcpy(bakapee2, argv[2]); }//bakapee2[] = argv[2]; }
\r
134 printf("bakapee1[%s]\n", bakapee1);
\r
135 printf("bakapee2[%s]\n", bakapee2);
\r
136 #ifdef EXMMVERBOSE__
\r
137 printf("coreleft(): %u\n", coreleft());
\r
138 printf("farcoreleft(): %ld\n", farcoreleft());
\r
140 printf("stackavail()=%u\n", stackavail());
\r
145 // save the palette
\r
146 modexPalSave(&gvar.video.dpal); //modexFadeOff(4, &gvar.video.dpal); //modexPalBlack();
\r
148 StartupCAMMPM(&gvar);
\r
149 #endif //elsed NOVID
\r
155 IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar);
\r
156 IN_SetControlType(&gvar.player[0],ctrl_Keyboard1);
\r
161 #ifdef FILEREADLOAD
\r
165 // printf("size of big buffer~=%u\n", _bmsize(segu, BBUF));
\r
168 printf("======================================read=====================================\n");
\r
169 if(CA_ReadFile(bakapee2, BBUFPTR, &gvar)) baka=1; else baka=0;
\r
170 printf("====================================read end===================================\n");
\r
175 printf("======================================load=====================================\n");
\r
176 if(CA_LoadFile(bakapee1, BBUFPTR, &gvar)) baka=1; else baka=0;
\r
177 printf("====================================load end===================================\n");
\r
184 if(!w) fh = fopen(bakapee1, "r");
\r
185 else fh = fopen(bakapee2, "r");
\r
186 file_s = filesize(fh);
\r
188 printf("contents of the buffer\n[\n%.*s\n]\n", file_s, BBUFSTRING);
\r
191 // mmblocktype far *scan;
\r
192 // scan = gvar.mm.mmhead;
\r
193 // while (scan->useptr != &BBUFNAME && scan)
\r
195 // scan = scan->next;
\r
197 // printf("\n %Fp %Fp\n", scan->useptr, &BBUFNAME);
\r
198 printf("\nstrlen of buffer = %zu\n", strlen(BBUFSTRING));
\r
199 printf("length of buffer = %zu\n", file_s);
\r
200 // printf("length of buffer = %lu\n", scan->length);
\r
208 //printf("dark purple = purgable\n");
\r
209 //printf("medium blue = non purgable\n");
\r
210 //printf("red = locked\n");
\r
212 // DebugMemory_(&gvar, 1);
\r
213 if(baka) printf("\nyay!\n");
\r
214 else printf("\npoo!\n");
\r
215 #ifdef BUFFDUMPPAUSE
\r
221 #endif //filereadload
\r
225 CA_loadmap(bakapee2, &gvar.map, &gvar); //BREAKS!
\r
226 // newloadmap(bakapee2, &gvar.map);
\r
227 VRS_LoadVRS(bakapee1, &gvar.player[0].enti, &gvar);
\r
228 // HC_heapdump(&gvar);
\r
230 #endif //scrollload
\r
233 VGAmodeX(8, 0, &gvar); VL_LoadPalFileCore(&gvar.video.palette, &gvar);
\r
235 modexHiganbanaPageSetup(&gvar);
\r
236 gvar.video.page[0].dx = gvar.video.page[0].dy = 0;
\r
237 // VL_modexPalScramble(&gvar.video.palette);
\r
238 // ShapeTest_(&gvar);
\r
240 MM_ShowMemory(&gvar);
\r
245 for (done = false;!done;)
\r
247 while (!(scan = gvar.in.inst->LastScan))
\r
255 // MM_ShowMemory(&gvar);
\r
257 //#ifdef __WATCOMC__
\r
259 VL_modexPalScramble(&gvar.video.palette); modexpdump(&gvar.video.page);
\r
262 modexpdump(&gvar.video.page[0]);
\r
265 VL_PatternDraw(&gvar.video, 0, 1, 1);
\r
277 if(gvar.video.VL_Started)
\r
278 VL_Shutdown (&gvar);//VGAmodeX(0, 0, gvar);
\r
279 modexFadeOn(4, gvar.video.dpal);
\r
281 DebugMemory_(&gvar, 1);
\r
282 MM_DumpData(&gvar);
\r
285 //printf("bakapee1=%s\n", bakapee1);
\r
286 //printf("bakapee2=%s\n", bakapee2);
\r
287 MM_FreePtr(BBUFPTR, &gvar);
\r
291 ShutdownCAMMPM(&gvar);
\r
293 IN_Shutdown(&gvar);
\r
294 printf("========================================\n");
\r
295 printf("near= %Fp ", gvar.mm.nearheap);
\r
296 printf("far= %Fp", gvar.mm.farheap);
\r
298 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
299 printf("&far= %Fp", &(gvar.mm.farheap));
\r
302 printf("bigb= %Fp ", BBUF);
\r
303 //printf("bigbr= %04x", BBUF);
\r
305 printf("&bigb=%Fp ", BBUFPTR);
\r
306 //printf("&bigb=%04x", BBUFPTR);
\r
309 printf("========================================\n");
\r
311 #ifdef EXMMVERBOSE__
\r
312 printf("coreleft(): %u\n", coreleft());
\r
313 printf("farcoreleft(): %ld\n", farcoreleft());
\r
316 //this is far printf("Total free: %lu\n", (dword)(HC_GetFreeSize()));
\r
317 //super buggy printf("HC_coreleft(): %u\n", HC_coreleft());
\r
318 // printf("HC_farcoreleft(): %lu\n", (dword)HC_farcoreleft());
\r
319 //printf("HC_GetNearFreeSize(): %u\n", HC_GetNearFreeSize());
\r
320 //printf("HC_GetFarFreeSize(): %lu\n", (dword)HC_GetFarFreeSize());
\r
323 #ifdef __BORLANDC__
\r
324 // printf("HC_coreleft: %lu\n", (dword)HC_coreleft());
\r
325 // printf("HC_farcoreleft: %lu\n", (dword)HC_farcoreleft());
\r
326 // printf("HC_Newfarcoreleft(): %lu\n", (dword)HC_Newfarcoreleft());
\r
328 HC_heapdump(&gvar);
\r
329 printf("Project 16 ");
\r
331 printf("exmmtest");
\r
333 #ifdef __BORLANDC__
\r
336 printf(".exe. This is just a test file!\n");
\r
337 printf("version %s\n", VERSION);
\r
342 #if defined(__DEBUG__) && ( defined(__DEBUG_PM__) || defined(__DEBUG_MM__) )
\r
343 #ifdef __DEBUG_MM__
\r
344 printf("debugmm: %u\t", dbg_debugmm);
\r
346 #ifdef __DEBUG_PM__
\r
347 printf("debugpm: %u", dbg_debugpm);
\r
351 // printf("curr_mode=%u\n", gvar.video.curr_mode);
\r
352 // VL_PrintmodexmemInfo(&gvar.video);
\r
353 //printf("old_mode=%u VL_Started=%u", gvar.video.old_mode, gvar.video.VL_Started);
\r
354 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
355 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r