/[projet1]/public/oric/demos/assembly_2002/MainPlayer.c
Defence Force logotype

Contents of /public/oric/demos/assembly_2002/MainPlayer.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 473 - (show annotations)
Fri Apr 29 22:00:16 2011 UTC (8 years, 9 months ago) by dbug
File MIME type: text/plain
File size: 2655 byte(s)
Added the Assembly 2002 demo, it's very messy, need some cleanup, but well
1
2
3
4
5
6 //
7 // MYM music player
8 // 31.1.2000 Marq/Lieves!Tuore & Fit (marq@iki.fi)
9 // 7.8.2001 Dbug (dbug@defence-force.org) Oric version.
10
11
12 #include <lib.h>
13
14 #define REGS 14 // Number of PSG registers
15 #define FRAG 128 // Number of rows to compress at a time
16 #define OFFNUM 14 // Bits needed to store off+num of FRAG
17 #define OFFHALF (OFFNUM/2)
18
19
20
21 // ========================= externs
22
23 extern void VSync();
24 extern void TimeIrqHandler();
25
26
27
28 void DoLoad();
29
30 void PsgPlay();
31
32 void ReadBits();
33 void PlayerInit();
34
35 void PlayerCopyUnchanged();
36 void PlayerCopyPacked();
37
38 void PlayerUnpackBlock();
39 void PlayerUnpackRegister();
40
41
42
43 extern unsigned char PsgVbl;
44 //extern unsigned char PsgControl;
45 //extern unsigned char PsgData;
46
47 //extern unsigned char ReadBitCount;
48 //extern unsigned char ReadBitResult;
49
50 extern unsigned int MusicRowCount;
51
52 extern unsigned char PlayerBuffer[];
53
54 extern unsigned int PlayerVbl;
55
56 extern unsigned char PlayerVblRow;
57
58 extern unsigned char PlayerRegister;
59
60 extern unsigned char PlayerRegCurrentValue;
61
62 extern unsigned char PlayerRegisterBitCount;
63
64 extern unsigned char *PlayerRegPointer;
65
66
67 extern unsigned char PlayerUnpackCount;
68 extern int PlayerUnpackOffset;
69
70 extern unsigned char PlayerCounter;
71
72 // ========================= externs
73
74
75
76
77 void main()
78 {
79 unsigned char reg;
80 unsigned char count;
81 unsigned char decount;
82
83
84
85
86 //
87 // Display a message...
88 //
89 printf("MYM Music player - v0.001\r\n");
90
91 //
92 // Load the song
93 //
94 printf("Loading music \r\n");
95 /*
96 strcpy((char*)0x27f,"music.tap");
97 DoLoad();
98
99 zap();
100 */
101
102
103 //
104 // Read the number of rows
105 //
106 PlayerInit();
107
108 //
109 // Unpack a 1792 bytes blocs...
110 //
111 PlayerUnpackBlock();
112 printf("Number of rows: %d\r\n",MusicRowCount);
113 printf("Playing music\r\n");
114
115
116 //
117 // Install the irq handler
118 //
119 chain_irq_handler(TimeIrqHandler);
120
121 //
122 // Unpack the data
123 //
124 while (1)
125 {
126 while (PlayerVbl<MusicRowCount)
127 {
128 PlayerVbl+=FRAG;
129
130 PlayerRegister=0;
131 decount=9;
132 for (count=0;count<FRAG;count++)
133 {
134 //
135 // Unpack one register list
136 // in not finished
137 //
138 if (PlayerRegister<14)
139 {
140 decount--;
141 if (!decount)
142 {
143 PlayerUnpackRegister();
144 PlayerRegister++;
145 decount=9;
146 }
147 }
148 else
149 {
150 if ((PlayerVbl+count)>=MusicRowCount)
151 {
152 goto restart;
153 }
154 }
155
156 //
157 // Play the serie of registers
158 //
159 PsgPlay();
160 PsgVbl++;
161 VSync();
162 }
163 }
164 restart:
165 PlayerVbl=0;
166 PlayerVblRow=0;
167 PsgVbl=0;
168 }
169 }
170
171
172

  ViewVC Help
Powered by ViewVC 1.1.26