]> 4ch.mooo.com Git - 16.git/blob - 16/exmmtest/exmmtest.c
wwww WHAT!?
[16.git] / 16 / exmmtest / exmmtest.c
1 /* Project 16 Source Code~
2  * Copyright (C) 2012-2015 sparky4 & pngwen & andrius4669
3  *
4  * This file is part of Project 16.
5  *
6  * Project 16 is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * Project 16 is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,
19  * Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  */
22 /*
23         exmm test borland c ver
24 */
25 #include <stdio.h>
26 #include <bios.h>
27
28 /*#include "src/lib/16_head.h"
29 #include "src/lib/16_ca.h"
30 #include "src/lib/16_mm.h"*/
31 #include "16_head.h"
32 #include "16_ca.h"
33 #include "16_mm.h"
34 //#include "src/lib/modex16.h"
35 #pragma hdrstop\r
36 \r
37 #pragma warn -pro\r
38 #pragma warn -use
39
40 //file load or read definition
41 #define FILERL
42 #define FILEREAD
43
44 void
45 main(int argc, char *argv[])
46 {
47         mminfo_t mm; mminfotype mmi;
48         void _seg * segu;
49 #ifdef FILERL
50         memptr bigbuffer;
51         char *bakapee;
52 //      int bakapeehandle;
53         word baka;
54 #endif
55         //static page_t screen;
56
57         //mmi.segu=FP_SEG(segu);
58
59         printf("&main()=%Fp\n", *argv[0]);
60         printf("&segu=%p\n", (segu));
61         //printf("mmi.segu=%p\n", (mmi.segu));
62
63 #ifdef FILERL
64         bakapee = malloc(64);
65 //      memset(bakapee, 0, 64);
66 #endif
67         mm.mmstarted=0;
68
69 #ifdef FILERL
70         if(argv[1]) bakapee = argv[1];
71         else bakapee = "../../data/koishi~~.pcx";
72 #endif
73
74         textInit();\r
75
76         /* setup camera and screen~ */
77         //bug!!!\r
78         //screen = modexDefaultPage();\r
79         /*screen.width += (16*2);\r
80         screen.height += (16*2);*/
81
82         printf("main()=%Fp      start MM\n", *argv[0]);
83         MM_Startup(&mm, &mmi);
84         //PM_Startup();\r
85         //PM_UnlockMainMem();\r
86         CA_Startup();
87         printf("                done!\n");
88         /*if(FP_SEG(*argv[0])==0)
89         {
90                 MM_Report(&screen, &mm, &mmi);
91                 MM_Shutdown(&mm);
92                 printf("&main()=%Fp\n", *argv[0]);
93                 printf("&main() == %u\n", FP_SEG(*argv[0]));
94                 exit(-5);
95         }*/
96         printf("&main()=%Fp\n", *argv[0]);
97         printf("&segu=%p\n", (segu));\r
98         //printf("mmi.segu=%p\n", (mmi.segu));
99 #ifdef FILERL
100 //      bakapeehandle = open(bakapee,O_RDONLY | O_BINARY, S_IREAD);
101 //wat   printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
102 //      if(CA_FarRead(bakapeehandle,(void far *)&bigbuffer,sizeof(bigbuffer),&mm))
103 #ifdef FILEREAD
104         printf("                read\n");
105         if(CA_ReadFile(bakapee, &bigbuffer, &mm))
106 #else
107         printf("                load\n");
108         if(CA_LoadFile(bakapee, &bigbuffer, &mm, &mmi))
109 #endif
110                 baka=1;
111         else
112                 baka=0;
113 //      close(bakapeehandle);
114         //hmm functions in cache system use the buffered stuff
115         printf("size of big buffer~=%u\n", _bmsize(segu, bigbuffer));
116 #endif
117         printf("dark purple = purgable\n");
118         printf("medium blue = non purgable\n");
119         printf("red = locked\n");
120         getch();
121         //++++modexEnter();
122         //++++modexShowPage(&screen);
123         MM_ShowMemory(/*&screen, */&mm);
124         //getch();
125         MM_DumpData(&mm);
126         //++++modexLeave();
127         MM_Report(&mm, &mmi);
128         printf("                stop!\n");
129 #ifdef FILERL
130         MM_FreePtr(&bigbuffer, &mm);
131 #endif
132         //PM_Shutdown();
133         CA_Shutdown();
134         MM_Shutdown(&mm);
135         printf("                done!\n");
136 #ifdef FILERL
137         free(bakapee);
138         if(baka) printf("\nyay!\n");
139         else printf("\npoo!\n");
140 #endif
141         printf("_bios_memsize=%u\n", _bios_memsize());
142 }