]> 4ch.mooo.com Git - 16.git/blob - src/vrstest.c
branch is in the master swap branch code added to swap the files out ^^; vrstest...
[16.git] / src / vrstest.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 <stdio.h>\r
24 #include <dos.h>\r
25 #include <string.h>\r
26 #include "src/lib/modex16.h"\r
27 #include "src/lib/16_sprite.h"\r
28 #include "src/lib/16_ca.h"\r
29 #include "src/lib/16_mm.h"\r
30 \r
31 \r
32 global_game_variables_t gvar;\r
33 \r
34 void main() {\r
35         __segment sega;\r
36         void __based(sega)* bigbuffer;\r
37         int i;\r
38         word start;\r
39         int plane;\r
40         float t1, t2;\r
41 \r
42         // DOSLIB: check our environment\r
43         probe_dos();\r
44 \r
45         // DOSLIB: what CPU are we using?\r
46         // NTS: I can see from the makefile Sparky4 intends this to run on 8088 by the -0 switch in CFLAGS.\r
47         //      So this code by itself shouldn't care too much what CPU it's running on. Except that other\r
48         //      parts of this project (DOSLIB itself) rely on CPU detection to know what is appropriate for\r
49         //      the CPU to carry out tasks. --J.C.\r
50         cpu_probe();\r
51 \r
52         gvar.mm.mmstarted=0;\r
53 \r
54         MM_Startup(&gvar.mm, &gvar.mmi);\r
55         CA_Startup(&gvar);\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         //bmp = bitmapLoadPcx("data/chikyuu.pcx");\r
69 \r
70         VGAmodeX(1, 1, &gvar);\r
71         gvar.video.page[0]=modexDefaultPage(&gvar.video.page[0]);\r
72 \r
73         /* fix up the palette and everything */\r
74         //modexPalUpdate1(bmp.palette);\r
75 \r
76         /* clear and draw one sprite and one bitmap */\r
77         modexClearRegion(&gvar.video.page[0], 0, 0, gvar.video.page[0].sw, gvar.video.page[0].sh, 1);\r
78 \r
79         /* non sprite comparison */\r
80         start = *clockw;\r
81         //for(i=0; i<100 ;i++) {\r
82         //      oldDrawBmp(VGA, 20, 20, &bmp, 0);\r
83         //}\r
84 \r
85         start = *clockw;\r
86         //for(i=0; i<100 ;i++) {\r
87 //0000          modexDrawBmp(&gvar.video.page[0], 20, 20, &bmp);\r
88         //      modexDrawBmp(&gvar.video.page[0], 160, 120, &bmp);\r
89         //}\r
90         t1 = (*clockw-start) /18.2;\r
91 \r
92         start = *clockw;\r
93         //for(i=0; i<100; i++) {\r
94 //0000          modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 20, 20, 128, 20, 64, 64);\r
95                 modexCopyPageRegion(&gvar.video.page[0], &gvar.video.page[0], 0, 0, 0, 0, 320, 240);\r
96         //}\r
97         t2 = (*clockw-start)/18.2;\r
98 \r
99 \r
100         start = *clockw;\r
101         //for(i=0; i<100 ;i++) {\r
102         //      oldDrawBmp(VGA, 20, 20, &bmp, 1);\r
103         //}\r
104 \r
105 \r
106         start = *clockw;\r
107         //for(i=0; i<100 ;i++) {\r
108 //0000          modexDrawSprite(&gvar.video.page[0], 20, 20, &bmp);\r
109         //      modexDrawSprite(&gvar.video.page[0], 160, 120, &bmp);\r
110         //}\r
111         //_fmemset(MK_FP(0xA000, 0), (int)p->plane, gvar.video.page[0].sw*(gvar.video.page[0].sh*2));\r
112         //modexDrawBmp(&gvar.video.page[0], 0, 0, &bmp);\r
113         while(!kbhit())\r
114         {\r
115                 //DrawPBuf(&gvar.video.page[0], 0, 0, p, 0);\r
116         }\r
117         MM_FreePtr(&bigbuffer, &gvar.mm);\r
118         CA_Shutdown(&gvar);\r
119         MM_Shutdown(&gvar.mm);\r
120         VGAmodeX(0, 1, &gvar);\r
121         /*printf("\nmain=%Fp\n\n", &i);\r
122         printf("bmp.data=%Fp\n", bmp.data);\r
123         printf("*bmp.data=%Fp\n", *(bmp.data));\r
124         printf("&bmp.data=%Fp\n", &(bmp.data));\r
125 \r
126         printf("\n%d\n", sizeof(p->plane));\r
127         printf("%d\n", sizeof(bmp));*/\r
128 \r
129         /*for(i=0; i<(320*240); i++)\r
130         {\r
131                 fprintf(stdout, "%d", bmp.data[i]);\r
132                 if(i%bmp.width==0) fprintf(stdout, "\n");\r
133         }*/\r
134         printf("CPU to VGA: %f\n", t1);\r
135         printf("VGA to VGA: %f\n", t2);\r
136         printf("gvar.video.page[0].width: %u\n", gvar.video.page[0].width);\r
137         printf("gvar.video.page[0].height: %u\n", gvar.video.page[0].height);\r
138         return;\r
139 }\r