Skip to content

Instantly share code, notes, and snippets.

@SpotlightKid
Forked from anonymous/dspD8.ino
Created February 20, 2016 21:02
Show Gist options
  • Save SpotlightKid/c9293d883cc7897c12c9 to your computer and use it in GitHub Desktop.
Save SpotlightKid/c9293d883cc7897c12c9 to your computer and use it in GitHub Desktop.
The dsp-D8 drum synthesizer
// dsp-D8 Drum Chip (c) DSP Synthesizers 2015
// Free for non commercial use
// http://janostman.wordpress.com
#include <avr/interrupt.h>
#include <avr/io.h>
#include <avr/pgmspace.h>
#ifndef cbi
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit))
#endif
#ifndef sbi
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit))
#endif
// Standard Arduino Pins
#define digitalPinToPortReg(P) \
(((P) >= 0 && (P) <= 7) ? &PORTD : (((P) >= 8 && (P) <= 13) ? &PORTB : &PORTC))
#define digitalPinToDDRReg(P) \
(((P) >= 0 && (P) <= 7) ? &DDRD : (((P) >= 8 && (P) <= 13) ? &DDRB : &DDRC))
#define digitalPinToPINReg(P) \
(((P) >= 0 && (P) <= 7) ? &PIND : (((P) >= 8 && (P) <= 13) ? &PINB : &PINC))
#define digitalPinToBit(P) \
(((P) >= 0 && (P) <= 7) ? (P) : (((P) >= 8 && (P) <= 13) ? (P) - 8 : (P) - 14))
#define digitalReadFast(P) bitRead(*digitalPinToPINReg(P), digitalPinToBit(P))
#define digitalWriteFast(P, V) bitWrite(*digitalPinToPortReg(P), digitalPinToBit(P), (V))
const unsigned char PS_128 = (1 << ADPS2) | (1 << ADPS1) | (1 << ADPS0);
//--------- Ringbuf parameters ----------
uint8_t Ringbuffer[256];
uint8_t RingWrite=0;
uint8_t RingRead=0;
volatile uint8_t RingCount=0;
volatile uint16_t SFREQ;
//-----------------------------------------
const uint8_t BD[2154] PROGMEM =
{
128,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,127,127,127,127,126,126,126,126,126,126,126,126,126,125,125,125,125,124,124,124,124,123,123,121,119,84,61,59,53,54,53,55,55,58,58,60,61,62,63,64,65,67,68,69,71,72,73,75,76,78,79,81,82,83,85,87,88,89,91,92,94,96,99,105,115,129,145,162,178,191,203,214,222,227,231,233,233,232,230,229,228,226,225,224,
222,221,219,218,217,215,214,212,211,210,208,207,206,204,203,201,200,199,198,196,195,194,192,191,190,189,188,186,185,184,182,181,180,178,177,174,171,167,161,154,147,138,130,121,111,101,91,82,73,64,57,51,47,43,40,38,37,35,35,36,38,39,40,42,43,45,46,48,49,51,52,54,55,57,58,59,61,62,64,65,66,68,69,70,71,73,74,75,76,77,79,80,81,82,83,85,86,87,88,89,
90,92,93,94,95,96,98,99,100,102,104,108,112,118,124,131,138,146,155,163,172,180,188,195,201,207,213,218,222,225,228,230,231,232,232,233,232,231,229,228,226,225,223,222,220,218,217,215,214,212,210,209,207,206,204,203,201,200,198,197,195,194,193,192,190,189,187,186,185,183,182,181,180,178,177,176,175,174,172,171,170,169,168,167,166,164,163,162,161,160,159,158,157,156,156,155,154,153,152,151,
150,149,148,148,147,146,145,144,144,143,142,141,141,140,139,138,138,137,136,135,134,132,129,127,124,120,117,113,109,104,99,94,90,85,79,74,70,64,59,54,49,44,40,36,32,29,26,23,21,19,17,16,15,15,14,14,14,14,15,15,15,16,16,17,18,20,22,23,25,27,29,31,32,34,36,37,39,41,42,44,46,47,49,50,52,54,55,56,58,59,61,62,64,65,66,68,69,70,72,73,
74,76,77,78,79,81,82,83,84,85,87,88,89,90,91,92,94,95,96,97,99,100,101,102,103,104,105,106,108,109,110,111,112,113,114,115,116,117,118,119,120,121,121,122,123,124,125,126,127,128,129,130,130,131,132,133,134,134,135,136,137,137,138,139,140,141,142,142,144,146,150,154,158,163,168,173,179,184,189,194,200,205,209,214,218,222,226,230,233,236,238,240,242,243,244,245,246,246,246,246,
245,245,244,243,241,240,238,237,235,233,231,230,228,226,225,223,221,220,218,217,215,213,212,211,209,207,206,204,203,201,200,198,197,196,194,193,192,190,189,188,186,185,184,183,182,180,179,178,177,176,174,173,172,171,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,153,152,151,150,149,148,148,147,146,145,144,144,143,142,141,140,140,139,138,138,137,136,136,135,134,134,133,133,
132,131,131,130,130,129,128,128,127,127,126,126,125,125,124,124,123,123,122,122,121,121,120,120,119,119,118,118,117,117,117,116,115,115,114,113,112,111,110,108,106,104,102,99,97,94,91,88,84,81,77,74,70,66,62,58,54,50,46,42,38,35,31,28,25,22,19,16,14,11,9,8,6,5,4,4,3,3,3,3,4,4,4,5,6,7,7,8,9,10,11,12,13,15,16,17,19,21,22,24,
26,28,30,31,33,35,37,39,40,42,44,46,48,49,51,53,55,56,58,59,61,62,64,65,67,68,70,71,73,75,76,78,79,81,82,84,85,87,88,90,91,92,94,95,96,98,99,100,101,103,104,105,107,108,109,110,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,130,131,132,133,134,135,135,136,137,138,139,140,140,141,142,143,143,144,145,145,146,147,148,148,149,
149,150,151,151,152,152,153,153,154,155,155,156,156,157,157,158,158,159,159,160,160,161,161,162,162,162,163,163,164,164,165,165,166,166,167,168,169,173,177,182,187,192,197,202,207,212,217,221,225,229,233,237,240,243,245,248,249,251,252,253,253,253,253,253,253,252,252,251,250,248,247,245,243,241,240,238,236,234,232,231,229,228,226,224,222,220,219,217,215,214,212,210,209,207,206,204,203,201,200,198,
197,195,194,192,191,189,188,187,186,184,183,182,181,179,178,177,176,174,173,172,170,169,168,167,166,165,164,163,162,161,160,159,158,157,156,155,154,153,152,151,150,149,148,148,147,146,145,144,143,143,142,141,140,140,139,138,137,137,136,135,135,134,134,133,132,132,131,130,130,129,128,128,127,127,126,125,125,124,124,123,123,122,122,122,121,121,120,120,119,119,119,118,118,117,117,116,116,116,115,115,
114,114,113,113,113,112,112,111,111,110,110,109,109,109,108,107,106,105,103,101,99,97,95,93,90,88,85,82,78,75,71,68,64,60,56,52,48,44,41,37,34,30,27,24,21,18,15,13,10,8,6,5,4,2,2,1,1,1,1,1,2,2,3,4,4,5,6,7,8,9,10,12,13,14,15,17,18,20,21,23,25,27,29,31,33,35,36,38,40,42,44,45,47,49,51,53,54,56,58,60,
61,63,64,66,68,70,71,73,74,76,78,79,81,82,84,86,87,88,90,91,93,94,96,97,98,100,101,102,104,105,106,107,109,110,111,112,114,114,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,131,132,133,134,135,136,136,137,138,139,139,140,141,141,142,143,143,144,145,145,146,147,148,148,149,149,150,151,151,152,152,153,153,154,154,155,155,156,156,157,157,158,158,159,159,159,
160,160,161,161,162,162,163,163,163,164,164,164,165,165,165,166,166,166,166,167,167,168,168,169,170,173,178,182,187,193,198,203,207,212,217,222,226,230,233,237,240,243,245,247,248,250,250,251,251,251,251,250,250,249,248,247,245,244,242,240,239,237,235,233,231,230,228,226,225,223,221,219,218,216,214,212,211,209,208,206,204,203,201,200,198,197,195,193,192,191,189,188,186,185,184,182,181,180,178,177,
176,175,173,172,171,170,168,167,166,165,164,163,162,161,160,159,158,156,156,155,154,152,152,151,150,149,148,147,146,145,144,143,142,142,141,140,139,138,138,137,136,135,135,134,133,133,132,131,131,130,129,129,128,127,126,126,125,124,124,123,123,122,122,121,121,120,120,119,119,118,118,117,117,116,116,115,115,114,114,113,113,112,112,111,110,109,108,107,106,105,104,102,102,100,99,98,97,95,94,92,
91,89,87,86,84,82,80,78,76,74,72,70,68,66,63,61,59,57,55,53,51,49,47,46,44,42,40,39,38,36,35,33,32,31,30,29,28,27,27,26,25,25,25,25,24,24,24,24,25,25,25,25,26,26,27,27,28,29,29,30,31,32,33,34,35,36,37,38,39,40,41,42,44,45,46,47,49,50,51,52,53,54,56,57,58,59,60,62,63,64,65,67,68,69,70,72,73,74,75,77,
78,79,80,82,83,84,85,86,88,89,90,91,93,94,95,96,98,98,100,101,102,103,104,105,106,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,
181,182,183,184,185,186,187,188,189,190,191,192,193,193,194,195,196,196,197,198,198,199,199,199,200,200,201,201,201,201,202,202,202,202,202,202,202,202,202,202,202,201,201,201,201,201,200,200,200,199,199,199,198,198,197,197,196,196,195,195,194,193,193,192,192,191,190,190,189,188,187,187,186,185,185,184,183,182,182,181,180,179,178,177,177,176,175,174,173,172,171,171,170,169,168,167,166,165,164,163,
163,162,161,160,159,158,157,156,155,154,153,152,152,151,150,149,148,147,146,146,145,144,143,142,141,140,140,139,138,137,136,136,135,134,133,133,132,131,130,130,129,128,128,127,126,125,125,124,123,123,122,122,121,120,120,119,118,118,117,116,116,115,115,114,114,113,113,112,112,111,111,110,110,109,109,108,108,108,107,107,106,106,106,105,105,105,104,104,104,103,103,103,102,102,102,102,101,101,101,101,
100,100,100,100,100,99,99,99,99,99,99,99,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,98,99,99,99,99,99,99,99,99,99,100,100,100,100,100,100,101,101,101,101,101,102,102,102,102,103,103,103,103,104,104,104,104,105,105,105,105,106,106,106,106,107,107,107,108,108,108,109,109,109,109,110,110,110,111,111,111,112,112,112,113,113,113,114,114,114,115,115,
115,115,116,116,116,117,117,117,118,118,118,118,119,119,119,120,120,120,120,121,121,121,121,122,122,122,123,123,123,123,124,124,124,124,125,125,125,125,125,126,126,126,126,126,127,127,127,127,127,128,128,128,128,128,128,129,129,129,129,129,129,130,130,130,130,130,130,130,131,131,131,131,131,131,131,131,131,132,132,132,132,132,132,132,132,132,132,132,133,133,133,133,133,133,133,133,133,133,133,133,
133,133,133,133,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,134,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,133,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,132,131,
131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,130,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,129,128
};
const uint8_t CH[482] PROGMEM =
{
128,128,128,128,132,123,145,128,96,150,66,110,222,81,135,100,99,144,77,189,109,92,196,75,153,215,81,54,186,149,154,92,131,173,146,72,136,109,47,133,200,85,107,232,179,87,115,120,163,223,81,208,149,163,157,130,177,170,139,148,150,175,151,126,180,130,88,135,49,42,212,160,42,103,96,114,213,135,101,141,33,94,140,30,23,85,188,95,136,112,109,139,67,79,172,79,47,138,203,82,
105,105,126,180,98,100,82,129,127,105,151,105,123,167,111,204,144,155,103,196,101,62,115,56,108,104,105,124,150,111,176,170,176,157,114,158,185,195,111,118,161,141,136,87,140,102,124,109,151,72,74,125,147,101,84,123,111,145,96,91,111,147,115,146,138,92,135,107,130,129,113,115,172,186,91,122,149,123,151,143,114,145,161,173,82,167,113,148,150,150,141,89,161,160,137,89,131,141,110,128,
116,102,137,156,149,104,117,106,120,141,93,99,110,126,127,95,128,150,177,133,117,152,112,141,123,138,127,107,151,159,157,132,133,130,137,155,106,114,180,133,115,109,127,112,127,132,117,103,137,140,125,119,110,120,135,115,130,134,107,126,121,116,128,136,125,131,151,149,109,137,136,133,129,149,120,132,160,153,107,118,148,111,130,111,127,136,127,115,127,112,158,127,134,145,139,153,125,126,140,147,
118,147,122,130,150,124,108,126,151,128,124,140,124,147,131,119,126,115,144,125,111,143,139,113,140,142,109,132,143,108,120,116,150,123,129,136,127,143,120,153,136,107,144,133,124,124,129,141,114,141,113,125,126,122,129,125,142,125,135,146,137,111,118,128,140,120,124,124,119,132,122,133,125,117,124,125,125,126,125,139,125,127,148,121,128,137,121,127,128,145,136,122,128,139,135,122,134,139,128,120,
129,137,134,130,127,136,134,131,128,140,125,121,132,130,133,133,120,141,128,126,147,135,126,136,136,131,120,139,133,131,137,119,118,131,140,120,125,129,134,129,124,128,128,122,128,127,129,122,130,127,134,135,123,131,127,127,129,131,134,119,132,134,134,135,126,136,133,124,125,130,137,126,121,134,124,124,133,126,133,127,129,128
};
const uint8_t CL[2384] PROGMEM =
{
128,128,128,128,129,128,123,116,133,218,230,208,153,75,10,8,17,13,18,20,36,85,206,240,240,233,209,100,33,56,165,231,185,112,39,154,105,149,231,147,43,10,25,16,33,67,140,153,86,203,248,237,237,218,153,68,55,29,46,153,163,44,22,28,34,60,89,137,197,227,219,177,107,160,237,177,221,245,239,236,235,224,211,141,96,47,11,19,37,55,112,125,60,97,136,195,164,142,136,92,
174,227,193,77,45,82,141,189,147,169,229,198,183,198,115,88,72,47,56,126,163,131,155,215,205,214,215,161,122,41,10,17,20,48,116,148,149,164,197,207,146,202,230,216,219,217,187,133,52,25,44,76,129,152,133,60,21,53,77,72,142,179,175,215,224,211,198,115,91,113,87,57,33,42,63,70,100,164,207,216,215,189,170,131,128,162,175,154,125,94,120,111,80,86,98,90,46,40,37,79,
79,83,151,183,191,190,142,160,184,185,200,198,186,155,103,108,160,177,129,88,73,105,123,130,110,92,92,58,51,49,62,105,114,126,124,151,181,184,144,140,177,155,144,148,160,154,144,110,94,97,74,57,59,66,64,83,138,159,184,206,211,200,173,165,152,140,142,143,130,103,93,94,95,98,103,107,92,35,16,28,26,51,165,234,217,198,76,18,22,30,75,147,115,100,234,221,211,237,236,232,
230,223,226,202,185,108,21,10,7,13,25,34,48,78,186,223,225,213,154,197,209,149,148,150,84,52,12,25,59,89,54,135,232,208,192,179,110,96,196,234,224,227,218,210,198,168,64,6,2,2,7,10,23,49,136,174,173,107,131,216,172,136,214,228,221,221,207,196,155,58,7,46,46,11,44,103,87,111,135,191,231,210,194,109,39,24,20,18,31,58,124,194,210,217,213,226,184,164,162,135,
119,116,102,27,12,18,39,120,200,210,178,112,108,179,198,119,164,205,140,144,193,175,138,128,134,147,172,191,178,111,30,14,19,18,23,22,45,121,123,95,122,130,145,191,217,208,203,210,217,192,152,134,127,74,48,23,10,16,25,37,66,106,164,162,163,190,213,221,217,200,129,71,79,103,138,136,133,173,203,163,136,125,125,138,103,75,67,67,67,72,48,100,116,114,85,62,97,151,190,188,
193,191,151,114,131,82,94,123,127,133,130,130,142,152,146,144,140,133,144,165,152,157,153,128,92,88,91,96,93,86,97,76,52,39,44,63,104,135,127,152,192,198,207,195,189,189,172,139,105,96,55,36,38,41,49,68,86,123,167,178,191,201,206,204,199,186,157,145,143,133,118,114,108,99,94,96,85,38,22,26,27,35,52,94,161,230,249,248,247,245,242,240,235,227,207,201,154,66,119,219,
189,166,125,48,18,8,12,20,20,18,26,31,40,74,174,228,238,245,239,240,230,213,115,41,37,113,214,168,166,187,95,19,21,24,23,33,48,76,172,244,228,201,238,238,218,150,86,62,90,115,115,128,94,171,244,209,199,183,161,157,88,60,83,69,26,24,69,89,164,239,202,153,204,221,154,82,148,223,184,197,232,215,192,103,24,14,15,37,46,50,123,193,185,184,106,38,50,61,132,90,
46,62,98,161,185,217,230,239,232,232,215,208,206,174,143,120,76,25,10,22,27,26,46,93,107,190,229,228,218,157,141,159,192,169,124,104,134,117,151,186,138,116,120,101,52,24,18,44,54,30,53,102,171,191,203,220,209,207,175,162,182,202,198,175,160,145,114,72,51,48,54,30,30,40,52,70,114,143,163,184,206,201,201,220,191,196,214,205,180,111,63,60,38,28,35,37,39,48,67,84,
130,173,187,204,210,199,186,166,187,194,171,129,122,124,114,106,117,125,109,106,129,131,125,69,17,38,113,224,224,227,180,71,56,188,165,156,229,124,99,185,141,40,19,12,13,44,145,200,193,176,73,18,15,21,21,30,85,78,60,123,154,101,169,234,242,238,236,233,223,197,116,28,44,36,26,66,139,146,88,43,32,41,80,170,234,219,184,232,236,213,223,154,196,179,69,150,179,113,96,186,
218,160,45,10,24,60,130,178,130,95,81,113,69,15,35,54,159,195,228,234,233,165,106,95,130,210,208,211,148,74,43,124,76,68,191,200,223,194,154,71,53,59,45,154,133,78,149,218,193,92,82,105,19,13,14,21,25,52,90,164,231,236,236,228,239,231,233,220,207,192,140,49,8,8,8,18,51,168,199,126,61,18,30,52,119,179,188,189,145,200,243,232,235,228,214,167,103,141,71,62,
133,138,139,40,10,13,22,21,63,136,177,154,142,181,204,192,135,120,107,134,97,44,123,198,234,233,227,222,217,204,142,41,17,75,88,10,15,19,38,95,191,193,163,231,235,226,223,219,209,201,149,124,61,2,5,4,14,13,32,69,181,231,231,228,215,166,84,39,15,44,54,26,26,74,134,208,234,236,237,232,226,218,182,142,71,4,37,86,27,10,63,118,201,231,217,181,80,17,16,16,
30,45,50,110,194,225,235,211,190,218,235,228,223,190,104,17,11,10,30,86,167,222,176,108,89,153,141,76,55,71,52,34,42,86,189,221,233,236,234,193,132,161,224,182,106,185,213,137,100,99,77,17,60,123,192,157,106,157,192,87,71,93,21,44,59,77,69,128,227,209,212,240,224,224,192,129,83,35,4,12,11,20,59,137,109,78,152,216,233,235,233,229,222,181,100,89,54,25,24,22,
28,95,139,198,236,208,184,126,63,11,15,22,44,33,46,104,214,237,238,195,133,148,188,181,78,97,155,216,213,162,91,51,35,34,73,57,34,74,152,219,236,219,200,217,216,187,83,57,93,63,64,79,71,123,161,106,99,177,230,216,217,166,59,16,20,22,31,43,95,190,242,240,240,235,225,196,119,33,13,13,16,27,39,59,72,75,75,123,123,125,144,197,249,246,240,211,150,110,94,148,
233,201,109,149,196,166,202,211,235,213,198,221,217,186,104,37,32,30,19,12,18,28,79,161,178,150,136,175,194,227,209,171,92,70,172,195,179,106,109,126,154,205,189,137,88,46,35,16,24,25,22,44,123,191,203,223,165,140,173,175,176,173,189,208,157,144,137,99,86,127,128,157,142,79,57,16,69,92,140,232,221,212,142,51,18,18,21,23,40,76,101,137,133,151,174,213,164,203,222,210,
118,115,221,223,226,189,101,36,35,43,119,126,162,128,42,39,52,155,207,193,211,225,195,150,63,31,63,181,141,159,231,183,153,55,22,30,62,74,81,99,69,44,78,147,194,182,80,65,149,184,231,184,118,76,145,223,211,173,163,193,204,151,66,24,23,14,23,30,95,96,44,111,116,105,164,213,222,198,197,237,223,225,209,203,147,66,46,54,52,125,146,140,146,177,178,139,50,25,37,82,
161,96,70,139,184,202,146,126,156,128,81,31,69,94,138,141,120,110,142,219,217,208,144,125,97,105,96,59,110,113,72,46,76,48,81,145,160,203,209,214,224,203,177,146,178,152,141,136,61,43,41,57,98,160,179,145,60,54,67,66,118,175,179,107,128,216,213,215,202,197,191,190,138,150,188,188,148,65,59,40,30,32,45,128,136,92,58,37,50,61,108,186,215,191,195,201,175,130,91,159,
200,195,144,122,151,162,162,188,166,103,77,50,39,45,85,100,109,115,170,191,201,187,101,75,158,165,161,134,93,97,88,58,29,50,70,86,98,170,199,196,144,76,119,153,155,118,164,181,178,192,193,176,103,65,99,117,117,107,60,49,44,44,63,104,107,92,104,176,206,208,182,183,207,200,203,195,184,129,57,41,45,98,93,43,58,74,121,176,156,135,152,127,113,137,140,119,135,180,176,160,
183,171,150,134,149,129,80,114,125,110,89,81,100,103,96,63,60,62,68,108,136,138,150,155,171,175,184,191,176,176,167,158,136,140,137,159,161,135,84,53,53,50,56,69,81,108,165,192,163,142,161,139,157,184,167,139,97,110,156,164,177,190,168,142,99,124,183,176,136,145,160,126,98,75,64,75,113,139,122,100,96,105,106,134,110,77,76,83,75,66,70,77,106,122,143,151,144,139,150,180,
193,191,175,159,165,173,186,183,180,162,118,73,69,76,63,93,119,90,65,100,110,130,179,183,172,139,145,160,156,138,101,99,102,127,92,73,71,78,91,111,125,135,156,168,155,146,152,138,144,163,159,132,140,154,145,161,142,108,86,66,66,65,79,95,123,151,172,170,162,155,134,112,110,130,152,125,86,105,148,173,179,173,149,152,150,138,134,139,138,131,110,90,123,116,89,95,112,98,120,132,
100,139,158,154,148,119,142,128,115,110,103,128,137,102,84,94,99,99,91,101,126,128,124,150,166,162,154,148,145,152,149,160,166,143,139,152,154,148,142,117,111,95,83,99,105,86,85,109,118,143,160,155,156,157,146,143,129,114,133,149,135,126,126,123,117,105,110,110,123,108,117,147,142,159,163,157,142,108,90,88,94,105,107,114,143,149,149,149,144,160,159,152,132,118,123,116,115,115,115,119,
104,94,92,89,98,102,126,147,149,147,147,158,166,162,154,158,155,141,137,139,136,131,109,95,97,102,105,121,133,139,143,138,131,133,151,156,153,140,136,130,103,91,92,92,104,126,126,117,116,138,148,144,141,145,144,144,143,150,154,146,132,122,116,101,97,98,107,126,140,141,139,141,145,142,131,118,120,123,119,103,104,120,129,140,136,141,132,128,134,132,144,139,130,132,131,135,127,117,116,109,
103,98,98,100,102,106,120,131,133,140,147,150,154,157,154,151,154,153,149,150,145,132,121,116,105,104,110,116,113,106,110,121,134,135,140,141,131,120,132,142,137,134,136,126,123,125,122,124,119,116,121,122,118,114,110,121,124,125,130,128,120,118,119,130,140,142,147,145,143,142,139,135,134,136,133,125,127,135,130,128,132,128,125,123,116,117,117,118,117,119,122,126,127,126,125,123,123,125,126,127,
128,125,124,123,125,129,129,134,141,141,142,144,143,142,140,142,142,139,133,122,115,112,111,110,114,117,118,122,129,129,133,137,138,140,140,137,134,134,135,132,132,131,123,118,116,115,119,121,120,122,128,129,131,134,136,137,136,138,137,135,132,129,125,122,119,120,120,120,120,124,127,125,126,129,128,129,132,135,134,135,135,134,134,131,129,128,127,123,120,120,120,119,119,119,121,125,127,128,131,133,
134,135,136,136,136,135,134,132,130,131,131,132,132,132,130,126,126,124,124,125,125,123,122,123,124,127,127,128,129,129,129,130,130,129,130,131,130,130,130,129,129,128,127,126,125,124,124,125,125,126,126,127,128,129,130,130,129,130,130,130,130,130,129,129,128,128,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128,128
};
const uint8_t CR[5414] PROGMEM =
{
128,128,128,128,113,141,149,125,111,113,130,145,118,118,121,94,118,156,159,118,124,127,144,116,136,178,86,140,87,99,193,104,67,213,117,83,194,168,125,61,41,171,232,156,77,21,53,197,227,202,171,130,72,33,28,64,68,90,230,246,255,198,157,105,28,19,121,137,67,137,130,166,163,188,153,156,78,78,147,92,132,90,138,96,190,152,209,155,41,58,114,194,157,208,134,152,69,16,82,121,
155,199,135,190,143,103,94,97,145,55,136,164,188,133,103,113,112,57,146,130,178,238,186,167,82,54,29,41,144,195,204,160,104,189,167,113,61,94,98,96,109,151,139,200,214,167,92,34,72,199,133,85,183,82,105,151,181,149,172,53,107,134,85,76,195,186,104,136,98,127,109,103,146,152,104,105,185,163,81,151,131,143,107,85,60,105,103,180,185,218,146,175,84,77,133,70,94,89,128,148,
170,89,236,131,120,119,92,68,109,78,107,118,234,202,145,181,107,90,102,93,84,132,122,171,210,151,138,134,45,78,99,82,124,146,119,178,169,117,87,147,112,162,114,38,86,130,169,143,167,116,188,64,76,112,117,187,205,162,123,142,64,92,123,125,73,169,211,158,148,52,168,94,135,147,98,150,119,105,107,162,102,147,91,161,163,152,138,167,118,64,113,91,148,127,111,117,145,103,165,188,
171,128,90,44,126,148,85,176,167,97,184,114,93,198,162,88,120,85,115,137,124,214,87,114,113,159,128,136,161,137,141,80,103,136,137,153,146,106,146,135,74,196,113,113,159,103,116,156,110,113,166,109,147,109,101,112,192,107,167,110,72,114,120,118,147,144,126,127,157,151,98,142,96,147,126,120,107,119,116,161,124,155,115,128,124,91,114,127,144,137,104,118,125,149,136,136,124,91,114,123,
133,140,137,93,163,150,118,113,106,105,103,124,142,167,134,110,125,108,127,142,108,101,138,100,156,148,172,140,136,97,92,126,101,110,144,105,127,192,122,145,138,100,84,136,139,127,120,136,129,153,122,119,141,113,123,136,130,129,131,130,119,133,136,114,139,113,120,142,141,136,133,105,124,130,96,123,126,155,119,152,118,137,166,108,137,100,129,101,158,110,158,153,114,126,131,127,114,145,112,160,
140,127,136,134,105,155,124,108,109,123,152,149,148,132,118,104,103,122,143,128,132,112,139,158,144,126,107,130,133,87,153,136,144,149,126,133,164,110,142,117,98,136,106,127,107,167,147,131,146,103,123,75,134,128,157,140,146,136,125,112,127,113,123,152,102,151,140,123,156,143,114,128,126,106,129,136,113,83,161,120,175,105,136,95,147,92,111,157,127,163,126,165,92,142,114,131,109,120,114,141,
154,125,146,129,124,103,122,122,97,134,122,132,150,106,129,138,132,109,131,120,147,115,136,138,128,132,139,132,121,136,108,136,126,145,110,117,139,138,130,133,107,148,100,139,150,101,127,127,133,142,133,114,111,118,158,110,146,113,139,144,103,124,123,137,136,133,110,134,110,139,146,151,129,141,126,139,126,86,121,94,180,108,121,183,94,146,105,131,124,130,114,122,125,117,127,150,139,134,169,85,
143,99,125,122,170,136,127,137,103,150,110,133,113,171,107,142,93,145,138,124,127,96,141,102,141,126,162,97,151,139,135,132,117,131,117,125,107,136,148,140,133,120,104,134,125,100,148,118,109,141,88,154,126,135,126,124,122,121,142,144,94,147,132,142,149,107,149,124,113,121,139,114,154,103,139,111,140,109,131,124,136,155,131,132,100,148,109,137,100,151,115,137,129,130,108,119,114,161,103,142,
137,112,140,133,128,125,127,110,123,142,135,107,159,124,137,133,107,149,137,126,146,121,131,110,147,125,134,127,109,122,130,110,123,134,110,148,153,100,143,117,131,145,119,133,119,136,117,128,123,141,113,137,117,144,127,98,143,107,144,109,154,115,137,137,119,117,133,116,136,141,107,157,124,139,117,134,133,126,145,122,126,141,109,157,136,116,131,104,139,130,142,119,142,129,121,113,133,98,143,120,
109,141,118,131,113,127,119,150,125,137,112,143,116,112,130,128,134,134,137,127,129,127,128,130,146,98,138,118,134,116,135,128,155,115,122,126,107,139,115,127,94,157,109,136,127,144,105,122,125,123,127,129,157,105,145,112,151,139,105,139,93,132,115,129,145,131,119,160,121,124,120,103,148,102,155,120,132,123,131,134,126,136,134,122,125,129,130,136,116,118,143,123,139,129,126,134,122,123,125,152,
154,144,118,143,120,143,119,153,132,113,130,132,118,133,128,152,130,129,119,113,154,123,135,130,124,128,121,118,152,125,135,126,112,135,110,148,125,120,148,122,150,112,136,150,110,125,135,98,135,147,122,143,99,131,114,134,124,123,120,126,122,142,138,110,119,129,136,141,129,120,120,119,112,146,146,100,136,126,116,122,143,114,150,125,110,120,125,124,118,143,99,158,118,105,142,116,109,141,137,137,
135,124,130,138,144,107,136,118,125,132,142,123,140,106,137,128,139,129,110,148,115,117,131,147,120,129,110,129,128,127,131,130,126,118,153,109,131,128,110,117,138,122,122,157,99,156,131,141,133,118,120,133,129,120,140,137,117,128,150,102,160,113,121,141,109,122,118,131,122,125,159,134,128,149,102,136,112,118,159,123,138,127,121,130,126,134,141,126,135,95,151,140,135,126,117,136,140,121,134,138,
127,108,132,131,114,148,117,143,106,151,108,151,106,126,143,129,124,135,130,114,144,104,141,95,157,92,156,116,141,135,120,123,136,120,115,142,133,138,96,147,102,142,118,139,141,112,124,148,106,138,107,128,124,132,130,104,161,120,132,144,120,105,168,100,139,110,136,123,140,129,115,153,104,126,126,138,109,156,113,131,132,122,110,141,130,111,141,123,130,125,150,106,171,109,122,115,130,116,141,128,
125,154,118,139,118,141,77,168,100,140,145,114,145,115,125,113,150,114,141,117,133,107,170,125,110,157,83,163,120,112,147,115,126,123,154,119,118,120,125,104,164,101,155,141,96,150,111,132,133,124,130,140,131,130,119,145,125,138,126,114,123,143,114,151,126,125,121,128,122,117,136,124,140,140,122,122,146,120,129,132,114,145,114,126,139,130,147,115,172,104,125,129,123,137,127,109,126,152,114,134,
123,148,117,127,121,112,144,106,150,129,127,132,128,117,121,134,104,135,102,146,119,142,113,142,112,131,123,139,115,113,149,108,148,109,146,119,134,112,138,136,137,102,134,116,141,119,123,140,115,121,132,132,126,138,129,137,104,164,82,146,127,101,123,138,110,143,120,127,126,148,129,116,157,98,129,137,123,131,140,125,148,113,137,112,148,113,136,135,127,132,114,124,132,128,132,138,121,144,113,139,
123,132,107,118,122,139,142,144,121,135,109,131,131,128,136,113,119,131,121,126,142,141,125,137,127,109,145,118,127,137,130,115,141,111,117,127,132,130,135,133,119,155,97,139,127,136,131,115,142,127,127,126,118,124,135,123,126,144,122,140,111,136,110,132,121,116,156,124,140,118,145,110,139,116,140,130,114,130,134,128,144,124,106,136,124,137,122,136,108,131,117,142,145,152,108,135,104,113,134,114,
165,106,149,109,151,104,144,119,121,140,121,126,137,139,109,170,100,142,129,125,129,117,121,129,143,119,137,131,116,142,127,122,135,152,121,119,134,123,138,127,139,111,147,113,128,132,135,131,118,144,110,162,110,137,116,143,115,128,143,123,132,122,132,117,154,108,145,118,125,123,137,131,141,119,116,131,136,108,144,116,120,150,107,148,131,132,125,136,98,135,108,137,125,137,122,147,123,133,131,114,
124,124,116,130,148,124,162,113,121,119,119,100,154,109,136,139,124,140,129,100,120,129,107,151,133,136,124,132,89,154,120,128,132,129,122,132,118,143,129,131,130,99,132,122,139,137,112,151,110,124,141,122,158,109,126,119,142,122,150,116,141,113,135,127,123,143,93,156,117,150,113,129,118,119,119,142,129,123,145,94,140,125,126,131,134,134,132,116,116,126,124,127,135,139,104,149,111,126,135,117,
136,142,99,123,141,117,164,122,119,123,129,111,128,130,120,149,144,124,160,108,120,119,135,113,140,115,135,128,132,139,115,148,100,141,131,145,108,135,108,129,129,131,132,124,134,114,146,116,124,138,119,128,139,122,122,135,114,122,125,135,125,155,128,129,131,112,126,125,120,123,156,115,145,125,113,138,131,108,143,136,103,143,112,149,126,139,107,134,128,121,117,130,138,118,155,124,146,106,135,107,
145,132,128,149,128,122,128,137,104,146,108,122,141,124,129,149,127,107,143,112,130,129,130,118,147,131,110,150,107,121,130,109,141,155,105,136,137,112,135,134,133,115,132,114,130,162,108,152,138,118,126,127,111,139,128,116,144,141,141,112,144,111,132,135,124,125,133,121,122,140,132,125,116,132,118,145,113,124,119,127,122,142,128,140,123,120,135,133,125,117,133,130,131,130,135,129,136,104,131,133,
125,135,132,129,133,134,125,125,127,119,109,147,116,138,148,122,123,133,111,144,123,129,130,131,145,102,127,106,139,128,136,116,142,115,134,124,143,109,114,140,110,150,105,130,119,143,126,151,122,120,128,134,124,130,135,101,143,106,138,140,132,125,140,112,124,134,104,149,115,131,125,134,124,140,139,120,128,128,132,121,140,115,136,131,113,138,127,127,127,127,107,130,130,130,133,128,124,116,136,126,
136,121,121,127,130,131,136,130,131,133,120,119,133,121,122,130,133,133,147,123,133,130,125,125,114,135,136,136,130,122,119,142,105,140,137,122,135,133,136,120,130,118,132,124,125,107,161,129,136,134,121,119,123,138,118,137,110,129,137,146,121,134,136,116,131,116,126,138,132,120,153,126,138,119,119,121,133,118,133,146,130,126,132,115,125,143,117,138,128,126,119,135,129,124,148,114,112,145,106,122,
139,123,144,149,111,127,123,125,123,131,118,120,155,115,137,133,119,125,131,116,134,120,119,137,137,117,133,124,119,123,119,120,134,135,141,138,133,114,122,138,115,130,124,118,128,142,134,134,141,115,122,130,116,130,122,126,128,131,119,138,128,126,118,133,117,130,120,123,146,130,133,128,130,124,124,116,129,123,144,118,151,120,114,116,127,122,132,133,125,135,133,127,136,133,119,125,118,128,129,131,
141,121,136,137,120,136,114,121,133,127,118,139,125,130,133,128,122,127,112,132,137,136,123,135,127,133,132,121,131,145,125,132,131,112,147,132,112,132,129,111,137,123,123,137,130,114,145,127,114,139,119,117,142,129,119,143,125,136,126,118,117,138,121,127,134,134,140,128,129,128,124,118,117,133,132,136,126,133,130,143,114,127,119,129,127,135,125,126,140,121,125,140,139,121,132,112,133,128,125,121,
143,138,117,133,128,126,123,125,135,130,124,127,125,134,122,131,136,122,129,129,133,119,120,137,135,130,126,133,125,120,113,140,131,121,120,135,132,139,125,119,140,122,131,129,132,130,130,110,124,141,122,125,134,118,129,133,104,142,133,118,140,129,135,146,120,111,137,125,123,128,120,119,135,121,125,131,129,131,126,130,129,135,114,124,137,143,122,116,130,125,135,119,129,139,125,119,142,126,126,136,
122,123,137,133,114,130,124,132,145,121,133,137,119,112,125,118,138,125,139,132,142,129,108,127,130,118,127,118,130,131,127,131,133,133,130,128,122,134,131,121,122,135,117,140,121,133,125,128,120,131,128,127,136,121,134,122,133,127,122,124,141,127,130,140,130,127,124,112,127,139,112,132,138,119,136,134,126,129,133,127,133,124,128,114,139,123,132,137,129,117,123,136,124,130,123,148,136,135,103,128,
115,117,135,135,131,148,119,133,153,110,120,119,118,124,134,125,133,140,129,131,142,116,123,132,115,130,140,112,152,123,136,126,132,111,134,123,129,131,128,127,133,139,112,144,100,116,127,145,124,151,124,129,130,127,116,131,112,117,124,129,141,143,122,130,130,117,142,109,127,122,144,124,145,125,138,126,136,118,131,120,121,128,118,145,133,121,121,135,125,134,113,141,127,126,118,141,127,132,109,130,
133,122,132,127,135,126,142,114,139,119,128,117,143,126,132,131,124,116,130,134,123,136,119,147,124,128,112,124,125,119,122,142,128,120,141,134,128,122,122,119,135,119,132,128,134,129,131,138,136,122,119,127,122,122,137,130,119,136,116,142,130,112,119,139,126,121,135,138,125,119,133,121,138,115,118,136,139,132,137,142,112,133,118,128,128,132,130,140,140,126,135,110,129,122,121,122,129,129,136,137,
120,130,126,125,113,134,123,141,130,131,128,140,119,130,117,121,132,125,128,136,139,128,130,121,137,120,142,101,131,117,128,144,141,132,129,118,116,127,119,137,121,143,117,145,123,141,130,117,119,123,117,137,136,127,135,120,123,121,130,128,130,120,141,127,132,119,141,120,133,110,141,138,124,134,127,128,126,130,111,151,107,136,128,150,116,134,111,131,128,124,129,123,128,116,144,127,137,116,124,125,
143,118,139,126,138,135,125,134,124,110,130,128,125,139,130,132,124,131,128,125,121,114,129,136,124,135,134,126,133,131,125,126,124,127,126,132,117,138,113,128,136,135,136,133,125,137,124,118,136,120,119,126,141,125,135,126,135,141,129,126,124,121,118,129,124,127,138,123,135,127,128,129,112,136,128,124,129,127,133,126,128,133,119,122,132,125,146,122,132,120,125,132,118,122,131,137,119,142,124,155,
105,136,132,125,109,134,121,123,135,116,146,127,139,120,147,105,124,114,133,125,135,129,136,129,133,131,131,121,109,122,123,132,126,133,132,126,118,142,124,135,115,131,131,137,118,131,128,115,127,121,143,122,140,124,142,122,128,111,132,113,129,138,143,123,133,125,138,127,122,127,126,132,126,139,123,143,109,139,121,125,119,135,123,137,134,125,138,128,122,125,131,117,122,130,137,123,134,136,133,131,
138,116,117,113,124,123,151,125,137,135,133,125,124,123,121,126,123,136,135,134,116,138,132,126,118,128,128,131,131,124,135,125,115,123,145,129,122,127,132,135,119,128,124,121,120,128,142,131,122,119,140,135,133,130,131,110,123,121,136,142,122,130,139,129,128,113,124,123,135,117,140,131,125,133,136,130,122,118,109,137,117,152,128,140,120,128,116,131,125,123,117,141,141,131,137,121,130,115,125,115,
133,113,144,125,141,125,138,120,127,126,121,122,121,125,141,139,133,131,135,126,115,125,121,129,115,135,138,144,119,145,116,125,106,128,115,143,122,138,142,124,126,117,138,118,134,113,146,115,137,115,147,123,135,133,127,125,123,126,115,137,121,146,135,128,119,129,129,124,126,133,133,133,118,133,136,127,122,132,119,126,123,131,138,131,125,120,127,121,133,134,126,128,125,135,129,123,122,133,123,127,
136,135,128,122,137,127,130,127,125,122,137,129,128,130,133,137,127,120,130,127,116,130,125,122,134,123,127,140,128,125,118,136,123,132,125,128,128,122,124,128,134,134,136,115,132,128,128,132,125,136,124,120,134,129,128,118,129,124,139,131,131,124,132,122,127,133,121,129,120,139,127,146,119,130,122,127,117,127,124,127,133,129,135,129,129,118,136,124,134,118,128,124,130,130,131,137,121,121,133,124,
124,124,134,131,136,124,134,123,130,118,123,127,133,134,118,145,133,133,122,139,114,130,114,126,128,131,126,141,136,128,130,117,119,122,120,128,139,124,128,128,136,120,132,127,130,125,129,132,132,129,123,127,129,131,122,125,124,135,130,135,127,126,123,116,130,132,124,127,131,126,129,134,129,138,124,129,126,133,122,129,121,130,139,131,124,124,121,129,134,121,133,128,122,125,133,120,134,131,125,127,
142,123,132,122,129,129,122,124,132,130,127,130,125,139,129,123,121,134,127,127,119,135,132,129,126,134,127,129,125,130,126,128,115,127,133,132,134,131,132,110,129,119,141,122,132,127,133,125,131,124,130,132,128,131,124,122,119,137,126,134,126,130,128,129,128,124,132,130,129,131,125,128,126,129,129,129,130,131,123,129,128,121,134,130,126,126,130,128,133,128,130,121,133,125,123,131,130,123,132,122,
133,121,137,120,127,131,119,128,128,130,125,135,121,137,127,128,122,140,118,131,135,128,132,128,122,133,127,122,125,134,130,121,125,128,144,121,119,123,133,113,130,125,141,131,119,131,133,133,114,134,128,129,126,123,132,134,133,124,137,129,121,125,124,126,133,126,130,137,131,132,120,129,118,128,135,128,125,129,124,127,135,126,129,127,131,120,128,130,133,129,127,129,126,119,121,133,131,129,124,130,
132,126,122,131,132,123,134,123,131,135,123,129,130,127,126,127,128,127,131,127,123,121,133,138,126,131,124,129,126,125,122,134,128,127,127,132,128,120,121,124,135,129,136,130,126,131,123,125,129,128,129,129,132,131,132,123,132,131,127,121,131,122,130,123,128,134,125,133,130,134,130,119,119,136,122,133,132,130,118,124,128,131,136,127,122,134,128,124,130,127,128,128,130,131,136,131,124,119,126,127,
129,127,131,131,124,126,131,131,126,128,125,134,126,122,133,130,127,132,120,128,132,122,127,130,132,125,137,132,129,129,122,122,126,124,133,127,136,128,119,138,133,127,125,129,132,127,128,123,127,140,123,135,132,124,126,125,125,134,119,129,128,132,128,126,127,133,125,119,139,126,130,121,127,126,135,119,136,129,134,119,132,129,121,139,118,135,124,131,127,131,118,130,119,140,128,130,132,125,125,118,
132,123,128,125,130,134,133,127,134,123,126,127,126,130,126,128,124,131,129,128,134,130,122,126,120,133,130,128,131,123,122,126,128,129,128,134,130,133,131,122,129,122,124,125,128,129,133,132,122,128,133,126,129,124,124,128,123,129,129,130,133,132,125,133,130,122,128,130,122,136,129,122,127,128,126,126,132,128,128,127,128,127,134,121,125,130,139,121,125,127,123,131,133,122,136,130,122,130,130,133,
127,131,120,129,128,131,121,133,122,138,132,130,127,124,127,113,133,134,132,121,141,124,132,126,128,127,129,121,122,128,128,128,128,137,134,134,126,125,125,128,119,129,127,132,124,135,134,127,133,122,129,129,134,128,132,123,124,124,137,126,133,126,127,125,130,125,130,131,121,122,130,129,123,133,123,134,131,133,125,135,118,130,127,128,130,122,132,130,133,128,122,123,133,124,133,118,136,126,125,129,
134,123,126,125,126,137,132,125,125,132,122,133,129,126,129,129,122,134,131,123,123,131,122,139,122,126,124,127,126,132,126,125,134,124,135,127,131,123,133,119,134,121,130,136,124,126,129,129,125,130,129,129,130,129,123,134,119,130,128,128,129,132,130,134,122,125,125,125,138,126,130,128,131,124,129,130,122,127,128,124,134,127,121,130,130,130,129,128,121,128,122,129,130,128,126,134,130,137,130,120,
129,122,128,125,133,125,136,129,132,129,127,122,125,126,125,135,130,134,128,132,123,129,121,131,127,130,128,130,130,134,123,127,134,119,128,125,127,130,132,130,128,131,123,124,126,124,129,128,128,137,134,124,132,122,129,128,122,121,128,129,130,139,125,136,127,122,121,129,123,125,129,136,139,128,127,125,124,125,125,125,134,132,127,132,130,130,130,120,127,127,126,129,132,125,136,131,126,125,129,123,
129,123,122,137,127,132,133,132,128,125,118,129,127,127,125,134,130,133,129,124,130,121,127,123,132,128,133,125,134,129,129,126,128,129,129,127,123,131,123,132,127,128,129,134,121,127,127,128,128,127,128,127,133,124,129,126,125,130,129,128,130,129,127,130,127,130,128,124,128,133,126,124,129,128,134,126,129,125,130,124,122,134,131,129,129,125,131,126,128,129,126,130,127,125,129,128,127,133,128,125,
127,134,123,130,128,121,132,127,126,132,134,123,132,126,127,126,125,123,133,123,131,130,124,133,130,126,128,131,123,131,123,132,130,126,124,132,125,128,132,121,132,125,128,126,126,129,133,126,128,130,129,130,127,123,125,133,120,132,134,125,127,128,122,138,124,120,131,127,132,127,128,124,136,124,130,130,128,125,131,126,129,133,125,127,125,133,129,128,123,129,126,128,130,129,125,132,128,127,130,128,
122,129,128,128,130,126,126,134,131,124,126,125,131,130,130,129,129,128,131,124,128,130,121,124,131,128,130,132,121,131,131,125,131,131,124,130,128,123,134,129,128,129,130,128,130,122,127,131,122,131,126,128,126,132,125,131,128,126,129,128,130,133,126,124,131,122,132,128,129,129,130,125,130,127,130,128,126,131,130,126,124,129,128,133,127,126,128,128,126,125,132,124,132,129,126,129,128,128,126,128,
124,132,128,128,127,130,128,128,128,128,132,124,123,130,128,129,128,126,133,128,126,127,130,125,131,127,129,130,131,123,128,129,125,128,124,132,130,127,127,131,126,131,126,126,125,129,125,130,129,128,136,126,127,124,129,122,133,124,131,131,127,129,130,129,125,128,121,130,124,131,130,131,125,131,125,123,132,126,127,130,127,125,133,122,134,128,129,127,129,124,125,127,130,131,129,129,124,131,120,127,
127,132,125,131,130,129,127,126,127,128,130,127,131,129,125,126,131,127,130,126,129,127,129,127,130,129,128,127,128,130,127,127,125,130,128,130,128,131,126,129,128,126,132,127,123,131,129,127,133,127,131,128,126,125,129,129,123,127,130,127,130,129,128,132,123,131,124,128,129,127,128,130,129,129,126,128,130,124,130,128,131,130,127,126,127,130,124,129,129,129,127,128,130,131,131,125,130,127,127,126,
128,127,130,127,131,130,129,128,126,128,128,127,128,125,128,132,127,132,125,129,125,129,128,129,127,124,127,131,127,132,126,125,131,125,129,129,127,126,128,129,130,127,129,124,128,126,129,129,127,129,129,129,128,127,125,129,128,126,128,128,127,129,128,128,132,126,128,125,128,126,127,129,126,130,128,129,128,130,127,128,125,129,127,130,127,129,129,127,128,129,128,127,131,127,128,128,127,126,133,125,
130,127,128,128,129,127,127,134,128,128,129,126,124,132,125,129,130,128,129,128,128,128,131,125,128,130,127,126,129,128,128,129,128,130,126,131,125,128,127,126,132,128,129,126,127,129,129,125,128,129,129,125,128,127,128,129,128,127,132,125,129,129,127,127,129,128,128,132,125,130,127,130,124,129,128,127,129,129,125,131,128,126,131,127,127,127,127,128,130,128,127,127,130,127,129,126,129,126,128,130,
129,129,127,131,127,128,127,127,128,128,127,130,130,126,129,128,128,126,127,129,126,128,130,129,130,129,123,129,128,125,128,128,129,128,129,127,129,127,126,128,127,128,127,128,126,131,130,128,128,128,127,128,127,130,129,126,126,128,130,126,129,128,129,127,128,129,130,125,129,127,128,129,126,128,128,130,127,129,129,129,127,129,126,130,126,129,128,129,129,127,128,129,127,128,128,128,131,126,127,127,
131,125,129,127,130,127,128,126,130,128,126,131,128,128,127,128,128,131,123,131,126,131,126,129,127,128,127,128,129,128,129,125,131,126,130,127,128,128,129,128,128,127,127,127,127,130,128,130,127,128,127,128,125,129,129,127,130,128,129,128,128,127,129,126,128,129,129,127,128,129,127,129,128,128,129,127,127,129,128,127,129,128,128,129,125,128,128,128,127,130,130,127,127,128,127,127,128,128,129,127,
129,129,128,129,128,127,127,128,129,127,130,128,129,127,129,127,128,128,127,129,129,127,128,128,127,130,126,129,129,128,126,130,128,128,128,129,126,129,128,128,129,125,127,129,128,127,131,126,129,125,128,129,129,127,129,127,129,127,128,129,126,130,127,128,128,129,128,127,128,130,127,129,127,129,129,125,130,128,128,128,128,129,130,126,127,127,129,127,130,129,127,129,127,129,129,127,127,129,127,127,
127,130,126,129,128,127,129,128,126,129,128,127,129,127,129,128,127,128,128,128,129,127,128,128,127,128,127,129,128,128,128,128,128,128,127,129,127,128,128,128,128,127,128,128,128,128,128,128,129,127,127,129,128,127,128,128,127,129,127,129,128,128,128,128,128,127,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,127,128,128,128,127,129,127,129,128,127,128,128,128,128,
127,128,129,128,128,127,129,127,128,128,128,128,128,128
};
const uint8_t PROGMEM OH[2572] PROGMEM =
{
128,128,128,128,123,132,81,98,134,99,132,124,200,128,145,164,112,151,211,121,174,171,120,152,116,92,129,109,68,39,91,143,100,106,122,74,144,130,117,119,124,157,122,193,137,177,156,197,65,75,168,76,117,165,101,125,163,146,138,162,97,99,45,170,122,171,215,97,122,96,151,138,130,110,104,94,192,138,56,83,133,91,119,92,191,185,206,114,127,122,181,151,105,136,17,119,143,219,182,164,
140,122,84,155,99,141,204,107,153,115,106,131,152,130,93,156,135,172,177,127,104,123,74,101,132,164,92,70,142,129,181,111,85,113,135,143,133,104,142,115,155,133,140,219,82,96,152,142,204,146,87,152,68,63,93,108,192,52,86,132,47,154,117,128,158,93,120,101,163,132,60,175,144,114,115,37,94,86,148,138,126,177,144,57,145,143,140,118,116,138,136,181,75,116,165,67,109,116,84,149,
111,171,130,120,155,117,118,149,86,146,91,86,148,107,108,174,150,97,76,128,89,116,166,156,134,90,158,52,127,135,63,126,122,182,165,159,100,82,73,146,129,138,178,71,152,115,127,113,108,147,112,61,119,99,193,213,163,96,65,96,113,135,79,116,105,67,155,130,131,107,103,96,106,174,128,167,143,115,67,172,118,110,170,90,189,123,100,183,140,149,134,50,115,150,158,167,56,150,168,95,
179,155,173,97,80,186,153,115,141,131,66,61,117,158,117,123,131,123,121,213,181,137,146,133,122,124,130,193,143,57,94,103,167,84,116,196,57,127,133,99,157,156,162,155,120,142,215,136,183,94,177,150,71,153,91,155,96,77,135,163,150,113,122,88,142,177,185,98,112,141,127,154,147,187,131,76,76,71,156,161,113,134,80,170,159,174,155,77,206,125,106,173,170,215,119,46,138,101,98,153,
49,147,153,131,204,154,161,111,122,173,124,139,180,94,87,153,85,120,136,164,166,121,166,180,205,163,83,89,116,80,151,175,116,135,127,83,146,124,121,140,136,179,126,175,124,78,129,74,104,184,170,158,137,121,152,183,113,125,108,131,108,122,181,179,156,87,75,87,197,190,113,198,101,116,185,139,166,109,100,110,53,187,188,127,165,42,147,105,101,208,180,106,106,66,147,171,154,141,87,110,
127,144,168,149,167,136,92,155,144,162,141,143,126,62,99,140,158,144,39,108,162,150,169,99,160,136,56,132,137,159,123,64,102,114,140,147,111,140,152,95,144,107,181,171,67,87,81,147,171,146,124,174,86,102,154,169,114,98,114,71,127,160,122,121,93,71,128,138,154,182,97,116,115,150,143,116,177,83,52,120,106,135,144,101,111,96,103,143,162,176,146,71,113,111,160,161,91,88,90,99,
146,160,162,100,84,128,129,163,133,108,158,117,124,96,140,153,67,104,105,131,186,113,131,112,112,130,110,150,134,103,97,132,149,158,82,105,99,125,164,142,160,103,114,83,89,100,133,138,115,122,104,122,161,141,112,128,77,114,127,177,143,116,89,55,104,133,153,138,113,140,122,116,152,134,87,87,57,161,144,142,154,103,132,91,105,175,147,159,123,91,120,97,152,120,98,84,74,112,131,169,
163,113,105,118,119,146,131,124,151,90,99,102,185,132,64,134,125,116,156,118,128,143,119,121,119,144,92,95,167,104,129,156,88,149,110,121,145,92,174,120,113,134,91,163,116,86,172,95,98,156,142,145,89,100,144,94,159,130,118,173,103,122,120,150,133,119,111,83,154,127,156,125,131,92,96,148,143,165,126,106,90,177,137,136,145,83,111,98,118,161,150,135,112,110,118,133,150,170,135,131,
117,103,136,147,138,119,93,91,135,132,171,173,96,101,107,151,191,149,140,103,86,152,107,117,149,94,133,97,110,201,132,144,121,78,149,119,147,173,101,146,98,100,178,122,157,126,119,151,100,151,132,130,117,80,115,120,131,155,135,95,129,154,142,136,158,140,129,146,105,161,130,89,136,106,146,112,121,146,118,146,143,119,179,130,85,150,123,137,141,94,135,136,146,146,104,151,108,91,158,108,
156,135,81,158,133,121,136,116,177,147,128,153,129,157,125,107,135,108,102,118,145,135,115,131,92,151,140,160,150,140,161,113,130,147,135,120,94,81,151,146,94,170,129,135,124,118,159,142,132,136,115,131,126,112,137,136,112,140,113,153,168,153,157,116,125,126,116,125,142,116,110,81,121,138,145,147,123,142,147,147,166,137,134,101,116,109,152,134,125,130,109,126,128,148,142,119,162,127,122,149,
129,137,127,107,113,130,141,147,142,151,118,102,131,123,131,138,118,117,130,121,133,153,126,134,145,145,137,146,125,127,118,129,120,108,132,104,147,142,127,137,121,108,149,135,137,153,99,140,116,140,147,113,133,136,115,154,108,150,161,82,142,112,131,145,109,149,116,114,134,127,160,129,119,143,117,133,142,139,150,102,109,115,128,150,116,144,124,116,149,115,159,149,119,126,86,148,155,119,147,115,
121,123,86,169,140,111,127,90,156,140,139,144,110,129,119,110,153,144,139,127,112,123,131,131,122,120,123,110,116,154,130,154,124,113,146,136,131,135,132,119,113,110,120,132,125,132,112,124,129,137,160,131,126,131,119,136,148,136,124,106,118,128,127,118,128,122,123,115,117,150,144,140,127,122,119,127,140,119,122,131,129,147,143,106,130,125,121,133,113,124,121,124,130,128,152,116,128,134,120,138,
131,129,131,126,110,114,120,132,123,139,113,129,156,119,142,126,116,125,111,146,126,124,138,95,135,115,117,158,130,121,139,122,141,129,125,120,105,110,121,116,153,128,139,104,104,160,121,158,135,119,122,105,126,135,125,122,119,106,127,114,148,138,128,144,97,132,135,151,159,125,119,93,100,151,128,140,123,99,126,114,126,158,114,130,109,108,142,149,144,136,116,120,110,128,140,117,150,131,112,126,
108,134,125,110,125,112,131,155,117,142,133,107,120,111,145,123,133,150,113,133,129,113,124,114,109,127,130,144,128,134,122,127,129,116,124,122,142,132,134,146,128,108,131,100,147,132,116,144,101,140,128,118,136,105,132,124,132,139,132,135,136,121,119,110,137,113,131,143,109,138,115,113,139,123,136,113,121,151,116,148,134,118,130,109,137,139,102,150,120,121,145,121,138,125,119,128,120,133,125,132,
124,117,146,114,126,139,111,141,123,120,124,129,138,113,132,130,104,132,146,127,136,121,110,150,136,129,112,117,124,117,135,127,133,128,112,132,128,131,146,117,141,115,125,129,137,131,139,121,126,109,137,137,126,140,108,121,128,112,136,128,115,124,128,130,140,141,136,121,124,117,134,135,122,134,121,120,126,132,124,119,124,128,115,143,123,137,133,120,134,133,125,132,121,136,128,155,119,116,115,117,
121,134,127,126,124,129,124,128,132,134,135,128,127,134,128,140,136,118,127,115,119,130,123,149,132,113,127,120,143,126,131,137,111,127,139,129,143,130,127,122,117,127,142,127,133,102,126,136,118,123,128,121,135,120,142,137,138,142,113,122,141,125,128,122,122,135,126,125,125,129,131,116,130,130,131,132,128,131,132,124,127,140,131,131,113,131,130,143,134,120,131,125,120,136,124,139,129,112,132,130,
129,147,117,133,122,120,146,123,141,130,113,142,118,135,137,119,135,115,120,138,122,144,123,136,138,107,139,121,142,137,116,127,121,125,134,139,131,126,125,127,130,129,128,125,142,113,129,137,125,127,131,129,138,131,132,131,131,126,129,128,131,116,122,126,130,137,120,125,132,137,132,133,132,130,137,118,127,135,129,126,122,127,132,137,124,136,129,136,122,130,126,123,139,124,122,128,125,128,133,133,
125,130,129,125,139,128,129,130,113,135,117,143,138,119,136,127,123,141,124,134,127,124,133,116,132,137,122,138,113,122,139,123,141,130,130,132,115,132,122,131,135,117,131,127,127,139,131,128,125,121,123,129,139,123,125,129,126,130,128,127,134,124,128,130,127,137,129,126,128,121,131,129,125,135,123,127,134,120,140,122,136,132,119,133,126,122,136,122,134,126,119,130,129,125,135,123,131,126,126,133,
124,133,129,126,129,127,131,131,129,122,129,126,123,134,125,128,127,125,135,121,131,127,128,133,126,128,130,127,136,128,121,134,124,129,129,130,121,130,126,124,131,130,121,135,129,130,125,131,128,129,125,124,124,127,121,127,137,124,127,131,123,133,123,131,128,128,135,129,128,130,126,132,121,125,134,127,129,132,124,129,121,120,129,122,133,127,123,132,126,136,130,123,137,118,132,127,127,134,125,128,
130,121,131,122,125,128,131,125,125,131,132,125,129,124,131,137,122,132,124,132,126,118,134,123,127,129,119,130,132,124,132,124,125,130,122,138,131,131,131,123,129,132,121,130,125,124,132,124,133,130,122,129,123,125,126,126,132,127,128,132,126,129,127,128,126,131,131,126,127,127,129,128,125,119,129,130,129,130,127,131,128,125,132,125,130,125,126,132,129,126,126,123,129,124,128,125,131,133,128,124,
133,126,122,124,122,133,133,127,127,127,137,126,127,129,125,132,127,131,127,126,126,121,127,128,124,128,126,132,137,124,126,129,125,131,127,124,134,126,125,129,124,132,123,125,128,125,132,129,127,137,124,128,130,122,127,129,125,134,128,130,124,127,129,129,124,129,123,129,129,130,130,126,127,124,128,133,126,133,125,133,127,124,129,121,129,127,122,133,131,125,130,124,129,131,128,130,128,127,131,125,
128,123,126,132,125,131,133,125,135,124,129,126,123,127,129,127,130,127,130,126,126,130,127,129,126,129,130,126,129,127,127,126,125,130,128,125,133,128,130,129,125,131,125,125,134,128,128,127,126,128,127,128,126,128,127,129,130,128,126,127,129,123,129,129,125,134,125,130,128,128,129,129,129,125,129,131,126,126,127,127,125,129,125,128,130,130,127,129,132,127,132,127,127,131,128,126,125,129,131,126,
125,129,124,133,127,126,136,125,129,127,127,133,128,129,129,125,135,125,124,131,127,128,128,121,133,128,128,133,125,129,125,128,130,127,133,127,129,130,127,130,127,126,127,125,128,128,129,131,126,128,127,130,129,128,130,129,125,131,126,130,130,126,130,125,129,133,123,131,128,127,127,124,127,132,126,130,128,126,133,125,128,132,127,129,124,129,130,127,130,126,128,126,127,129,128,127,129,130,131,127,
129,128,127,129,128,129,127,129,129,126,132,128,128,126,128,131,129,128,126,129,130,126,126,127,129,130,129,129,128,127,127,128,128,132,127,125,127,128,129,128,127,127,130,128,130,128,126,130,128,126,131,127,131,127,127,131,127,128,128,128,130,128,128,128,128,127,127,126,130,127,128,130,128,131,126,128,130,128,129,128,127,130,127,128,128,128,128,128,126,128,130,128,128,128,130,127,127,129,129,128,
126,129,128,130,128,127,128,127,127,129,127,128,126,128,130,127,128,128,128,129,127,130,129,128,130,127,127,128,128,128,128,128,129,127,127,129,128,128,128,128,128,127,129,129,128,128,128,128,128,128,128,129,129,128,128,127,129,128,127,128,127,129,128,128,128,128,128,128,128,129,128,127,128,128,128,129,127,128,128,127,128,128,128,128,129,129,127,128,128,128,128,128,127,128,128,128,129,128,128,128,
128,128,128,129,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128
};
const uint8_t RD[5066] PROGMEM =
{
128,128,128,128,121,182,191,80,131,123,101,160,31,208,158,89,15,169,122,93,128,128,73,79,140,56,98,131,74,93,137,178,186,131,131,80,129,193,194,161,102,60,109,117,205,190,164,72,137,114,112,135,144,152,142,124,137,116,143,166,155,134,96,181,82,110,119,199,165,100,161,149,112,80,133,220,151,171,150,92,1,32,209,144,174,153,190,33,73,115,144,137,123,198,158,118,131,124,127,134,
171,99,107,89,53,152,146,191,156,185,95,128,148,136,121,138,119,128,130,164,170,113,113,106,139,61,99,124,120,136,140,145,155,91,126,159,179,98,144,188,104,79,141,174,117,151,125,138,119,68,165,172,110,107,155,155,77,134,66,142,96,159,142,122,72,93,122,107,156,148,150,92,132,123,134,114,162,149,152,121,118,151,135,77,138,163,146,73,108,193,121,109,140,188,70,60,98,144,97,121,
148,162,76,103,184,137,113,119,116,87,147,184,130,125,94,142,134,100,115,62,129,119,174,105,143,179,90,86,101,145,90,108,122,133,154,108,175,115,127,95,84,118,80,113,135,172,148,144,95,124,144,90,60,122,152,128,75,181,152,112,147,185,129,55,114,145,139,112,105,135,131,133,160,169,164,92,154,101,137,94,124,128,130,179,126,141,162,162,155,103,99,142,163,43,119,165,110,150,172,189,
79,83,110,131,56,92,174,165,140,139,172,102,66,151,144,126,117,190,114,113,105,114,121,110,159,160,156,127,146,120,122,139,116,83,130,122,123,143,194,155,117,128,150,113,70,92,133,77,162,145,143,139,173,141,66,119,114,144,58,135,152,93,118,176,181,142,84,140,115,93,66,150,110,104,161,162,158,98,130,153,144,86,130,126,126,120,135,134,130,126,137,113,163,142,115,98,111,147,124,128,
128,170,109,72,172,138,135,108,183,156,50,139,148,127,92,164,166,151,136,136,144,98,116,168,129,87,119,147,101,154,150,158,100,128,159,102,122,139,129,67,126,204,150,149,141,140,108,68,134,131,112,93,163,130,131,157,134,122,117,145,116,113,154,92,118,137,166,135,112,147,142,101,86,169,138,100,146,165,123,91,94,181,98,78,172,201,95,107,121,117,118,115,158,102,92,124,136,146,124,135,
139,126,124,134,114,102,156,129,151,100,184,173,115,95,155,146,101,108,165,165,79,132,200,131,90,149,172,106,94,161,91,85,118,180,164,126,153,155,106,132,120,103,69,151,151,150,138,151,139,63,137,184,124,83,130,145,71,97,177,164,119,123,182,103,105,109,145,104,144,171,121,109,133,117,113,150,186,98,94,100,157,110,99,165,148,95,98,184,125,106,140,161,134,127,117,143,80,127,108,143,
142,123,129,150,117,115,143,108,86,105,113,102,126,189,141,141,115,124,136,63,169,150,107,75,142,137,124,122,176,139,102,82,153,82,75,122,174,161,98,132,116,108,90,186,154,114,92,133,109,90,155,154,118,160,143,111,80,148,124,113,151,160,156,91,154,147,92,89,119,136,91,105,176,178,113,108,147,74,96,127,169,154,142,169,100,112,139,120,107,117,163,122,126,138,142,116,119,150,122,119,
80,119,150,114,148,168,142,107,90,166,130,125,131,133,98,119,115,108,174,126,141,182,125,117,94,97,97,126,144,122,147,137,144,75,165,137,98,95,133,173,121,118,168,151,95,105,192,119,92,123,143,144,81,163,137,135,118,149,140,125,119,140,95,119,179,149,109,116,129,113,90,147,159,99,144,154,149,78,117,136,136,119,126,160,136,127,122,113,154,124,134,122,119,109,72,155,155,150,126,163,
127,89,97,117,157,98,119,165,129,146,109,143,136,116,115,115,133,121,123,133,166,159,104,128,146,117,109,135,125,101,137,130,145,121,124,112,113,147,119,132,137,134,124,106,167,130,136,92,124,148,139,114,131,162,76,112,154,138,132,105,138,115,105,157,128,145,106,139,114,145,142,105,104,132,163,104,121,138,143,123,102,185,128,87,98,142,144,84,147,169,133,105,123,154,124,108,116,118,144,133,
137,139,163,94,111,158,143,105,114,142,126,105,134,160,123,113,144,142,107,120,110,145,109,136,130,136,126,126,146,120,165,130,138,99,134,151,103,138,135,144,111,94,140,137,149,127,139,135,124,109,116,164,135,110,142,154,111,95,138,141,125,93,158,153,85,127,141,176,111,136,149,123,100,111,159,128,121,117,112,130,120,142,103,143,164,104,124,122,127,113,125,164,124,116,121,145,131,111,151,110,
157,121,124,119,142,147,129,122,136,116,83,133,146,133,118,133,168,110,98,149,168,114,106,171,125,103,113,134,135,130,133,143,120,127,126,110,126,160,127,121,130,123,106,79,154,156,116,98,151,143,96,119,156,120,116,122,135,120,114,120,143,144,111,141,128,163,99,104,126,121,128,122,153,142,112,128,119,138,111,136,141,127,134,116,116,123,136,145,135,131,147,112,65,111,169,129,132,156,152,96,
100,126,151,110,112,145,143,128,104,131,134,132,136,124,165,100,79,129,180,144,71,151,170,112,97,133,164,81,84,158,154,122,104,167,139,92,100,132,133,107,138,150,131,104,138,146,117,136,123,125,143,151,109,72,124,151,165,144,126,125,94,96,124,172,133,111,110,139,134,92,127,156,132,112,135,145,116,110,118,148,147,98,135,132,109,106,165,146,117,137,111,124,124,153,122,138,149,100,121,135,
128,121,112,159,141,119,116,134,138,109,131,133,144,124,99,130,140,152,129,118,130,107,101,105,172,136,136,117,145,133,94,124,145,125,110,156,141,98,95,124,156,136,137,141,100,111,124,132,146,138,138,128,110,131,131,107,137,154,112,131,92,155,127,111,137,151,168,104,113,140,113,101,135,166,131,97,118,151,149,112,138,129,117,90,143,168,115,117,133,157,106,100,154,131,124,127,152,112,118,115,
126,166,137,143,86,115,122,106,143,153,170,127,133,111,101,108,129,179,120,149,119,104,111,126,141,126,147,159,131,100,106,151,119,125,173,144,110,95,167,148,106,119,161,133,71,138,168,121,115,140,160,114,132,142,116,95,107,162,141,133,104,131,123,127,158,111,142,114,140,143,104,133,113,118,123,164,123,121,112,125,160,103,132,151,139,92,123,155,128,97,127,147,130,110,141,122,129,136,116,128,
114,145,129,118,126,129,137,118,145,128,111,115,159,152,87,137,130,116,109,152,147,103,113,125,140,116,135,151,98,139,116,122,134,148,129,118,156,126,119,88,128,152,117,145,145,145,87,106,158,126,127,111,157,118,98,140,142,125,105,145,111,101,114,122,154,121,143,125,127,105,111,141,125,143,135,137,133,89,135,120,123,150,129,130,99,148,142,126,102,133,152,101,115,127,160,97,137,171,138,130,
102,135,103,102,155,146,134,114,148,111,135,138,127,122,109,134,101,152,147,116,124,116,173,128,100,133,123,134,114,151,137,115,127,141,147,112,127,128,96,121,127,153,106,146,134,116,123,142,147,94,142,150,119,119,113,160,104,112,142,122,135,109,147,113,146,107,142,138,107,113,120,153,126,124,120,132,144,117,150,123,123,121,132,145,100,99,127,138,119,158,144,125,135,115,103,105,132,161,103,149,
153,111,107,151,183,82,115,133,140,128,120,160,118,117,136,143,122,94,136,126,137,112,143,134,94,170,103,127,126,138,132,105,184,135,96,120,128,128,109,178,130,121,92,130,140,136,146,113,125,113,139,127,139,151,118,123,116,142,123,87,148,160,137,94,150,136,105,119,151,131,101,118,155,118,135,117,145,128,132,124,93,151,123,138,116,141,119,99,167,146,125,112,114,174,116,129,113,121,97,146,
159,131,129,108,142,103,138,154,103,125,143,141,92,114,155,121,116,152,155,79,113,123,151,123,125,144,106,109,132,133,145,139,129,105,130,135,105,134,135,161,97,98,141,147,117,116,176,129,106,144,128,139,95,146,144,124,123,122,116,127,165,130,130,144,97,98,122,167,135,104,154,139,116,98,155,115,121,104,173,169,86,115,113,151,136,150,162,82,119,110,112,136,150,156,93,153,116,109,110,153,
144,103,118,134,128,118,127,155,116,130,121,137,147,94,139,141,146,119,105,112,142,139,136,138,119,110,80,132,186,124,125,119,172,106,110,121,119,111,141,164,141,141,119,99,140,141,121,130,147,129,82,139,135,160,101,143,146,95,86,124,150,137,138,158,112,122,100,139,121,122,158,120,129,133,139,85,126,160,143,97,128,148,110,112,165,121,99,89,181,154,132,131,102,111,107,155,136,132,117,123,
126,122,149,113,96,148,164,120,83,141,127,127,120,163,153,81,110,162,133,106,94,155,137,129,117,127,132,103,136,148,160,100,121,156,129,88,92,147,156,121,162,125,114,90,140,142,143,107,126,144,107,151,133,94,134,152,131,110,145,135,98,101,146,161,88,157,135,124,116,130,118,98,150,167,114,131,135,128,98,156,151,120,109,132,140,88,141,161,149,98,128,162,114,69,134,170,129,86,185,130,
100,113,153,125,111,148,126,134,115,133,116,133,151,119,109,124,127,126,123,160,121,125,117,151,128,111,112,164,152,114,118,125,118,135,149,149,129,107,106,111,156,131,124,121,156,117,107,135,129,119,146,148,120,90,140,121,130,139,157,112,103,161,117,98,106,156,135,113,125,143,109,104,149,181,94,102,124,153,109,134,151,125,111,136,158,114,109,129,113,141,149,123,116,116,160,98,133,144,119,85,
156,159,126,108,147,145,89,101,162,130,112,141,168,135,94,126,123,113,110,163,128,112,127,159,105,104,154,149,111,137,120,125,99,141,145,155,126,101,137,131,137,110,129,131,118,128,165,124,100,102,163,138,122,131,157,100,95,132,169,126,108,144,136,110,109,130,132,113,160,159,95,121,125,126,95,173,139,120,120,144,108,116,143,140,118,136,122,131,115,131,139,121,131,117,137,102,138,126,136,122,
137,136,111,118,165,118,107,144,165,84,104,147,141,124,142,156,108,103,144,141,125,123,121,105,108,154,133,131,126,148,116,123,123,135,110,135,147,150,109,118,143,138,95,144,149,139,107,113,143,103,129,130,166,126,113,107,144,133,107,131,157,124,133,113,139,102,133,149,149,113,99,144,112,123,148,140,132,102,126,137,118,129,135,143,113,139,117,123,112,146,133,125,110,141,134,116,126,148,107,139,
129,115,141,123,119,135,181,108,104,112,153,113,118,150,146,109,108,152,141,77,138,138,155,100,116,159,105,106,134,176,96,119,141,121,130,141,148,117,110,146,106,135,128,150,115,128,145,122,107,106,138,147,136,146,127,124,108,118,143,121,135,123,136,115,144,121,128,128,125,129,123,121,134,120,153,133,125,99,134,118,130,132,116,169,125,126,110,142,122,105,124,161,136,89,117,161,131,136,112,147,
102,120,136,118,125,116,144,142,128,126,127,120,125,131,123,124,139,117,124,111,165,128,116,141,140,108,104,171,148,76,130,133,140,109,137,137,115,118,146,162,85,125,127,134,124,137,154,100,101,144,155,121,88,174,108,117,136,179,98,100,160,134,114,89,166,148,102,120,141,150,98,112,157,125,114,118,178,123,110,100,145,134,124,140,133,117,116,113,155,130,117,131,139,134,106,132,127,132,116,149,
125,132,130,99,132,140,128,132,113,143,97,139,142,140,116,103,127,129,157,135,128,101,134,154,105,143,131,130,115,109,164,115,111,116,180,118,93,123,160,128,98,170,144,94,120,148,148,80,118,164,133,131,114,134,109,151,130,131,121,118,126,127,148,147,93,121,133,174,104,101,145,130,123,104,166,133,101,127,165,128,92,141,142,108,118,124,154,117,138,109,151,122,122,144,132,127,107,137,115,141,
131,126,134,119,164,109,113,141,112,134,103,164,119,121,128,134,144,123,113,127,133,119,109,163,127,129,118,123,153,105,140,116,139,135,112,144,149,105,96,139,181,125,102,119,149,88,118,156,159,110,95,168,134,96,107,152,151,115,121,142,123,88,156,165,99,137,110,146,97,130,133,122,140,130,142,104,104,130,148,149,115,143,128,107,142,134,130,76,149,174,130,96,112,140,131,118,153,127,124,96,
139,147,121,112,124,147,127,144,114,127,116,120,144,138,116,114,118,149,138,120,113,161,116,113,98,159,123,99,148,134,146,103,141,146,114,125,106,136,147,130,144,126,137,97,141,110,137,129,106,133,142,139,127,113,128,108,132,148,152,109,99,143,131,139,123,119,117,137,133,134,127,107,115,132,151,164,97,110,95,147,137,146,137,122,148,87,135,143,120,119,132,155,103,108,119,135,159,113,137,134,
134,92,122,136,116,139,140,170,107,87,147,141,133,124,126,117,123,134,136,145,121,120,126,134,122,110,112,138,142,148,131,122,111,130,125,154,135,126,132,116,125,121,154,133,122,136,116,106,128,158,121,114,149,128,128,91,165,130,104,121,143,147,93,131,144,133,116,112,161,122,89,130,143,148,117,141,121,124,110,151,132,121,114,116,146,143,125,105,116,143,124,134,140,110,110,122,155,141,119,93,
141,155,135,128,110,135,126,119,155,122,128,105,153,141,115,123,108,136,134,139,115,125,123,124,141,111,127,143,134,141,124,126,101,145,144,141,106,120,139,117,139,143,122,112,114,147,133,137,114,109,140,144,140,112,139,127,109,116,153,147,106,127,143,140,126,95,151,123,116,139,160,119,83,137,127,127,139,144,142,108,118,128,131,126,120,143,121,149,113,122,127,132,136,118,131,128,129,122,122,137,
135,135,132,127,116,121,113,133,157,124,120,118,139,124,120,125,136,119,130,152,139,99,120,130,147,121,125,121,125,134,137,143,125,122,115,127,155,136,108,123,138,127,98,143,137,150,113,137,129,97,120,146,144,116,124,137,115,133,129,142,115,143,150,107,101,110,141,116,161,146,115,107,128,148,117,111,137,126,127,127,153,112,116,132,139,123,126,122,109,128,131,127,125,129,153,125,104,147,136,119,
108,147,131,118,125,137,133,120,126,135,132,114,113,132,125,141,119,140,145,99,121,131,146,112,125,135,137,109,120,161,137,107,116,139,128,113,149,126,112,122,138,139,117,141,121,110,136,157,121,95,130,143,124,128,131,131,101,133,152,130,108,130,132,128,131,134,115,130,135,132,116,131,146,106,117,156,149,100,132,148,131,87,127,161,122,108,151,139,98,111,170,135,119,111,147,118,123,129,117,140,
123,148,125,121,135,116,108,148,137,116,118,143,130,123,127,154,124,109,128,129,129,127,128,127,110,143,130,132,142,116,114,127,146,127,118,114,143,124,125,139,137,121,116,146,129,114,135,108,137,130,138,122,129,149,120,111,125,159,103,119,149,137,124,119,159,131,89,134,134,140,112,137,142,126,121,141,131,130,123,114,121,143,124,121,135,146,140,93,148,136,111,105,144,153,104,117,163,127,101,124,
150,122,119,135,146,106,137,147,118,121,132,141,121,121,127,132,105,133,163,125,112,132,131,135,100,154,114,129,117,140,140,111,122,138,140,120,113,134,139,130,109,137,144,102,120,139,155,110,123,125,129,107,127,139,143,116,146,117,125,120,123,126,135,130,126,127,127,143,104,130,141,132,109,125,145,117,105,149,132,128,117,144,121,115,117,150,124,132,152,107,107,133,132,124,115,151,135,118,122,141,
111,90,162,147,135,96,135,136,111,133,144,120,111,129,154,118,124,123,131,120,143,132,112,137,123,133,116,132,149,113,120,145,131,125,120,144,121,129,104,150,133,126,117,128,144,116,128,125,142,117,120,152,137,109,117,142,139,111,130,131,135,103,136,150,125,124,139,124,108,129,129,126,147,135,121,100,124,150,118,134,135,134,111,128,134,130,114,142,151,127,119,128,110,130,125,150,118,115,148,118,
130,139,140,95,118,153,131,103,123,164,121,93,161,139,118,100,150,129,106,115,158,136,111,138,135,124,114,129,136,120,142,123,122,136,125,137,105,139,129,131,114,150,127,105,147,128,129,138,117,137,119,137,120,132,132,127,126,120,146,114,113,139,142,134,113,129,132,119,135,129,148,105,125,126,137,121,144,132,107,139,131,123,135,131,133,111,129,139,120,115,154,142,101,128,127,138,102,144,143,125,
114,128,139,119,118,157,123,135,112,132,122,128,148,116,129,122,149,104,124,142,114,122,142,131,122,107,153,128,129,114,149,125,111,136,128,126,129,131,132,127,133,120,125,138,138,129,115,136,129,132,104,146,119,127,124,135,130,127,125,126,135,118,118,130,119,157,124,124,143,113,113,117,167,117,124,130,137,119,108,146,140,109,130,132,152,103,129,128,116,140,119,136,129,112,132,138,130,132,129,118,
117,144,116,131,121,147,114,128,130,134,125,129,124,125,123,126,133,132,140,122,115,145,125,115,128,127,143,107,149,123,130,110,128,150,131,122,126,123,129,115,147,129,134,121,131,131,120,138,109,132,139,133,122,126,126,122,124,150,128,129,112,136,115,135,134,135,124,125,124,124,132,135,128,128,124,134,124,118,136,138,125,114,141,120,133,110,147,130,122,128,139,128,111,124,148,127,130,116,134,123,
128,131,134,137,111,135,120,135,123,124,135,131,127,128,116,132,121,138,116,146,126,120,118,137,136,120,130,136,136,109,120,138,131,122,130,144,128,102,145,135,125,110,146,119,127,120,127,129,126,148,130,115,136,121,129,123,141,122,108,130,131,140,113,139,122,130,115,129,138,122,119,137,132,129,122,135,119,131,134,131,122,126,124,119,139,139,130,127,134,134,113,120,142,127,129,117,145,123,135,114,
143,133,121,122,137,133,118,125,127,131,133,127,136,130,111,128,131,139,120,131,116,128,127,134,131,124,126,141,122,132,129,127,109,141,138,121,120,129,138,117,132,128,136,111,131,137,131,123,128,129,127,122,138,125,140,117,131,123,125,139,130,126,126,130,123,120,139,132,120,124,147,136,103,129,125,134,113,144,143,124,103,131,139,129,126,132,124,125,117,129,135,132,127,131,128,125,132,123,134,127,
128,116,136,132,126,124,133,122,143,115,136,124,127,118,136,142,125,126,116,143,123,124,139,123,116,125,136,135,124,134,112,144,131,139,118,129,127,132,122,130,131,121,109,142,145,124,123,131,136,117,121,139,142,104,137,139,135,113,129,129,131,121,134,125,131,114,133,134,133,133,129,120,124,126,120,132,129,136,120,118,146,131,121,129,126,136,106,141,132,136,112,124,140,133,119,129,129,124,118,140,
137,124,114,136,130,117,134,129,127,124,138,128,128,121,136,114,131,136,140,105,124,145,129,109,139,136,123,115,132,146,119,113,135,141,114,125,138,129,121,130,132,137,116,134,114,134,122,135,130,132,135,118,116,141,130,114,127,139,125,120,132,141,133,106,135,127,135,122,128,122,131,132,136,125,130,119,121,128,137,133,122,120,138,122,121,137,129,126,123,126,126,132,119,133,127,136,123,133,127,137,
111,120,130,143,122,124,139,124,117,125,143,133,105,131,143,128,125,131,128,111,135,130,135,122,130,132,124,129,140,117,122,129,141,117,126,132,130,121,129,147,127,116,123,141,115,122,136,130,126,134,127,129,126,129,122,133,128,131,115,133,137,119,122,145,137,115,125,138,118,119,127,143,140,113,136,125,126,123,139,124,125,132,134,123,125,127,128,122,138,136,123,113,138,132,121,135,132,125,117,130,
136,139,113,128,128,135,125,125,128,138,120,128,127,132,111,128,142,133,124,118,140,127,118,129,138,122,120,131,133,121,134,129,141,121,129,122,121,124,141,132,125,137,133,109,131,129,128,119,136,143,117,122,122,142,122,138,133,127,116,129,123,131,133,127,126,134,125,136,116,128,137,129,118,135,139,114,123,130,138,119,128,138,124,113,133,133,129,121,140,118,133,126,131,126,122,132,125,128,133,128,
130,120,133,133,124,124,129,136,120,131,132,135,114,122,130,130,129,129,127,132,118,125,135,139,120,127,131,133,116,124,141,125,129,130,138,121,120,130,131,130,131,126,125,123,134,122,130,126,136,126,123,133,126,118,131,136,129,118,126,131,129,126,127,130,122,134,129,129,121,130,123,129,140,129,116,127,139,127,120,135,130,124,119,146,131,114,126,136,132,116,134,129,126,124,130,132,123,126,131,124,
133,129,136,118,130,129,121,126,131,135,126,127,135,124,127,127,135,127,123,127,122,137,124,132,125,137,123,124,132,133,122,119,137,133,121,132,129,131,114,132,136,126,123,129,140,118,130,126,130,119,134,140,115,125,132,126,128,126,143,118,124,132,132,119,128,137,123,124,128,129,125,124,134,132,122,129,125,130,122,134,126,128,132,130,122,126,136,125,119,129,135,124,118,145,133,123,121,136,126,117,
139,125,133,123,136,130,124,127,126,127,123,134,131,123,134,122,130,123,134,134,122,131,124,127,123,127,134,128,129,127,124,130,131,128,125,137,129,124,124,136,130,121,130,140,122,118,130,135,122,127,137,131,119,125,137,125,128,126,134,121,129,135,125,124,125,134,122,128,136,126,128,124,144,116,124,133,127,130,120,138,123,125,130,129,129,123,129,127,127,138,122,124,131,133,119,128,135,126,124,129,
136,127,120,132,137,125,121,127,130,122,131,134,127,121,126,127,131,126,133,124,120,134,128,124,132,130,129,121,132,128,126,127,128,137,121,132,125,129,127,127,131,123,134,126,125,133,127,132,120,133,130,125,127,133,136,119,125,132,129,123,131,135,128,122,130,130,127,126,130,129,127,127,127,127,130,128,126,130,131,126,125,126,132,127,127,130,129,128,124,129,127,130,124,131,132,128,127,124,131,127,
129,129,128,134,118,130,132,128,125,125,136,124,124,127,135,128,125,132,126,125,127,132,129,127,130,125,131,128,129,127,125,128,132,125,126,131,126,127,131,131,125,123,129,135,128,126,128,128,126,129,129,130,129,124,127,130,128,126,126,134,127,128,125,132,130,123,131,127,130,125,129,129,127,127,125,132,126,126,128,128,130,125,130,127,131,126,127,129,128,127,125,129,130,127,127,129,126,126,129,129,
129,130,126,126,128,131,128,127,128,128,125,127,131,131,123,126,133,129,126,128,128,127,126,127,134,125,126,130,129,128,126,130,127,127,129,127,128,126,132,126,128,128,130,126,125,133,124,126,130,130,130,126,127,128,129,127,130,129,126,128,128,130,128,127,127,130,128,129,128,128,129,128,126,129,128,127,127,130,128,126,129,128,128,128,128,128,128,127,127,127,129,128,127,128,131,126,128,130,129,127,
127,127,128,129,128,129,129,127,128,127,129,128,127,129,127,129,128,128,127,130,127,126,129,130,127,126,131,130,125,129,128,128,127,128,130,129,126,129,129,128,129,128,128,127,129,128,128,127,129,127,128,129,129,127,127,129,128,127,128,129,128,128,129,128,128,128
};
const uint8_t RS[1160] PROGMEM =
{
128,128,128,128,128,127,128,127,128,126,129,129,130,86,38,42,42,45,46,49,51,54,60,77,125,200,224,226,226,224,223,221,219,218,216,214,212,212,211,209,208,206,204,202,200,198,196,193,188,174,132,54,21,19,19,22,24,27,30,33,41,61,119,188,204,207,206,205,203,202,200,199,197,196,195,194,193,191,190,188,187,185,184,181,180,176,173,162,134,64,9,3,1,4,6,8,10,12,14,16,
18,20,21,23,25,27,28,30,32,34,37,39,41,43,47,53,70,110,156,190,207,211,208,199,173,130,79,52,46,44,46,48,50,52,54,56,58,59,61,64,67,71,78,98,139,190,226,239,240,238,237,235,233,232,230,229,227,226,224,223,221,220,218,216,215,213,211,209,207,204,201,197,189,171,146,121,100,85,74,69,66,66,68,70,74,79,85,92,100,109,118,128,138,147,154,158,160,159,154,146,
132,113,91,68,49,40,37,36,37,38,39,41,43,44,46,48,49,51,53,55,57,59,61,63,66,69,72,77,83,96,119,150,182,209,227,235,237,237,235,234,232,230,229,227,226,224,223,221,220,218,216,214,212,209,207,204,202,200,199,197,196,195,194,193,192,192,191,190,189,187,186,184,183,182,180,178,176,174,172,169,166,162,157,149,137,121,103,83,63,45,30,20,15,12,11,11,12,13,15,16,
18,20,21,23,25,27,30,32,34,37,40,43,47,51,56,62,69,75,82,88,93,98,102,106,109,111,114,116,118,120,122,125,128,132,136,141,146,151,157,164,171,178,185,191,197,201,205,208,210,211,211,211,211,210,209,208,206,205,204,202,200,199,197,195,192,190,187,184,180,175,170,164,157,149,141,133,125,117,110,103,97,92,87,83,79,76,74,72,70,69,68,67,67,66,65,65,64,63,62,61,
60,59,59,58,57,57,56,56,56,57,57,58,59,61,62,64,67,70,73,77,81,86,92,98,104,112,119,127,135,143,150,157,164,170,176,181,185,188,191,194,195,196,197,197,197,197,196,195,194,192,191,189,188,186,184,182,180,178,176,174,172,170,168,166,164,162,160,158,156,153,151,148,146,143,140,137,133,130,126,122,118,114,109,105,101,97,93,88,85,81,77,74,72,69,67,66,65,64,64,64,
64,65,66,67,69,70,73,75,78,80,83,86,90,93,96,100,103,107,110,113,117,120,123,126,128,131,134,136,138,141,143,145,147,149,151,152,154,156,158,159,161,162,163,164,166,167,167,168,168,169,169,169,169,168,168,167,166,165,164,162,161,159,157,154,152,150,147,144,142,139,136,133,130,127,125,122,119,117,114,112,110,108,106,104,103,101,100,99,98,97,97,96,96,96,95,95,95,95,96,96,
96,97,97,98,99,99,100,101,102,103,104,106,107,109,110,112,113,115,117,119,121,123,125,127,129,131,133,135,137,139,141,143,144,146,148,149,150,151,152,153,154,154,154,155,155,155,155,155,154,154,153,153,152,151,150,149,148,147,146,145,144,143,142,141,139,138,137,136,134,133,132,131,129,128,127,126,125,123,122,121,120,119,118,117,116,115,114,113,112,112,111,111,110,110,110,110,110,110,110,110,
111,111,112,112,113,114,115,116,117,118,119,120,121,122,123,125,126,127,128,129,130,132,133,134,135,136,137,137,138,139,140,141,141,142,142,143,143,144,144,144,145,145,145,145,145,145,145,145,145,145,145,144,144,144,143,143,142,142,141,140,140,139,138,137,137,136,135,134,133,132,132,131,130,129,128,128,127,126,125,125,124,124,123,123,122,122,122,121,121,121,121,121,121,121,121,121,121,121,121,122,
122,122,123,123,123,124,124,125,125,126,126,127,128,128,129,129,130,131,131,132,132,133,134,134,135,135,136,136,137,137,138,138,138,139,139,139,140,140,140,140,140,140,140,140,140,140,140,140,139,139,139,139,138,138,138,137,137,137,136,136,135,135,134,134,133,133,132,132,132,131,131,130,130,129,129,129,128,128,128,127,127,127,126,126,126,126,126,125,125,125,125,125,125,125,125,125,125,125,126,126,
126,126,126,127,127,127,127,128,128,128,129,129,129,130,130,130,131,131,131,132,132,132,132,133,133,133,133,134,134,134,134,134,134,135,135,135,135,135,135,135,135,135,135,135,135,135,135,134,134,134,134,134,134,133,133,133,133,133,132,132,132,132,131,131,131,130,130,130,130,129,129,129,129,128,128,128,128,128,127,127,127,127,127,127,127,127,127,127,126,126,126,126,126,127,127,127,127,127,127,127,
127,127,127,127,127,128,128,128,128,128,128,128,129,129,129,129,129,129,129,130,130,130,130,130,130,130,130,130,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,131,130,130,130,130,130,130,130,130,130,130,129,129,129,129,129,129,129,128,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,127,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,126,
126,126,126,126,126,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,127,127,127,127,127,127,127,127,127,127,127,127,127,128
};
const uint8_t SN[3482] PROGMEM =
{
128,128,128,128,127,129,134,129,130,135,130,141,128,119,138,136,125,118,133,125,150,131,138,135,144,117,170,120,119,150,120,156,111,101,145,133,102,121,135,133,82,37,47,47,28,39,35,41,40,44,42,47,46,50,49,55,54,59,57,65,62,85,98,130,147,166,215,200,228,248,242,237,246,232,230,243,236,237,233,233,225,231,225,228,219,223,201,175,209,159,134,160,98,130,96,62,69,75,94,32,
48,34,47,33,51,69,44,53,62,61,56,51,69,66,75,84,79,71,71,94,87,65,89,75,74,68,68,70,73,98,80,118,108,139,116,118,184,129,188,225,190,218,243,237,254,232,236,253,246,247,244,242,239,240,237,236,233,232,230,228,226,224,223,221,219,217,215,213,211,209,208,205,203,201,198,196,194,186,156,158,139,155,90,62,63,67,62,26,62,30,55,24,3,14,10,18,18,31,21,23,
23,29,31,30,32,48,35,37,42,44,41,46,46,56,63,94,118,84,88,120,92,120,120,135,186,189,146,206,222,182,197,161,173,221,223,215,222,231,216,225,226,225,221,209,219,213,217,216,214,214,206,209,199,193,209,201,203,191,197,197,192,190,192,177,189,177,179,177,180,156,163,181,164,146,123,156,115,107,155,131,99,107,56,91,62,114,71,54,86,1,61,102,78,70,33,68,47,33,68,21,
26,35,76,60,31,15,32,92,99,52,61,38,56,62,87,78,18,42,112,81,14,27,59,82,22,41,22,78,46,58,64,62,96,42,66,88,93,43,63,92,86,125,157,110,65,159,139,109,162,106,127,183,224,177,173,169,216,170,180,211,189,197,198,215,212,216,218,218,205,214,207,211,210,212,205,203,206,204,203,195,201,172,193,199,193,194,189,185,190,173,173,178,167,162,159,179,161,160,133,119,
144,123,77,50,80,88,62,59,66,81,46,32,29,67,19,21,48,7,28,31,4,69,34,1,15,9,12,13,22,25,28,56,23,32,69,32,26,29,33,33,35,51,57,56,67,86,49,60,108,55,115,88,58,78,118,72,79,138,170,107,104,132,72,116,149,160,124,189,137,146,193,141,198,127,112,188,151,188,166,160,175,181,218,178,215,178,224,175,182,182,154,185,206,215,146,191,157,209,157,175,
189,147,191,182,220,171,168,186,204,165,177,196,129,190,168,100,195,153,130,176,93,151,127,134,80,153,160,113,163,131,121,104,77,101,77,79,103,80,68,120,115,45,83,159,86,74,100,57,105,99,92,60,58,80,152,74,58,54,81,90,62,89,90,78,69,101,75,77,100,68,76,119,115,57,79,108,76,73,75,78,82,91,110,81,85,81,152,99,84,97,93,118,117,123,108,167,101,108,163,116,
156,143,98,195,150,117,178,105,155,193,176,214,134,186,172,195,174,199,208,203,235,161,190,192,254,173,222,219,216,224,219,199,218,240,194,226,224,208,217,201,221,218,210,218,188,211,160,206,207,178,200,174,211,156,174,172,168,166,181,156,129,124,149,116,87,153,110,123,101,124,78,77,71,109,82,73,61,54,71,106,116,102,81,68,124,35,69,88,76,57,110,57,52,74,52,68,92,122,60,75,
61,80,62,92,107,88,76,100,96,60,134,138,89,84,121,113,98,120,159,100,135,107,111,173,147,158,136,134,123,144,137,146,125,169,183,141,167,185,146,172,188,195,143,141,165,175,189,194,181,202,154,166,213,158,184,154,206,192,192,207,200,156,145,164,205,196,176,155,151,212,194,187,199,137,210,155,135,186,136,140,184,184,154,194,174,128,155,150,128,121,135,187,124,160,155,106,176,125,99,134,
101,114,98,142,129,84,152,97,117,101,91,158,127,87,121,124,74,103,85,89,161,133,58,106,104,126,79,88,96,89,129,105,127,119,100,111,82,67,107,136,111,93,97,112,131,80,166,130,93,142,54,110,148,95,95,110,92,139,118,108,134,80,123,157,114,89,138,173,126,100,133,149,148,145,123,136,143,159,164,164,157,151,167,175,174,168,180,175,181,148,173,155,180,170,187,175,175,178,139,208,
195,199,178,165,191,191,169,164,194,190,172,145,183,184,161,168,168,195,156,126,200,131,146,186,105,152,156,119,128,132,130,115,124,141,119,139,119,131,89,93,102,124,95,40,111,112,99,101,112,72,98,108,43,70,89,110,80,104,50,74,122,42,88,75,82,100,96,62,113,70,75,92,74,85,112,83,100,84,92,107,98,132,47,111,120,77,142,131,114,119,82,135,121,128,100,91,111,134,130,136,
121,139,163,117,131,152,153,100,160,130,137,167,119,104,161,176,135,177,145,149,137,166,133,131,172,124,171,169,128,170,142,127,162,120,141,166,162,122,188,142,115,149,107,151,158,169,129,142,150,161,171,124,113,143,171,112,142,94,145,136,124,90,137,151,109,128,100,152,73,108,134,132,76,113,87,98,94,129,137,91,113,106,100,119,128,73,124,88,104,115,85,120,111,64,123,96,87,86,108,93,
80,111,129,96,108,124,84,82,105,86,95,112,110,93,97,131,106,113,120,131,94,66,145,89,98,108,98,143,66,102,97,139,87,114,118,88,128,109,116,155,117,101,97,115,129,122,172,139,127,150,109,135,113,122,163,176,126,148,111,169,145,133,141,113,153,125,148,151,190,142,163,145,113,177,160,146,152,121,128,184,158,148,133,156,151,140,150,107,148,147,160,152,117,164,102,118,142,131,117,91,
129,143,111,131,116,101,118,110,116,92,104,117,104,100,99,75,80,91,106,132,93,92,107,66,92,81,136,93,75,85,78,107,74,113,105,77,98,101,69,106,90,79,86,124,101,105,102,119,124,72,113,97,82,117,114,83,130,94,92,108,122,131,110,134,151,98,114,136,127,86,125,144,117,134,142,103,130,176,130,143,97,130,152,107,139,136,134,132,128,127,155,124,136,162,127,119,159,113,152,149,
123,160,155,138,141,166,107,150,146,122,134,135,124,140,126,134,142,137,154,132,124,119,163,145,123,165,98,138,167,92,122,140,118,148,87,109,135,104,133,114,135,95,117,97,125,127,113,143,95,105,162,122,106,131,75,128,120,105,122,122,107,82,126,136,87,105,112,142,86,100,128,104,126,119,104,96,132,102,105,116,133,106,100,101,114,117,138,146,102,95,171,117,91,135,91,124,116,96,125,132,
104,109,124,110,117,138,157,109,102,135,142,120,118,124,124,146,123,125,132,166,123,145,116,147,147,140,140,148,157,130,148,124,125,156,161,165,136,128,156,119,150,155,170,147,144,174,131,142,144,132,136,145,175,152,140,125,167,139,140,187,122,153,156,124,157,111,124,133,123,128,131,148,114,115,120,143,146,127,107,126,128,96,128,131,139,99,104,110,110,114,143,113,85,114,118,106,108,133,113,93,
122,136,108,132,120,91,101,116,138,94,114,111,132,98,121,136,93,116,126,137,94,113,123,124,123,109,119,151,121,105,141,140,125,105,113,135,141,154,156,107,134,138,130,122,130,142,165,121,122,142,133,155,134,140,128,142,137,160,110,140,122,142,174,133,143,116,140,135,135,139,163,151,136,160,133,142,152,132,151,129,142,155,121,135,154,124,123,138,156,157,170,153,137,138,140,122,152,170,134,137,
116,126,126,147,145,150,117,151,117,126,147,109,139,117,106,140,160,119,143,115,111,145,111,118,105,162,144,114,134,135,138,112,108,133,120,121,116,111,134,139,131,141,132,118,117,128,131,115,123,145,126,122,119,104,156,125,129,127,126,113,122,119,114,144,131,129,152,105,126,126,127,133,136,129,136,135,127,132,147,135,126,131,124,115,150,153,127,122,141,157,118,160,147,143,141,121,150,158,124,137,
155,126,155,136,143,156,140,139,177,137,139,140,144,166,134,138,132,141,152,141,151,162,159,132,144,171,139,141,146,125,156,155,123,158,128,132,129,154,162,120,153,127,116,148,132,137,117,116,120,130,118,126,133,157,131,106,130,139,111,113,118,112,148,109,120,127,114,133,117,129,116,117,169,103,121,116,102,135,119,132,109,131,115,113,129,121,128,127,112,125,152,122,139,130,106,115,137,141,115,139,
138,106,146,127,118,131,121,164,121,126,142,126,142,126,116,146,172,122,117,124,150,138,116,134,154,144,132,144,135,131,138,147,131,124,137,142,148,149,112,139,147,126,148,141,153,119,163,138,123,139,130,153,147,135,135,144,122,135,152,146,120,143,137,139,140,140,129,126,136,145,153,134,118,120,155,143,112,130,126,147,124,144,112,111,143,135,119,145,124,112,146,107,132,124,126,135,109,133,125,128,
116,119,123,141,143,138,116,118,123,120,135,126,122,119,126,123,159,124,129,109,132,124,125,131,121,125,119,120,126,154,110,123,134,128,127,128,112,113,128,141,128,116,130,142,116,130,127,137,125,114,129,144,132,126,138,134,123,134,129,132,165,109,124,134,150,141,117,122,120,145,146,136,132,134,149,131,129,145,137,129,144,138,127,164,146,120,145,123,155,146,129,137,133,155,131,131,125,143,152,140,
127,126,143,143,123,133,125,134,135,126,138,134,130,125,133,138,110,133,125,114,122,126,121,138,131,112,110,135,140,104,136,110,123,146,106,118,124,104,140,122,112,126,113,130,109,111,134,131,122,105,118,123,112,130,127,125,102,135,140,112,119,122,130,113,117,124,124,140,132,112,123,115,133,126,123,133,116,126,136,130,146,114,118,142,132,122,131,114,135,127,123,131,125,135,123,139,134,132,134,125,
137,117,132,129,137,145,136,123,140,142,116,119,132,136,118,141,136,137,135,117,145,147,111,131,123,117,138,134,141,137,129,122,147,131,121,129,148,120,136,131,116,134,116,128,119,133,128,118,122,129,122,123,132,132,118,127,127,123,125,122,132,119,110,123,124,142,125,113,121,134,115,116,113,119,115,122,127,124,132,128,138,116,127,132,112,124,120,124,126,116,120,133,108,117,129,130,127,113,128,123,
114,124,140,121,113,125,115,123,130,121,112,125,136,126,118,114,126,120,130,132,132,118,126,129,119,129,122,128,124,130,130,121,135,139,122,126,121,121,140,125,128,117,139,142,114,150,124,135,134,115,128,138,129,129,129,129,141,142,125,138,128,132,123,116,146,137,138,129,132,135,127,119,127,118,134,137,129,129,142,124,118,130,129,125,123,119,115,122,131,127,116,123,113,121,122,122,124,131,125,114,
126,109,125,126,117,123,120,107,116,125,123,117,115,122,128,115,123,131,110,124,109,121,126,121,123,120,120,122,121,118,115,118,132,118,113,129,123,118,118,124,133,116,131,128,116,131,114,123,121,121,128,118,131,127,125,134,134,124,124,124,122,134,121,131,116,130,129,119,143,125,121,129,143,119,123,122,130,138,119,121,132,145,117,132,127,121,129,129,131,119,128,123,141,137,121,131,126,123,127,122,
123,132,145,130,132,118,132,142,115,126,126,130,117,135,130,120,121,126,138,122,124,117,118,125,127,121,126,125,122,125,118,125,124,119,120,126,131,128,120,117,114,128,128,120,116,130,135,116,122,127,135,119,113,122,126,127,126,132,117,118,141,112,124,125,115,125,125,128,116,126,124,125,126,117,120,123,118,118,130,126,125,124,128,125,109,134,138,119,132,117,125,126,122,121,128,134,122,122,128,134,
115,129,128,124,126,124,122,130,129,129,123,132,130,129,131,135,132,128,123,130,127,124,137,130,131,128,136,138,125,134,139,126,126,133,122,130,131,124,133,136,131,137,130,127,138,126,128,128,123,121,130,131,123,137,123,122,131,117,126,124,127,129,117,123,137,120,121,125,115,127,128,121,122,121,116,123,139,115,126,120,115,127,129,125,117,122,121,116,132,118,121,129,117,129,117,123,117,122,128,129,
121,119,131,127,124,128,122,119,126,131,125,120,124,129,124,122,131,125,126,124,132,121,127,130,115,142,126,130,130,122,127,129,126,125,124,128,131,133,132,133,125,131,125,126,135,127,132,127,132,124,122,131,136,133,129,129,127,129,134,128,129,123,130,141,124,126,129,128,130,128,132,125,129,139,132,127,131,137,123,122,140,128,126,136,121,128,129,124,129,124,131,127,133,122,120,135,123,125,127,129,
125,125,121,127,125,127,133,122,125,126,126,128,124,123,139,118,122,130,123,125,123,132,131,127,120,127,131,121,120,131,132,125,129,126,123,125,124,133,120,131,124,121,130,127,132,128,125,130,123,131,123,120,130,125,132,125,134,127,123,129,131,127,124,127,129,125,130,123,132,129,131,131,124,134,129,133,129,126,127,139,131,129,123,136,136,126,133,130,127,129,134,134,130,130,135,128,132,131,130,134,
133,131,127,134,136,136,135,133,130,127,138,134,129,133,131,132,133,127,129,140,126,126,134,124,132,128,129,128,122,129,132,128,126,124,125,126,125,126,126,127,128,128,123,129,123,123,128,130,129,122,126,128,124,127,131,127,125,125,127,124,132,128,127,131,123,125,131,131,123,129,125,124,128,132,126,126,132,127,128,127,125,129,124,130,131,127,132,124,127,128,128,131,134,126,125,132,134,127,127,129,
128,133,128,128,130,131,132,129,128,132,130,130,130,134,131,131,126,134,131,128,136,131,129,132,128,134,133,129,132,127,136,131,131,130,135,131,129,133,133,133,129,131,133,133,133,132,135,127,133,130,128,130,135,134,129,129,128,133,127,133,131,128,130,125,131,131,125,130,127,127,127,125,126,132,127,129,123,127,131,126,126,127,130,125,133,128,125,128,136,123,127,129,126,131,127,127,126,129,126,133,
125,129,128,125,133,126,128,128,128,128,131,129,127,129,125,128,128,132,128,131,128,131,129,124,130,130,131,127,128,132,129,131,129,130,130,131,130,129,129,127,130,132,132,130,130,128,132,133,132,128,131,130,130,132,135,127,133,130,129,133,130,135,131,132,132,130,131,132,133,134,130,130,131,134,129,133,133,128,134,132,132,133,128,129,134,133,130,130,133,132,126,131,128,132,131,127,131,126,132,127,
128,129,127,128,129,127,126,127,127,129,126,126,127,126,125,128,128,129,128,126,127,128,126,128,130,126,129,126,127,132,126,125,129,124,128,130,129,127,126,130,127,130,127,127,129,129,129,129,130,127,127,129,132,127,131,131,126,132,129,130,129,130,129,130,129,130,130,130,130,130,129,131,131,130,128,131,132,129,130,130,132,128,129,132,132,128,128,130,132,129,130,130,129,130,132,129,130,129,128,130,
132,132,130,130,131,129,131,129,129,131,131,130,129,130,131,132,129,129,130,131,129,131,131,129,131,130,128,132,128,127,131,129,129,129,127,129,129,130,128,126,128,127,131,129,128,127,128,129,130,127,127,130,130,128,127,129,128,129,128,128,128,131,130,128,128,129,131,128,129,128,130,129,130,127,127,129,131,128,128,128,127,129,129,129,127,128,129,130,129,127,128,130,128,128,130,127,130,128,129,129,
128,129,129,129,129,130,126,129,130,128,129,130,129,128,129,130,130,128,129,130,128,130,129,129,130,130,130,129,129,132,130,129,132,128,130,132,127,132,129,130,132,128,130,130,131,129,130,132,131,130,131,131,129,131,129,130,131,131,130,129,130,129,130,129,130,129,128,128,128,128,128,128,128,127,128,128,127,126,127,127,127,127,126,127,127,128,127,126,127,128,127,126,126,126,128,126,128,126,127,128,
126,128,127,127,128,127,127,127,126,128,128,128,127,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,129,128,129,129,128,128,128,128,129,129,128,128,129,128,129,129,129,129,128,129,128,128,128,129,128,128,129,128,128,128,128,129,128,128,128,127,128,129,128,129,128,128,129,128,129,129,128,129,129,128,128,128,128,128
};
ISR(TIMER1_COMPA_vect) {
//------------------- Ringbuffer handler -------------------------
if (RingCount) { //If entry in FIFO..
OCR2A = Ringbuffer[(RingRead++)]; //Output LSB of 16-bit DAC
RingCount--;
}
//-----------------------------------------------------------------
}
void setup() {
OSCCAL=0xFF;
//Drumtrigger inputs
pinMode(2,INPUT_PULLUP);
pinMode(3,INPUT_PULLUP);
pinMode(4,INPUT_PULLUP);
pinMode(5,INPUT_PULLUP);
pinMode(6,INPUT_PULLUP);
pinMode(7,INPUT_PULLUP);
pinMode(8,INPUT_PULLUP);
pinMode(9,INPUT_PULLUP);
pinMode(10,INPUT_PULLUP);
//8-bit PWM DAC pin
pinMode(11,OUTPUT);
// Set up Timer 1 to send a sample every interrupt.
cli();
// Set CTC mode
// Have to set OCR1A *after*, otherwise it gets reset to 0!
TCCR1B = (TCCR1B & ~_BV(WGM13)) | _BV(WGM12);
TCCR1A = TCCR1A & ~(_BV(WGM11) | _BV(WGM10));
// No prescaler
TCCR1B = (TCCR1B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);
// Set the compare register (OCR1A).
// OCR1A is a 16-bit register, so we have to do this with
// interrupts disabled to be safe.
//OCR1A = F_CPU / SAMPLE_RATE;
// Enable interrupt when TCNT1 == OCR1A
TIMSK1 |= _BV(OCIE1A);
sei();
OCR1A = 400; //40KHz Samplefreq
// Set up Timer 2 to do pulse width modulation on D11
// Use internal clock (datasheet p.160)
ASSR &= ~(_BV(EXCLK) | _BV(AS2));
// Set fast PWM mode (p.157)
TCCR2A |= _BV(WGM21) | _BV(WGM20);
TCCR2B &= ~_BV(WGM22);
// Do non-inverting PWM on pin OC2A (p.155)
// On the Arduino this is pin 11.
TCCR2A = (TCCR2A | _BV(COM2A1)) & ~_BV(COM2A0);
TCCR2A &= ~(_BV(COM2B1) | _BV(COM2B0));
// No prescaler (p.158)
TCCR2B = (TCCR2B & ~(_BV(CS12) | _BV(CS11))) | _BV(CS10);
// Set initial pulse width to the first sample.
OCR2A = 128;
//set timer0 interrupt at 61Hz
TCCR0A = 0;// set entire TCCR0A register to 0
TCCR0B = 0;// same for TCCR0B
TCNT0 = 0;//initialize counter value to 0
// set compare match register for 62hz increments
OCR0A = 255;// = 61Hz
// turn on CTC mode
TCCR0A |= (1 << WGM01);
// Set CS01 and CS00 bits for prescaler 1024
TCCR0B |= (1 << CS02) | (0 << CS01) | (1 << CS00); //1024 prescaler
TIMSK0=0;
// set up the ADC
SFREQ=analogRead(0);
ADCSRA &= ~PS_128; // remove bits set by Arduino library
// Choose prescaler PS_128.
ADCSRA |= PS_128;
ADMUX = 64;
sbi(ADCSRA, ADSC);
}
void loop() {
uint8_t phaccBD,phaccCH,phaccCL,phaccCR,phaccOH,phaccRD,phaccRS,phaccSD;
uint8_t pitchBD=128;
uint8_t pitchCH=64;
uint8_t pitchCL=64;
uint8_t pitchCR=16;
uint8_t pitchOH=64;
uint8_t pitchRD=16;
uint8_t pitchRS=64;
uint8_t pitchSD=64;
uint16_t samplecntBD,samplecntCH,samplecntCL,samplecntCR,samplecntOH,samplecntRD,samplecntRS,samplecntSD;
uint16_t samplepntBD,samplepntCH,samplepntCL,samplepntCR,samplepntOH,samplepntRD,samplepntRS,samplepntSD;
int16_t total;
uint8_t oldPORTB;
uint8_t oldPORTD;
uint8_t divider;
uint8_t MUX=0;
while(1) {
//------ Add current sample word to ringbuffer FIFO --------------------
if (RingCount<255) { //if space in ringbuffer
total=0;
if (samplecntBD) {
phaccBD+=pitchBD;
if (phaccBD & 128) {
phaccBD &= 127;
total+=(pgm_read_byte_near(BD + samplepntBD)-128);
samplepntBD++;
samplecntBD--;
}
}
if (samplecntSD) {
phaccSD+=pitchSD;
if (phaccSD & 128) {
phaccSD &= 127;
total+=(pgm_read_byte_near(SN + samplepntSD)-128);
samplepntSD++;
samplecntSD--;
}
}
if (samplecntCL) {
phaccCL+=pitchCL;
if (phaccCL & 128) {
phaccCL &= 127;
total+=(pgm_read_byte_near(CL + samplepntCL)-128);
samplepntCL++;
samplecntCL--;
}
}
if (samplecntRS) {
phaccRS+=pitchRS;
if (phaccRS & 128) {
phaccRS &= 127;
total+=(pgm_read_byte_near(RS + samplepntRS)-128);
samplepntRS++;
samplecntRS--;
}
}
if (samplecntCH) {
phaccCH+=pitchCH;
if (phaccCH & 128) {
phaccCH &= 127;
total+=(pgm_read_byte_near(CH + samplepntCH)-128);
samplepntCH++;
samplecntCH--;
}
}
if (samplecntOH) {
phaccOH+=pitchOH;
if (phaccOH & 128) {
phaccOH &= 127;
total+=(pgm_read_byte_near(OH + samplepntOH)-128);
samplepntOH++;
samplecntOH--;
}
}
if (samplecntCR) {
phaccCR+=pitchCR;
if (phaccCR & 128) {
phaccCR &= 127;
total+=(pgm_read_byte_near(CR + samplepntCR)-128);
samplepntCR++;
samplecntCR--;
}
}
if (samplecntRD) {
phaccRD+=pitchRD;
if (phaccRD & 128) {
phaccRD &= 127;
total+=(pgm_read_byte_near(RD + samplepntRD)-128);
samplepntRD++;
samplecntRD--;
}
}
total>>=1;
if (!(PINB&4)) total>>=1;
total+=128;
if (total>255) total=255;
cli();
Ringbuffer[RingWrite]=total;
RingWrite++;
RingCount++;
sei();
}
//----------------------------------------------------------------------------
//----------------- Handle Triggers ------------------------------
if (PIND&4) {
samplepntBD=0;
samplecntBD=2154;
}
if (PIND&8) {
samplepntSD=0;
samplecntSD=3482;
}
if (PIND&16) {
samplepntCH=0;
samplecntCH=482;
}
if (PIND&32) {
samplepntOH=0;
samplecntOH=2572;
}
if (PIND&64) {
samplepntRS=0;
samplecntRS=1160;
}
if (PIND&128) {
samplepntCL=0;
samplecntCL=2384;
}
if (PINB&1) {
samplepntRD=0;
samplecntRD=5066;
}
if (PINB&2) {
samplepntCR=0;
samplecntCR=5414;
}
//-----------------------------------------------------------------
//--------------- ADC block -------------------------------------
if (!(divider++)) {
if (!(ADCSRA & 64)) {
uint16_t pitch=((ADCL+(ADCH<<8))>>3)+1;
if (MUX==0) pitchSD=pitch;
if (MUX==1) pitchCH=pitch;
if (MUX==2) pitchOH=pitch;
if (MUX==3) pitchRS=pitch;
if (MUX==4) pitchCL=pitch;
if (MUX==5) pitchCR=pitch;
MUX++;
if (MUX==6) MUX=0;
ADMUX = 64 | MUX; //Select MUX
sbi(ADCSRA, ADSC); //start next conversation
}
}
//---------------------------------------------------------------
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment