1 /* Project 16 Source Code~
\r
2 * Copyright (C) 2012-2016 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_ca.h"
\r
27 #include "src/lib/16_mm.h"
\r
28 #include "src/lib/16_hc.h"
\r
29 //#include "src/lib/modex16.h"
\r
35 //file load or read definition
\r
39 #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
42 main(int argc, char *argv[])
\r
44 global_game_variables_t gvar;
\r
47 void __based(sega)* bigbuffer;
\r
53 //static byte bakapee[64];
\r
62 bakapee = malloc(64);
\r
64 gvar.mm.mmstarted=0;
\r
68 if(argv[1]) bakapee = argv[1];
\r
70 //{ printf("filename!: "); scanf("%[^\n]", &bakapee); }
\r
71 bakapee = "data/koishi~.pcx";
\r
74 // printf("main()=%Fp start MM\n", *argv[0]);
\r
75 MM_Startup(&gvar.mm, &gvar.mmi);
\r
77 //PM_UnlockMainMem();
\r
79 // printf(" done!\n");
\r
83 // bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);
\r
84 // printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
\r
85 // if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&gvar.mm))
\r
88 if(CA_ReadFile(bakapee, &bigbuffer, &gvar.mm))
\r
91 if(CA_LoadFile(bakapee, &bigbuffer, &gvar.mm, &gvar.mmi))
\r
96 // close(bakapeehandle);
\r
97 //hmm functions in cache system use the buffered stuff
\r
99 printf("\nsize of big buffer~=%u\n", _bmsize(sega, bigbuffer));
\r
102 printf("press any key to continue!\n");
\r
104 printf("\n\ncontents of the buffer\n[\n%s\n]\n", bigbuffer);
\r
105 //printf("dark purple = purgable\n");
\r
106 //printf("medium blue = non purgable\n");
\r
107 //printf("red = locked\n");
\r
108 printf("press any key to continue!\n");
\r
110 MM_ShowMemory(&gvar, &gvar.mm);
\r
112 MM_DumpData(&gvar.mm);
\r
114 // printf(" stop!\n");
\r
117 MM_FreePtr(&bigbuffer, &gvar.mm);
\r
120 CA_Shutdown(&gvar);
\r
121 MM_Shutdown(&gvar.mm);
\r
122 // printf(" done!\n");
\r
125 if(baka) printf("\nyay!\n");
\r
126 else printf("\npoo!\n");
\r
128 printf("========================================\n");
\r
129 printf("near= %Fp ", gvar.mm.nearheap);
\r
130 printf("far= %Fp", gvar.mm.farheap);
\r
132 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
133 printf("&far= %Fp", &(gvar.mm.farheap));
\r
136 printf("bigb= %Fp ", bigbuffer);
\r
137 //printf("bigbr= %04x", bigbuffer);
\r
139 printf("&bigb=%Fp ", &bigbuffer);
\r
140 //printf("&bigb=%04x", &bigbuffer);
\r
143 printf("========================================\n");
\r
145 //this is far printf("Total free: %lu\n", (dword)(GetFreeSize()));
\r
146 printf("Total near free: %lu\n", (dword)(GetNearFreeSize()));
\r
147 printf("Total far free: %lu\n", (dword)(GetFarFreeSize()));
\r
150 printf("Project 16 emmtest.exe. This is just a test file!\n");
\r
151 printf("version %s\n", VERSION);
\r
152 //printf("core left: %lu\n", (dword)_coreleft());
\r
153 //printf("far core left: %lu\n", (dword)_farcoreleft());
\r
154 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
155 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r