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_dbg.h"
\r
38 //file load or read definition
\r
39 #define FILEREADLOAD
\r
41 //#define EXMMVERBOSE
\r
42 //#define BUFFDUMPPAUSE
\r
43 //#define EXMMVERBOSE__
\r
44 // #define PRINTBBDUMP
\r
52 //#define SCROLLLOAD
\r
56 #define KEYP IN_Shutdown(&gvar); printf("\n\npress any key to continue!\n"); getch(); IN_Startup(&gvar);
\r
58 #define BBUFNAME gvar.mm.bufferseg//bigbuffer
\r
59 //#define INITBBUF static memptr BBUFNAME;
\r
60 #define BBUFPTR MEMPTRCONV BBUFNAME
\r
63 #define BBUF (memptr *)BBUFPTR
\r
64 #define BBUFSTRING (memptr *)BBUFNAME
\r
67 #define BBUF BBUFNAME
\r
68 #define BBUFSTRING BBUF
\r
71 ////////////////////////////////////////////////////////////////////////////
\r
73 void VL_Startup (global_game_variables_t *gvar){ gvar=gvar; }
\r
74 void VL_Shutdown (global_game_variables_t *gvar){ gvar=gvar; }
\r
75 void VGAmodeX(sword vq, boolean cmem, global_game_variables_t *gv)
\r
77 printf("VGAmodeX dummy:\n %Fp %Fp %Fp\n", &vq, &cmem, gv);
\r
80 word modexPalOverscan(word col)
\r
82 //modexWaitBorder();
\r
83 outp(PAL_WRITE_REG, 0); /* start at the beginning of palette */
\r
84 outp(PAL_DATA_REG, col);
\r
87 void TL_VidInit(global_game_variables_t *gvar)
\r
89 gvar->video.old_mode = 3;
\r
93 //printf("* %Fp\t", *BBUF);
\r
94 //printf("* %04x\t", *BBUF);
\r
96 printf("-------------------------------------------------------------------------------\n");\
\r
97 printf("&main()= %Fp\n", argv[0]);\
\r
98 printf("buffer:\n");\
\r
99 printf(" %Fp\t", BBUF);\
\r
100 printf("&%Fp\n", BBUFPTR);\
\r
101 printf(" %04x\t", BBUF);\
\r
102 printf("& %04x\n", BBUFPTR);\
\r
103 printf("-------------------------------------------------------------------------------\n");\
\r
105 //printf("&main()= %Fp\n", *argv[0]);
\r
106 //printf("bigbuffer= %Fp\n", bigbuffer);
\r
107 //printf("&bigbuffer= %Fp\n", &bigbuffer);
\r
108 //printf("bigbuffer= %04x\n", bigbuffer);
\r
109 //printf("&bigbuffer= %04x\n", &bigbuffer);
\r
114 char __based( void ) * scrptr;
\r
118 printf( "Top left character is '%c'.\n", *(screen:>scrptr) );
\r
119 // printf("Next string is: [");
\r
120 // while(*scrptr<16)
\r
122 // printf("%c", *(screen:>scrptr));
\r
133 #define FILENAME_1 "data/spri/chikyuu.vrs"
\r
134 #define FILENAME_2 "data/test.map"
\r
136 #define FILENAME_1 "data/koishi~.pcx"
\r
137 #define FILENAME_2 "data/test.map"
\r
140 //===========================================================================//
\r
142 //=======================================//
\r
146 //=======================================//
\r
148 main(int argc, char *argv[])
\r
150 static global_game_variables_t gvar;
\r
155 char bakapee1[64] = FILENAME_1;
\r
156 char bakapee2[64] = FILENAME_2;
\r
158 #ifdef __BORLANDC__
\r
163 //0000PRINTBB; KEYP
\r
166 #ifdef __DEBUG_PM__
\r
167 dbg_debugpm=1; //debug pm
\r
170 #ifdef __DEBUG_CA__
\r
173 #ifdef __DEBUG_MM__
\r
177 if(argv[1]){ strcpy(bakapee1, argv[1]);//bakapee1[] = *argv[1];
\r
178 if(argv[2]) strcpy(bakapee2, argv[2]); }//bakapee2[] = argv[2]; }
\r
180 printf("bakapee1[%s]\n", bakapee1);
\r
181 printf("bakapee2[%s]\n", bakapee2);
\r
186 // save the palette
\r
187 modexPalSave(&gvar.video.dpal); //modexFadeOff(4, &gvar.video.dpal); //modexPalBlack();
\r
189 StartupCAMMPM(&gvar);
\r
190 #endif //elsed NOVID
\r
196 IN_Default(0,&gvar.player[0],ctrl_Keyboard1, &gvar);
\r
197 IN_SetControlType(&gvar.player[0],ctrl_Keyboard1);
\r
202 #ifdef FILEREADLOAD
\r
206 // printf("size of big buffer~=%u\n", _bmsize(segu, BBUF));
\r
209 printf("======================================read=====================================\n");
\r
210 if(CA_ReadFile(bakapee2, BBUFPTR, &gvar)) baka=1; else baka=0;
\r
211 printf("====================================read end===================================\n");
\r
216 printf("======================================load=====================================\n");
\r
217 if(CA_LoadFile(bakapee1, BBUFPTR, &gvar)) baka=1; else baka=0;
\r
218 printf("====================================load end===================================\n");
\r
221 printf("contents of the buffer\n[\n%s\n]\n", BBUFSTRING);
\r
227 //printf("dark purple = purgable\n");
\r
228 //printf("medium blue = non purgable\n");
\r
229 //printf("red = locked\n");
\r
231 // DebugMemory_(&gvar, 1);
\r
232 if(baka) printf("\nyay!\n");
\r
233 else printf("\npoo!\n");
\r
234 #ifdef BUFFDUMPPAUSE
\r
240 #endif //filereadload
\r
244 // #else //scrollload
\r
245 CA_loadmap(bakapee2, &gvar.map, &gvar);
\r
246 // newloadmap(bakapee2, &gvar.map);
\r
247 VRS_LoadVRS(bakapee1, &gvar.player[0].enti, &gvar);
\r
248 HC_heapdump(&gvar);
\r
250 #endif //scrollload
\r
253 VL_Startup(&gvar);// VGAmodeX(8, 0, &gvar);
\r
254 modexHiganbanaPageSetup(&gvar);
\r
255 // VL_modexPalScramble(&gvar.video.palette);
\r
256 VL_LoadPalFileCore(&gvar.video.palette, &gvar);
\r
257 // ShapeTest_(&gvar);
\r
259 MM_ShowMemory(&gvar);
\r
264 for (done = false;!done;)
\r
266 while (!(scan = gvar.in.inst->LastScan))
\r
274 // MM_ShowMemory(&gvar);
\r
276 //#ifdef __WATCOMC__
\r
278 VL_modexPalScramble(&gvar.video.palette); modexpdump(&gvar.video.page);
\r
281 modexpdump(&gvar.video.page[0]);
\r
284 VL_PatternDraw(&gvar.video, 0, 1, 1);
\r
296 if(gvar.video.VL_Started)
\r
297 VL_Shutdown (&gvar);//VGAmodeX(0, 0, gvar);
\r
298 modexFadeOn(4, gvar.video.dpal);
\r
300 DebugMemory_(&gvar, 1);
\r
301 MM_DumpData(&gvar);
\r
303 //printf("bakapee1=%s\n", bakapee1);
\r
304 //printf("bakapee2=%s\n", bakapee2);
\r
305 MM_FreePtr(BBUFPTR, &gvar);
\r
309 ShutdownCAMMPM(&gvar);
\r
311 IN_Shutdown(&gvar);
\r
312 printf("========================================\n");
\r
313 printf("near= %Fp ", gvar.mm.nearheap);
\r
314 printf("far= %Fp", gvar.mm.farheap);
\r
316 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
317 printf("&far= %Fp", &(gvar.mm.farheap));
\r
320 printf("bigb= %Fp ", BBUF);
\r
321 //printf("bigbr= %04x", BBUF);
\r
323 printf("&bigb=%Fp ", BBUFPTR);
\r
324 //printf("&bigb=%04x", BBUFPTR);
\r
327 printf("========================================\n");
\r
329 #ifdef EXMMVERBOSE__
\r
330 printf("coreleft(): %u\n", coreleft());
\r
331 printf("farcoreleft(): %ld\n", farcoreleft());
\r
334 //this is far printf("Total free: %lu\n", (dword)(HC_GetFreeSize()));
\r
335 //super buggy printf("HC_coreleft(): %u\n", HC_coreleft());
\r
336 // printf("HC_farcoreleft(): %lu\n", (dword)HC_farcoreleft());
\r
337 //printf("HC_GetNearFreeSize(): %u\n", HC_GetNearFreeSize());
\r
338 //printf("HC_GetFarFreeSize(): %lu\n", (dword)HC_GetFarFreeSize());
\r
339 HC_heapdump(&gvar);
\r
342 #ifdef __BORLANDC__
\r
343 // printf("HC_coreleft: %lu\n", (dword)HC_coreleft());
\r
344 // printf("HC_farcoreleft: %lu\n", (dword)HC_farcoreleft());
\r
345 // printf("HC_Newfarcoreleft(): %lu\n", (dword)HC_Newfarcoreleft());
\r
347 printf("Project 16 ");
\r
349 printf("exmmtest");
\r
351 #ifdef __BORLANDC__
\r
354 printf(".exe. This is just a test file!\n");
\r
355 printf("version %s\n", VERSION);
\r
360 #if defined(__DEBUG__) && ( defined(__DEBUG_PM__) || defined(__DEBUG_MM__) )
\r
361 #ifdef __DEBUG_MM__
\r
362 printf("debugmm: %u\t", dbg_debugmm);
\r
364 #ifdef __DEBUG_PM__
\r
365 printf("debugpm: %u", dbg_debugpm);
\r
369 // printf("curr_mode=%u\n", gvar.video.curr_mode);
\r
370 // VL_PrintmodexmemInfo(&gvar.video);
\r
371 //printf("old_mode=%u VL_Started=%u", gvar.video.old_mode, gvar.video.VL_Started);
\r
372 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
373 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r