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
45 char __based( void ) * scrptr;
\r
49 printf( "Top left character is '%c'.\n", *(screen:>scrptr) );
\r
50 // printf("Next string is: [");
\r
51 // while(*scrptr<16)
\r
53 // printf("%c", *(screen:>scrptr));
\r
59 // printf("press any key to continue!\n");
\r
65 main(int argc, char *argv[])
\r
67 global_game_variables_t gvar;
\r
74 //static byte bakapee[64];
\r
83 bakapee = malloc(64);
\r
85 gvar.mm.mmstarted=0;
\r
89 if(argv[1]) bakapee = argv[1];
\r
91 //{ printf("filename!: "); scanf("%[^\n]", &bakapee); }
\r
92 bakapee = "data/koishi~.pcx";
\r
95 // printf("main()=%Fp start MM\n", *argv[0]);
\r
96 MM_Startup(&gvar.mm, &gvar.mmi);
\r
98 //PM_UnlockMainMem();
\r
100 // printf(" done!\n");
\r
102 // printf("press any key to continue!\n");
\r
105 // bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);
\r
106 // printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
\r
107 // if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&gvar.mm))
\r
110 if(CA_ReadFile(bakapee, &bigbuffer, &gvar))
\r
113 if(CA_LoadFile(bakapee, &bigbuffer, &gvar))
\r
118 // close(bakapeehandle);
\r
119 //hmm functions in cache system use the buffered stuff
\r
121 printf("\nsize of big buffer~=%u\n", _bmsize(sega, bigbuffer));
\r
124 printf("contents of the buffer\n[\n%s\n]\n", bigbuffer);
\r
125 //printf("dark purple = purgable\n");
\r
126 //printf("medium blue = non purgable\n");
\r
127 //printf("red = locked\n");
\r
128 printf("press any key to continue!\n");
\r
130 MM_ShowMemory(&gvar, &gvar.mm);
\r
131 MM_DumpData(&gvar.mm);
\r
133 printf("press any key to continue!\n");
\r
136 MM_FreePtr(&bigbuffer, &gvar.mm);
\r
139 CA_Shutdown(&gvar);
\r
140 MM_Shutdown(&gvar.mm);
\r
143 if(baka) printf("\nyay!\n");
\r
144 else printf("\npoo!\n");
\r
146 printf("========================================\n");
\r
147 printf("near= %Fp ", gvar.mm.nearheap);
\r
148 printf("far= %Fp", gvar.mm.farheap);
\r
150 printf("&near= %Fp ", &(gvar.mm.nearheap));
\r
151 printf("&far= %Fp", &(gvar.mm.farheap));
\r
154 printf("bigb= %Fp ", bigbuffer);
\r
155 //printf("bigbr= %04x", bigbuffer);
\r
157 printf("&bigb=%Fp ", &bigbuffer);
\r
158 //printf("&bigb=%04x", &bigbuffer);
\r
161 printf("========================================\n");
\r
163 //this is far printf("Total free: %lu\n", (dword)(GetFreeSize()));
\r
164 printf("Total near free: %lu\n", (dword)(GetNearFreeSize()));
\r
165 printf("Total far free: %lu\n", (dword)(GetFarFreeSize()));
\r
169 printf("Project 16 emmtest.exe. This is just a test file!\n");
\r
170 printf("version %s\n", VERSION);
\r
171 //printf("core left: %lu\n", (dword)_coreleft());
\r
172 //printf("far core left: %lu\n", (dword)_farcoreleft());
\r
173 //printf("based core left: %lu\n", (dword)_basedcoreleft());
\r
174 //printf("huge core left: %lu\n", (dword)_hugecoreleft());
\r