OpenCores
URL https://opencores.org/ocsvn/395_vgs/395_vgs/trunk

Subversion Repositories 395_vgs

[/] [395_vgs/] [trunk/] [src/] [PIC18/] [intro.c] - Blame information for rev 27

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 zuofu
#include <system.h>
2
#include "gpu_pic.h"
3
 
4
#pragma CLOCK_FREQ 50000000                                             //required for accurate delay functionality
5
//#pragma DATA 0x2007, 0x3F3A                                           //Configuration bits to prevent having to configure in programmer
6
 
7
void main( void )
8
{
9
        //Configure port A
10
        adcon1 = 0x07;                                                          //disable analog inputs
11
        trisa = 00000000b;
12
        //Configure port B
13
        trisb = 0x00;
14
        //Configure port C
15
        trisc = 10000000b;
16
 
17
        //Initialize port A
18
        porta = 0x00;
19
        //Initialize port B
20
        portb = 0x00;
21
        //Initialize port C
22
        portc = 0x00;
23
 
24
        //wait for GPU to get ready
25
        //START OF REAL PROGRAM--------------------------------------------
26
 
27
        char i = 0;
28
        char j = 0;
29
 
30
        delay_s(3);
31
 
32
        //Endless loop
33
        while( 1 )
34
        {
35
                //initalize graphics to original settings
36
                Bitmap neogeo;
37
                        neogeo.address = 0x00012C00;
38
                        neogeo.lines = 0x00F0;
39
                        neogeo.width = 0x0000;
40
 
41
                Bitmap black;
42
                        black.address = 0x0001C200;
43
                        black.lines = 0x00F0;
44
                        black.width = 0x00A0;
45
 
46
                Sprite near_future;
47
                        near_future.image.address = 0x00025800;
48
                        near_future.image.lines = 0x000B;
49
                        near_future.image.width = 0x00A0;
50
                        near_future.position.x = 0;
51
                        near_future.position.y = 63;
52
                        near_future.alpha = 0;
53
 
54
                Sprite eye_anim;
55
                        eye_anim.image.address = 0x00026CA0;
56
                        eye_anim.image.lines = 0x001B;
57
                        eye_anim.image.width = 0x001F;
58
                        eye_anim.position.x = 14;
59
                        eye_anim.position.y = 135;
60
                        eye_anim.alpha = 0;
61
 
62
                Sprite eye_mask;
63
                        eye_mask.image.address = 0x0001C200;
64
                        eye_mask.image.lines = 0x001B;
65
                        eye_mask.image.width = 0x001F;
66
                        eye_mask.position.x = 14;
67
                        eye_mask.position.y = 135;
68
                        eye_mask.alpha = 0;
69
 
70
                Sprite compass;
71
                        compass.image.address = 0x00029A40;
72
                        compass.image.lines = 0x0006;
73
                        compass.image.width = 0x002D;
74
                        compass.position.x = 51;
75
                        compass.position.y = 134;
76
                        compass.alpha = 0;
77
 
78
                Sprite lines;
79
                        lines.image.address = 0x00029E00;
80
                        lines.image.lines = 0x001A;
81
                        lines.image.width = 0x004F;
82
                        lines.position.x = 73;
83
                        lines.position.y = 76;
84
                        lines.alpha = 0;
85
 
86
                Sprite bars;
87
                        bars.image.address = 0x0002AE94;
88
                        bars.image.lines = 15;
89
                        bars.image.width = 0x002F;
90
                        bars.position.x = 10;
91
                        bars.position.y = 81;
92
                        bars.alpha = 0;
93
 
94
                Sprite outline;
95
                        outline.image.address = 0x00027D80;
96
                        outline.image.lines = 46;
97
                        outline.image.width = 43;
98
                        outline.position.x = 27;
99
                        outline.position.y = 130;
100
                        outline.alpha = 1;
101
 
102
                //scroll neo geo logo
103
                for (i = 0; i < 160; i++)
104
                {
105
                        drawtobackground(neogeo);
106
                        delay_ms(10);
107
                        neogeo.width += 1;
108
                }
109
                delay_s(3);
110
                //fade in introduction text
111
                drawtobackground(black);
112
                delay_s(2);
113
                drawsprite(near_future);
114
                delay_ms(255);
115
                near_future.image.address = 0X00025EE0;
116
                drawtobackground(black);
117
                drawsprite(near_future);
118
                delay_ms(255);
119
                near_future.image.address = 0X000265C0;
120
                drawtobackground(black);
121
                drawsprite(near_future);
122
                delay_s(2);
123
                //black screen - dramatic pause
124
                drawtobackground(black);
125
                delay_s(2);
126
                //draw eye open animation
127
                for (i = 0; i < 5; i++)
128
                {
129
                        drawsprite(eye_mask);
130
                        drawsprite(eye_anim);
131
                        eye_anim.image.address += 0x00000020;
132
                        delay_ms(100);
133
                }
134
                //draw and animate compass
135
                j = 30;
136
                for ( i = 0; i < 5; i++)//slow down
137
                {
138
                        drawsprite(compass);//1
139
                        compass.image.address += 0x0000002E;
140
                        delay_ms(j);
141
                        drawsprite(compass);//2
142
                        compass.image.address += 0x0000002E;
143
                        delay_ms(j);
144
                        drawsprite(compass);//3
145
                        compass.image.address -= 0x0000005C;
146
                        delay_ms(j);
147
                        j+= 15;
148
                }
149
                j=20;
150
                for ( i = 0; i < 5; i++)//reverse
151
                {
152
                        compass.image.address += 0x0000005C;
153
                        drawsprite(compass);//3
154
                        compass.image.address -= 0x0000002E;
155
                        delay_ms(j);
156
                        drawsprite(compass);//2
157
                        compass.image.address -= 0x0000002E;
158
                        delay_ms(j);
159
                        drawsprite(compass);//1
160
                        delay_ms(j);
161
                        j+= 15;
162
                }
163
                j=150;
164
                for ( i = 0; i < 3; i++)//speed up
165
                {
166
                        drawsprite(compass);//1
167
                        compass.image.address += 0x0000002E;
168
                        delay_ms(j);
169
                        drawsprite(compass);//2
170
                        compass.image.address += 0x0000002E;
171
                        delay_ms(j);
172
                        drawsprite(compass);//3
173
                        compass.image.address -= 0x0000005C;
174
                        delay_ms(j);
175
                        j-= 60;
176
                }
177
                drawsprite (lines);
178
                drawsprite (bars);
179
 
180
                j=10;
181
                for ( i = 0; i < 2; i++)//slow down
182
                {
183
                        drawsprite(compass);
184
                        compass.image.address += 0x0000002E;
185
                        delay_ms(j);
186
                        drawsprite(compass);//2
187
                        compass.image.address += 0x0000002E;
188
                        delay_ms(j);
189
                        drawsprite(compass);//3
190
                        compass.image.address -= 0x0000005C;
191
                        delay_ms(j);
192
                        j+= 40;
193
                }
194
 
195
                lines.image.address = 0x00029E50;
196
                lines.image.width = 0x004B;
197
                bars.image.address += 0x00000960;
198
                bars.image.width = 0x0035;
199
                drawsprite (lines);
200
                drawsprite (bars);
201
 
202
                drawsprite(compass);
203
                compass.image.address += 0x0000002E;
204
                delay_ms(j);
205
                drawsprite(compass);//2
206
                compass.image.address += 0x0000002E;
207
                delay_ms(j);
208
                drawsprite(compass);//3
209
                compass.image.address -= 0x0000005C;
210
                delay_ms(j);
211
                j+= 40;
212
 
213
                lines.image.address = 0x0002AE40;
214
                lines.image.width = 0x0053;
215
                bars.image.address += 0x0000960;
216
                drawsprite (lines);
217
                drawsprite (bars);
218
 
219
                drawsprite(compass);
220
                compass.image.address += 0x0000002E;
221
                delay_ms(j);
222
                drawsprite(compass);//2
223
                compass.image.address += 0x0000002E;
224
                delay_ms(j);
225
                drawsprite(compass);//3
226
                compass.image.address -= 0x0000005C;
227
                delay_ms(j);
228
 
229
                lines.image.address = 0x0002BE80;
230
                bars.image.address += 0x00000961;
231
                bars.image.width = 0x0036;
232
                drawsprite (lines);
233
                drawsprite (bars);
234
                delay_ms(200);
235
 
236
                lines.image.address = 0x0002CEC0;
237
                lines.image.lines = 32;
238
                lines.image.width = 84;
239
                lines.position.x = 72;
240
                lines.position.y = 75;
241
                bars.image.address += 0x00000960;
242
                drawsprite (bars);
243
                drawsprite (lines);
244
                delay_ms(50);
245
                bars.image.address = 0x000713E0;
246
                bars.image.lines = 21;
247
                bars.image.width = 62;
248
                bars.position.x = 4;
249
                bars.position.y = 80;
250
                drawsprite (bars);
251
                drawsprite (lines);
252
 
253
                //glitch stuff up
254
                for (i = 0; i < 50; i++)
255
                {
256
                        bars.image.address = 0x000713E0;
257
                        lines.image.address = 0x000821E0;
258
                        drawsprite(bars);
259
                        drawsprite (lines);
260
                        delay_ms(5);
261
                        bars.image.address = 0x000706C0;
262
                        lines.image.address = 0x0002CEC0;
263
                        drawsprite(bars);
264
                        drawsprite (lines);
265
                        delay_ms(5);
266
                }
267
 
268
                //draw overlay
269
 
270
                drawsprite (outline);
271
 
272
                for (i = 0; i < 30; i++)
273
                {
274
                        bars.image.address = 0x000713E0;
275
                        lines.image.address = 0x000821E0;
276
                        drawsprite(bars);
277
                        drawsprite (lines);
278
                        delay_ms(5);
279
                        bars.image.address = 0x000706C0;
280
                        lines.image.address = 0x0002CEC0;
281
                        drawsprite(bars);
282
                        drawsprite (lines);
283
                        delay_ms(5);
284
                }
285
 
286
                //draw eye close animation with overlay
287
                eye_anim.image.address = 0x00026D20;
288
                for (i = 0; i < 5; i++)
289
                {
290
                        drawsprite(eye_mask);
291
                        drawsprite(eye_anim);
292
                        drawsprite(outline);
293
                        eye_anim.image.address -= 0x00000020;
294
                        delay_ms(50);
295
                }
296
                //draw eye open with overlay
297
                eye_anim.image.address = 0x00026CA0;
298
                for (i = 0; i < 5; i++)
299
                {
300
                        drawsprite(eye_mask);
301
                        drawsprite(eye_anim);
302
                        drawsprite(outline);
303
                        eye_anim.image.address += 0x00000020;
304
                        delay_ms(50);
305
                }
306
 
307
                delay_ms(255);
308
                //draw rest of overlay
309
                drawsprite(eye_mask);
310
                outline.position.x = 24;
311
                outline.image.address = 0x00027DAB;
312
                outline.image.width = 46;
313
                drawsprite(outline);
314
                drawsprite(compass);
315
                delay_ms(200);
316
                outline.image.address = 0x00027DD9;
317
                outline.image.width = 60;
318
                drawsprite(outline);
319
                drawsprite(compass);
320
                //final halt
321
                delay_s(10);
322
        }
323
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.