]> 4ch.mooo.com Git - 16.git/blob - 16/ADT2PLAY/a2player.c
92c799ffd54a5fd115f50340f3c69e435a452c59
[16.git] / 16 / ADT2PLAY / a2player.c
1 /* Output from p2c 1.21alpha-07.Dec.93, the Pascal-to-C translator */
2 /* From input file "a2player.pas" */
3
4
5 #include <p2c/p2c.h>
6
7
8 #define A2PLAYER_G
9 #include "a2player.h"
10
11
12 unsigned short opl3port = 0x388;
13 short error_code = 0;
14 uchar current_order = 0, current_pattern = 0, current_line = 0, tempo = 50,
15       speed = 6;
16 unsigned short macro_speedup = 1;
17 boolean irq_mode = false;
18 uchar max_patterns = 128;
19 boolean fast_forward = false;
20 uchar overall_volume = 63, global_volume = 63;
21 unsigned short song_timer = 0, song_timer_tenths = 0;
22 Void (*external_irq_hook) PV() = NULL;
23 long _delay_counter = 0;
24 unsigned short irq_freq = 50;
25 boolean irq_initialized = false, timer_fix = true, pattern_break = false,
26         pattern_delay = false;
27 uchar next_line = 0;
28 tPLAY_STATUS play_status = isStopped;
29 boolean replay_forbidden = true, force_macro_keyon = false;
30
31 #ifndef TIMERINT_H
32 #include "timerint.h"
33 #endif
34
35 #ifndef PARSERIO_H
36 #include "parserio.h"
37 #endif
38
39
40 typedef unsigned short tTRACK_ADDR[20];
41
42
43 #define keyoff_flag     0x80
44 #define fixed_note_flag  0x90
45 #define pattern_loop_flag  0xe0
46 #define pattern_break_flag  0xf0
47
48
49 typedef struct _REC_porta_table {
50   unsigned short freq;
51   uchar speed;
52 } _REC_porta_table;
53
54 typedef struct _REC_porta_table2 {
55   unsigned short freq;
56   uchar speed;
57 } _REC_porta_table2;
58
59 typedef struct _REC_arpgg_table {
60   uchar state, note, add1, add2;
61 } _REC_arpgg_table;
62
63 typedef struct _REC_arpgg_table2 {
64   uchar state, note, add1, add2;
65 } _REC_arpgg_table2;
66
67 typedef struct _REC_vibr_table {
68   uchar pos, speed, depth;
69   boolean fine;
70 } _REC_vibr_table;
71
72 typedef struct _REC_vibr_table2 {
73   uchar pos, speed, depth;
74   boolean fine;
75 } _REC_vibr_table2;
76
77 typedef struct _REC_trem_table {
78   uchar pos, speed, depth;
79   boolean fine;
80 } _REC_trem_table;
81
82 typedef struct _REC_trem_table2 {
83   uchar pos, speed, depth;
84   boolean fine;
85 } _REC_trem_table2;
86
87 typedef struct _REC_tremor_table {
88   short pos;
89   unsigned short volume;
90 } _REC_tremor_table;
91
92 typedef struct _REC_tremor_table2 {
93   short pos;
94   unsigned short volume;
95 } _REC_tremor_table2;
96
97 typedef struct _REC_macro_table {
98   unsigned short fmreg_pos, arpg_pos, vib_pos;
99   uchar fmreg_count, fmreg_duration, arpg_count, vib_count, vib_delay;
100   boolean vib_paused;
101   uchar fmreg_table, arpg_table, vib_table, arpg_note;
102   unsigned short vib_freq;
103 } _REC_macro_table;
104
105
106 Static uchar _panning[3] = {
107   0x30, 0x10, 0x20
108 };
109
110 Static uchar _instr[12] = {
111   0x20, 0x20, 0x40, 0x40, 0x60, 0x60, 0x80, 0x80, 0xe0, 0xe0, 0xc0, 0xbd
112 };
113
114 /* 01 - 02 - 03 - 04 - 05 - 06 - 07 - 08 - 09 - 10 - 11 - 12 - 13 - 14 - 15 - 16 - 17 - 18 - 19 - 20 */
115
116 Static tTRACK_ADDR _chmm_n = {
117   0x3, 0, 0x4, 0x1, 0x5, 0x2, 0x6, 0x7, 0x8, 0x103, 0x100, 0x104, 0x101,
118   0x105, 0x102, 0x106, 0x107, 0x108, BYTE_NULL, BYTE_NULL
119 };
120
121 Static tTRACK_ADDR _chmm_m = {
122   0x8, 0, 0x9, 0x1, 0xa, 0x2, 0x10, 0x11, 0x12, 0x108, 0x100, 0x109, 0x101,
123   0x10a, 0x102, 0x110, 0x111, 0x112, BYTE_NULL, BYTE_NULL
124 };
125
126 Static tTRACK_ADDR _chmm_c = {
127   0xb, 0x3, 0xc, 0x4, 0xd, 0x5, 0x13, 0x14, 0x15, 0x10b, 0x103, 0x10c, 0x104,
128   0x10d, 0x105, 0x113, 0x114, 0x115, BYTE_NULL, BYTE_NULL
129 };
130
131 /*                                                                            BD   SD   TT   TC   HH */
132
133 Static tTRACK_ADDR _chpm_n = {
134   0x3, 0, 0x4, 0x1, 0x5, 0x2, 0x106, 0x107, 0x108, 0x103, 0x100, 0x104, 0x101,
135   0x105, 0x102, 0x6, 0x7, 0x8, 0x8, 0x7
136 };
137
138 Static tTRACK_ADDR _chpm_m = {
139   0x8, 0, 0x9, 0x1, 0xa, 0x2, 0x110, 0x111, 0x112, 0x108, 0x100, 0x109, 0x101,
140   0x10a, 0x102, 0x10, 0x14, 0x12, 0x15, 0x11
141 };
142
143 Static tTRACK_ADDR _chpm_c = {
144   0xb, 0x3, 0xc, 0x4, 0xd, 0x5, 0x113, 0x114, 0x115, 0x10b, 0x103, 0x10c,
145   0x104, 0x10d, 0x105, 0x13, BYTE_NULL, BYTE_NULL, BYTE_NULL, BYTE_NULL
146 };
147
148 Static tTRACK_ADDR _chan_n, _chan_m, _chan_c;
149 Static uchar def_vibtrem_speed_factor = 1, def_vibtrem_table_size = 32;
150
151 Static uchar def_vibtrem_table[256] = {
152   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
153   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
154   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
155   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
156   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
157   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
158   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
159   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
160   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
161   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
162   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
163   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
164   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
165   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24,
166   0, 24, 49, 74, 97, 120, 141, 161, 180, 197, 212, 224, 235, 244, 250, 253,
167   255, 253, 250, 244, 235, 224, 212, 197, 180, 161, 141, 120, 97, 74, 49, 24
168 /* p2c: a2player.pas, line 484: 
169  * Note: Line breaker spent 0.0 seconds, 5000 tries on line 167 [251] */
170 };
171
172 Static uchar vibtrem_speed_factor, vibtrem_table_size;
173 Static uchar vibtrem_table[256];
174
175 Static tFM_PARAMETER_TABLE fmpar_table[20];
176 Static boolean volume_lock[20];
177 Static unsigned short volume_table[20];
178 Static unsigned short vscale_table[20];
179 Static boolean peak_lock[20];
180 Static boolean pan_lock[20];
181 Static tADTRACK2_EVENT event_table[20];
182 Static uchar voice_table[20];
183 Static uchar modulator_vol[20];
184 Static uchar carrier_vol[20];
185 Static unsigned short freq_table[20];
186 Static unsigned short effect_table[20];
187 Static unsigned short effect_table2[20];
188 Static uchar fslide_table[20];
189 Static uchar fslide_table2[20];
190 Static unsigned short glfsld_table[20];
191 Static unsigned short glfsld_table2[20];
192 Static _REC_porta_table porta_table[20];
193 Static _REC_porta_table2 porta_table2[20];
194 Static _REC_arpgg_table arpgg_table[20];
195 Static _REC_arpgg_table2 arpgg_table2[20];
196 Static _REC_vibr_table vibr_table[20];
197 Static _REC_vibr_table2 vibr_table2[20];
198 Static _REC_trem_table trem_table[20];
199 Static _REC_trem_table2 trem_table2[20];
200 Static uchar retrig_table[20];
201 Static uchar retrig_table2[20];
202 Static _REC_tremor_table tremor_table[20];
203 Static _REC_tremor_table2 tremor_table2[20];
204 Static uchar panning_table[20];
205 Static unsigned short last_effect[20];
206 Static unsigned short last_effect2[20];
207 Static uchar volslide_type[20];
208 Static boolean event_new[20];
209 Static uchar notedel_table[20];
210 Static uchar notecut_table[20];
211 Static short ftune_table[20];
212 Static boolean keyoff_loop[20];
213 Static _REC_macro_table macro_table[20];
214
215 Static uchar loopbck_table[20];
216 Static uchar loop_table[20][256];
217 Static uchar misc_register;
218 Static uchar current_tremolo_depth = 0, current_vibrato_depth = 0;
219
220 Static boolean speed_update, lockvol, panlock, lockVP;
221 Static uchar tremolo_depth, vibrato_depth;
222 Static boolean volume_scaling, percussion_mode;
223 Static uchar last_order;
224 Static boolean reset_chan[20];
225 /* p2c: a2player.pas, line 484: 
226  * Warning: Expected BEGIN, found 'assembler' [227] */
227
228
229 extern Void opl2out PP((int reg, int data));
230 /* p2c: a2player.pas, line 485: Warning: Expected END, found 'asm' [227] */
231 /* p2c: a2player.pas, line 504: 
232  * Warning: Expected a '.', found PROCEDURE [227] */
233 /* p2c: a2player.pas, line 504: 
234  * Warning: Junk at end of input file ignored [277] */
235
236
237
238
239 /* End. */