OSDN Git Service

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