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