/[projet1]/public/oric/demos/SlideShowDemo/code/main.c
Defence Force logotype

Annotation of /public/oric/demos/SlideShowDemo/code/main.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1071 - (hide annotations)
Mon Jan 6 20:20:59 2014 UTC (5 years, 11 months ago) by dbug
File MIME type: text/plain
File size: 3377 byte(s)
More work on the code:
- The switch to HIRES is now more optimal and in the boot sector, so the loader code itself is more compact which leaves more room for the file info tables.
- Reorganized all the buffers in a new file, in order to avoid wasting room with the alignment
- There's now a small intro before the main slide
- The music player now cleanly stops after the end of a music has been reached and informed the main code so it can load the next track
- Removed a lot of redundant code in the scroller code
1 dbug 1015 //
2     // This program simply display a picture on the hires screen
3     //
4     #include <lib.h>
5    
6     #include "floppy_description.h"
7    
8     // irq.s
9     extern void System_InstallIRQ_SimpleVbl();
10     extern void VSync();
11 dbug 1038 extern void Stop();
12 dbug 1015
13     // player.s
14 dbug 1071 extern volatile unsigned char MusicPlaying;
15     extern unsigned int MusicLength;
16 dbug 1015 extern Mym_Initialize();
17     extern Mym_ReInitialize();
18    
19 dbug 1024 // transitions.s
20     extern unsigned char PictureLoadBuffer[];
21     extern void PictureTransitionFromTopAndBottom();
22 dbug 1045 extern void PictureTransitionVenicianStore();
23     extern void PictureTransitionUnroll();
24 dbug 1024
25 dbug 1045 extern void PictureDoTransition();
26    
27 dbug 1049 //extern void PrintDescription();
28 dbug 1045
29    
30     extern void InitTransitionData();
31    
32 dbug 1024 // scroller.s
33     extern unsigned char FontBuffer[];
34 dbug 1050 extern void ScrollerInit();
35 dbug 1070 extern void TestScroller();
36 dbug 1024
37 dbug 1015 // loader_api.s
38     extern unsigned char LoaderApiEntryIndex;
39 dbug 1024 extern unsigned char LoaderApiAddressLow;
40     extern unsigned char LoaderApiAddressHigh;
41     extern void* LoaderApiAddress;
42    
43     extern void SetLoadAddress();
44 dbug 1015 extern void LoadFile();
45    
46 dbug 1071 void Pause(int delay)
47 dbug 1015 {
48 dbug 1071 int wasPlayingMusic=MusicPlaying;
49 dbug 1015 int i;
50 dbug 1071
51     for (i=0;i<delay;i++)
52 dbug 1015 {
53     VSync();
54 dbug 1071 if (MusicPlaying!=wasPlayingMusic)
55     {
56     break;
57     }
58 dbug 1015 }
59     }
60    
61     extern void Player_SetMusic_Birthday();
62    
63 dbug 1071 unsigned char CurrentMusic=0;
64     unsigned char CurrentPicture=0;
65 dbug 1015
66 dbug 1071 void RetroIntro()
67 dbug 1045 {
68 dbug 1071 // Load and play the music
69     LoaderApiEntryIndex=LOADER_INTRO_MUSIC; // BeBop music
70     LoadFile();
71     MusicLength=50*3; // 3 seconds
72     MusicLength=50*30; // 3 seconds
73     MusicLength=50*20; // 3 seconds
74     MusicLength=50*25; // 3 seconds
75     //MusicLength=50*28; // 3 seconds
76     MusicLength=50*24; // 3 seconds
77     Mym_Initialize();
78 dbug 1045
79 dbug 1071 for (LoaderApiEntryIndex=LOADER_FIRST_INTRO_PICTURE;LoaderApiEntryIndex<LOADER_LAST_INTRO_PICTURE;LoaderApiEntryIndex++)
80     {
81     LoaderApiAddress=PictureLoadBuffer;
82     SetLoadAddress();
83     LoadFile();
84 dbug 1045
85 dbug 1071 PictureTransitionUnroll();
86    
87     Pause(50*4);
88     }
89    
90    
91     while (MusicPlaying);
92    
93     // Clear the screen again
94     memset((unsigned char*)0xa000,64,8000);
95 dbug 1045 }
96    
97 dbug 1071
98 dbug 1015 void main()
99     {
100 dbug 1071 // Clear the screen
101     //memset((unsigned char*)0xa000,64,8000);
102     memset((unsigned char*)0x9900,0,0xbfe0-0x9900);
103 dbug 1015
104 dbug 1045 // Load the 6x8 font
105     LoaderApiEntryIndex=LOADER_FONT_6x8_ARTDECO;
106     LoadFile();
107    
108 dbug 1070 // Load the 12x16 font
109     LoaderApiEntryIndex=LOADER_FONT_12x16_ARTDECO; // 3040 bytes
110     LoaderApiAddress=FontBuffer;
111     SetLoadAddress();
112     LoadFile();
113    
114 dbug 1045 // Some basic inits
115     InitTransitionData();
116    
117 dbug 1071 // Install the IRQ handler
118 dbug 1015 System_InstallIRQ_SimpleVbl();
119 dbug 1024
120 dbug 1071 // Play the black & white retro intro
121     //RetroIntro();
122 dbug 1050
123 dbug 1071 // Start the scroller
124     ScrollerInit();
125 dbug 1015
126     while (1)
127     {
128 dbug 1071 // Change the music if necessary
129     if (!MusicPlaying)
130 dbug 1015 {
131     if ( (CurrentMusic<LOADER_FIRST_MUSIC) || (CurrentMusic>=LOADER_LAST_MUSIC) )
132     {
133     CurrentMusic=LOADER_FIRST_MUSIC;
134     }
135 dbug 1071 LoaderApiEntryIndex=CurrentMusic++;
136 dbug 1015 LoadFile();
137 dbug 1071 Mym_Initialize();
138 dbug 1015 }
139 dbug 1071
140     // Next picture
141     if ( (CurrentPicture<LOADER_FIRST_PICTURE) || (CurrentPicture>=LOADER_LAST_PICTURE) )
142 dbug 1015 {
143 dbug 1071 CurrentPicture=LOADER_FIRST_PICTURE;
144     }
145     LoaderApiEntryIndex=CurrentPicture++;
146     LoaderApiAddress=PictureLoadBuffer;
147     SetLoadAddress();
148     LoadFile();
149 dbug 1024
150 dbug 1071 PictureDoTransition();
151     //PictureTransitionVenicianStore();
152 dbug 1024
153 dbug 1071 Pause(50*15);
154 dbug 1015
155     VSync();
156     }
157    
158 dbug 1024 //memset((unsigned char*)0xa000,0,8000);
159 dbug 1015 }
160    
161 dbug 1024
162    
163    

  ViewVC Help
Powered by ViewVC 1.1.26