annotate playercode/s3m_it.c @ 12:437e8455d862

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