├── .DS_Store ├── convert.bat ├── data ├── hard.pt3 ├── p_pp.pt3 ├── megamix.pt3 ├── oldlove.pt3 ├── summer.pt3 ├── timeup.pt3 ├── kakvsegda.pt3 ├── moonlight.pt3 ├── 199Xnostalgy.pt3 ├── chinesewatch.pt3 ├── durkadablues.pt3 ├── mehalanholia.pt3 ├── spring_came.pt3 ├── autumn_colors.pt3 ├── proper_summer.pt3 ├── snowball_game.pt3 ├── under_the_sun.pt3 ├── a_little_journey.pt3 ├── buhanidvebatonki.pt3 ├── enchanted_woods.pt3 ├── vozhidaniitepla.pt3 └── itscomefromthedark.pt3 ├── gfx ├── espboy.bmp └── espboy.h ├── pics ├── 0_PCM5102.jpg ├── 1_PCM5102.jpg ├── 2_PCM5102.jpg ├── 3_PCM5102.jpg └── 4_PCM5102.jpg ├── bin2h.py ├── README.md ├── ay_emu.h ├── glcdfont.c ├── ESPboy_PT3Play.ino ├── PT3Play.h └── LICENSE /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/.DS_Store -------------------------------------------------------------------------------- /convert.bat: -------------------------------------------------------------------------------- 1 | del gfx\*.h 2 | 3 | bin2h.py gfx\espboy.bmp g_espboy > gfx\espboy.h 4 | -------------------------------------------------------------------------------- /data/hard.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/hard.pt3 -------------------------------------------------------------------------------- /data/p_pp.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/p_pp.pt3 -------------------------------------------------------------------------------- /data/megamix.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/megamix.pt3 -------------------------------------------------------------------------------- /data/oldlove.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/oldlove.pt3 -------------------------------------------------------------------------------- /data/summer.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/summer.pt3 -------------------------------------------------------------------------------- /data/timeup.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/timeup.pt3 -------------------------------------------------------------------------------- /gfx/espboy.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/gfx/espboy.bmp -------------------------------------------------------------------------------- /data/kakvsegda.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/kakvsegda.pt3 -------------------------------------------------------------------------------- /data/moonlight.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/moonlight.pt3 -------------------------------------------------------------------------------- /pics/0_PCM5102.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/pics/0_PCM5102.jpg -------------------------------------------------------------------------------- /pics/1_PCM5102.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/pics/1_PCM5102.jpg -------------------------------------------------------------------------------- /pics/2_PCM5102.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/pics/2_PCM5102.jpg -------------------------------------------------------------------------------- /pics/3_PCM5102.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/pics/3_PCM5102.jpg -------------------------------------------------------------------------------- /pics/4_PCM5102.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/pics/4_PCM5102.jpg -------------------------------------------------------------------------------- /data/199Xnostalgy.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/199Xnostalgy.pt3 -------------------------------------------------------------------------------- /data/chinesewatch.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/chinesewatch.pt3 -------------------------------------------------------------------------------- /data/durkadablues.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/durkadablues.pt3 -------------------------------------------------------------------------------- /data/mehalanholia.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/mehalanholia.pt3 -------------------------------------------------------------------------------- /data/spring_came.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/spring_came.pt3 -------------------------------------------------------------------------------- /data/autumn_colors.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/autumn_colors.pt3 -------------------------------------------------------------------------------- /data/proper_summer.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/proper_summer.pt3 -------------------------------------------------------------------------------- /data/snowball_game.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/snowball_game.pt3 -------------------------------------------------------------------------------- /data/under_the_sun.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/under_the_sun.pt3 -------------------------------------------------------------------------------- /data/a_little_journey.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/a_little_journey.pt3 -------------------------------------------------------------------------------- /data/buhanidvebatonki.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/buhanidvebatonki.pt3 -------------------------------------------------------------------------------- /data/enchanted_woods.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/enchanted_woods.pt3 -------------------------------------------------------------------------------- /data/vozhidaniitepla.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/vozhidaniitepla.pt3 -------------------------------------------------------------------------------- /data/itscomefromthedark.pt3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ESPboy-edu/ESPboy_PT3Play/HEAD/data/itscomefromthedark.pt3 -------------------------------------------------------------------------------- /bin2h.py: -------------------------------------------------------------------------------- 1 | import array 2 | import os 3 | import sys 4 | 5 | data=array.array('B') 6 | size=0 7 | 8 | if len(sys.argv)!=3: 9 | raise ValueError("Usage: bin2h.py source.bin array_name") 10 | 11 | try: 12 | size=os.path.getsize(sys.argv[1]) 13 | except: 14 | raise ValueError('File not found') 15 | 16 | file=open(sys.argv[1],'rb') 17 | data.fromfile(file,size) 18 | file.close() 19 | 20 | print ('static const uint8_t %s[] PROGMEM ={' % sys.argv[2]) 21 | 22 | str='' 23 | 24 | for i in range(0,size): 25 | 26 | str+='0x%2.2x,' % data[i] 27 | 28 | if (i&15)==15: 29 | print (str) 30 | str='' 31 | 32 | if str!='': 33 | print (str) 34 | 35 | print ('};') 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ESPboy_PT3Play 2 | 3 | ESPboy PT3 - AY-3-8910 music player, using standard speaker or additional ESPboy PCM5102 I2S DAC module for better sound quality 4 | 5 | [demo video](https://www.youtube.com/watch?v=zYsDjjNx5j0) 6 | 7 | 8 | initial version by Shiru 9 | 10 | 11 | 12 | 13 | 14 | This is a PT3 format chiptune music player. The format is kind of standard de-facto for AY-3-8910 chiptune music on Russian ZX Spectrum clones. About ten thousands songs has been made since mid-90s when it was first introduced. 15 | 16 | The program emulates AY sound chip and plays PT3 files loaded into the SPIFFS. The sound is output through the sigma-delta modulation based DAC via the built-in speaker. It also supports i2s stereo DAC if connected (change define in the sketch, no run-time option to switch between outputs at the moment). 17 | 18 | Programming lesson learned: do not use sigma-delta while accessing SPIFFS, it crashes the device (i.e. disable sigma-delta while accessing files). 19 | 20 | I have included some of my own music to test it out. See zxtunes.com or the TrSongs archive to get much more. 21 | 22 | You can buy this DAC module ready-made or make it yourself. 23 | 24 | 25 | ![1](pics/1_PCM5102.jpg) 26 | 27 | ![2](pics/2_PCM5102.jpg) 28 | 29 | ![3](pics/3_PCM5102.jpg) 30 | 31 | ![4](pics/4_PCM5102.jpg) 32 | 33 | 34 | ## 1. Buy I2S PCM5102 DAC module 35 | 36 | - PCM5102 module [link to buy](https://aliexpress.ru/wholesale?catId=&SearchText=PCM5102) 37 | 38 | ![PCM5102 module](pics/0_PCM5102.jpg) 39 | 40 | 41 | 42 | ## 2. Connect PCM5102 DAC module -> ESPboy I2S bus 43 | 44 | - VIN -> VCC 45 | - GND -> GND 46 | - LCK -> G2 (GPIO2 / D4 / I2S0-WS) 47 | - DIN -> RX (I2S0-DATA) 48 | - BCK -> SS (CS / GPIO15/ D8 / I2S0-BCK) 49 | - SCK -> 10k resistor -> GND 50 | 51 | 52 | ## 3. Upload this firmware 53 | 54 | NOTE1: Before compilation, set Arduino IDE settings 55 | 56 | - Board: ESP8266 WeMos D1 mini 57 | - !CPU frequency: 80Mhz 58 | 59 | NOTE2: After compilation [upload music files to SPIFFS](https://randomnerdtutorials.com/install-esp8266-filesystem-uploader-arduino-ide/) 60 | 61 | 62 | ## 4. Useful links 63 | 64 | - [Buy ESPboy](https://www.tindie.com/products/23910/) 65 | - [DIY ESPboy](https://easyeda.com/ESPboy) 66 | - [Main Web site](https://www.espboy.com) 67 | - [YouTube channel](https://www.youtube.com/c/ESPboy) 68 | - [Community](https://community.espboy.com) 69 | - [Discord chat](https://discord.gg/kXfDQpX) 70 | - [Twitter](https://twitter.com/ESPboy_edu) 71 | - [Software](https://github.com/ESPboy-edu) 72 | - [Contact: espboy.edu@gmail.com](mailto:espboy.edu@gmail.com) 73 | 74 | -------------------------------------------------------------------------------- /ay_emu.h: -------------------------------------------------------------------------------- 1 | struct toneStruct { 2 | int count; 3 | int state; 4 | }; 5 | 6 | struct noiseStruct { 7 | int count; 8 | int reg; 9 | int qcc; 10 | int state; 11 | }; 12 | 13 | struct envStruct { 14 | int count; 15 | int dac; 16 | int up; 17 | }; 18 | 19 | struct AYChipStruct { 20 | toneStruct tone[3]; 21 | noiseStruct noise; 22 | envStruct env; 23 | 24 | int reg[16]; 25 | int dac[3]; 26 | int out[3]; 27 | 28 | int freqDiv; 29 | }; 30 | 31 | 32 | 33 | //�������� ��������� (��������, (�)HackerKAY) 34 | 35 | #define VDIV 3 36 | 37 | int volTab[16] = { 38 | 0 / VDIV, 39 | 836 / VDIV, 40 | 1212 / VDIV, 41 | 1773 / VDIV, 42 | 2619 / VDIV, 43 | 3875 / VDIV, 44 | 5397 / VDIV, 45 | 8823 / VDIV, 46 | 10392 / VDIV, 47 | 16706 / VDIV, 48 | 23339 / VDIV, 49 | 29292 / VDIV, 50 | 36969 / VDIV, 51 | 46421 / VDIV, 52 | 55195 / VDIV, 53 | 65535 / VDIV 54 | }; 55 | 56 | 57 | 58 | void ay_init(AYChipStruct *ay) 59 | { 60 | memset(ay, 0, sizeof(AYChipStruct)); 61 | 62 | ay->noise.reg = 0x0ffff; 63 | ay->noise.qcc = 0; 64 | ay->noise.state = 0; 65 | } 66 | 67 | 68 | 69 | void ay_out(AYChipStruct *ay, int reg, int value) 70 | { 71 | if (reg > 13) return; 72 | 73 | //������ � ������ �� ��������� ����� ��������� ������ ��� ���� 74 | //�����, ��� ������ R13 ���������� ����� �������� ��������� 75 | switch (reg) 76 | { 77 | case 1: 78 | case 3: 79 | case 5: 80 | value &= 15; 81 | break; 82 | case 8: 83 | case 9: 84 | case 10: 85 | case 6: 86 | value &= 31; 87 | break; 88 | case 13: 89 | value &= 15; 90 | ay->env.count = 0; 91 | if (value & 2) 92 | { 93 | ay->env.dac = 0; 94 | ay->env.up = 1; 95 | } 96 | else 97 | { 98 | ay->env.dac = 15; 99 | ay->env.up = 0; 100 | } 101 | break; 102 | } 103 | 104 | ay->reg[reg] = value; 105 | } 106 | 107 | 108 | 109 | inline void ay_tick(AYChipStruct *ay, int ticks) 110 | { 111 | int noise_di; 112 | int i, ta, tb, tc, na, nb, nc; 113 | 114 | ay->out[0] = 0; 115 | ay->out[1] = 0; 116 | ay->out[2] = 0; 117 | 118 | for (i = 0; i < ticks; ++i) 119 | { 120 | //�������� �������� ������� 121 | ay->freqDiv ^= 1; 122 | 123 | //���������� 124 | 125 | if (ay->tone[0].count >= (ay->reg[0] | (ay->reg[1] << 8))) 126 | { 127 | ay->tone[0].count = 0; 128 | ay->tone[0].state ^= 1; 129 | } 130 | if (ay->tone[1].count >= (ay->reg[2] | (ay->reg[3] << 8))) 131 | { 132 | ay->tone[1].count = 0; 133 | ay->tone[1].state ^= 1; 134 | } 135 | if (ay->tone[2].count >= (ay->reg[4] | (ay->reg[5] << 8))) 136 | { 137 | ay->tone[2].count = 0; 138 | ay->tone[2].state ^= 1; 139 | } 140 | 141 | ay->tone[0].count++; 142 | ay->tone[1].count++; 143 | ay->tone[2].count++; 144 | 145 | 146 | if (ay->freqDiv) 147 | { 148 | 149 | //��� (�������� ��������, (C)HackerKAY) 150 | 151 | if (ay->noise.count == 0) 152 | { 153 | noise_di = (ay->noise.qcc ^ ((ay->noise.reg >> 13) & 1)) ^ 1; 154 | ay->noise.qcc = (ay->noise.reg >> 15) & 1; 155 | ay->noise.state = ay->noise.qcc; 156 | ay->noise.reg = (ay->noise.reg << 1) | noise_di; 157 | } 158 | 159 | ay->noise.count = (ay->noise.count + 1) & 31; 160 | if (ay->noise.count >= ay->reg[6]) ay->noise.count = 0; 161 | 162 | 163 | //��������� 164 | 165 | if (ay->env.count == 0) 166 | { 167 | switch (ay->reg[13]) 168 | { 169 | case 0: 170 | case 1: 171 | case 2: 172 | case 3: 173 | case 9: 174 | if (ay->env.dac > 0) ay->env.dac--; 175 | break; 176 | case 4: 177 | case 5: 178 | case 6: 179 | case 7: 180 | case 15: 181 | if (ay->env.up) 182 | { 183 | ay->env.dac++; 184 | if (ay->env.dac > 15) 185 | { 186 | ay->env.dac = 0; 187 | ay->env.up = 0; 188 | } 189 | } 190 | break; 191 | 192 | case 8: 193 | ay->env.dac--; 194 | if (ay->env.dac < 0) ay->env.dac = 15; 195 | break; 196 | 197 | case 10: 198 | case 14: 199 | if (!ay->env.up) 200 | { 201 | ay->env.dac--; 202 | if (ay->env.dac < 0) 203 | { 204 | ay->env.dac = 0; 205 | ay->env.up = 1; 206 | } 207 | } 208 | else 209 | { 210 | ay->env.dac++; 211 | if (ay->env.dac > 15) 212 | { 213 | ay->env.dac = 15; 214 | ay->env.up = 0; 215 | } 216 | 217 | } 218 | break; 219 | 220 | case 11: 221 | if (!ay->env.up) 222 | { 223 | ay->env.dac--; 224 | if (ay->env.dac < 0) 225 | { 226 | ay->env.dac = 15; 227 | ay->env.up = 1; 228 | } 229 | } 230 | break; 231 | 232 | case 12: 233 | ay->env.dac++; 234 | if (ay->env.dac > 15) ay->env.dac = 0; 235 | break; 236 | 237 | case 13: 238 | if (ay->env.dac < 15) ay->env.dac++; 239 | break; 240 | 241 | } 242 | } 243 | 244 | ay->env.count++; 245 | if (ay->env.count >= (ay->reg[11] | (ay->reg[12] << 8))) ay->env.count = 0; 246 | 247 | } 248 | 249 | //������ 250 | 251 | ta = ay->tone[0].state | ((ay->reg[7] >> 0) & 1); 252 | tb = ay->tone[1].state | ((ay->reg[7] >> 1) & 1); 253 | tc = ay->tone[2].state | ((ay->reg[7] >> 2) & 1); 254 | na = ay->noise.state | ((ay->reg[7] >> 3) & 1); 255 | nb = ay->noise.state | ((ay->reg[7] >> 4) & 1); 256 | nc = ay->noise.state | ((ay->reg[7] >> 5) & 1); 257 | 258 | if (ay->reg[8] & 16) 259 | { 260 | ay->dac[0] = ay->env.dac; 261 | } 262 | else 263 | { 264 | if (ta & na) ay->dac[0] = ay->reg[8]; else ay->dac[0] = 0; 265 | } 266 | 267 | if (ay->reg[9] & 16) 268 | { 269 | ay->dac[1] = ay->env.dac; 270 | } 271 | else 272 | { 273 | if (tb & nb) ay->dac[1] = ay->reg[9]; else ay->dac[1] = 0; 274 | } 275 | 276 | if (ay->reg[10] & 16) 277 | { 278 | ay->dac[2] = ay->env.dac; 279 | } 280 | else 281 | { 282 | if (tc & nc) ay->dac[2] = ay->reg[10]; else ay->dac[2] = 0; 283 | } 284 | 285 | ay->out[0] += volTab[ay->dac[0]]; 286 | ay->out[1] += volTab[ay->dac[1]]; 287 | ay->out[2] += volTab[ay->dac[2]]; 288 | } 289 | 290 | ay->out[0] /= ticks; 291 | ay->out[1] /= ticks; 292 | ay->out[2] /= ticks; 293 | } 294 | -------------------------------------------------------------------------------- /glcdfont.c: -------------------------------------------------------------------------------- 1 | // This is the 'classic' fixed-space bitmap font for Adafruit_GFX since 1.0. 2 | // See gfxfont.h for newer custom bitmap font info. 3 | 4 | #ifndef FONT5X7_H 5 | #define FONT5X7_H 6 | 7 | #ifdef __AVR__ 8 | #include 9 | #include 10 | #elif defined(ESP8266) 11 | #include 12 | #elif defined(__IMXRT1052__) || defined(__IMXRT1062__) 13 | // PROGMEM is defefind for T4 to place data in specific memory section 14 | #undef PROGMEM 15 | #define PROGMEM 16 | #else 17 | #define PROGMEM 18 | #endif 19 | 20 | // Standard ASCII 5x7 font 21 | 22 | static const unsigned char font[] PROGMEM = { 23 | 0x00, 0x00, 0x00, 0x00, 0x00, 24 | 0x3E, 0x5B, 0x4F, 0x5B, 0x3E, 25 | 0x3E, 0x6B, 0x4F, 0x6B, 0x3E, 26 | 0x1C, 0x3E, 0x7C, 0x3E, 0x1C, 27 | 0x18, 0x3C, 0x7E, 0x3C, 0x18, 28 | 0x1C, 0x57, 0x7D, 0x57, 0x1C, 29 | 0x1C, 0x5E, 0x7F, 0x5E, 0x1C, 30 | 0x00, 0x18, 0x3C, 0x18, 0x00, 31 | 0xFF, 0xE7, 0xC3, 0xE7, 0xFF, 32 | 0x00, 0x18, 0x24, 0x18, 0x00, 33 | 0xFF, 0xE7, 0xDB, 0xE7, 0xFF, 34 | 0x30, 0x48, 0x3A, 0x06, 0x0E, 35 | 0x26, 0x29, 0x79, 0x29, 0x26, 36 | 0x40, 0x7F, 0x05, 0x05, 0x07, 37 | 0x40, 0x7F, 0x05, 0x25, 0x3F, 38 | 0x5A, 0x3C, 0xE7, 0x3C, 0x5A, 39 | 0x7F, 0x3E, 0x1C, 0x1C, 0x08, 40 | 0x08, 0x1C, 0x1C, 0x3E, 0x7F, 41 | 0x14, 0x22, 0x7F, 0x22, 0x14, 42 | 0x5F, 0x5F, 0x00, 0x5F, 0x5F, 43 | 0x06, 0x09, 0x7F, 0x01, 0x7F, 44 | 0x00, 0x66, 0x89, 0x95, 0x6A, 45 | 0x60, 0x60, 0x60, 0x60, 0x60, 46 | 0x94, 0xA2, 0xFF, 0xA2, 0x94, 47 | 0x08, 0x04, 0x7E, 0x04, 0x08, 48 | 0x10, 0x20, 0x7E, 0x20, 0x10, 49 | 0x08, 0x08, 0x2A, 0x1C, 0x08, 50 | 0x08, 0x1C, 0x2A, 0x08, 0x08, 51 | 0x1E, 0x10, 0x10, 0x10, 0x10, 52 | 0x0C, 0x1E, 0x0C, 0x1E, 0x0C, 53 | 0x30, 0x38, 0x3E, 0x38, 0x30, 54 | 0x06, 0x0E, 0x3E, 0x0E, 0x06, 55 | 0x00, 0x00, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x5F, 0x00, 0x00, 57 | 0x00, 0x07, 0x00, 0x07, 0x00, 58 | 0x14, 0x7F, 0x14, 0x7F, 0x14, 59 | 0x24, 0x2A, 0x7F, 0x2A, 0x12, 60 | 0x23, 0x13, 0x08, 0x64, 0x62, 61 | 0x36, 0x49, 0x56, 0x20, 0x50, 62 | 0x00, 0x08, 0x07, 0x03, 0x00, 63 | 0x00, 0x1C, 0x22, 0x41, 0x00, 64 | 0x00, 0x41, 0x22, 0x1C, 0x00, 65 | 0x2A, 0x1C, 0x7F, 0x1C, 0x2A, 66 | 0x08, 0x08, 0x3E, 0x08, 0x08, 67 | 0x00, 0x80, 0x70, 0x30, 0x00, 68 | 0x08, 0x08, 0x08, 0x08, 0x08, 69 | 0x00, 0x00, 0x60, 0x60, 0x00, 70 | 0x20, 0x10, 0x08, 0x04, 0x02, 71 | 0x3E, 0x51, 0x49, 0x45, 0x3E, 72 | 0x00, 0x42, 0x7F, 0x40, 0x00, 73 | 0x72, 0x49, 0x49, 0x49, 0x46, 74 | 0x21, 0x41, 0x49, 0x4D, 0x33, 75 | 0x18, 0x14, 0x12, 0x7F, 0x10, 76 | 0x27, 0x45, 0x45, 0x45, 0x39, 77 | 0x3C, 0x4A, 0x49, 0x49, 0x31, 78 | 0x41, 0x21, 0x11, 0x09, 0x07, 79 | 0x36, 0x49, 0x49, 0x49, 0x36, 80 | 0x46, 0x49, 0x49, 0x29, 0x1E, 81 | 0x00, 0x00, 0x14, 0x00, 0x00, 82 | 0x00, 0x40, 0x34, 0x00, 0x00, 83 | 0x00, 0x08, 0x14, 0x22, 0x41, 84 | 0x14, 0x14, 0x14, 0x14, 0x14, 85 | 0x00, 0x41, 0x22, 0x14, 0x08, 86 | 0x02, 0x01, 0x59, 0x09, 0x06, 87 | 0x3E, 0x41, 0x5D, 0x59, 0x4E, 88 | 0x7C, 0x12, 0x11, 0x12, 0x7C, 89 | 0x7F, 0x49, 0x49, 0x49, 0x36, 90 | 0x3E, 0x41, 0x41, 0x41, 0x22, 91 | 0x7F, 0x41, 0x41, 0x41, 0x3E, 92 | 0x7F, 0x49, 0x49, 0x49, 0x41, 93 | 0x7F, 0x09, 0x09, 0x09, 0x01, 94 | 0x3E, 0x41, 0x41, 0x51, 0x73, 95 | 0x7F, 0x08, 0x08, 0x08, 0x7F, 96 | 0x00, 0x41, 0x7F, 0x41, 0x00, 97 | 0x20, 0x40, 0x41, 0x3F, 0x01, 98 | 0x7F, 0x08, 0x14, 0x22, 0x41, 99 | 0x7F, 0x40, 0x40, 0x40, 0x40, 100 | 0x7F, 0x02, 0x1C, 0x02, 0x7F, 101 | 0x7F, 0x04, 0x08, 0x10, 0x7F, 102 | 0x3E, 0x41, 0x41, 0x41, 0x3E, 103 | 0x7F, 0x09, 0x09, 0x09, 0x06, 104 | 0x3E, 0x41, 0x51, 0x21, 0x5E, 105 | 0x7F, 0x09, 0x19, 0x29, 0x46, 106 | 0x26, 0x49, 0x49, 0x49, 0x32, 107 | 0x03, 0x01, 0x7F, 0x01, 0x03, 108 | 0x3F, 0x40, 0x40, 0x40, 0x3F, 109 | 0x1F, 0x20, 0x40, 0x20, 0x1F, 110 | 0x3F, 0x40, 0x38, 0x40, 0x3F, 111 | 0x63, 0x14, 0x08, 0x14, 0x63, 112 | 0x03, 0x04, 0x78, 0x04, 0x03, 113 | 0x61, 0x59, 0x49, 0x4D, 0x43, 114 | 0x00, 0x7F, 0x41, 0x41, 0x41, 115 | 0x02, 0x04, 0x08, 0x10, 0x20, 116 | 0x00, 0x41, 0x41, 0x41, 0x7F, 117 | 0x04, 0x02, 0x01, 0x02, 0x04, 118 | 0x40, 0x40, 0x40, 0x40, 0x40, 119 | 0x00, 0x03, 0x07, 0x08, 0x00, 120 | 0x20, 0x54, 0x54, 0x78, 0x40, 121 | 0x7F, 0x28, 0x44, 0x44, 0x38, 122 | 0x38, 0x44, 0x44, 0x44, 0x28, 123 | 0x38, 0x44, 0x44, 0x28, 0x7F, 124 | 0x38, 0x54, 0x54, 0x54, 0x18, 125 | 0x00, 0x08, 0x7E, 0x09, 0x02, 126 | 0x18, 0xA4, 0xA4, 0x9C, 0x78, 127 | 0x7F, 0x08, 0x04, 0x04, 0x78, 128 | 0x00, 0x44, 0x7D, 0x40, 0x00, 129 | 0x20, 0x40, 0x40, 0x3D, 0x00, 130 | 0x7F, 0x10, 0x28, 0x44, 0x00, 131 | 0x00, 0x41, 0x7F, 0x40, 0x00, 132 | 0x7C, 0x04, 0x78, 0x04, 0x78, 133 | 0x7C, 0x08, 0x04, 0x04, 0x78, 134 | 0x38, 0x44, 0x44, 0x44, 0x38, 135 | 0xFC, 0x18, 0x24, 0x24, 0x18, 136 | 0x18, 0x24, 0x24, 0x18, 0xFC, 137 | 0x7C, 0x08, 0x04, 0x04, 0x08, 138 | 0x48, 0x54, 0x54, 0x54, 0x24, 139 | 0x04, 0x04, 0x3F, 0x44, 0x24, 140 | 0x3C, 0x40, 0x40, 0x20, 0x7C, 141 | 0x1C, 0x20, 0x40, 0x20, 0x1C, 142 | 0x3C, 0x40, 0x30, 0x40, 0x3C, 143 | 0x44, 0x28, 0x10, 0x28, 0x44, 144 | 0x4C, 0x90, 0x90, 0x90, 0x7C, 145 | 0x44, 0x64, 0x54, 0x4C, 0x44, 146 | 0x00, 0x08, 0x36, 0x41, 0x00, 147 | 0x00, 0x00, 0x77, 0x00, 0x00, 148 | 0x00, 0x41, 0x36, 0x08, 0x00, 149 | 0x02, 0x01, 0x02, 0x04, 0x02, 150 | 0x3C, 0x26, 0x23, 0x26, 0x3C, 151 | 0x1E, 0xA1, 0xA1, 0x61, 0x12, 152 | 0x3A, 0x40, 0x40, 0x20, 0x7A, 153 | 0x38, 0x54, 0x54, 0x55, 0x59, 154 | 0x21, 0x55, 0x55, 0x79, 0x41, 155 | 0x22, 0x54, 0x54, 0x78, 0x42, // a-umlaut 156 | 0x21, 0x55, 0x54, 0x78, 0x40, 157 | 0x20, 0x54, 0x55, 0x79, 0x40, 158 | 0x0C, 0x1E, 0x52, 0x72, 0x12, 159 | 0x39, 0x55, 0x55, 0x55, 0x59, 160 | 0x39, 0x54, 0x54, 0x54, 0x59, 161 | 0x39, 0x55, 0x54, 0x54, 0x58, 162 | 0x00, 0x00, 0x45, 0x7C, 0x41, 163 | 0x00, 0x02, 0x45, 0x7D, 0x42, 164 | 0x00, 0x01, 0x45, 0x7C, 0x40, 165 | 0x7D, 0x12, 0x11, 0x12, 0x7D, // A-umlaut 166 | 0xF0, 0x28, 0x25, 0x28, 0xF0, 167 | 0x7C, 0x54, 0x55, 0x45, 0x00, 168 | 0x20, 0x54, 0x54, 0x7C, 0x54, 169 | 0x7C, 0x0A, 0x09, 0x7F, 0x49, 170 | 0x32, 0x49, 0x49, 0x49, 0x32, 171 | 0x3A, 0x44, 0x44, 0x44, 0x3A, // o-umlaut 172 | 0x32, 0x4A, 0x48, 0x48, 0x30, 173 | 0x3A, 0x41, 0x41, 0x21, 0x7A, 174 | 0x3A, 0x42, 0x40, 0x20, 0x78, 175 | 0x00, 0x9D, 0xA0, 0xA0, 0x7D, 176 | 0x3D, 0x42, 0x42, 0x42, 0x3D, // O-umlaut 177 | 0x3D, 0x40, 0x40, 0x40, 0x3D, 178 | 0x3C, 0x24, 0xFF, 0x24, 0x24, 179 | 0x48, 0x7E, 0x49, 0x43, 0x66, 180 | 0x2B, 0x2F, 0xFC, 0x2F, 0x2B, 181 | 0xFF, 0x09, 0x29, 0xF6, 0x20, 182 | 0xC0, 0x88, 0x7E, 0x09, 0x03, 183 | 0x20, 0x54, 0x54, 0x79, 0x41, 184 | 0x00, 0x00, 0x44, 0x7D, 0x41, 185 | 0x30, 0x48, 0x48, 0x4A, 0x32, 186 | 0x38, 0x40, 0x40, 0x22, 0x7A, 187 | 0x00, 0x7A, 0x0A, 0x0A, 0x72, 188 | 0x7D, 0x0D, 0x19, 0x31, 0x7D, 189 | 0x26, 0x29, 0x29, 0x2F, 0x28, 190 | 0x26, 0x29, 0x29, 0x29, 0x26, 191 | 0x30, 0x48, 0x4D, 0x40, 0x20, 192 | 0x38, 0x08, 0x08, 0x08, 0x08, 193 | 0x08, 0x08, 0x08, 0x08, 0x38, 194 | 0x2F, 0x10, 0xC8, 0xAC, 0xBA, 195 | 0x2F, 0x10, 0x28, 0x34, 0xFA, 196 | 0x00, 0x00, 0x7B, 0x00, 0x00, 197 | 0x08, 0x14, 0x2A, 0x14, 0x22, 198 | 0x22, 0x14, 0x2A, 0x14, 0x08, 199 | 0x55, 0x00, 0x55, 0x00, 0x55, // #176 (25% block) missing in old code 200 | 0xAA, 0x55, 0xAA, 0x55, 0xAA, // 50% block 201 | 0xFF, 0x55, 0xFF, 0x55, 0xFF, // 75% block 202 | 0x00, 0x00, 0x00, 0xFF, 0x00, 203 | 0x10, 0x10, 0x10, 0xFF, 0x00, 204 | 0x14, 0x14, 0x14, 0xFF, 0x00, 205 | 0x10, 0x10, 0xFF, 0x00, 0xFF, 206 | 0x10, 0x10, 0xF0, 0x10, 0xF0, 207 | 0x14, 0x14, 0x14, 0xFC, 0x00, 208 | 0x14, 0x14, 0xF7, 0x00, 0xFF, 209 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 210 | 0x14, 0x14, 0xF4, 0x04, 0xFC, 211 | 0x14, 0x14, 0x17, 0x10, 0x1F, 212 | 0x10, 0x10, 0x1F, 0x10, 0x1F, 213 | 0x14, 0x14, 0x14, 0x1F, 0x00, 214 | 0x10, 0x10, 0x10, 0xF0, 0x00, 215 | 0x00, 0x00, 0x00, 0x1F, 0x10, 216 | 0x10, 0x10, 0x10, 0x1F, 0x10, 217 | 0x10, 0x10, 0x10, 0xF0, 0x10, 218 | 0x00, 0x00, 0x00, 0xFF, 0x10, 219 | 0x10, 0x10, 0x10, 0x10, 0x10, 220 | 0x10, 0x10, 0x10, 0xFF, 0x10, 221 | 0x00, 0x00, 0x00, 0xFF, 0x14, 222 | 0x00, 0x00, 0xFF, 0x00, 0xFF, 223 | 0x00, 0x00, 0x1F, 0x10, 0x17, 224 | 0x00, 0x00, 0xFC, 0x04, 0xF4, 225 | 0x14, 0x14, 0x17, 0x10, 0x17, 226 | 0x14, 0x14, 0xF4, 0x04, 0xF4, 227 | 0x00, 0x00, 0xFF, 0x00, 0xF7, 228 | 0x14, 0x14, 0x14, 0x14, 0x14, 229 | 0x14, 0x14, 0xF7, 0x00, 0xF7, 230 | 0x14, 0x14, 0x14, 0x17, 0x14, 231 | 0x10, 0x10, 0x1F, 0x10, 0x1F, 232 | 0x14, 0x14, 0x14, 0xF4, 0x14, 233 | 0x10, 0x10, 0xF0, 0x10, 0xF0, 234 | 0x00, 0x00, 0x1F, 0x10, 0x1F, 235 | 0x00, 0x00, 0x00, 0x1F, 0x14, 236 | 0x00, 0x00, 0x00, 0xFC, 0x14, 237 | 0x00, 0x00, 0xF0, 0x10, 0xF0, 238 | 0x10, 0x10, 0xFF, 0x10, 0xFF, 239 | 0x14, 0x14, 0x14, 0xFF, 0x14, 240 | 0x10, 0x10, 0x10, 0x1F, 0x00, 241 | 0x00, 0x00, 0x00, 0xF0, 0x10, 242 | 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 243 | 0xF0, 0xF0, 0xF0, 0xF0, 0xF0, 244 | 0xFF, 0xFF, 0xFF, 0x00, 0x00, 245 | 0x00, 0x00, 0x00, 0xFF, 0xFF, 246 | 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 247 | 0x38, 0x44, 0x44, 0x38, 0x44, 248 | 0xFC, 0x4A, 0x4A, 0x4A, 0x34, // sharp-s or beta 249 | 0x7E, 0x02, 0x02, 0x06, 0x06, 250 | 0x02, 0x7E, 0x02, 0x7E, 0x02, 251 | 0x63, 0x55, 0x49, 0x41, 0x63, 252 | 0x38, 0x44, 0x44, 0x3C, 0x04, 253 | 0x40, 0x7E, 0x20, 0x1E, 0x20, 254 | 0x06, 0x02, 0x7E, 0x02, 0x02, 255 | 0x99, 0xA5, 0xE7, 0xA5, 0x99, 256 | 0x1C, 0x2A, 0x49, 0x2A, 0x1C, 257 | 0x4C, 0x72, 0x01, 0x72, 0x4C, 258 | 0x30, 0x4A, 0x4D, 0x4D, 0x30, 259 | 0x30, 0x48, 0x78, 0x48, 0x30, 260 | 0xBC, 0x62, 0x5A, 0x46, 0x3D, 261 | 0x3E, 0x49, 0x49, 0x49, 0x00, 262 | 0x7E, 0x01, 0x01, 0x01, 0x7E, 263 | 0x2A, 0x2A, 0x2A, 0x2A, 0x2A, 264 | 0x44, 0x44, 0x5F, 0x44, 0x44, 265 | 0x40, 0x51, 0x4A, 0x44, 0x40, 266 | 0x40, 0x44, 0x4A, 0x51, 0x40, 267 | 0x00, 0x00, 0xFF, 0x01, 0x03, 268 | 0xE0, 0x80, 0xFF, 0x00, 0x00, 269 | 0x08, 0x08, 0x6B, 0x6B, 0x08, 270 | 0x36, 0x12, 0x36, 0x24, 0x36, 271 | 0x06, 0x0F, 0x09, 0x0F, 0x06, 272 | 0x00, 0x00, 0x18, 0x18, 0x00, 273 | 0x00, 0x00, 0x10, 0x10, 0x00, 274 | 0x30, 0x40, 0xFF, 0x01, 0x01, 275 | 0x00, 0x1F, 0x01, 0x01, 0x1E, 276 | 0x00, 0x19, 0x1D, 0x17, 0x12, 277 | 0x00, 0x3C, 0x3C, 0x3C, 0x3C, 278 | 0x00, 0x00, 0x00, 0x00, 0x00 // #255 NBSP 279 | }; 280 | #endif // FONT5X7_H 281 | -------------------------------------------------------------------------------- /ESPboy_PT3Play.ino: -------------------------------------------------------------------------------- 1 | //v1.3 22.10.2019 gfx to TFT_eSPI lib, fixed 80/160Mhz bug 2 | //v1.2 14.12.2019 linear interp for better quality, analyzer display fix, backlight off during startup 3 | //v1.1 14.12.2019 hardware init fix, stereo and i2s support 4 | //v1.0 13.12.2019 initial version 5 | //by Shiru 6 | //shiru@mail.ru 7 | //https://www.patreon.com/shiru8bit 8 | 9 | //configure output device 10 | //if the i2s DAC is selected, but not connected, ESPboy crashes 11 | 12 | 13 | //#define OUTPUT_DEVICE OUT_SPEAKER 14 | #define OUTPUT_DEVICE OUT_I2S 15 | 16 | 17 | 18 | enum { 19 | OUT_SPEAKER = 0, 20 | OUT_I2S 21 | }; 22 | 23 | 24 | #include 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | #include "glcdfont.c" 33 | #include "gfx/espboy.h" 34 | 35 | #define MCP23017address 0 // actually it's 0x20 but in lib there is (x|0x20) :) 36 | 37 | //PINS 38 | #define LEDPIN D4 39 | #define SOUNDPIN D3 40 | 41 | #define csTFTMCP23017pin 8 42 | 43 | TFT_eSPI tft; 44 | Adafruit_MCP23017 mcp; 45 | 46 | #define MCP4725address 0x60 47 | Adafruit_MCP4725 dac; 48 | 49 | #define AY_CLOCK 1773400 //pitch 50 | #define SAMPLE_RATE 44010 //quality of the sound, i2s DAC can't handle more than 44100 by some reason (not even 48000) 51 | #define FRAME_RATE 50 //speed 52 | 53 | 54 | volatile uint32_t sound_stereo_dac; 55 | 56 | int pad_state; 57 | int pad_state_prev; 58 | int pad_state_t; 59 | 60 | 61 | #define PAD_LEFT 0x01 62 | #define PAD_UP 0x02 63 | #define PAD_DOWN 0x04 64 | #define PAD_RIGHT 0x08 65 | #define PAD_A 0x10 66 | #define PAD_B 0x20 67 | #define PAD_ANY (PAD_UP|PAD_DOWN|PAD_LEFT|PAD_RIGHT|PAD_A|PAD_B) 68 | 69 | 70 | #define SPEC_BANDS 42 71 | #define SPEC_HEIGHT 48 72 | #define SPEC_RANGE 1000 73 | #define SPEC_SX 0 74 | #define SPEC_SY 64 75 | #define SPEC_BAND_WIDTH 3 76 | #define SPEC_DECAY 3 77 | 78 | #define SPEC_CHA_COL 0x041F 79 | #define SPEC_CHB_COL 0xFC18 80 | #define SPEC_CHC_COL 0xFC1F 81 | #define SPEC_ENV_COL 0x87F0 82 | 83 | volatile int16_t spec_levels[SPEC_BANDS]; 84 | volatile int16_t spec_levels_prev[SPEC_BANDS]; 85 | volatile uint16_t spec_colors[SPEC_BANDS]; 86 | 87 | uint8_t music_data[32768]; 88 | int music_data_size; 89 | 90 | int output_device; 91 | 92 | 93 | 94 | #include "ay_emu.h" 95 | 96 | struct PT3_Channel_Parameters 97 | { 98 | unsigned short Address_In_Pattern, OrnamentPointer, SamplePointer, Ton; 99 | unsigned char Loop_Ornament_Position, Ornament_Length, Position_In_Ornament, Loop_Sample_Position, Sample_Length, Position_In_Sample, Volume, Number_Of_Notes_To_Skip, Note, Slide_To_Note, Amplitude; 100 | bool Envelope_Enabled, Enabled, SimpleGliss; 101 | short Current_Amplitude_Sliding, Current_Noise_Sliding, Current_Envelope_Sliding, Ton_Slide_Count, Current_OnOff, OnOff_Delay, OffOn_Delay, Ton_Slide_Delay, Current_Ton_Sliding, Ton_Accumulator, Ton_Slide_Step, Ton_Delta; 102 | signed char Note_Skip_Counter; 103 | }; 104 | 105 | struct PT3_Parameters 106 | { 107 | unsigned char Env_Base_lo; 108 | unsigned char Env_Base_hi; 109 | short Cur_Env_Slide, Env_Slide_Add; 110 | signed char Cur_Env_Delay, Env_Delay; 111 | unsigned char Noise_Base, Delay, AddToNoise, DelayCounter, CurrentPosition; 112 | int Version; 113 | }; 114 | 115 | struct PT3_SongInfo 116 | { 117 | PT3_Parameters PT3; 118 | PT3_Channel_Parameters PT3_A, PT3_B, PT3_C; 119 | }; 120 | 121 | struct AYSongInfo 122 | { 123 | unsigned char* module; 124 | unsigned char* module1; 125 | int module_len; 126 | PT3_SongInfo data; 127 | PT3_SongInfo data1; 128 | bool is_ts; 129 | 130 | AYChipStruct chip0; 131 | AYChipStruct chip1; 132 | }; 133 | 134 | struct AYSongInfo AYInfo; 135 | 136 | void ay_resetay(AYSongInfo* info, int chipnum) 137 | { 138 | if (!chipnum) ay_init(&info->chip0); else ay_init(&info->chip1); 139 | } 140 | 141 | void ay_writeay(AYSongInfo* info, int reg, int val, int chipnum) 142 | { 143 | if (!chipnum) ay_out(&info->chip0, reg, val); else ay_out(&info->chip1, reg, val); 144 | } 145 | 146 | #include "PT3Play.h" 147 | 148 | 149 | 150 | int interruptCnt; 151 | 152 | 153 | 154 | void spec_add(int hz, int level, uint16_t color) 155 | { 156 | int i, off; 157 | const int curve[5] = {SPEC_HEIGHT / 10, SPEC_HEIGHT / 5, SPEC_HEIGHT / 2, SPEC_HEIGHT / 5, SPEC_HEIGHT / 10}; 158 | 159 | if (hz) 160 | { 161 | off = hz / (SPEC_RANGE / SPEC_BANDS) - 2; 162 | 163 | if (off > SPEC_BANDS - 1) off = SPEC_BANDS - 1; 164 | 165 | for (i = 0; i < 5; ++i) 166 | { 167 | if (off >= 0 && off < SPEC_BANDS) 168 | { 169 | spec_levels[off] += curve[i] * level / 16; 170 | 171 | if (spec_levels[off] > SPEC_HEIGHT) spec_levels[off] = SPEC_HEIGHT; 172 | 173 | spec_colors[off] = color; 174 | } 175 | 176 | ++off; 177 | } 178 | } 179 | } 180 | 181 | void spec_update() 182 | { 183 | int i; 184 | 185 | for (i = 0; i < SPEC_BANDS; ++i) 186 | { 187 | spec_levels[i] -= SPEC_DECAY; 188 | if (spec_levels[i] < 0) spec_levels[i] = 0; 189 | } 190 | } 191 | 192 | void spec_add_ay(AYChipStruct* chip) 193 | { 194 | int period; 195 | 196 | if (!(chip->reg[7] & 0x01) && !(chip->reg[8] & 0x10)) 197 | { 198 | period = chip->reg[0] + chip->reg[1] * 256; 199 | if (period) spec_add(AY_CLOCK / 16 / period, chip->reg[8], SPEC_CHA_COL); 200 | } 201 | if (!(chip->reg[7] & 0x02) && !(chip->reg[9] & 0x10)) 202 | { 203 | period = chip->reg[2] + chip->reg[3] * 256; 204 | if (period) spec_add(AY_CLOCK / 16 / period, chip->reg[9], SPEC_CHB_COL); 205 | } 206 | if (!(chip->reg[7] & 0x04) && !(chip->reg[10] & 0x10)) 207 | { 208 | period = chip->reg[4] + chip->reg[5] * 256; 209 | if (period) spec_add(AY_CLOCK / 16 / period, chip->reg[10], SPEC_CHC_COL); 210 | } 211 | if ((chip->reg[8] & 0x10) || (chip->reg[9] & 0x10) || (chip->reg[10] & 0x10)) 212 | { 213 | period = chip->reg[11] + chip->reg[12] * 256; 214 | if (period) spec_add(AY_CLOCK / 16 / 16 / period, 12, SPEC_ENV_COL); 215 | } 216 | } 217 | 218 | 219 | 220 | uint32_t emulate_sample(void) 221 | { 222 | uint32_t out_l, out_r; 223 | 224 | if (interruptCnt++ >= (SAMPLE_RATE / FRAME_RATE)) 225 | { 226 | spec_update(); 227 | 228 | spec_add_ay(&AYInfo.chip0); 229 | 230 | if (AYInfo.is_ts) spec_add_ay(&AYInfo.chip1); 231 | 232 | PT3_Play_Chip(AYInfo, 0); 233 | 234 | interruptCnt = 0; 235 | } 236 | 237 | ay_tick(&AYInfo.chip0, (AY_CLOCK / SAMPLE_RATE / 8)); 238 | 239 | out_l = AYInfo.chip0.out[0] + AYInfo.chip0.out[1] / 2; 240 | out_r = AYInfo.chip0.out[2] + AYInfo.chip0.out[1] / 2; 241 | 242 | if (AYInfo.is_ts) 243 | { 244 | ay_tick(&AYInfo.chip1, (AY_CLOCK / SAMPLE_RATE / 8)); 245 | 246 | out_l += AYInfo.chip0.out[0] + AYInfo.chip0.out[1] / 2; 247 | out_r += AYInfo.chip0.out[2] + AYInfo.chip0.out[1] / 2; 248 | } 249 | 250 | if (out_l > 32767) out_l = 32767; 251 | if (out_r > 32767) out_r = 32767; 252 | 253 | return out_l | (out_r << 16); 254 | } 255 | 256 | 257 | 258 | void ICACHE_RAM_ATTR sound_speaker_ISR() 259 | { 260 | sigmaDeltaWrite(0, sound_stereo_dac); 261 | 262 | uint32_t out = emulate_sample(); 263 | 264 | sound_stereo_dac = ((out & 0xff00) >> 8) + ((out & 0xff000000) >> 24); //convert to 8-bit mono 265 | } 266 | 267 | 268 | 269 | void ICACHE_RAM_ATTR sound_i2s_ISR() 270 | { 271 | i2s_write_sample_nb(sound_stereo_dac); 272 | 273 | sound_stereo_dac = emulate_sample(); 274 | } 275 | 276 | 277 | 278 | int check_key() 279 | { 280 | pad_state_prev = pad_state; 281 | pad_state = 0; 282 | 283 | for (int i = 0; i < 8; i++) 284 | { 285 | if (!mcp.digitalRead(i)) pad_state |= (1 << i); 286 | } 287 | 288 | pad_state_t = pad_state ^ pad_state_prev & pad_state; 289 | 290 | return pad_state; 291 | } 292 | 293 | 294 | 295 | //0 no timeout, otherwise timeout in ms 296 | 297 | void wait_any_key(int timeout) 298 | { 299 | timeout /= 100; 300 | 301 | while (1) 302 | { 303 | check_key(); 304 | 305 | if (pad_state_t&PAD_ANY) break; 306 | 307 | if (timeout) 308 | { 309 | --timeout; 310 | 311 | if (timeout <= 0) break; 312 | } 313 | 314 | delay(100); 315 | } 316 | } 317 | 318 | 319 | 320 | //render part of a 8-bit uncompressed BMP file 321 | //no clipping 322 | //uses line buffer to draw it much faster than through writePixel 323 | 324 | void drawBMP8Part(int16_t x, int16_t y, const uint8_t bitmap[], int16_t dx, int16_t dy, int16_t w, int16_t h) 325 | { 326 | int32_t i, j, bw, bh, wa, off, col, rgb; 327 | static uint16_t buf[128]; 328 | 329 | bw = pgm_read_dword(&bitmap[0x12]); 330 | bh = pgm_read_dword(&bitmap[0x16]); 331 | wa = (bw + 3) & ~3; 332 | 333 | if (w >= h) 334 | { 335 | for (i = 0; i < h; ++i) 336 | { 337 | off = 54 + 256 * 4 + (bh - 1 - (i + dy)) * wa + dx; 338 | 339 | for (j = 0; j < w; ++j) 340 | { 341 | col = pgm_read_byte(&bitmap[off++]); 342 | rgb = pgm_read_dword(&bitmap[54 + col * 4]); 343 | buf[j] = ((rgb & 0xf8) >> 3) | ((rgb & 0xfc00) >> 5) | ((rgb & 0xf80000) >> 8); 344 | } 345 | 346 | tft.pushImage(x, y + i, w, 1, buf); 347 | } 348 | } 349 | else 350 | { 351 | for (i = 0; i < w; ++i) 352 | { 353 | off = 54 + 256 * 4 + (bh - 1 - dy) * wa + i + dx; 354 | 355 | for (j = 0; j < h; ++j) 356 | { 357 | col = pgm_read_byte(&bitmap[off]); 358 | rgb = pgm_read_dword(&bitmap[54 + col * 4]); 359 | buf[j] = ((rgb & 0xf8) >> 3) | ((rgb & 0xfc00) >> 5) | ((rgb & 0xf80000) >> 8); 360 | off -= wa; 361 | } 362 | 363 | tft.pushImage(x + i, y, 1, h, buf); 364 | } 365 | } 366 | } 367 | 368 | 369 | 370 | void drawCharFast(int x, int y, int c, int16_t color, int16_t bg) 371 | { 372 | int i, j, line; 373 | static uint16_t buf[5 * 8]; 374 | 375 | for (i = 0; i < 5; ++i) 376 | { 377 | line = pgm_read_byte(&font[c * 5 + i]); 378 | 379 | for (j = 0; j < 8; ++j) 380 | { 381 | buf[j * 5 + i] = (line & 1) ? color : bg; 382 | line >>= 1; 383 | } 384 | } 385 | tft.pushImage(x, y, 5, 8, buf); 386 | } 387 | 388 | 389 | 390 | void printFast(int x, int y, char* str, int16_t color) 391 | { 392 | char c; 393 | 394 | while (1) 395 | { 396 | c = *str++; 397 | 398 | if (!c) break; 399 | 400 | drawCharFast(x, y, c, color, 0); 401 | x += 6; 402 | } 403 | } 404 | 405 | 406 | 407 | bool espboy_logo_effect(int out) 408 | { 409 | int i, j, w, h, sx, sy, off, st, anim; 410 | 411 | sx = 32; 412 | sy = 28; 413 | w = 64; 414 | h = 72; 415 | st = 8; 416 | 417 | for (anim = 0; anim < st; ++anim) 418 | { 419 | if (check_key()&PAD_ANY) return false; 420 | 421 | //if (!out) set_speaker(200 + anim * 50, 5); 422 | 423 | for (i = 0; i < w / st; ++i) 424 | { 425 | for (j = 0; j < st; ++j) 426 | { 427 | off = anim - (7 - j); 428 | 429 | if (out) off += 8; 430 | 431 | if (off < 0 || off >= st) off = 0; else off += i * st; 432 | 433 | drawBMP8Part(sx + i * st + j, sy, g_espboy, off, 0, 1, h); 434 | } 435 | } 436 | 437 | delay(1000 / 30); 438 | } 439 | 440 | return true; 441 | } 442 | 443 | 444 | 445 | void music_open(const char* filename) 446 | { 447 | fs::File f = SPIFFS.open(filename, "r"); 448 | 449 | if (!f) return; 450 | 451 | music_data_size = f.size(); 452 | f.readBytes((char*)music_data, music_data_size); 453 | f.close(); 454 | } 455 | 456 | void music_play() 457 | { 458 | memset(&AYInfo, 0, sizeof(AYInfo)); 459 | 460 | ay_init(&AYInfo.chip0); 461 | ay_init(&AYInfo.chip1); 462 | 463 | AYInfo.module = music_data; 464 | AYInfo.module_len = music_data_size; 465 | 466 | PT3_Init(AYInfo); 467 | 468 | sound_stereo_dac = 0; 469 | interruptCnt = 0; 470 | 471 | switch (output_device) 472 | { 473 | case OUT_SPEAKER: 474 | 475 | noInterrupts(); 476 | sigmaDeltaSetup(0, SAMPLE_RATE); 477 | sigmaDeltaAttachPin(SOUNDPIN); 478 | sigmaDeltaEnable(); 479 | timer1_attachInterrupt(sound_speaker_ISR); 480 | timer1_enable(TIM_DIV1, TIM_EDGE, TIM_LOOP); 481 | timer1_write(80 * 1000000 / SAMPLE_RATE); 482 | interrupts(); 483 | break; 484 | 485 | case OUT_I2S: 486 | i2s_begin(); 487 | i2s_set_rate(SAMPLE_RATE); 488 | timer1_attachInterrupt(sound_i2s_ISR); 489 | timer1_enable(TIM_DIV1, TIM_EDGE, TIM_LOOP); 490 | timer1_write(80 * 1000000 / SAMPLE_RATE); 491 | break; 492 | } 493 | } 494 | 495 | void music_stop() 496 | { 497 | noInterrupts(); 498 | timer1_disable(); 499 | 500 | switch (output_device) 501 | { 502 | case OUT_SPEAKER: sigmaDeltaDisable(); break; 503 | case OUT_I2S: i2s_end(); break; 504 | } 505 | 506 | interrupts(); 507 | delay(10); 508 | } 509 | 510 | 511 | 512 | void playing_screen(const char* filename) 513 | { 514 | int i, h, sx, sy, off, frame; 515 | char str[21]; 516 | 517 | for (i = 0; i < SPEC_BANDS; ++i) 518 | { 519 | spec_levels[i] = 0; 520 | spec_levels_prev[i] = -1; 521 | spec_colors[i] = TFT_BLACK; 522 | } 523 | 524 | music_open(filename); 525 | 526 | tft.fillScreen(TFT_BLACK); 527 | 528 | printFast(4, 16, "Now playing...", TFT_YELLOW); 529 | tft.fillRect(0, 24, 128, 1, TFT_WHITE); 530 | 531 | memset(str, 0, sizeof(str)); 532 | memcpy(str, &music_data[0x1e], 20); 533 | printFast(4, 26, str, TFT_WHITE); 534 | memcpy(str, &music_data[0x3f], 20); 535 | printFast(4, 34, str, TFT_WHITE); 536 | 537 | sx = SPEC_SX; 538 | 539 | for (i = 0; i < SPEC_BANDS; ++i) 540 | { 541 | tft.fillRect(sx, SPEC_SY + SPEC_HEIGHT + 1, SPEC_BAND_WIDTH - 1, 1, TFT_WHITE); 542 | sx += SPEC_BAND_WIDTH; 543 | } 544 | 545 | music_play(); 546 | 547 | frame = 0; 548 | 549 | while (music_data) 550 | { 551 | sx = SPEC_SX; 552 | sy = SPEC_SY; 553 | 554 | for (i = 0; i < SPEC_BANDS; ++i) 555 | { 556 | h = spec_levels[i]; 557 | 558 | if (spec_levels_prev[i] != h) 559 | { 560 | spec_levels_prev[i] = h; 561 | 562 | if (h > SPEC_HEIGHT) h = SPEC_HEIGHT; 563 | 564 | tft.fillRect(sx, sy, 5, SPEC_HEIGHT - h, TFT_BLACK); 565 | tft.fillRect(sx, sy + SPEC_HEIGHT - h, SPEC_BAND_WIDTH - 1, h, spec_colors[i]); 566 | } 567 | 568 | sx += SPEC_BAND_WIDTH; 569 | } 570 | 571 | check_key(); 572 | 573 | if (pad_state_t) break; 574 | 575 | delay(1); 576 | } 577 | 578 | music_stop(); 579 | } 580 | 581 | 582 | #define FILE_HEIGHT 14 583 | #define FILE_FILTER "pt3" 584 | 585 | int file_cursor; 586 | 587 | bool file_browser_ext(const char* name) 588 | { 589 | while (1) if (*name++ == '.') break; 590 | 591 | return (strcasecmp(name, FILE_FILTER) == 0) ? true : false; 592 | } 593 | 594 | 595 | 596 | void file_browser(String path, const char* header, char* filename, int filename_len) 597 | { 598 | int i, j, sy, pos, frame, file_count; 599 | bool change, filter; 600 | fs::Dir dir; 601 | fs::File entry; 602 | char name[19 + 1]; 603 | const char* str; 604 | 605 | memset(filename, 0, filename_len); 606 | memset(name, 0, sizeof(name)); 607 | 608 | tft.fillScreen(TFT_BLACK); 609 | 610 | dir = SPIFFS.openDir(path); 611 | 612 | file_count = 0; 613 | 614 | while (dir.next()) 615 | { 616 | entry = dir.openFile("r"); 617 | 618 | filter = file_browser_ext(entry.name()); 619 | 620 | entry.close(); 621 | 622 | if (filter) ++file_count; 623 | } 624 | 625 | if (!file_count) 626 | { 627 | printFast(24, 60, "No files found", TFT_RED); 628 | 629 | while (1) delay(1000); 630 | } 631 | 632 | printFast(4, 4, (char*)header, TFT_GREEN); 633 | tft.fillRect(0, 12, 128, 1, TFT_WHITE); 634 | 635 | change = true; 636 | frame = 0; 637 | 638 | while (1) 639 | { 640 | if (change) 641 | { 642 | pos = file_cursor - FILE_HEIGHT / 2; 643 | 644 | if (pos > file_count - FILE_HEIGHT) pos = file_count - FILE_HEIGHT; 645 | if (pos < 0) pos = 0; 646 | 647 | dir = SPIFFS.openDir(path); 648 | i = pos; 649 | while (dir.next()) 650 | { 651 | entry = dir.openFile("r"); 652 | 653 | filter = file_browser_ext(entry.name()); 654 | 655 | entry.close(); 656 | 657 | if (!filter) continue; 658 | 659 | --i; 660 | if (i <= 0) break; 661 | } 662 | 663 | sy = 14; 664 | i = 0; 665 | 666 | while (1) 667 | { 668 | entry = dir.openFile("r"); 669 | 670 | filter = file_browser_ext(entry.name()); 671 | 672 | if (filter) 673 | { 674 | str = entry.name() + 1; 675 | 676 | for (j = 0; j < sizeof(name) - 1; ++j) 677 | { 678 | if (*str != 0 && *str != '.') name[j] = *str++; else name[j] = ' '; 679 | } 680 | 681 | printFast(8, sy, name, TFT_WHITE); 682 | 683 | drawCharFast(2, sy, ' ', TFT_WHITE, TFT_BLACK); 684 | 685 | if (pos == file_cursor) 686 | { 687 | strncpy(filename, entry.name(), filename_len); 688 | 689 | if (frame & 32) drawCharFast(2, sy, 0xdb, TFT_WHITE, TFT_BLACK); 690 | } 691 | } 692 | 693 | entry.close(); 694 | 695 | if (!dir.next()) break; 696 | 697 | if (filter) 698 | { 699 | sy += 8; 700 | ++pos; 701 | ++i; 702 | if (i >= FILE_HEIGHT) break; 703 | } 704 | } 705 | 706 | change = false; 707 | } 708 | 709 | check_key(); 710 | 711 | if (pad_state_t & PAD_UP) 712 | { 713 | --file_cursor; 714 | 715 | if (file_cursor < 0) file_cursor = file_count - 1; 716 | 717 | change = true; 718 | frame = 32; 719 | 720 | } 721 | 722 | if (pad_state_t & PAD_DOWN) 723 | { 724 | ++file_cursor; 725 | 726 | if (file_cursor >= file_count) file_cursor = 0; 727 | 728 | change = true; 729 | frame = 32; 730 | } 731 | 732 | if (pad_state_t & (PAD_A | PAD_B)) break; 733 | 734 | delay(1); 735 | 736 | ++frame; 737 | 738 | if (!(frame & 31)) change = true; 739 | } 740 | } 741 | 742 | 743 | 744 | void setup() 745 | { 746 | //serial init 747 | 748 | Serial.begin(115200); 749 | 750 | //disable wifi to save some battery power 751 | 752 | WiFi.mode(WIFI_OFF); 753 | WiFi.forceSleepBegin(); 754 | 755 | //DAC init, LCD backlit off 756 | 757 | dac.begin(MCP4725address); 758 | delay(100); 759 | dac.setVoltage(0, false); 760 | 761 | //mcp23017 and buttons init, should preceed the TFT init 762 | 763 | mcp.begin(MCP23017address); 764 | delay(100); 765 | 766 | for (int i = 0; i < 8; i++) 767 | { 768 | mcp.pinMode(i, INPUT); 769 | mcp.pullUp(i, HIGH); 770 | } 771 | 772 | pad_state = 0; 773 | pad_state_prev = 0; 774 | pad_state_t = 0; 775 | 776 | //TFT init 777 | 778 | mcp.pinMode(csTFTMCP23017pin, OUTPUT); 779 | mcp.digitalWrite(csTFTMCP23017pin, LOW); 780 | 781 | tft.begin(); 782 | tft.setSwapBytes(true); 783 | tft.setRotation(0); 784 | tft.fillScreen(TFT_BLACK); 785 | delay(200); 786 | dac.setVoltage(4095, true); 787 | 788 | //filesystem init 789 | SPIFFS.begin(); 790 | delay(100); 791 | 792 | output_device = OUTPUT_DEVICE; 793 | } 794 | 795 | 796 | 797 | void loop() 798 | { 799 | char filename[64]; 800 | 801 | file_cursor = 0; 802 | 803 | //logo (skippable) 804 | 805 | if (espboy_logo_effect(0)) 806 | { 807 | wait_any_key(1000); 808 | espboy_logo_effect(1); 809 | } 810 | 811 | //main loop 812 | 813 | while (1) 814 | { 815 | file_browser("/", "Select PT3 file:", filename, sizeof(filename)); 816 | playing_screen(filename); 817 | } 818 | } 819 | -------------------------------------------------------------------------------- /gfx/espboy.h: -------------------------------------------------------------------------------- 1 | static const uint8_t g_espboy[] PROGMEM ={ 2 | 0x42,0x4d,0x36,0x16,0x00,0x00,0x00,0x00,0x00,0x00,0x36,0x04,0x00,0x00,0x28,0x00, 3 | 0x00,0x00,0x40,0x00,0x00,0x00,0x48,0x00,0x00,0x00,0x01,0x00,0x08,0x00,0x00,0x00, 4 | 0x00,0x00,0x00,0x12,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 5 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x00,0x01,0x01, 6 | 0x02,0x00,0x01,0x01,0x03,0x00,0x02,0x02,0x04,0x00,0x02,0x02,0x05,0x00,0x04,0x02, 7 | 0x06,0x00,0x04,0x02,0x07,0x00,0x04,0x02,0x08,0x00,0x04,0x02,0x09,0x00,0x06,0x02, 8 | 0x0c,0x00,0x05,0x02,0x0e,0x00,0x05,0x03,0x0b,0x00,0x06,0x02,0x0f,0x00,0x07,0x02, 9 | 0x10,0x00,0x07,0x02,0x12,0x00,0x09,0x03,0x13,0x00,0x0a,0x02,0x16,0x00,0x09,0x03, 10 | 0x14,0x00,0x0a,0x02,0x17,0x00,0x0b,0x02,0x18,0x00,0x0b,0x02,0x19,0x00,0x0d,0x01, 11 | 0x1d,0x00,0x0d,0x01,0x1e,0x00,0x0d,0x02,0x1b,0x00,0x0e,0x01,0x20,0x00,0x0f,0x01, 12 | 0x22,0x00,0x0f,0x02,0x21,0x00,0x10,0x02,0x24,0x00,0x11,0x02,0x26,0x00,0x12,0x01, 13 | 0x2a,0x00,0x12,0x01,0x2b,0x00,0x12,0x02,0x28,0x00,0x12,0x01,0x2d,0x00,0x13,0x01, 14 | 0x30,0x00,0x13,0x02,0x2f,0x00,0x14,0x01,0x32,0x00,0x15,0x01,0x33,0x00,0x15,0x01, 15 | 0x34,0x00,0x16,0x00,0x38,0x00,0x16,0x00,0x39,0x00,0x16,0x01,0x36,0x00,0x18,0x00, 16 | 0x3b,0x00,0x19,0x00,0x3c,0x00,0x19,0x00,0x3e,0x00,0x1a,0x00,0x3f,0x00,0x1b,0x00, 17 | 0x41,0x00,0x1b,0x00,0x42,0x00,0x1c,0x00,0x43,0x00,0x1c,0x00,0x44,0x00,0x1d,0x00, 18 | 0x46,0x00,0x1d,0x00,0x47,0x00,0x1e,0x00,0x48,0x00,0x1e,0x00,0x49,0x00,0x1f,0x00, 19 | 0x4b,0x00,0x1f,0x00,0x4c,0x00,0x20,0x00,0x4d,0x00,0x20,0x00,0x4e,0x00,0x21,0x00, 20 | 0x50,0x00,0x21,0x00,0x51,0x00,0x21,0x00,0x52,0x00,0x23,0x00,0x54,0x00,0x23,0x00, 21 | 0x55,0x00,0x24,0x00,0x56,0x00,0x24,0x00,0x57,0x00,0x25,0x00,0x59,0x00,0x25,0x00, 22 | 0x5a,0x00,0x26,0x00,0x5b,0x00,0x26,0x00,0x5c,0x00,0x27,0x00,0x5e,0x00,0x27,0x00, 23 | 0x5f,0x00,0x27,0x00,0x60,0x00,0x27,0x00,0x61,0x00,0x29,0x00,0x62,0x00,0x29,0x00, 24 | 0x63,0x00,0x2a,0x00,0x64,0x00,0x2a,0x00,0x65,0x00,0x2b,0x00,0x67,0x00,0x2b,0x00, 25 | 0x68,0x00,0x2c,0x00,0x69,0x00,0x2c,0x00,0x6a,0x00,0x2d,0x00,0x6c,0x00,0x2d,0x00, 26 | 0x6d,0x00,0x2d,0x00,0x6e,0x00,0x2e,0x00,0x6f,0x00,0x2f,0x00,0x71,0x00,0x30,0x00, 27 | 0x72,0x00,0x30,0x00,0x74,0x00,0x31,0x00,0x75,0x00,0x31,0x00,0x76,0x00,0x32,0x00, 28 | 0x77,0x00,0x32,0x00,0x78,0x00,0x34,0x00,0x7a,0x00,0x34,0x00,0x7b,0x00,0x34,0x00, 29 | 0x7c,0x00,0x34,0x00,0x7d,0x00,0x35,0x00,0x7f,0x00,0x35,0x00,0x80,0x00,0x36,0x00, 30 | 0x81,0x00,0x36,0x00,0x82,0x00,0x37,0x00,0x83,0x00,0x37,0x00,0x84,0x00,0x38,0x00, 31 | 0x85,0x00,0x38,0x00,0x86,0x00,0x39,0x00,0x88,0x00,0x3a,0x00,0x88,0x00,0x3a,0x00, 32 | 0x8a,0x00,0x3a,0x00,0x8b,0x00,0x3b,0x00,0x8d,0x00,0x3c,0x00,0x8f,0x00,0x3c,0x00, 33 | 0x90,0x00,0x3d,0x00,0x92,0x00,0x3e,0x00,0x93,0x00,0x3f,0x00,0x95,0x00,0x41,0x00, 34 | 0x96,0x00,0x42,0x00,0x96,0x00,0x44,0x00,0x97,0x00,0x46,0x00,0x98,0x00,0x47,0x00, 35 | 0x98,0x00,0x49,0x00,0x99,0x00,0x48,0x00,0x9a,0x00,0x4b,0x01,0x9a,0x00,0x4b,0x08, 36 | 0x9b,0x00,0x4c,0x0b,0x9c,0x00,0x4d,0x10,0x9c,0x00,0x4f,0x16,0x9d,0x00,0x50,0x19, 37 | 0x9d,0x00,0x51,0x1b,0x9e,0x00,0x52,0x1e,0x9f,0x00,0x54,0x23,0x9f,0x00,0x55,0x25, 38 | 0x9f,0x00,0x56,0x27,0xa0,0x00,0x56,0x2a,0xa1,0x00,0x59,0x2d,0xa2,0x00,0x59,0x2f, 39 | 0xa2,0x00,0x5a,0x30,0xa3,0x00,0x5b,0x32,0xa3,0x00,0x5d,0x35,0xa4,0x00,0x5e,0x37, 40 | 0xa5,0x00,0x5f,0x38,0xa5,0x00,0x60,0x3a,0xa6,0x00,0x62,0x3e,0xa6,0x00,0x63,0x40, 41 | 0xa6,0x00,0x64,0x40,0xa7,0x00,0x65,0x42,0xa7,0x00,0x67,0x45,0xa8,0x00,0x68,0x47, 42 | 0xa9,0x00,0x69,0x48,0xaa,0x00,0x6a,0x49,0xaa,0x00,0x6c,0x4c,0xab,0x00,0x6d,0x4d, 43 | 0xab,0x00,0x6d,0x4f,0xac,0x00,0x6e,0x50,0xac,0x00,0x70,0x53,0xac,0x00,0x71,0x55, 44 | 0xad,0x00,0x72,0x56,0xae,0x00,0x73,0x57,0xae,0x00,0x75,0x5a,0xaf,0x00,0x76,0x5b, 45 | 0xaf,0x00,0x77,0x5c,0xb0,0x00,0x77,0x5e,0xb0,0x00,0x7a,0x60,0xb1,0x00,0x7b,0x61, 46 | 0xb1,0x00,0x7c,0x63,0xb2,0x00,0x7c,0x64,0xb3,0x00,0x7e,0x67,0xb2,0x00,0x80,0x68, 47 | 0xb2,0x00,0x80,0x69,0xb4,0x00,0x81,0x6b,0xb4,0x00,0x83,0x6d,0xb5,0x00,0x84,0x6e, 48 | 0xb5,0x00,0x85,0x6f,0xb6,0x00,0x86,0x71,0xb6,0x00,0x89,0x75,0xb7,0x00,0x8a,0x76, 49 | 0xb7,0x00,0x8d,0x7b,0xb8,0x00,0x8f,0x7c,0xb9,0x00,0x8f,0x7d,0xb9,0x00,0x91,0x7f, 50 | 0xba,0x00,0x92,0x81,0xba,0x00,0x93,0x82,0xbb,0x00,0x94,0x83,0xbb,0x00,0x96,0x85, 51 | 0xbc,0x00,0x95,0x86,0xbd,0x00,0x97,0x88,0xbd,0x00,0x99,0x89,0xbc,0x00,0x9a,0x8c, 52 | 0xbd,0x00,0x9a,0x8c,0xbe,0x00,0x9c,0x8e,0xbf,0x00,0x9f,0x91,0xbf,0x00,0x9f,0x92, 53 | 0xc0,0x00,0xa1,0x95,0xc1,0x00,0xa4,0x97,0xc1,0x00,0xff,0xff,0xff,0x00,0x00,0x00, 54 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 55 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 56 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 57 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 58 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 59 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 60 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 61 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 62 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 63 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 64 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 65 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 66 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 67 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 68 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 69 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01, 70 | 0x03,0x04,0x04,0x04,0x03,0x03,0x03,0x03,0x03,0x04,0x04,0x04,0x03,0x02,0x02,0x02, 71 | 0x02,0x01,0x01,0x01,0x01,0x01,0x01,0x02,0x03,0x04,0x03,0x03,0x02,0x02,0x02,0x03, 72 | 0x04,0x04,0x06,0x0c,0x11,0x1a,0x23,0x29,0x29,0x24,0x20,0x18,0x0b,0x04,0x01,0x01, 73 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03, 74 | 0x06,0x08,0x09,0x09,0x08,0x07,0x06,0x07,0x08,0x09,0x09,0x08,0x07,0x06,0x05,0x06, 75 | 0x05,0x03,0x01,0x01,0x01,0x01,0x03,0x06,0x08,0x08,0x08,0x07,0x05,0x04,0x05,0x07, 76 | 0x08,0x0c,0x0b,0x11,0x1a,0x25,0x30,0x37,0x39,0x34,0x2a,0x20,0x15,0x09,0x03,0x01, 77 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x04,0x0c, 78 | 0x10,0x14,0x15,0x15,0x14,0x11,0x12,0x11,0x14,0x14,0x15,0x14,0x11,0x0f,0x0e,0x0f, 79 | 0x0e,0x09,0x05,0x03,0x03,0x05,0x0c,0x10,0x13,0x14,0x13,0x11,0x0e,0x0b,0x0e,0x11, 80 | 0x14,0x15,0x16,0x1d,0x29,0x39,0x4c,0x56,0x58,0x53,0x43,0x2e,0x1e,0x14,0x08,0x02, 81 | 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x05,0x0d,0x18, 82 | 0x1d,0x21,0x23,0x23,0x21,0x1e,0x20,0x1e,0x21,0x23,0x23,0x21,0x1e,0x1d,0x1c,0x1c, 83 | 0x1a,0x18,0x0e,0x09,0x09,0x0e,0x18,0x1d,0x21,0x21,0x21,0x20,0x1c,0x19,0x1c,0x20, 84 | 0x21,0x23,0x24,0x2a,0x3a,0x55,0x6e,0x7a,0x7d,0x76,0x65,0x49,0x2e,0x1d,0x12,0x06, 85 | 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x05,0x0e,0x19,0x24, 86 | 0x30,0x38,0x3a,0x3a,0x38,0x34,0x31,0x34,0x38,0x3a,0x3a,0x39,0x34,0x2e,0x2c,0x2d, 87 | 0x2b,0x22,0x1a,0x15,0x15,0x1c,0x24,0x2f,0x37,0x39,0x37,0x33,0x2d,0x28,0x2d,0x33, 88 | 0x37,0x39,0x3a,0x3f,0x52,0x6f,0xc1,0xc1,0xc1,0xc1,0x86,0x65,0x43,0x27,0x19,0x0b, 89 | 0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x04,0x0d,0x19,0x29,0x3a, 90 | 0x50,0x5a,0x5e,0x5d,0x5a,0x55,0x50,0x55,0x59,0x5d,0x5d,0x5b,0x56,0x4e,0x49,0x4c, 91 | 0x48,0x39,0x2a,0x21,0x21,0x2a,0x3b,0x4f,0x59,0x5b,0x5a,0x55,0x4b,0x44,0x4b,0x55, 92 | 0x59,0x5a,0x58,0x57,0x63,0x7c,0xc1,0xc1,0xc1,0xc1,0xc1,0x77,0x53,0x32,0x20,0x12, 93 | 0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x0c,0x18,0x24,0x3a,0x58, 94 | 0x73,0x82,0x86,0x84,0x7f,0x77,0x71,0x77,0x7e,0x83,0x85,0x83,0x7c,0x71,0x6d,0x70, 95 | 0x6c,0x57,0x42,0x34,0x34,0x41,0x5a,0x72,0x7f,0x82,0x80,0x7a,0x6f,0x68,0x6f,0x79, 96 | 0x7f,0x7f,0x7b,0x73,0x74,0x88,0xa3,0xb1,0xba,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x14, 97 | 0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x05,0x10,0x1d,0x30,0x50,0x73, 98 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x90,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x98,0x90,0xc1, 99 | 0xc1,0x75,0x5f,0x4f,0x4e,0x5b,0x75,0xc1,0xc1,0xc1,0xc1,0xc1,0x95,0x8c,0x95,0xc1, 100 | 0xc1,0xc1,0xc1,0x97,0x91,0x9f,0xc1,0xc1,0xc1,0xc1,0xc1,0x89,0x60,0x3a,0x22,0x15, 101 | 0x08,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x02,0x07,0x14,0x21,0x38,0x5b,0x82, 102 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x95,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xa9,0xc1, 103 | 0xc1,0x90,0x78,0x6c,0x6a,0x71,0x89,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xa7,0xc1,0xc1, 104 | 0xc1,0xc1,0xc1,0xc1,0xa9,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x8a,0x61,0x3b,0x22,0x15, 105 | 0x09,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x02,0x08,0x15,0x22,0x3b,0x60,0x8a, 106 | 0xc1,0xc1,0xc1,0xb2,0xa1,0x8e,0x86,0x92,0xa3,0xb0,0xba,0xbe,0xc1,0xc1,0xb1,0xc1, 107 | 0xc1,0xa8,0x97,0x8c,0x87,0x88,0x98,0xc1,0xc1,0xb5,0xb5,0xc1,0xc1,0xb1,0xc1,0xc1, 108 | 0xb5,0xb5,0xc1,0xc1,0xb1,0xc1,0xc1,0xb4,0xb4,0xc1,0xc1,0x88,0x60,0x3b,0x22,0x15, 109 | 0x08,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x03,0x09,0x18,0x24,0x3d,0x63,0x8d, 110 | 0xc1,0xc1,0xc1,0xb3,0x9f,0x88,0x80,0x91,0xa8,0xc1,0xc1,0xc1,0xc1,0xc1,0xb3,0xc1, 111 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xa3,0xa7,0xc1,0xc1,0xb3,0xb3,0xc1,0xc1,0xb4,0xc1,0xc1, 112 | 0xb3,0xb3,0xc1,0xc1,0xb4,0xc1,0xc1,0xac,0xab,0xc1,0xc1,0x85,0x5e,0x3a,0x22,0x15, 113 | 0x08,0x02,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x03,0x0c,0x18,0x24,0x3d,0x64,0x8e, 114 | 0xc1,0xc1,0xc1,0xc1,0xc1,0x91,0x8b,0x9e,0xc1,0xc1,0xc1,0xc1,0xc1,0xae,0xae,0xc1, 115 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xb1,0xc1,0xc1,0xb9,0xb7,0xc1,0xc1,0xb1,0xc1,0xc1, 116 | 0xb5,0xb5,0xc1,0xc1,0xb1,0xc1,0xc1,0xa3,0xa1,0xc1,0xc1,0x81,0x5b,0x39,0x23,0x15, 117 | 0x09,0x03,0x01,0x01,0x00,0x00,0x00,0x01,0x01,0x04,0x0b,0x17,0x25,0x3e,0x64,0x8e, 118 | 0xc1,0xc1,0xc1,0xc1,0xc1,0x9b,0x98,0xc1,0xc1,0xc1,0xc1,0xc1,0xae,0xa4,0xa7,0xc1, 119 | 0xc1,0xb8,0xb3,0xb6,0xc1,0xc1,0xb7,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xa8,0xc1,0xc1, 120 | 0xc1,0xc1,0xc1,0xc1,0xaa,0xc1,0xc1,0x97,0x95,0xc1,0xc1,0x79,0x56,0x36,0x21,0x18, 121 | 0x0c,0x03,0x01,0x01,0x00,0x00,0x00,0x01,0x02,0x07,0x12,0x1c,0x27,0x3f,0x63,0x8c, 122 | 0xc1,0xc1,0xc1,0xbe,0xaf,0xa2,0xa0,0xc1,0xc1,0xbd,0xbb,0xb3,0xab,0xa2,0xa6,0xc1, 123 | 0xc1,0xb7,0xb3,0xb6,0xc1,0xc1,0xb5,0xc1,0xc1,0xc1,0xc1,0xc1,0x98,0x8e,0x96,0xc1, 124 | 0xc1,0xc1,0xc1,0x9a,0x92,0xc1,0xc1,0x84,0x83,0xc1,0xc1,0x6e,0x4e,0x32,0x21,0x17, 125 | 0x0e,0x06,0x02,0x01,0x00,0x00,0x01,0x02,0x06,0x0f,0x19,0x22,0x2e,0x43,0x63,0x88, 126 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xa3,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xaa,0xc1, 127 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xae,0xc1,0xc1,0xa5,0x95,0x87,0x76,0x6f,0x74,0x7f, 128 | 0x85,0x85,0x81,0x77,0x72,0x76,0x74,0x6c,0x6b,0x71,0x6e,0x5a,0x43,0x31,0x29,0x1e, 129 | 0x16,0x0d,0x05,0x01,0x01,0x00,0x01,0x05,0x0e,0x19,0x25,0x33,0x3f,0x4f,0x66,0x82, 130 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x9b,0xa3,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xa5,0xc1, 131 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xa4,0x9e,0xc1,0xc1,0x8f,0x7d,0x71,0x66,0x60,0x63,0x6a, 132 | 0x6d,0x6d,0x6b,0x65,0x62,0x65,0x63,0x5d,0x5c,0x61,0x5f,0x54,0x48,0x40,0x39,0x30, 133 | 0x24,0x19,0x0e,0x05,0x01,0x01,0x04,0x0b,0x19,0x26,0x3a,0x4f,0x5d,0x67,0x71,0x82, 134 | 0x96,0xa2,0xa6,0xa5,0xa0,0x99,0x91,0x95,0x9e,0xa3,0xa5,0xa4,0xa1,0x9c,0x99,0x9f, 135 | 0xa4,0xa5,0xa4,0xa2,0x9d,0x95,0x91,0x95,0x92,0x86,0x7b,0x73,0x6f,0x6d,0x6e,0x70, 136 | 0x71,0x71,0x70,0x6e,0x6d,0x6e,0x6e,0x6c,0x6c,0x6d,0x6c,0x68,0x65,0x60,0x5a,0x4e, 137 | 0x3a,0x26,0x19,0x0b,0x04,0x02,0x09,0x18,0x22,0x39,0x56,0x71,0x80,0x8a,0x90,0x98, 138 | 0xa1,0xa6,0xa8,0xa8,0xa6,0xa2,0x9f,0xa0,0xa5,0xa7,0xa9,0xa9,0xa7,0xa5,0xa3,0xa5, 139 | 0xa7,0xa8,0xa8,0xa7,0xa4,0xa0,0x9e,0xa0,0x9f,0x9a,0x95,0x92,0x91,0x90,0x91,0x91, 140 | 0x92,0x91,0x90,0x90,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8f,0x8d,0x8b,0x88,0x80,0x71, 141 | 0x55,0x39,0x22,0x18,0x0c,0x04,0x0f,0x1c,0x2d,0x4c,0x6f,0xc1,0xc1,0xc1,0xc1,0xc1, 142 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 143 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 144 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 145 | 0x6f,0x4c,0x2d,0x1c,0x10,0x08,0x12,0x20,0x31,0x52,0x75,0xc1,0xc1,0xc1,0xc1,0xc1, 146 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 147 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 148 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 149 | 0x75,0x52,0x31,0x20,0x11,0x09,0x0f,0x1c,0x2d,0x4c,0x6f,0xc1,0xc1,0xc1,0xc1,0xc1, 150 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 151 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 152 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1, 153 | 0x6f,0x4c,0x2d,0x1c,0x10,0x08,0x09,0x18,0x22,0x39,0x55,0x71,0x80,0x87,0x8b,0x8c, 154 | 0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x90,0x94,0x9d,0xaa,0xb2,0xb8,0xba,0xb5,0xac,0x9f, 155 | 0x95,0x90,0x8e,0x8d,0x8d,0x8d,0x8d,0x8d,0x8e,0x90,0x94,0x9d,0xaa,0xb2,0xb8,0xba, 156 | 0xb5,0xac,0x9e,0x95,0x90,0x8e,0x8d,0x8c,0x8c,0x8c,0x8c,0x8c,0x8a,0x87,0x7f,0x71, 157 | 0x55,0x39,0x22,0x18,0x0c,0x04,0x04,0x0b,0x19,0x26,0x3a,0x4e,0x59,0x5f,0x61,0x62, 158 | 0x63,0x63,0x63,0x63,0x64,0x66,0x6c,0x74,0x88,0xa1,0xc1,0xc1,0xc1,0xc1,0xa6,0x8b, 159 | 0x76,0x6c,0x67,0x64,0x64,0x63,0x63,0x64,0x66,0x6c,0x74,0x88,0xa1,0xc1,0xc1,0xc1, 160 | 0xc1,0xa6,0x8b,0x75,0x6c,0x66,0x64,0x63,0x63,0x63,0x63,0x62,0x61,0x5f,0x59,0x4e, 161 | 0x3a,0x26,0x19,0x0b,0x04,0x02,0x01,0x05,0x0d,0x19,0x24,0x2f,0x37,0x3a,0x3c,0x3c, 162 | 0x3d,0x3d,0x3d,0x3e,0x40,0x45,0x51,0x66,0x82,0xc1,0xc1,0xc0,0xc1,0xc1,0xc1,0x88, 163 | 0x6a,0x53,0x46,0x40,0x3e,0x3e,0x3e,0x40,0x45,0x51,0x66,0x82,0xc1,0xc1,0xbf,0xc1, 164 | 0xc1,0xc1,0x88,0x68,0x52,0x45,0x40,0x3e,0x3d,0x3d,0x3d,0x3c,0x3c,0x3a,0x37,0x2f, 165 | 0x24,0x19,0x0d,0x05,0x01,0x01,0x01,0x01,0x05,0x0b,0x18,0x1d,0x21,0x23,0x24,0x24, 166 | 0x24,0x24,0x24,0x25,0x27,0x2f,0x41,0x5e,0x81,0xc1,0xbc,0xc1,0xc1,0xc1,0xc1,0x8a, 167 | 0x64,0x45,0x31,0x28,0x26,0x25,0x26,0x28,0x31,0x43,0x60,0x83,0xc1,0xbc,0xc1,0xc1, 168 | 0xc1,0xc1,0x88,0x63,0x44,0x31,0x28,0x26,0x24,0x24,0x24,0x24,0x24,0x23,0x21,0x1d, 169 | 0x18,0x0b,0x05,0x01,0x01,0x00,0x00,0x01,0x01,0x04,0x09,0x0f,0x13,0x15,0x15,0x18, 170 | 0x18,0x18,0x18,0x19,0x1d,0x26,0x3a,0x5b,0x81,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x89, 171 | 0x62,0x3f,0x28,0x20,0x19,0x19,0x1b,0x20,0x2a,0x3f,0x60,0x85,0xc1,0xc1,0xc1,0xc1, 172 | 0xc1,0xc1,0x85,0x5e,0x3c,0x29,0x1d,0x19,0x18,0x18,0x18,0x18,0x15,0x15,0x13,0x0f, 173 | 0x09,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x01,0x01,0x03,0x05,0x07,0x08,0x09,0x09, 174 | 0x09,0x0c,0x0a,0x0f,0x18,0x1f,0x33,0x54,0x78,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x85, 175 | 0x5f,0x3d,0x26,0x1b,0x11,0x10,0x15,0x1d,0x2a,0x42,0x62,0x83,0xc1,0xc1,0xc1,0xc1, 176 | 0xc1,0xc1,0x7a,0x55,0x34,0x21,0x18,0x0f,0x0a,0x0c,0x09,0x09,0x08,0x08,0x07,0x05, 177 | 0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x02,0x02,0x02,0x03, 178 | 0x03,0x03,0x04,0x07,0x0f,0x1b,0x2a,0x44,0x69,0x8b,0xc1,0xc1,0xc1,0xc1,0xa2,0x81, 179 | 0x61,0x41,0x27,0x1b,0x12,0x10,0x16,0x23,0x34,0x4e,0x6a,0x83,0xa1,0xc1,0xc1,0xc1, 180 | 0xc1,0x8b,0x69,0x44,0x2a,0x1b,0x0f,0x07,0x04,0x03,0x03,0x03,0x02,0x02,0x02,0x01, 181 | 0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01,0x01,0x01,0x01, 182 | 0x01,0x01,0x01,0x03,0x08,0x13,0x1e,0x32,0x50,0x6f,0x8c,0xa2,0xad,0xad,0xa2,0x8c, 183 | 0x70,0x51,0x33,0x1f,0x18,0x18,0x20,0x2e,0x49,0x67,0x7c,0x90,0xa2,0xaa,0xa5,0x97, 184 | 0x83,0x6c,0x4d,0x30,0x20,0x11,0x08,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x01, 185 | 0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x01,0x01, 186 | 0x01,0x01,0x01,0x01,0x04,0x0b,0x19,0x29,0x3f,0x5f,0x7e,0x9d,0xc1,0xc1,0xc1,0xc1, 187 | 0x8b,0x69,0x44,0x2a,0x1d,0x1d,0x27,0x40,0x62,0x82,0xc1,0xc1,0xc1,0xc1,0xa2,0x86, 188 | 0x6c,0x51,0x36,0x23,0x18,0x0c,0x03,0x01,0x01,0x01,0x01,0x01,0x01,0x01,0x00,0x00, 189 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 190 | 0x00,0x00,0x01,0x01,0x03,0x09,0x18,0x22,0x3a,0x5a,0x7d,0xc1,0xc1,0xbe,0xc1,0xc1, 191 | 0xc1,0x79,0x54,0x34,0x22,0x23,0x31,0x50,0x73,0xc1,0xc1,0xba,0xc1,0xc1,0xc1,0x85, 192 | 0x63,0x43,0x2a,0x1a,0x0f,0x05,0x01,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 193 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 194 | 0x00,0x00,0x01,0x01,0x02,0x08,0x14,0x21,0x38,0x5a,0x80,0xc1,0xbb,0xc1,0xc1,0xc1, 195 | 0xc1,0x83,0x5b,0x39,0x26,0x25,0x36,0x56,0x7c,0xc1,0xb8,0xc1,0xc1,0xc1,0xc1,0x87, 196 | 0x61,0x3d,0x25,0x16,0x0a,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 197 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 198 | 0x00,0x00,0x01,0x01,0x02,0x07,0x13,0x21,0x37,0x59,0x80,0xc1,0xc1,0xc1,0xc1,0xc1, 199 | 0xc1,0x84,0x5b,0x3a,0x29,0x26,0x38,0x58,0x7f,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x85, 200 | 0x5d,0x3a,0x23,0x15,0x08,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 201 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 202 | 0x00,0x00,0x00,0x01,0x02,0x06,0x12,0x20,0x32,0x53,0x77,0xc1,0xc1,0xc1,0xc1,0xc1, 203 | 0xc1,0x7a,0x55,0x35,0x24,0x24,0x34,0x53,0x77,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x7a, 204 | 0x55,0x33,0x1e,0x11,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 205 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 206 | 0x00,0x00,0x00,0x01,0x01,0x04,0x0b,0x19,0x27,0x43,0x66,0x87,0xc1,0xc1,0xc1,0xc1, 207 | 0x89,0x69,0x45,0x2d,0x23,0x23,0x2d,0x45,0x66,0x87,0xc1,0xc1,0xc1,0xc1,0x89,0x67, 208 | 0x44,0x28,0x19,0x0d,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 209 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 210 | 0x00,0x00,0x00,0x00,0x01,0x02,0x07,0x11,0x20,0x2f,0x4a,0x66,0x78,0x83,0x83,0x7a, 211 | 0x69,0x4d,0x36,0x2a,0x25,0x26,0x2a,0x36,0x4c,0x67,0x79,0x83,0x83,0x7a,0x67,0x4b, 212 | 0x2f,0x20,0x11,0x07,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 213 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 214 | 0x00,0x00,0x00,0x00,0x01,0x01,0x04,0x0b,0x18,0x21,0x30,0x44,0x54,0x5b,0x5b,0x55, 215 | 0x47,0x38,0x32,0x34,0x37,0x38,0x36,0x33,0x39,0x46,0x55,0x5b,0x5b,0x55,0x44,0x30, 216 | 0x21,0x18,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 217 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 218 | 0x00,0x00,0x00,0x00,0x01,0x02,0x07,0x0e,0x15,0x1c,0x22,0x2c,0x35,0x39,0x3a,0x37, 219 | 0x33,0x37,0x43,0x50,0x56,0x58,0x54,0x46,0x39,0x34,0x37,0x3a,0x39,0x35,0x2c,0x22, 220 | 0x1c,0x18,0x0e,0x07,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 221 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 222 | 0x00,0x00,0x00,0x01,0x02,0x07,0x10,0x19,0x20,0x21,0x24,0x29,0x29,0x29,0x29,0x2a, 223 | 0x34,0x49,0x62,0x73,0x7c,0x7f,0x77,0x66,0x4c,0x36,0x2a,0x29,0x29,0x29,0x26,0x24, 224 | 0x23,0x20,0x19,0x12,0x08,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 225 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 226 | 0x00,0x00,0x01,0x02,0x08,0x11,0x1d,0x29,0x2f,0x35,0x37,0x34,0x2d,0x26,0x24,0x2c, 227 | 0x42,0x62,0x81,0xc1,0xc1,0xc1,0xc1,0x87,0x67,0x45,0x2d,0x24,0x25,0x2b,0x32,0x36, 228 | 0x36,0x31,0x27,0x1d,0x13,0x08,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 229 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 230 | 0x00,0x01,0x02,0x07,0x11,0x20,0x2d,0x40,0x4f,0x56,0x58,0x53,0x44,0x33,0x2c,0x35, 231 | 0x51,0x73,0xc1,0xc1,0xb8,0xc1,0xc1,0xc1,0x79,0x55,0x38,0x2c,0x32,0x42,0x50,0x56, 232 | 0x58,0x52,0x42,0x2e,0x1e,0x13,0x07,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 233 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 234 | 0x01,0x01,0x05,0x10,0x1d,0x2d,0x46,0x61,0x73,0x7c,0x7f,0x77,0x67,0x4d,0x3a,0x3d, 235 | 0x58,0x7c,0xc1,0xb8,0xc1,0xc1,0xc1,0xc1,0x84,0x5d,0x40,0x3a,0x4a,0x62,0x73,0x7c, 236 | 0x7e,0x77,0x66,0x49,0x2e,0x1d,0x12,0x06,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 237 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 238 | 0x01,0x03,0x0a,0x17,0x29,0x40,0x61,0x80,0xc1,0xc1,0xc1,0xc1,0x87,0x69,0x4c,0x46, 239 | 0x5c,0x80,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x85,0x5f,0x46,0x4a,0x64,0x81,0xc1,0xc1, 240 | 0xc1,0xc1,0x87,0x66,0x43,0x27,0x19,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 241 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 242 | 0x01,0x05,0x10,0x1d,0x2f,0x4f,0x73,0xc1,0xc1,0xb8,0xc1,0xc1,0xc1,0x7a,0x59,0x4a, 243 | 0x59,0x79,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x7c,0x5a,0x49,0x55,0x74,0xc1,0xc1,0xb8, 244 | 0xc1,0xc1,0xc1,0x78,0x54,0x32,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00, 245 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 246 | 0x02,0x07,0x11,0x1e,0x34,0x56,0x7c,0xc1,0xb8,0xc1,0xc1,0xc1,0xc1,0x84,0x5f,0x48, 247 | 0x4f,0x6c,0x8e,0xc1,0xc1,0xc1,0xc1,0x90,0x6d,0x4f,0x46,0x5a,0x7d,0xc1,0xb8,0xc1, 248 | 0xc1,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x13,0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00, 249 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 250 | 0x02,0x07,0x11,0x1f,0x36,0x58,0x7f,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x84,0x5e,0x43, 251 | 0x43,0x5a,0x77,0x90,0x9c,0x9e,0x93,0x79,0x5c,0x43,0x42,0x5b,0x7f,0xc1,0xc1,0xc1, 252 | 0xc1,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x13,0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00, 253 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 254 | 0x02,0x06,0x12,0x20,0x31,0x53,0x77,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x7b,0x57,0x3f, 255 | 0x41,0x59,0x75,0x8d,0x99,0x9b,0x91,0x78,0x5b,0x42,0x3e,0x55,0x78,0xc1,0xc1,0xc1, 256 | 0xc1,0xc1,0xc1,0x7a,0x55,0x33,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00, 257 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 258 | 0x01,0x04,0x0b,0x19,0x28,0x44,0x67,0x89,0xc1,0xc1,0xc1,0xc1,0x8b,0x6a,0x4a,0x3b, 259 | 0x49,0x69,0x88,0xc1,0xc1,0xc1,0xc1,0x8e,0x6c,0x4c,0x3c,0x49,0x68,0x89,0xc1,0xc1, 260 | 0xc1,0xc1,0x8b,0x68,0x45,0x28,0x19,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 261 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 262 | 0x01,0x02,0x07,0x13,0x1e,0x33,0x50,0x6e,0x82,0x8e,0x8f,0x84,0x6f,0x53,0x3c,0x3b, 263 | 0x53,0x74,0xc1,0xc1,0xbb,0xc1,0xc1,0xc1,0x7a,0x56,0x3d,0x3c,0x52,0x6e,0x83,0x8e, 264 | 0x8f,0x84,0x6f,0x51,0x33,0x1f,0x13,0x07,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 265 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 266 | 0x01,0x01,0x05,0x0f,0x1c,0x2b,0x43,0x5f,0x71,0x7b,0x7c,0x74,0x62,0x48,0x38,0x3c, 267 | 0x58,0x7d,0xc1,0xb9,0xc1,0xc1,0xc1,0xc1,0x84,0x5d,0x3f,0x38,0x47,0x60,0x72,0x7b, 268 | 0x7c,0x74,0x61,0x45,0x2c,0x1c,0x0f,0x05,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 269 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 270 | 0x01,0x02,0x06,0x11,0x20,0x31,0x4d,0x6b,0x7d,0x88,0x8b,0x82,0x6f,0x53,0x3e,0x40, 271 | 0x5b,0x80,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x85,0x5e,0x41,0x3d,0x50,0x6c,0x7e,0x88, 272 | 0x8b,0x82,0x6e,0x50,0x33,0x1f,0x13,0x07,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 273 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 274 | 0x01,0x03,0x0a,0x19,0x29,0x41,0x63,0x83,0xc1,0xc1,0xc1,0xc1,0x8a,0x6a,0x4c,0x44, 275 | 0x58,0x7a,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x7d,0x5a,0x44,0x4a,0x65,0x83,0xc1,0xc1, 276 | 0xc1,0xc1,0x89,0x69,0x44,0x28,0x19,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 277 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 278 | 0x01,0x05,0x10,0x1d,0x2f,0x50,0x73,0xc1,0xc1,0xb9,0xc1,0xc1,0xc1,0x7a,0x58,0x46, 279 | 0x51,0x6e,0x90,0xc1,0xc1,0xc1,0xc1,0x93,0x70,0x53,0x45,0x55,0x74,0xc1,0xc1,0xb9, 280 | 0xc1,0xc1,0xc1,0x79,0x54,0x32,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00, 281 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 282 | 0x02,0x07,0x11,0x1e,0x35,0x56,0x7c,0xc1,0xb8,0xc1,0xc1,0xc1,0xc1,0x84,0x5f,0x48, 283 | 0x4c,0x63,0x7c,0x94,0xa0,0xa2,0x99,0x84,0x6a,0x51,0x49,0x5c,0x7d,0xc1,0xb8,0xc1, 284 | 0xc1,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x13,0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00, 285 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 286 | 0x02,0x07,0x11,0x1f,0x36,0x58,0x7f,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x85,0x62,0x4f, 287 | 0x55,0x6a,0x7f,0x94,0xa0,0xa4,0x9e,0x8f,0x75,0x5f,0x53,0x61,0x81,0xc1,0xc1,0xc1, 288 | 0xc1,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x13,0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00, 289 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 290 | 0x02,0x06,0x12,0x20,0x31,0x52,0x77,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x7d,0x61,0x58, 291 | 0x68,0x7c,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x95,0x77,0x63,0x63,0x7c,0xc1,0xc1,0xc1, 292 | 0xc1,0xc1,0xc1,0x7a,0x54,0x32,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00, 293 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 294 | 0x01,0x04,0x0b,0x19,0x27,0x43,0x66,0x88,0xc1,0xc1,0xc1,0xc1,0x8c,0x6e,0x5c,0x64, 295 | 0x79,0xc1,0xa3,0xb5,0xc1,0xc1,0xc1,0xc1,0xc1,0x94,0x72,0x63,0x6f,0x8a,0xc1,0xc1, 296 | 0xc1,0xc1,0x8a,0x69,0x44,0x28,0x19,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 297 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 298 | 0x01,0x02,0x06,0x12,0x20,0x30,0x4c,0x68,0x7c,0x87,0x88,0x7f,0x6d,0x5a,0x5a,0x6f, 299 | 0xc1,0x9e,0xaf,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x81,0x65,0x5e,0x6e,0x7e,0x88, 300 | 0x88,0x7d,0x6a,0x4d,0x30,0x20,0x11,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 301 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 302 | 0x01,0x01,0x03,0x0a,0x16,0x24,0x38,0x50,0x62,0x6b,0x6c,0x65,0x57,0x4f,0x5b,0x78, 303 | 0xc1,0xad,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x8a,0x66,0x54,0x57,0x64,0x6c, 304 | 0x6c,0x63,0x51,0x39,0x24,0x16,0x0a,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 305 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 306 | 0x01,0x01,0x03,0x0c,0x16,0x24,0x37,0x4e,0x60,0x68,0x6b,0x65,0x57,0x52,0x61,0x81, 307 | 0xc1,0xb9,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x8f,0x6a,0x55,0x56,0x62,0x68, 308 | 0x6a,0x62,0x51,0x39,0x24,0x16,0x0a,0x03,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 309 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 310 | 0x01,0x01,0x06,0x12,0x1d,0x2e,0x49,0x65,0x76,0x81,0x84,0x7d,0x6e,0x61,0x6b,0x89, 311 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x90,0x6d,0x61,0x6c,0x78,0x81, 312 | 0x83,0x7b,0x68,0x4c,0x30,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 313 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 314 | 0x01,0x03,0x0a,0x17,0x29,0x40,0x62,0x81,0xc1,0xc1,0xc1,0xc1,0x8c,0x74,0x71,0x8b, 315 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x8e,0x71,0x71,0x86,0xc1,0xc1, 316 | 0xc1,0xc1,0x88,0x67,0x43,0x28,0x19,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 317 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 318 | 0x01,0x05,0x10,0x1d,0x2f,0x4f,0x73,0xc1,0xc1,0xb8,0xc1,0xc1,0xc1,0x84,0x75,0x86, 319 | 0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x87,0x74,0x7e,0xc1,0xc1,0xb8, 320 | 0xc1,0xc1,0xc1,0x78,0x54,0x32,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00, 321 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 322 | 0x02,0x07,0x11,0x1e,0x34,0x56,0x7c,0xc1,0xb8,0xc1,0xc1,0xc1,0xc1,0x8a,0x72,0x77, 323 | 0x94,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x95,0x76,0x6f,0x83,0xc1,0xb8,0xc1, 324 | 0xc1,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x13,0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00, 325 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 326 | 0x02,0x07,0x11,0x1f,0x36,0x58,0x7e,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x88,0x6b,0x65, 327 | 0x76,0x92,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x93,0x76,0x64,0x69,0x83,0xc1,0xc1,0xc1, 328 | 0xc1,0xc1,0xc1,0x83,0x5b,0x38,0x21,0x13,0x07,0x02,0x01,0x01,0x00,0x00,0x00,0x00, 329 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 330 | 0x02,0x06,0x12,0x20,0x31,0x52,0x77,0xc1,0xc1,0xc1,0xc1,0xc1,0xc1,0x7c,0x5c,0x4e, 331 | 0x58,0x6d,0x7d,0x88,0x8d,0x8d,0x89,0x7e,0x6d,0x58,0x4d,0x5a,0x79,0xc1,0xc1,0xc1, 332 | 0xc1,0xc1,0xc1,0x79,0x54,0x32,0x20,0x12,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00, 333 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x01, 334 | 0x01,0x04,0x0b,0x19,0x27,0x42,0x66,0x87,0xc1,0xc1,0xc1,0xc1,0x89,0x69,0x48,0x37, 335 | 0x3a,0x48,0x56,0x5f,0x62,0x62,0x5f,0x56,0x48,0x3a,0x37,0x47,0x67,0x87,0xc1,0xc1, 336 | 0xc1,0xc1,0x89,0x67,0x43,0x28,0x19,0x0b,0x04,0x01,0x01,0x00,0x00,0x00,0x00,0x00, 337 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 338 | 0x01,0x01,0x06,0x12,0x1d,0x2e,0x49,0x66,0x78,0x83,0x83,0x79,0x67,0x4b,0x31,0x24, 339 | 0x24,0x2b,0x34,0x3a,0x3c,0x3c,0x3a,0x34,0x2b,0x24,0x24,0x31,0x4a,0x66,0x78,0x83, 340 | 0x83,0x79,0x67,0x4a,0x2e,0x1d,0x12,0x06,0x01,0x01,0x00,0x00,0x00,0x00,0x00,0x00, 341 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 342 | 0x00,0x01,0x02,0x07,0x13,0x1e,0x2e,0x43,0x54,0x5b,0x5b,0x54,0x43,0x2f,0x1f,0x17, 343 | 0x16,0x1a,0x1e,0x23,0x24,0x24,0x23,0x1e,0x1a,0x16,0x17,0x1f,0x2e,0x43,0x54,0x5b, 344 | 0x5b,0x54,0x43,0x2e,0x1e,0x13,0x08,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 345 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 346 | 0x00,0x00,0x01,0x02,0x08,0x13,0x1d,0x27,0x32,0x38,0x38,0x32,0x28,0x20,0x14,0x0b, 347 | 0x0c,0x0e,0x11,0x14,0x18,0x18,0x14,0x11,0x0e,0x0c,0x0b,0x14,0x1d,0x27,0x32,0x38, 348 | 0x38,0x32,0x28,0x1d,0x13,0x08,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 349 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 350 | 0x00,0x00,0x00,0x01,0x02,0x07,0x12,0x19,0x20,0x21,0x21,0x20,0x19,0x12,0x08,0x04, 351 | 0x03,0x04,0x07,0x08,0x09,0x09,0x08,0x07,0x04,0x03,0x04,0x08,0x12,0x19,0x20,0x21, 352 | 0x21,0x20,0x19,0x12,0x08,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 353 | 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 354 | 0x00,0x00,0x00,0x00,0x01,0x02,0x06,0x0b,0x12,0x13,0x13,0x12,0x0b,0x06,0x02,0x01, 355 | 0x01,0x01,0x02,0x02,0x03,0x03,0x02,0x02,0x01,0x01,0x01,0x02,0x06,0x0b,0x12,0x13, 356 | 0x13,0x12,0x0b,0x06,0x02,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 357 | 0x00,0x00,0x00,0x00,0x00,0x00, 358 | }; 359 | -------------------------------------------------------------------------------- /PT3Play.h: -------------------------------------------------------------------------------- 1 | //Pro tracker 3.x player was written by S.V. Bulba. 2 | //modified code from libayfly 3 | 4 | enum 5 | { 6 | AY_CHNL_A_FINE = 0, 7 | AY_CHNL_A_COARSE, 8 | AY_CHNL_B_FINE, 9 | AY_CHNL_B_COARSE, 10 | AY_CHNL_C_FINE, 11 | AY_CHNL_C_COARSE, 12 | AY_NOISE_PERIOD, 13 | AY_MIXER, 14 | AY_CHNL_A_VOL, 15 | AY_CHNL_B_VOL, 16 | AY_CHNL_C_VOL, 17 | AY_ENV_FINE, 18 | AY_ENV_COARSE, 19 | AY_ENV_SHAPE, 20 | AY_GPIO_A, 21 | AY_GPIO_B 22 | }; 23 | 24 | int ay_sys_getword(unsigned char* data) 25 | { 26 | return data[0]+data[1]*256; 27 | } 28 | 29 | 30 | 31 | //Table #0 of Pro Tracker 3.3x - 3.4r 32 | const unsigned short PT3NoteTable_PT_33_34r[] = 33 | { 0x0C21, 0x0B73, 0x0ACE, 0x0A33, 0x09A0, 0x0916, 0x0893, 0x0818, 0x07A4, 0x0736, 0x06CE, 0x066D, 0x0610, 0x05B9, 0x0567, 0x0519, 0x04D0, 0x048B, 0x0449, 0x040C, 0x03D2, 0x039B, 0x0367, 0x0336, 0x0308, 0x02DC, 0x02B3, 0x028C, 0x0268, 0x0245, 0x0224, 0x0206, 0x01E9, 0x01CD, 0x01B3, 0x019B, 0x0184, 0x016E, 0x0159, 0x0146, 0x0134, 0x0122, 0x0112, 0x0103, 0x00F4, 0x00E6, 0x00D9, 0x00CD, 0x00C2, 0x00B7, 0x00AC, 0x00A3, 0x009A, 0x0091, 0x0089, 0x0081, 0x007A, 0x0073, 0x006C, 0x0066, 0x0061, 0x005B, 0x0056, 0x0051, 0x004D, 0x0048, 0x0044, 0x0040, 0x003D, 0x0039, 0x0036, 0x0033, 0x0030, 0x002D, 0x002B, 0x0028, 0x0026, 0x0024, 0x0022, 0x0020, 0x001E, 0x001C, 0x001B, 0x0019, 0x0018, 0x0016, 0x0015, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E, 0x000D, 0x000C }; 34 | 35 | //{Table #0 of Pro Tracker 3.4x - 3.5x} 36 | const unsigned short PT3NoteTable_PT_34_35[] = 37 | { 0x0C22, 0x0B73, 0x0ACF, 0x0A33, 0x09A1, 0x0917, 0x0894, 0x0819, 0x07A4, 0x0737, 0x06CF, 0x066D, 0x0611, 0x05BA, 0x0567, 0x051A, 0x04D0, 0x048B, 0x044A, 0x040C, 0x03D2, 0x039B, 0x0367, 0x0337, 0x0308, 0x02DD, 0x02B4, 0x028D, 0x0268, 0x0246, 0x0225, 0x0206, 0x01E9, 0x01CE, 0x01B4, 0x019B, 0x0184, 0x016E, 0x015A, 0x0146, 0x0134, 0x0123, 0x0112, 0x0103, 0x00F5, 0x00E7, 0x00DA, 0x00CE, 0x00C2, 0x00B7, 0x00AD, 0x00A3, 0x009A, 0x0091, 0x0089, 0x0082, 0x007A, 0x0073, 0x006D, 0x0067, 0x0061, 0x005C, 0x0056, 0x0052, 0x004D, 0x0049, 0x0045, 0x0041, 0x003D, 0x003A, 0x0036, 0x0033, 0x0031, 0x002E, 0x002B, 0x0029, 0x0027, 0x0024, 0x0022, 0x0020, 0x001F, 0x001D, 0x001B, 0x001A, 0x0018, 0x0017, 0x0016, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E, 0x000D, 0x000C }; 38 | 39 | //{Table #1 of Pro Tracker 3.3x - 3.5x)} 40 | const unsigned short PT3NoteTable_ST[] = 41 | { 0x0EF8, 0x0E10, 0x0D60, 0x0C80, 0x0BD8, 0x0B28, 0x0A88, 0x09F0, 0x0960, 0x08E0, 0x0858, 0x07E0, 0x077C, 0x0708, 0x06B0, 0x0640, 0x05EC, 0x0594, 0x0544, 0x04F8, 0x04B0, 0x0470, 0x042C, 0x03FD, 0x03BE, 0x0384, 0x0358, 0x0320, 0x02F6, 0x02CA, 0x02A2, 0x027C, 0x0258, 0x0238, 0x0216, 0x01F8, 0x01DF, 0x01C2, 0x01AC, 0x0190, 0x017B, 0x0165, 0x0151, 0x013E, 0x012C, 0x011C, 0x010A, 0x00FC, 0x00EF, 0x00E1, 0x00D6, 0x00C8, 0x00BD, 0x00B2, 0x00A8, 0x009F, 0x0096, 0x008E, 0x0085, 0x007E, 0x0077, 0x0070, 0x006B, 0x0064, 0x005E, 0x0059, 0x0054, 0x004F, 0x004B, 0x0047, 0x0042, 0x003F, 0x003B, 0x0038, 0x0035, 0x0032, 0x002F, 0x002C, 0x002A, 0x0027, 0x0025, 0x0023, 0x0021, 0x001F, 0x001D, 0x001C, 0x001A, 0x0019, 0x0017, 0x0016, 0x0015, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F }; 42 | 43 | //{Table #2 of Pro Tracker 3.4r} 44 | const unsigned short PT3NoteTable_ASM_34r[] = 45 | { 0x0D3E, 0x0C80, 0x0BCC, 0x0B22, 0x0A82, 0x09EC, 0x095C, 0x08D6, 0x0858, 0x07E0, 0x076E, 0x0704, 0x069F, 0x0640, 0x05E6, 0x0591, 0x0541, 0x04F6, 0x04AE, 0x046B, 0x042C, 0x03F0, 0x03B7, 0x0382, 0x034F, 0x0320, 0x02F3, 0x02C8, 0x02A1, 0x027B, 0x0257, 0x0236, 0x0216, 0x01F8, 0x01DC, 0x01C1, 0x01A8, 0x0190, 0x0179, 0x0164, 0x0150, 0x013D, 0x012C, 0x011B, 0x010B, 0x00FC, 0x00EE, 0x00E0, 0x00D4, 0x00C8, 0x00BD, 0x00B2, 0x00A8, 0x009F, 0x0096, 0x008D, 0x0085, 0x007E, 0x0077, 0x0070, 0x006A, 0x0064, 0x005E, 0x0059, 0x0054, 0x0050, 0x004B, 0x0047, 0x0043, 0x003F, 0x003C, 0x0038, 0x0035, 0x0032, 0x002F, 0x002D, 0x002A, 0x0028, 0x0026, 0x0024, 0x0022, 0x0020, 0x001E, 0x001D, 0x001B, 0x001A, 0x0019, 0x0018, 0x0015, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E }; 46 | 47 | //{Table #2 of Pro Tracker 3.4x - 3.5x} 48 | const unsigned short PT3NoteTable_ASM_34_35[] = 49 | { 0x0D10, 0x0C55, 0x0BA4, 0x0AFC, 0x0A5F, 0x09CA, 0x093D, 0x08B8, 0x083B, 0x07C5, 0x0755, 0x06EC, 0x0688, 0x062A, 0x05D2, 0x057E, 0x052F, 0x04E5, 0x049E, 0x045C, 0x041D, 0x03E2, 0x03AB, 0x0376, 0x0344, 0x0315, 0x02E9, 0x02BF, 0x0298, 0x0272, 0x024F, 0x022E, 0x020F, 0x01F1, 0x01D5, 0x01BB, 0x01A2, 0x018B, 0x0174, 0x0160, 0x014C, 0x0139, 0x0128, 0x0117, 0x0107, 0x00F9, 0x00EB, 0x00DD, 0x00D1, 0x00C5, 0x00BA, 0x00B0, 0x00A6, 0x009D, 0x0094, 0x008C, 0x0084, 0x007C, 0x0075, 0x006F, 0x0069, 0x0063, 0x005D, 0x0058, 0x0053, 0x004E, 0x004A, 0x0046, 0x0042, 0x003E, 0x003B, 0x0037, 0x0034, 0x0031, 0x002F, 0x002C, 0x0029, 0x0027, 0x0025, 0x0023, 0x0021, 0x001F, 0x001D, 0x001C, 0x001A, 0x0019, 0x0017, 0x0016, 0x0015, 0x0014, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E, 0x000D }; 50 | 51 | //{Table #3 of Pro Tracker 3.4r} 52 | const unsigned short PT3NoteTable_REAL_34r[] = 53 | { 0x0CDA, 0x0C22, 0x0B73, 0x0ACF, 0x0A33, 0x09A1, 0x0917, 0x0894, 0x0819, 0x07A4, 0x0737, 0x06CF, 0x066D, 0x0611, 0x05BA, 0x0567, 0x051A, 0x04D0, 0x048B, 0x044A, 0x040C, 0x03D2, 0x039B, 0x0367, 0x0337, 0x0308, 0x02DD, 0x02B4, 0x028D, 0x0268, 0x0246, 0x0225, 0x0206, 0x01E9, 0x01CE, 0x01B4, 0x019B, 0x0184, 0x016E, 0x015A, 0x0146, 0x0134, 0x0123, 0x0113, 0x0103, 0x00F5, 0x00E7, 0x00DA, 0x00CE, 0x00C2, 0x00B7, 0x00AD, 0x00A3, 0x009A, 0x0091, 0x0089, 0x0082, 0x007A, 0x0073, 0x006D, 0x0067, 0x0061, 0x005C, 0x0056, 0x0052, 0x004D, 0x0049, 0x0045, 0x0041, 0x003D, 0x003A, 0x0036, 0x0033, 0x0031, 0x002E, 0x002B, 0x0029, 0x0027, 0x0024, 0x0022, 0x0020, 0x001F, 0x001D, 0x001B, 0x001A, 0x0018, 0x0017, 0x0016, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E, 0x000D }; 54 | 55 | //{Table #3 of Pro Tracker 3.4x - 3.5x} 56 | const unsigned short PT3NoteTable_REAL_34_35[] = 57 | { 0x0CDA, 0x0C22, 0x0B73, 0x0ACF, 0x0A33, 0x09A1, 0x0917, 0x0894, 0x0819, 0x07A4, 0x0737, 0x06CF, 0x066D, 0x0611, 0x05BA, 0x0567, 0x051A, 0x04D0, 0x048B, 0x044A, 0x040C, 0x03D2, 0x039B, 0x0367, 0x0337, 0x0308, 0x02DD, 0x02B4, 0x028D, 0x0268, 0x0246, 0x0225, 0x0206, 0x01E9, 0x01CE, 0x01B4, 0x019B, 0x0184, 0x016E, 0x015A, 0x0146, 0x0134, 0x0123, 0x0112, 0x0103, 0x00F5, 0x00E7, 0x00DA, 0x00CE, 0x00C2, 0x00B7, 0x00AD, 0x00A3, 0x009A, 0x0091, 0x0089, 0x0082, 0x007A, 0x0073, 0x006D, 0x0067, 0x0061, 0x005C, 0x0056, 0x0052, 0x004D, 0x0049, 0x0045, 0x0041, 0x003D, 0x003A, 0x0036, 0x0033, 0x0031, 0x002E, 0x002B, 0x0029, 0x0027, 0x0024, 0x0022, 0x0020, 0x001F, 0x001D, 0x001B, 0x001A, 0x0018, 0x0017, 0x0016, 0x0014, 0x0013, 0x0012, 0x0011, 0x0010, 0x000F, 0x000E, 0x000D }; 58 | 59 | //{Volume table of Pro Tracker 3.3x - 3.4x} 60 | const unsigned char PT3VolumeTable_33_34[16][16] = 61 | { 62 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 63 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, 64 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02 }, 65 | { 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03 }, 66 | { 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04 }, 67 | { 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05 }, 68 | { 0x00, 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06 }, 69 | { 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07 }, 70 | { 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08 }, 71 | { 0x00, 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09 }, 72 | { 0x00, 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0A }, 73 | { 0x00, 0x00, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x09, 0x09, 0x0A, 0x0B }, 74 | { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x04, 0x05, 0x06, 0x07, 0x08, 0x08, 0x09, 0x0A, 0x0B, 0x0C }, 75 | { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D }, 76 | { 0x00, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E }, 77 | { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } }; 78 | 79 | //{Volume table of Pro Tracker 3.5x} 80 | const unsigned char PT3VolumeTable_35[16][16] = 81 | { 82 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }, 83 | { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01 }, 84 | { 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02 }, 85 | { 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03 }, 86 | { 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04 }, 87 | { 0x00, 0x00, 0x01, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05 }, 88 | { 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06 }, 89 | { 0x00, 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07 }, 90 | { 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x06, 0x07, 0x07, 0x08 }, 91 | { 0x00, 0x01, 0x01, 0x02, 0x02, 0x03, 0x04, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08, 0x08, 0x09 }, 92 | { 0x00, 0x01, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x05, 0x06, 0x07, 0x07, 0x08, 0x09, 0x09, 0x0A }, 93 | { 0x00, 0x01, 0x01, 0x02, 0x03, 0x04, 0x04, 0x05, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B }, 94 | { 0x00, 0x01, 0x02, 0x02, 0x03, 0x04, 0x05, 0x06, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x0C }, 95 | { 0x00, 0x01, 0x02, 0x03, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0A, 0x0B, 0x0C, 0x0D }, 96 | { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E }, 97 | { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F } }; 98 | 99 | struct PT3_File 100 | { 101 | signed char PT3_MusicName[0x63]; 102 | unsigned char PT3_TonTableId; 103 | unsigned char PT3_Delay; 104 | unsigned char PT3_NumberOfPositions; 105 | unsigned char PT3_LoopPosition; 106 | unsigned char PT3_PatternsPointer0, PT3_PatternsPointer1; 107 | unsigned char PT3_SamplesPointers0[32*2]; 108 | unsigned char PT3_OrnamentsPointers0[16*2]; 109 | unsigned char PT3_PositionList[128*2]; 110 | }; 111 | 112 | #define PT3_PatternsPointer (header->PT3_PatternsPointer0 | (header->PT3_PatternsPointer1 << 8)) 113 | #define PT3_SamplesPointers(x) (header->PT3_SamplesPointers0 [(x) * 2] | (header->PT3_SamplesPointers0 [(x) * 2 + 1] << 8)) 114 | #define PT3_OrnamentsPointers(x) (header->PT3_OrnamentsPointers0 [(x) * 2] | (header->PT3_OrnamentsPointers0 [(x) * 2 + 1] << 8)) 115 | 116 | #define PT3_A ((PT3_SongInfo *)data)->PT3_A 117 | #define PT3_B ((PT3_SongInfo *)data)->PT3_B 118 | #define PT3_C ((PT3_SongInfo *)data)->PT3_C 119 | #define PT3 ((PT3_SongInfo *)data)->PT3 120 | 121 | #define GET_COMMON_VARS(x) \ 122 | unsigned char *module;\ 123 | PT3_File *header;\ 124 | PT3_SongInfo *data;\ 125 | if(!info.is_ts || x == 0)\ 126 | {\ 127 | module = info.module;\ 128 | header = (PT3_File *)info.module;\ 129 | data = &info.data;\ 130 | }\ 131 | else\ 132 | {\ 133 | module = info.module1;\ 134 | header = (PT3_File *)info.module1;\ 135 | data = &info.data1;\ 136 | } 137 | 138 | 139 | unsigned char *PT3_FindSig(unsigned char *buffer, long length) 140 | { 141 | char sig[] = 142 | { 0x50, 0x72, 0x6f, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x33, 0x2e }; 143 | char sig1[] = 144 | { 0x56, 0x6f, 0x72, 0x74, 0x65, 0x78, 0x20, 0x54, 0x72, 0x61, 0x63, 0x6b, 0x65, 0x72, 0x20, 0x49, 0x49 }; 145 | if(length < sizeof(sig) || length < sizeof(sig1)) 146 | return 0; 147 | unsigned char *ptr = buffer; 148 | unsigned long remaining = length - sizeof(sig); 149 | while(remaining > sizeof(sig)) 150 | { 151 | if(!memcmp(ptr, sig, sizeof(sig)) || !memcmp(ptr, sig1, sizeof(sig1))) //found 152 | { 153 | return ptr; 154 | } 155 | ptr++; 156 | remaining--; 157 | } 158 | return 0; 159 | } 160 | 161 | void PT3_Init(AYSongInfo &info) 162 | { 163 | int i; 164 | unsigned char b; 165 | unsigned char *module = info.module; 166 | PT3_File *header = (PT3_File *)module; 167 | 168 | memset(&info.data, 0, sizeof(PT3_SongInfo)); 169 | 170 | int version = 6; 171 | 172 | if((header->PT3_MusicName[13] >= '0') && (header->PT3_MusicName[13] <= '9')) 173 | { 174 | version = header->PT3_MusicName[13] - 0x30; 175 | } 176 | unsigned char *ptr = PT3_FindSig(module + 0x63, info.module_len - 0x63); 177 | if((unsigned long)ptr > 0) 178 | { 179 | info.is_ts = true; 180 | info.module1 = ptr; 181 | memset(&info.data1, 0, sizeof(PT3_SongInfo)); 182 | } 183 | 184 | void *data = (void*)&info.data; 185 | module = info.module; 186 | 187 | for(unsigned long y = 0; y < 2; y++) 188 | { 189 | i = header->PT3_PositionList[0]; 190 | b = header->PT3_MusicName[0x62]; 191 | if(b != 0x20) 192 | { 193 | i = b * 3 - 3 - i; 194 | } 195 | PT3.Version = version; 196 | PT3.DelayCounter = 1; 197 | PT3.Delay = header->PT3_Delay; 198 | PT3_A.Address_In_Pattern = ay_sys_getword(&module[PT3_PatternsPointer + i * 2]); 199 | PT3_B.Address_In_Pattern = ay_sys_getword(&module[PT3_PatternsPointer + i * 2 + 2]); 200 | PT3_C.Address_In_Pattern = ay_sys_getword(&module[PT3_PatternsPointer + i * 2 + 4]); 201 | 202 | PT3_A.OrnamentPointer = PT3_OrnamentsPointers(0); 203 | PT3_A.Loop_Ornament_Position = module[PT3_A.OrnamentPointer]; 204 | PT3_A.OrnamentPointer++; 205 | PT3_A.Ornament_Length = module[PT3_A.OrnamentPointer]; 206 | PT3_A.OrnamentPointer++; 207 | PT3_A.SamplePointer = PT3_SamplesPointers(1); 208 | PT3_A.Loop_Sample_Position = module[PT3_A.SamplePointer]; 209 | PT3_A.SamplePointer++; 210 | PT3_A.Sample_Length = module[PT3_A.SamplePointer]; 211 | PT3_A.SamplePointer++; 212 | PT3_A.Volume = 15; 213 | PT3_A.Note_Skip_Counter = 1; 214 | 215 | PT3_B.OrnamentPointer = PT3_A.OrnamentPointer; 216 | PT3_B.Loop_Ornament_Position = PT3_A.Loop_Ornament_Position; 217 | PT3_B.Ornament_Length = PT3_A.Ornament_Length; 218 | PT3_B.SamplePointer = PT3_A.SamplePointer; 219 | PT3_B.Loop_Sample_Position = PT3_A.Loop_Sample_Position; 220 | PT3_B.Sample_Length = PT3_A.Sample_Length; 221 | PT3_B.Volume = 15; 222 | PT3_B.Note_Skip_Counter = 1; 223 | 224 | PT3_C.OrnamentPointer = PT3_A.OrnamentPointer; 225 | PT3_C.Loop_Ornament_Position = PT3_A.Loop_Ornament_Position; 226 | PT3_C.Ornament_Length = PT3_A.Ornament_Length; 227 | PT3_C.SamplePointer = PT3_A.SamplePointer; 228 | PT3_C.Loop_Sample_Position = PT3_A.Loop_Sample_Position; 229 | PT3_C.Sample_Length = PT3_A.Sample_Length; 230 | PT3_C.Volume = 15; 231 | PT3_C.Note_Skip_Counter = 1; 232 | if(!info.is_ts) 233 | break; 234 | data = (void*)&info.data1; 235 | module = info.module1; 236 | header = (PT3_File *)module; 237 | } 238 | 239 | ay_resetay(&info, 0); 240 | ay_resetay(&info, 1); 241 | } 242 | 243 | int PT3_GetNoteFreq(AYSongInfo &info, unsigned char j, unsigned long chip_num) 244 | { 245 | GET_COMMON_VARS(chip_num); 246 | switch(header->PT3_TonTableId) 247 | { 248 | case 0: 249 | if(PT3.Version <= 3) 250 | return PT3NoteTable_PT_33_34r[j]; 251 | else 252 | return PT3NoteTable_PT_34_35[j]; 253 | case 1: 254 | return PT3NoteTable_ST[j]; 255 | case 2: 256 | if(PT3.Version <= 3) 257 | return PT3NoteTable_ASM_34r[j]; 258 | else 259 | return PT3NoteTable_ASM_34_35[j]; 260 | default: 261 | if(PT3.Version <= 3) 262 | return PT3NoteTable_REAL_34r[j]; 263 | else 264 | return PT3NoteTable_REAL_34_35[j]; 265 | } 266 | } 267 | 268 | void PT3_PatternIntterpreter(AYSongInfo &info, PT3_Channel_Parameters &chan, unsigned long chip_num) 269 | { 270 | GET_COMMON_VARS(chip_num); 271 | bool quit; 272 | unsigned char flag9, flag8, flag5, flag4, flag3, flag2, flag1; 273 | unsigned char counter; 274 | int prnote, prsliding; 275 | prnote = chan.Note; 276 | prsliding = chan.Current_Ton_Sliding; 277 | quit = false; 278 | counter = 0; 279 | flag9 = flag8 = flag5 = flag4 = flag3 = flag2 = flag1 = 0; 280 | do 281 | { 282 | unsigned char val = module[chan.Address_In_Pattern]; 283 | if(val >= 0xf0) 284 | { 285 | chan.OrnamentPointer = PT3_OrnamentsPointers((val - 0xf0)); 286 | chan.Loop_Ornament_Position = module[chan.OrnamentPointer]; 287 | chan.OrnamentPointer++; 288 | chan.Ornament_Length = module[chan.OrnamentPointer]; 289 | chan.OrnamentPointer++; 290 | chan.Address_In_Pattern++; 291 | chan.SamplePointer = PT3_SamplesPointers((module [chan.Address_In_Pattern] / 2)); 292 | chan.Loop_Sample_Position = module[chan.SamplePointer]; 293 | chan.SamplePointer++; 294 | chan.Sample_Length = module[chan.SamplePointer]; 295 | chan.SamplePointer++; 296 | chan.Envelope_Enabled = false; 297 | chan.Position_In_Ornament = 0; 298 | } 299 | else if(val >= 0xd1 && val <= 0xef) 300 | { 301 | chan.SamplePointer = PT3_SamplesPointers((val - 0xd0)); 302 | chan.Loop_Sample_Position = module[chan.SamplePointer]; 303 | chan.SamplePointer++; 304 | chan.Sample_Length = module[chan.SamplePointer]; 305 | chan.SamplePointer++; 306 | } 307 | else if(val == 0xd0) 308 | { 309 | quit = true; 310 | } 311 | else if(val >= 0xc1 && val <= 0xcf) 312 | { 313 | chan.Volume = val - 0xc0; 314 | } 315 | else if(val == 0xc0) 316 | { 317 | chan.Position_In_Sample = 0; 318 | chan.Current_Amplitude_Sliding = 0; 319 | chan.Current_Noise_Sliding = 0; 320 | chan.Current_Envelope_Sliding = 0; 321 | chan.Position_In_Ornament = 0; 322 | chan.Ton_Slide_Count = 0; 323 | chan.Current_Ton_Sliding = 0; 324 | chan.Ton_Accumulator = 0; 325 | chan.Current_OnOff = 0; 326 | chan.Enabled = false; 327 | quit = true; 328 | } 329 | else if(val >= 0xb2 && val <= 0xbf) 330 | { 331 | chan.Envelope_Enabled = true; 332 | ay_writeay(&info, AY_ENV_SHAPE, val - 0xb1, chip_num); 333 | chan.Address_In_Pattern++; 334 | PT3.Env_Base_hi = module[chan.Address_In_Pattern]; 335 | chan.Address_In_Pattern++; 336 | PT3.Env_Base_lo = module[chan.Address_In_Pattern]; 337 | chan.Position_In_Ornament = 0; 338 | PT3.Cur_Env_Slide = 0; 339 | PT3.Cur_Env_Delay = 0; 340 | } 341 | else if(val == 0xb1) 342 | { 343 | chan.Address_In_Pattern++; 344 | chan.Number_Of_Notes_To_Skip = module[chan.Address_In_Pattern]; 345 | } 346 | else if(val == 0xb0) 347 | { 348 | chan.Envelope_Enabled = false; 349 | chan.Position_In_Ornament = 0; 350 | } 351 | else if(val >= 0x50 && val <= 0xaf) 352 | { 353 | chan.Note = val - 0x50; 354 | chan.Position_In_Sample = 0; 355 | chan.Current_Amplitude_Sliding = 0; 356 | chan.Current_Noise_Sliding = 0; 357 | chan.Current_Envelope_Sliding = 0; 358 | chan.Position_In_Ornament = 0; 359 | chan.Ton_Slide_Count = 0; 360 | chan.Current_Ton_Sliding = 0; 361 | chan.Ton_Accumulator = 0; 362 | chan.Current_OnOff = 0; 363 | chan.Enabled = true; 364 | quit = true; 365 | } 366 | else if(val >= 0x40 && val <= 0x4f) 367 | { 368 | chan.OrnamentPointer = PT3_OrnamentsPointers((val - 0x40)); 369 | chan.Loop_Ornament_Position = module[chan.OrnamentPointer]; 370 | chan.OrnamentPointer++; 371 | chan.Ornament_Length = module[chan.OrnamentPointer]; 372 | chan.OrnamentPointer++; 373 | chan.Position_In_Ornament = 0; 374 | } 375 | else if(val >= 0x20 && val <= 0x3f) 376 | { 377 | PT3.Noise_Base = val - 0x20; 378 | } 379 | else if(val >= 0x10 && val <= 0x1f) 380 | { 381 | if(val == 0x10) 382 | chan.Envelope_Enabled = false; 383 | else 384 | { 385 | ay_writeay(&info, AY_ENV_SHAPE, val - 0x10, chip_num); 386 | chan.Address_In_Pattern++; 387 | PT3.Env_Base_hi = module[chan.Address_In_Pattern]; 388 | chan.Address_In_Pattern++; 389 | PT3.Env_Base_lo = module[chan.Address_In_Pattern]; 390 | chan.Envelope_Enabled = true; 391 | PT3.Cur_Env_Slide = 0; 392 | PT3.Cur_Env_Delay = 0; 393 | } 394 | chan.Address_In_Pattern++; 395 | chan.SamplePointer = PT3_SamplesPointers((module [chan.Address_In_Pattern] / 2)); 396 | chan.Loop_Sample_Position = module[chan.SamplePointer]; 397 | chan.SamplePointer++; 398 | chan.Sample_Length = module[chan.SamplePointer]; 399 | chan.SamplePointer++; 400 | chan.Position_In_Ornament = 0; 401 | } 402 | else if(val == 0x9) 403 | { 404 | counter++; 405 | flag9 = counter; 406 | } 407 | else if(val == 0x8) 408 | { 409 | counter++; 410 | flag8 = counter; 411 | } 412 | else if(val == 0x5) 413 | { 414 | counter++; 415 | flag5 = counter; 416 | } 417 | else if(val == 0x4) 418 | { 419 | counter++; 420 | flag4 = counter; 421 | } 422 | else if(val == 0x3) 423 | { 424 | counter++; 425 | flag3 = counter; 426 | } 427 | else if(val == 0x2) 428 | { 429 | counter++; 430 | flag2 = counter; 431 | } 432 | else if(val == 0x1) 433 | { 434 | counter++; 435 | flag1 = counter; 436 | } 437 | chan.Address_In_Pattern++; 438 | } 439 | while(!quit); 440 | 441 | while(counter > 0) 442 | { 443 | if(counter == flag1) 444 | { 445 | chan.Ton_Slide_Delay = module[chan.Address_In_Pattern]; 446 | chan.Ton_Slide_Count = chan.Ton_Slide_Delay; 447 | chan.Address_In_Pattern++; 448 | chan.Ton_Slide_Step = ay_sys_getword(&module[chan.Address_In_Pattern]); 449 | chan.Address_In_Pattern += 2; 450 | chan.SimpleGliss = true; 451 | chan.Current_OnOff = 0; 452 | if((chan.Ton_Slide_Count == 0) && (PT3.Version >= 7)) 453 | chan.Ton_Slide_Count++; 454 | } 455 | else if(counter == flag2) 456 | { 457 | chan.SimpleGliss = false; 458 | chan.Current_OnOff = 0; 459 | chan.Ton_Slide_Delay = module[chan.Address_In_Pattern]; 460 | chan.Ton_Slide_Count = chan.Ton_Slide_Delay; 461 | chan.Address_In_Pattern += 3; 462 | chan.Ton_Slide_Step = abs(short(ay_sys_getword(&module[chan.Address_In_Pattern]))); 463 | chan.Address_In_Pattern += 2; 464 | chan.Ton_Delta = PT3_GetNoteFreq(info, chan.Note, chip_num) - PT3_GetNoteFreq(info, prnote, chip_num); 465 | chan.Slide_To_Note = chan.Note; 466 | chan.Note = prnote; 467 | if(PT3.Version >= 6) 468 | chan.Current_Ton_Sliding = prsliding; 469 | if((chan.Ton_Delta - chan.Current_Ton_Sliding) < 0) 470 | chan.Ton_Slide_Step = -chan.Ton_Slide_Step; 471 | } 472 | else if(counter == flag3) 473 | { 474 | chan.Position_In_Sample = module[chan.Address_In_Pattern]; 475 | chan.Address_In_Pattern++; 476 | } 477 | else if(counter == flag4) 478 | { 479 | chan.Position_In_Ornament = module[chan.Address_In_Pattern]; 480 | chan.Address_In_Pattern++; 481 | } 482 | else if(counter == flag5) 483 | { 484 | chan.OnOff_Delay = module[chan.Address_In_Pattern]; 485 | chan.Address_In_Pattern++; 486 | chan.OffOn_Delay = module[chan.Address_In_Pattern]; 487 | chan.Current_OnOff = chan.OnOff_Delay; 488 | chan.Address_In_Pattern++; 489 | chan.Ton_Slide_Count = 0; 490 | chan.Current_Ton_Sliding = 0; 491 | } 492 | else if(counter == flag8) 493 | { 494 | PT3.Env_Delay = module[chan.Address_In_Pattern]; 495 | PT3.Cur_Env_Delay = PT3.Env_Delay; 496 | chan.Address_In_Pattern++; 497 | PT3.Env_Slide_Add = ay_sys_getword(&module[chan.Address_In_Pattern]); 498 | chan.Address_In_Pattern += 2; 499 | } 500 | else if(counter == flag9) 501 | { 502 | PT3.Delay = module[chan.Address_In_Pattern]; 503 | chan.Address_In_Pattern++; 504 | } 505 | counter--; 506 | } 507 | chan.Note_Skip_Counter = chan.Number_Of_Notes_To_Skip; 508 | } 509 | 510 | void PT3_ChangeRegisters(AYSongInfo &info, PT3_Channel_Parameters &chan, char &AddToEnv, unsigned char &TempMixer, unsigned long chip_num) 511 | { 512 | GET_COMMON_VARS(chip_num); 513 | unsigned char j, b1, b0; 514 | unsigned short w; 515 | if(chan.Enabled) 516 | { 517 | chan.Ton = ay_sys_getword(&module[chan.SamplePointer + chan.Position_In_Sample * 4 + 2]); 518 | chan.Ton += chan.Ton_Accumulator; 519 | b0 = module[chan.SamplePointer + chan.Position_In_Sample * 4]; 520 | b1 = module[chan.SamplePointer + chan.Position_In_Sample * 4 + 1]; 521 | if((b1 & 0x40) != 0) 522 | { 523 | chan.Ton_Accumulator = chan.Ton; 524 | } 525 | j = chan.Note + module[chan.OrnamentPointer + chan.Position_In_Ornament]; 526 | if((signed char)(j) < 0) 527 | j = 0; 528 | else if(j > 95) 529 | j = 95; 530 | w = PT3_GetNoteFreq(info, j, chip_num); 531 | chan.Ton = (chan.Ton + chan.Current_Ton_Sliding + w) & 0xfff; 532 | if(chan.Ton_Slide_Count > 0) 533 | { 534 | chan.Ton_Slide_Count--; 535 | if(chan.Ton_Slide_Count == 0) 536 | { 537 | chan.Current_Ton_Sliding += chan.Ton_Slide_Step; 538 | chan.Ton_Slide_Count = chan.Ton_Slide_Delay; 539 | if(!chan.SimpleGliss) 540 | { 541 | if(((chan.Ton_Slide_Step < 0) && (chan.Current_Ton_Sliding <= chan.Ton_Delta)) || ((chan.Ton_Slide_Step >= 0) && (chan.Current_Ton_Sliding >= chan.Ton_Delta))) 542 | { 543 | chan.Note = chan.Slide_To_Note; 544 | chan.Ton_Slide_Count = 0; 545 | chan.Current_Ton_Sliding = 0; 546 | } 547 | } 548 | } 549 | } 550 | chan.Amplitude = b1 & 0xf; 551 | if((b0 & 0x80) != 0) 552 | { 553 | if((b0 & 0x40) != 0) 554 | { 555 | if(chan.Current_Amplitude_Sliding < 15) 556 | chan.Current_Amplitude_Sliding++; 557 | } 558 | else if(chan.Current_Amplitude_Sliding > -15) 559 | { 560 | chan.Current_Amplitude_Sliding--; 561 | } 562 | } 563 | chan.Amplitude += chan.Current_Amplitude_Sliding; 564 | if((signed char)(chan.Amplitude) < 0) 565 | chan.Amplitude = 0; 566 | else if(chan.Amplitude > 15) 567 | chan.Amplitude = 15; 568 | if(PT3.Version <= 4) 569 | chan.Amplitude = PT3VolumeTable_33_34[chan.Volume][chan.Amplitude]; 570 | else 571 | chan.Amplitude = PT3VolumeTable_35[chan.Volume][chan.Amplitude]; 572 | if(((b0 & 1) == 0) && chan.Envelope_Enabled) 573 | chan.Amplitude = chan.Amplitude | 16; 574 | if((b1 & 0x80) != 0) 575 | { 576 | if((b0 & 0x20) != 0) 577 | j = ((b0 >> 1) | 0xf0) + chan.Current_Envelope_Sliding; 578 | else 579 | j = ((b0 >> 1) & 0xf) + chan.Current_Envelope_Sliding; 580 | if((b1 & 0x20) != 0) 581 | chan.Current_Envelope_Sliding = j; 582 | AddToEnv += j; 583 | } 584 | else 585 | { 586 | PT3.AddToNoise = (b0 >> 1) + chan.Current_Noise_Sliding; 587 | if((b1 & 0x20) != 0) 588 | chan.Current_Noise_Sliding = PT3.AddToNoise; 589 | } 590 | TempMixer = ((b1 >> 1) & 0x48) | TempMixer; 591 | chan.Position_In_Sample++; 592 | if(chan.Position_In_Sample >= chan.Sample_Length) 593 | chan.Position_In_Sample = chan.Loop_Sample_Position; 594 | chan.Position_In_Ornament++; 595 | if(chan.Position_In_Ornament >= chan.Ornament_Length) 596 | chan.Position_In_Ornament = chan.Loop_Ornament_Position; 597 | } 598 | else 599 | chan.Amplitude = 0; 600 | TempMixer = TempMixer >> 1; 601 | if(chan.Current_OnOff > 0) 602 | { 603 | chan.Current_OnOff--; 604 | if(chan.Current_OnOff == 0) 605 | { 606 | chan.Enabled = !chan.Enabled; 607 | if(chan.Enabled) 608 | chan.Current_OnOff = chan.OnOff_Delay; 609 | else 610 | chan.Current_OnOff = chan.OffOn_Delay; 611 | } 612 | } 613 | } 614 | 615 | void PT3_Play_Chip(AYSongInfo &info, unsigned long chip_num) 616 | { 617 | GET_COMMON_VARS(chip_num); 618 | unsigned char TempMixer; 619 | char AddToEnv; 620 | 621 | PT3.DelayCounter--; 622 | if(PT3.DelayCounter == 0) 623 | { 624 | PT3_A.Note_Skip_Counter--; 625 | if(PT3_A.Note_Skip_Counter == 0) 626 | { 627 | if(module[PT3_A.Address_In_Pattern] == 0) 628 | { 629 | PT3.CurrentPosition++; 630 | if(PT3.CurrentPosition == header->PT3_NumberOfPositions) 631 | PT3.CurrentPosition = header->PT3_LoopPosition; 632 | PT3_A.Address_In_Pattern = ay_sys_getword(&module[PT3_PatternsPointer + header->PT3_PositionList[PT3.CurrentPosition] * 2]); 633 | PT3_B.Address_In_Pattern = ay_sys_getword(&module[PT3_PatternsPointer + header->PT3_PositionList[PT3.CurrentPosition] * 2 + 2]); 634 | PT3_C.Address_In_Pattern = ay_sys_getword(&module[PT3_PatternsPointer + header->PT3_PositionList[PT3.CurrentPosition] * 2 + 4]); 635 | PT3.Noise_Base = 0; 636 | } 637 | PT3_PatternIntterpreter(info, PT3_A, chip_num); 638 | } 639 | PT3_B.Note_Skip_Counter--; 640 | if(PT3_B.Note_Skip_Counter == 0) 641 | PT3_PatternIntterpreter(info, PT3_B, chip_num); 642 | PT3_C.Note_Skip_Counter--; 643 | if(PT3_C.Note_Skip_Counter == 0) 644 | PT3_PatternIntterpreter(info, PT3_C, chip_num); 645 | PT3.DelayCounter = PT3.Delay; 646 | } 647 | 648 | AddToEnv = 0; 649 | TempMixer = 0; 650 | PT3_ChangeRegisters(info, PT3_A, AddToEnv, TempMixer, chip_num); 651 | PT3_ChangeRegisters(info, PT3_B, AddToEnv, TempMixer, chip_num); 652 | PT3_ChangeRegisters(info, PT3_C, AddToEnv, TempMixer, chip_num); 653 | 654 | ay_writeay(&info, AY_MIXER, TempMixer, chip_num); 655 | 656 | ay_writeay(&info, AY_CHNL_A_FINE, PT3_A.Ton & 0xff, chip_num); 657 | ay_writeay(&info, AY_CHNL_A_COARSE, (PT3_A.Ton >> 8) & 0xf, chip_num); 658 | ay_writeay(&info, AY_CHNL_B_FINE, PT3_B.Ton & 0xff, chip_num); 659 | ay_writeay(&info, AY_CHNL_B_COARSE, (PT3_B.Ton >> 8) & 0xf, chip_num); 660 | ay_writeay(&info, AY_CHNL_C_FINE, PT3_C.Ton & 0xff, chip_num); 661 | ay_writeay(&info, AY_CHNL_C_COARSE, (PT3_C.Ton >> 8) & 0xf, chip_num); 662 | ay_writeay(&info, AY_CHNL_A_VOL, PT3_A.Amplitude, chip_num); 663 | ay_writeay(&info, AY_CHNL_B_VOL, PT3_B.Amplitude, chip_num); 664 | ay_writeay(&info, AY_CHNL_C_VOL, PT3_C.Amplitude, chip_num); 665 | 666 | ay_writeay(&info, AY_NOISE_PERIOD, (PT3.Noise_Base + PT3.AddToNoise) & 31, chip_num); 667 | unsigned short cur_env = ay_sys_getword(&PT3.Env_Base_lo) + AddToEnv + PT3.Cur_Env_Slide; 668 | ay_writeay(&info, AY_ENV_FINE, cur_env & 0xff, chip_num); 669 | ay_writeay(&info, AY_ENV_COARSE, (cur_env >> 8) & 0xff, chip_num); 670 | 671 | if(PT3.Cur_Env_Delay > 0) 672 | { 673 | PT3.Cur_Env_Delay--; 674 | if(PT3.Cur_Env_Delay == 0) 675 | { 676 | PT3.Cur_Env_Delay = PT3.Env_Delay; 677 | PT3.Cur_Env_Slide += PT3.Env_Slide_Add; 678 | } 679 | } 680 | } 681 | 682 | void PT3_Play(AYSongInfo &info) 683 | { 684 | PT3_Play_Chip(info, 0); 685 | if(info.is_ts) 686 | PT3_Play_Chip(info, 1); 687 | } 688 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | --------------------------------------------------------------------------------