comparison playercode/s3m_it.c @ 6:d14fd386d182

Initial entry of mikmod into the CVS tree.
author darius
date Fri, 23 Jan 1998 16:05:09 +0000
parents
children
comparison
equal deleted inserted replaced
5:42e11dc15457 6:d14fd386d182
1 /*
2
3 Name:
4 S3M_IT.C
5
6 Description:
7 Commonfunctions between S3Ms and ITs (smaller .EXE! :)
8
9 Portability:
10 All systems - all compilers (hopefully)
11
12 */
13
14 #include "mikmod.h"
15
16 UBYTE *poslookup=NULL;// S3M/IT fix - removing blank patterns needs a
17 // lookup table to fix position-jump commands
18 SBYTE remap[64]; // for removing empty channels
19 SBYTE isused[64]; // for removing empty channels
20
21
22 void S3MIT_ProcessCmd(UBYTE cmd,UBYTE inf,BOOL oldeffect)
23 {
24 UBYTE hi,lo;
25
26 lo=inf&0xf;
27 hi=inf>>4;
28
29 // process S3M / IT specific command structure
30
31 if(cmd!=255)
32 { switch(cmd)
33 { case 1: // Axx set speed to xx
34 UniWrite(UNI_S3MEFFECTA);
35 UniWrite(inf);
36 break;
37
38 case 2: // Bxx position jump
39 UniPTEffect(0xb,poslookup[inf]);
40 break;
41
42 case 3: // Cxx patternbreak to row xx
43 if(oldeffect & 1)
44 UniPTEffect(0xd,(((inf&0xf0)>>4)*10)+(inf&0xf));
45 else
46 UniPTEffect(0xd,inf);
47 break;
48
49 case 4: // Dxy volumeslide
50 UniWrite(UNI_S3MEFFECTD);
51 UniWrite(inf);
52 break;
53
54 case 5: // Exy toneslide down
55 UniWrite(UNI_S3MEFFECTE);
56 UniWrite(inf);
57 break;
58
59 case 6: // Fxy toneslide up
60 UniWrite(UNI_S3MEFFECTF);
61 UniWrite(inf);
62 break;
63
64 case 7: // Gxx Tone portamento, speed xx
65 UniWrite(UNI_ITEFFECTG);
66 UniWrite(inf);
67 break;
68
69 case 8: // Hxy vibrato
70 if(oldeffect & 1)
71 UniPTEffect(0x4,inf);
72 else
73 { UniWrite(UNI_ITEFFECTH);
74 UniWrite(inf);
75 }
76 break;
77
78 case 9: // Ixy tremor, ontime x, offtime y
79 if(oldeffect & 1)
80 UniWrite(UNI_S3MEFFECTI);
81 else
82 UniWrite(UNI_ITEFFECTI);
83 UniWrite(inf);
84 break;
85
86 case 0xa: // Jxy arpeggio
87 UniPTEffect(0x0,inf);
88 break;
89
90 case 0xb: // Kxy Dual command H00 & Dxy
91 if(oldeffect & 1)
92 UniPTEffect(0x4,0);
93 else
94 { UniWrite(UNI_ITEFFECTH);
95 UniWrite(0);
96 }
97 UniWrite(UNI_S3MEFFECTD);
98 UniWrite(inf);
99 break;
100
101 case 0xc: // Lxy Dual command G00 & Dxy
102 if(oldeffect & 1)
103 UniPTEffect(0x3,0);
104 else
105 { UniWrite(UNI_ITEFFECTG);
106 UniWrite(0);
107 }
108 UniWrite(UNI_S3MEFFECTD);
109 UniWrite(inf);
110 break;
111
112 case 0xd: // Mxx Set Channel Volume
113 UniWrite(UNI_ITEFFECTM);
114 UniWrite(inf);
115 break;
116
117 case 0xe: // Nxy Slide Channel Volume
118 UniWrite(UNI_ITEFFECTN);
119 UniWrite(inf);
120 break;
121
122 case 0xf: // Oxx set sampleoffset xx00h
123 UniPTEffect(0x9,inf);
124 break;
125
126 case 0x10: // Pxy Slide Panning Commands
127 UniWrite(UNI_ITEFFECTP);
128 UniWrite(inf);
129 break;
130
131 case 0x11: // Qxy Retrig (+volumeslide)
132 UniWrite(UNI_S3MEFFECTQ);
133 if((inf!=0) && (lo==0) && !(oldeffect & 1))
134 UniWrite(1);
135 else
136 UniWrite(inf);
137 break;
138
139 case 0x12: // Rxy tremolo speed x, depth y
140 UniWrite(UNI_S3MEFFECTR);
141 UniWrite(inf);
142 break;
143
144 case 0x13: // Sxx special commands
145 UniWrite(UNI_ITEFFECTS0);
146 UniWrite(inf);
147 break;
148
149 case 0x14: // Txx tempo
150 if(inf>0x20)
151 { UniWrite(UNI_S3MEFFECTT);
152 UniWrite(inf);
153 }
154 break;
155
156 case 0x15: // Uxy Fine Vibrato speed x, depth y
157 if(oldeffect & 1)
158 UniWrite(UNI_S3MEFFECTU);
159 else
160 UniWrite(UNI_ITEFFECTU);
161 UniWrite(inf);
162 break;
163
164 case 0x16: // Vxx Set Global Volume
165 UniWrite(UNI_XMEFFECTG);
166 UniWrite(inf);
167 break;
168
169 case 0x17: // Wxy Global Volume Slide
170 UniWrite(UNI_ITEFFECTW);
171 UniWrite(inf);
172 break;
173
174 case 0x18: // Xxx amiga command 8xx
175 if(oldeffect & 1)
176 UniPTEffect(0x8,((inf<<1) == 256) ? 255 : (inf<<1));
177 else
178 UniPTEffect(0x8,inf);
179 break;
180
181 case 0x19: // Yxy Panbrello speed x, depth y
182 UniWrite(UNI_ITEFFECTY);
183 UniWrite(inf);
184 break;
185 }
186 }
187 }