]> 4ch.mooo.com Git - 16.git/blob - src/vgacamm.c
typedef void __based( void ) * memptr;
[16.git] / src / vgacamm.c
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2016 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\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
10  *\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
15  *\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
20  *\r
21  */\r
22 \r
23 #include "src/lib/modex16.h"\r
24 #include "src/lib/16_sprit.h"\r
25 #include "src/lib/16_ca.h"\r
26 #include "src/lib/16_mm.h"\r
27 \r
28 void main() {\r
29         global_game_variables_t gvar;\r
30         __segment sega;\r
31         memptr bigbuffer;\r
32         int i;\r
33         word start;\r
34         int plane;\r
35         float t1, t2;\r
36         boolean baka;\r
37         byte *pal;\r
38         word w=0;\r
39 \r
40         gvar.mm.mmstarted=0;\r
41 \r
42         MM_Startup(&gvar.mm, &gvar.mmi);\r
43         CA_Startup(&gvar);\r
44         printf("loading\n");\r
45         if(CA_LoadFile("data/spri/chikyuu.vrs", &bigbuffer, &gvar.mm, &gvar.mmi)) baka=1; else baka=0;\r
46 \r
47         // DOSLIB: check our environment\r
48         probe_dos();\r
49 \r
50         // DOSLIB: what CPU are we using?\r
51         // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
52         //      So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
53         //      parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
54         //      the CPU to carry out tasks. --J.C.\r
55         cpu_probe();\r
56 \r
57         // DOSLIB: check for VGA\r
58         if (!probe_vga()) {\r
59                 printf("VGA probe failed\n");\r
60                 return;\r
61         }\r
62         // hardware must be VGA or higher!\r
63         if (!(vga_state.vga_flags & VGA_IS_VGA)) {\r
64                 printf("This program requires VGA or higher graphics hardware\n");\r
65                 return;\r
66         }\r
67 \r
68         VGAmodeX(1, 1, &gvar);\r
69         modexHiganbanaPageSetup(&gvar.video);\r
70 \r
71         /* non sprite comparison */\r
72         start = *clockw;\r
73         modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);\r
74         t1 = (*clockw-start) /18.2;\r
75 \r
76         start = *clockw;\r
77 \r
78         t2 = (*clockw-start)/18.2;\r
79 \r
80         while(!kbhit())\r
81         {\r
82                 switch(w)\r
83                 {\r
84                         case 1024:\r
85                                 modexPalUpdate0(pal);\r
86                                 w=0;\r
87                         default:\r
88                                 w++;\r
89                         break;\r
90                 }\r
91         }\r
92         VGAmodeX(0, 1, &gvar);\r
93         MM_ShowMemory(&gvar, &gvar.mm);\r
94         MM_DumpData(&gvar.mm);\r
95         //\r
96         MM_FreePtr(&bigbuffer, &gvar.mm);\r
97         //\r
98         CA_Shutdown(&gvar);\r
99         MM_Shutdown(&gvar.mm);\r
100         //printf("CPU to VGA: %f\n", t1);\r
101         //printf("VGA to VGA: %f\n", t2);\r
102         heapdump(&gvar);\r
103         printf("Project 16 vgacamm.exe. This is just a test file!\n");\r
104         printf("version %s\n", VERSION);\r
105         printf("t1: %f\n", t1);\r
106         printf("t2: %f\n", t2);\r
107         printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);\r
108         printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);\r
109 //      printf("Num %d", num_of_vrl);\r
110         if(baka) printf("\nyay!\n");\r
111         else printf("\npoo!\n");\r
112 }\r