Fork of "Pokittris" for the Pokitto

Dependencies:   PWMOut Pokitto

Fork of Pokittris by Nicolas Mougin

Files at this revision

API Documentation at this revision

Comitter:
mougino
Date:
Tue Oct 10 07:17:45 2017 +0000
Commit message:
Pokittris 02/10/17 + PokittoLib for compilation on mbed.com

Changed in this revision

PWMOut.lib Show annotated file Show diff for this revision Revisions of this file
Pokitto.lib Show annotated file Show diff for this revision Revisions of this file
easing.h Show annotated file Show diff for this revision Revisions of this file
tetris.cpp Show annotated file Show diff for this revision Revisions of this file
tetris_gfx.h Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PWMOut.lib	Tue Oct 10 07:17:45 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/inst/code/PWMOut/#f1e5739acc27
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Pokitto.lib	Tue Oct 10 07:17:45 2017 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/Pokitto-Community-Team/code/Pokitto/#a65d553f2157
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/easing.h	Tue Oct 10 07:17:45 2017 +0000
@@ -0,0 +1,128 @@
+// t = time, b = start, c = end, d = duration
+//float PI = 3.141591;
+
+float easeInQuad(float t, float b, float c, float d) {
+    return c*(t/=d)*t + b;
+}
+float easeOutQuad(float t, float b, float c, float d) {
+    return -c *(t/=d)*(t-2) + b;
+}
+float easeInOutQuad(float t, float b, float c, float d) {
+    if ((t/=d/2) < 1) return c/2*t*t + b;
+    return -c/2 * ((--t)*(t-2) - 1) + b;
+}
+float easeInCubic(float t, float b, float c, float d) {
+    return c*(t/=d)*t*t + b;
+}
+float easeOutCubic(float t, float b, float c, float d) {
+    return c*((t=t/d-1)*t*t + 1) + b;
+}
+float easeInOutCubic(float t, float b, float c, float d) {
+    if ((t/=d/2) < 1) return c/2*t*t*t + b;
+    return c/2*((t-=2)*t*t + 2) + b;
+}
+float easeInQuart(float t, float b, float c, float d) {
+    return c*(t/=d)*t*t*t + b;
+}
+float easeOutQuart(float t, float b, float c, float d) {
+    return -c * ((t=t/d-1)*t*t*t - 1) + b;
+}
+float easeInOutQuart(float t, float b, float c, float d) {
+    if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
+    return -c/2 * ((t-=2)*t*t*t - 2) + b;
+}
+float easeInQuint(float t, float b, float c, float d) {
+    return c*(t/=d)*t*t*t*t + b;
+}
+float easeOutQuint(float t, float b, float c, float d) {
+    return c*((t=t/d-1)*t*t*t*t + 1) + b;
+}
+float easeInOutQuint(float t, float b, float c, float d) {
+    if ((t/=d/2) < 1) return c/2*t*t*t*t*t + b;
+    return c/2*((t-=2)*t*t*t*t + 2) + b;
+}
+float easeInSine(float t, float b, float c, float d) {
+    return -c * cos(t/d * (PI/2)) + c + b;
+}
+float easeOutSine(float t, float b, float c, float d) {
+    return c * sin(t/d * (PI/2)) + b;
+}
+float easeInOutSine(float t, float b, float c, float d) {
+    return -c/2 * (cos(PI*t/d) - 1) + b;
+}
+float easeInExpo(float t, float b, float c, float d) {
+    return (t==0) ? b : c * pow(2, 10 * (t/d - 1)) + b;
+}
+float easeOutExpo(float t, float b, float c, float d) {
+    return (t==d) ? b+c : c * (-pow(2, -10 * t/d) + 1) + b;
+}
+float easeInOutExpo(float t, float b, float c, float d) {
+    if (t==0) return b;
+    if (t==d) return b+c;
+    if ((t/=d/2) < 1) return c/2 * pow(2, 10 * (t - 1)) + b;
+    return c/2 * (-pow(2, -10 * --t) + 2) + b;
+}
+float easeInCirc(float t, float b, float c, float d) {
+    return -c * (sqrt(1 - (t/=d)*t) - 1) + b;
+}
+float easeOutCirc(float t, float b, float c, float d) {
+    return c * sqrt(1 - (t=t/d-1)*t) + b;
+}
+float easeInOutCirc(float t, float b, float c, float d) {
+    if ((t/=d/2) < 1) return -c/2 * (sqrt(1 - t*t) - 1) + b;
+    return c/2 * (sqrt(1 - (t-=2)*t) + 1) + b;
+}
+float easeInElastic(float t, float b, float c, float d) {
+    float s=1.70158;float p=0; float a=c;
+    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
+    if (a < abs(c)) { a=c; s=p/4; }
+    else  s = p/(2*PI) * asin (c/a);
+    return -(a*pow(2,10*(t-=1)) * sin( (t*d-s)*(2*PI)/p )) + b;
+}
+float easeOutElastic(float t, float b, float c, float d) {
+    float s=1.70158;float p=0;float a=c;
+    if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
+    if (a < abs(c)) { a=c; s=p/4; }
+    else s = p/(2*PI) * asin (c/a);
+    return a*pow(2,-10*t) * sin( (t*d-s)*(2*PI)/p ) + c + b;
+}
+float easeInOutElastic(float t, float b, float c, float d) {
+    float s=1.70158;float p=0;float a=c;
+    if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
+    if (a < abs(c)) { a=c; s=p/4; }
+    else s = p/(2*PI) * asin (c/a);
+    if (t < 1) return -.5*(a*pow(2,10*(t-=1)) * sin( (t*d-s)*(2*PI)/p )) + b;
+    return a*pow(2,-10*(t-=1)) * sin( (t*d-s)*(2*PI)/p )*.5 + c + b;
+}
+float easeInBack(float t, float b, float c, float d) {
+    float s = 1.70158;
+    return c*(t/=d)*t*((s+1)*t - s) + b;
+}
+float easeOutBack(float t, float b, float c, float d) {
+    float s = 1.70158;
+    return c*((t=t/d-1)*t*((s+1)*t + s) + 1) + b;
+}
+float easeInOutBack(float t, float b, float c, float d) {
+    float s = 1.70158; 
+    if ((t/=d/2) < 1) return c/2*(t*t*(((s*=(1.525))+1)*t - s)) + b;
+    return c/2*((t-=2)*t*(((s*=(1.525))+1)*t + s) + 2) + b;
+}
+
+float easeOutBounce(float t, float b, float c, float d) {
+    if ((t/=d) < (1/2.75)) {
+        return c*(7.5625*t*t) + b;
+    } else if (t < (2/2.75)) {
+        return c*(7.5625*(t-=(1.5/2.75))*t + .75) + b;
+    } else if (t < (2.5/2.75)) {
+        return c*(7.5625*(t-=(2.25/2.75))*t + .9375) + b;
+    } else {
+        return c*(7.5625*(t-=(2.625/2.75))*t + .984375) + b;
+    }
+}
+float easeInBounce(float t, float b, float c, float d) {
+    return c - easeOutBounce (d-t, 0, c, d) + b;
+}
+float easeInOutBounce(float t, float b, float c, float d) {
+    if (t < d/2) return easeInBounce (t*2, 0, c, d) * .5 + b;
+    return easeOutBounce (t*2-d, 0, c, d) * .5 + c*.5 + b;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tetris.cpp	Tue Oct 10 07:17:45 2017 +0000
@@ -0,0 +1,576 @@
+// music - 8bit archade4 from www.dl-sounds.com
+
+#include "Pokitto.h"
+#include "tetris_gfx.h"
+#include "easing.h"
+
+#define REPSPEED 12
+
+Pokitto::Core game;
+
+#define HELD 0
+#define NEW 1
+#define RELEASE 2
+byte CompletePad, ExPad, TempPad, myPad;
+bool _A[3], _B[3], _C[3], _Up[3], _Down[3], _Left[3], _Right[3];
+bool bgNum = 1;
+char musicName[] = "pokittris.raw";
+byte palNum = 0;
+
+int topLine;
+byte unlockedPal=0;
+bool removeLine[19];
+byte linesToRemove=0;
+byte animCount;
+bool splodeOK=0;
+byte animSplode=0;
+
+void UPDATEPAD(int pad, int var) {
+  _C[pad] = (var >> 1)&1;
+  _B[pad] = (var >> 2)&1;
+  _A[pad] = (var >> 3)&1;
+  _Down[pad] = (var >> 4)&1;
+  _Left[pad] = (var >> 5)&1;
+  _Right[pad] = (var >> 6)&1;
+  _Up[pad] = (var >> 7)&1;
+}
+
+void UpdatePad(int joy_code){
+  ExPad = CompletePad;
+  CompletePad = joy_code;
+  UPDATEPAD(HELD, CompletePad); // held
+  UPDATEPAD(RELEASE, (ExPad & (~CompletePad))); // released
+  UPDATEPAD(NEW, (CompletePad & (~ExPad))); // newpress
+}
+
+byte updateButtons(byte var){
+   var = 0;
+   if (game.buttons.cBtn()) var |= (1<<1);
+   if (game.buttons.bBtn()) var |= (1<<2);
+   if (game.buttons.aBtn()) var |= (1<<3);
+   if (game.buttons.downBtn()) var |= (1<<4);
+   if (game.buttons.leftBtn()) var |= (1<<5);
+   if (game.buttons.rightBtn()) var |= (1<<6);
+   if (game.buttons.upBtn()) var |= (1<<7);
+
+   return var;
+}
+
+
+
+// some globals...
+long int frameNumber = 0;
+long int myDelay;
+long int tempTime;
+int dropTime = 0;
+int slideTime = 0;
+byte gameMode = 0;
+bool paused = 0;
+byte menuItem;
+bool bgmusic = 1;
+
+byte px, py, ps, pr; // player x,y,shape,rotation
+byte nextTile;
+byte lineCount, level;
+int score, lines;
+bool okToContinue = 0;
+byte slideSpeed = 10;
+
+
+void loadPal(char num){
+    unsigned short curPal[4];
+    curPal[0] = pallet[(num*4)];
+    curPal[1] = pallet[(num*4)+1];
+    curPal[2] = pallet[(num*4)+2];
+    curPal[3] = pallet[(num*4)+3];
+    game.display.load565Palette(curPal);
+}
+
+void drawShape(byte x1, signed char y1, byte shape, byte frame) {
+  for (char y = 0; y < 4; y++) {
+    if (y1 + y > 1) {
+      for (char x = 0; x < 4; x++) {
+        byte mt = pgm_read_byte(shapeMap + (x + 4 * y) + shape * 64 + (frame * 16));
+        if (mt > 1) {
+          game.display.drawBitmap((x1 + x)*8, (y1 + y)*8, tile_gfx[(mt-1)+shape*6]);
+        }
+      }
+    }
+  }
+}
+
+bool check(signed char x1, signed char y1, char rot) {
+    byte ret=0;
+  for (char y = 0; y < 4; y++) {
+    if (y1 + y >= 0) {
+      for (char x = 0; x < 4; x++) {
+        byte mt = pgm_read_byte(shapeMap + (x + 4 * y) + ps * 64 + (rot * 16));
+        if (mt > 1) {
+          if ( playfield[(x1 + x) + 16 * (y1 + y)] != 0) {
+            ret= 1;
+          }
+        }
+      }
+    }
+  }
+  return ret;
+}
+
+void stamp(signed char x1, signed char y1, byte shape, byte rot) {
+  for (char y = 0; y < 4; y++) {
+    if (y1 + y >= 0) {
+      for (char x = 0; x < 4; x++) {
+        byte mt = pgm_read_byte(shapeMap + (x + 4 * y) + shape * 64 + (rot * 16));
+        if (mt > 1) {
+          playfield[(x1 + x) + 16 * (y1 + y)] = (mt-1)+shape*6;
+        }
+      }
+    }
+  }
+}
+
+
+void clearPlayfield() {
+  for (char y = 0; y < 19; y++) {
+    for (char x = 3; x < 13; x++) {
+      playfield[x + 16 * y] = 0;
+    }
+  }
+}
+
+void drawBackground(){
+  for (char y = 0; y < 22; y++) {
+    for (char x = 0; x < 28; x++) {
+      byte mt = bg_map[x + 28 * y + (616*bgNum)];
+      game.display.drawBitmap(x*8, y*8, bg_gfx[mt]);
+    }
+  }
+}
+
+void drawPlayfield() {
+    drawBackground();
+
+  for (char y = 1; y < 19; y++) {
+    for (char x = 3; x < 13; x++) {
+      byte mt = playfield[x + 16 * y];
+      game.display.drawBitmap((x + 5)*8, (y+1 )*8, tile_gfx[mt]);
+    }
+  }
+
+    if(animSplode==0){
+        // current shape
+        drawShape(px+5, py+1, ps, pr);
+    }
+    // next shape?
+    drawShape(19, 14, nextTile, 0);
+
+    char text[] = "        ";
+    sprintf(text, "%05d", score);
+    game.display.setCursor(152,56);
+    game.display.color=3;
+    game.display.print(text);
+    sprintf(text, "%5d", level);
+    game.display.setCursor(16,96);
+    game.display.print(text);
+    sprintf(text, "%5d", lines);
+    game.display.setCursor(16,48);
+    game.display.print(text);
+
+}
+
+
+
+void checkLine() {
+
+    for(char t=0; t<19; t++){
+        removeLine[t]=0;
+    }
+
+  if (py <= 0) {
+    loadPal(1); // default green palette
+    gameMode = 3;  // gameOver if off top of screen
+    frameNumber=0;
+    return;
+  }
+
+  score++; // increase score here as it's called whenever a tile drops
+  topLine = 0;
+
+  for (char y = 0; y < 19; y++) {
+    char line = 0;
+    for (char x = 3; x < 13; x++) {
+      line += playfield[x + 16 * y] != 0 ? 1 : 0;
+    }
+    if (line == 10) { // remove line
+        removeLine[y]=1;
+        linesToRemove++;
+        if(linesToRemove==4){splodeOK=1;}
+        lineCount++;
+        if (lineCount == 10) {
+            lineCount = 0;
+            level++;
+        }
+        lines++;
+        score += 10;
+        }
+    }
+
+  for (char y = 0; y < 10; y++) {
+    char line = 0;
+    for (char x = 3; x < 13; x++) {
+      topLine += playfield[x + 16 * y] != 0 ? 1 : 0;
+    }
+  }
+
+
+    // mess with the palette
+
+      int percent = 100;
+      int diff = topLine;
+
+      unsigned short *p;
+      palNum = 0;//level & 31;
+      p=pallet+(palNum*4);
+      unsigned short curPal[4];
+
+      curPal[0] = pallet[(palNum*4)];
+      curPal[1] = pallet[(palNum*4)+1];
+      curPal[2] = pallet[(palNum*4)+2];
+      curPal[3] = pallet[(palNum*4)+3];
+
+     int greyPal[] = {0xF800,0xF8000,0xF800,0xF800}; // it's actually RED for danger!
+
+    unsigned short red[4], green[4], blue[4], red1[4], green1[4], blue1[4], red2[4], green2[4], blue2[4];
+
+    for(char t=0; t<4; t++){
+        red1[t] = (curPal[t]>>11) & 31;
+        red2[t] = (greyPal[t]>> 11) & 31;
+        green1[t] = (curPal[t]>> 5) & 63;
+        green2[t] = (greyPal[t]>> 5) & 63;
+        blue1[t] = curPal[t] & 31;
+        blue2[t] = greyPal[t] & 31;
+
+        red[t] = red1[t]+((red2[t]-red1[t])*diff/percent);
+        green[t] = green1[t]+((green2[t]-green1[t])*diff/percent);
+        blue[t] = blue1[t]+((blue2[t]-blue1[t])*diff/percent);
+
+        curPal[t] = (red[t]<<11)+(green[t]<<5)+blue[t];
+
+    }
+
+    game.display.load565Palette(curPal);
+
+}
+
+
+// transparent 2bit bitmap with mask
+void drawMyBitmap(int16_t x, int16_t y, const uint8_t* bitmap, const uint8_t* mask)
+{
+    int16_t w = *bitmap;
+    int16_t h = *(bitmap + 1);
+    bitmap = bitmap + 2; //add an offset to the pointer to start after the width and height
+    /** visibility check */
+    if (y<-h || y>game.display.height) return; //invisible
+    if (x<-w || x>game.display.width) return;  //invisible
+
+    /** 2 bpp mode */
+    int16_t i, j, byteNum, bitNum, byteWidth = w >> 2;
+    for (i = 0; i < w; i++) {
+        byteNum = i / 4;
+        bitNum = (i % 4)<<1;
+        for (j = 0; j < h; j++) {
+            uint8_t source = *(bitmap + j * byteWidth + byteNum);
+            uint8_t source2 = *(mask + j * byteWidth + byteNum+2);
+            uint8_t output = (source & (0xC0 >> bitNum));
+            output >>= (6-bitNum);
+
+            uint8_t output2 = (source2 & (0xC0 >> bitNum));
+            output2 >>= (6-bitNum);
+
+            if (output2 != 0) {
+                game.display.setColor(output);
+                game.display.drawPixel(x + i, y + j);
+            }
+        }
+
+    //return;
+    }
+}
+
+
+
+void titleScreen(){
+
+  // background
+  for (char y = 0; y < 22; y++) {
+    for (char x = 0; x < 28; x++) {
+      byte mt = bg_map[x + 28 * y];
+      game.display.drawBitmap(x*8, y*8, bg_gfx[mt]);
+    }
+  }
+
+int y=48;
+    if(frameNumber<=64){
+                        // time, start, distance, duration
+        #ifdef POK_SIM
+        y = easeOutBounce(frameNumber, -48, 48+48, 64);
+        #else
+        y = easeOutBounce(frameNumber*4, -48, 48+48, 64);
+        if (y>48) y=48;
+        #endif
+    }
+    drawMyBitmap(16, y, title_bitmap, title_mask);
+
+
+    char text[] = " Press A to Start ";
+    game.display.setCursor(40,120);
+    game.display.color=3;
+    game.display.print(text);
+
+  if(_A[NEW]){
+    // make sure the playfield is clear!
+      for (char y = 18; y > 0; y--) {
+        for (char x = 3; x < 13; x++) {
+          playfield[x + 16 * y] = 0;
+        }
+      }
+
+    loadPal(0); // default green palette
+    gameMode = 1;
+  }
+
+}
+
+void gameOver(){
+  // background
+  for (char y = 0; y < 22; y++) {
+    for (char x = 0; x < 28; x++) {
+      byte mt = bg_map[x + 28 * y];
+      game.display.drawBitmap(x*8, y*8, bg_gfx[mt]);
+    }
+  }
+
+    int y=48;
+    if(frameNumber<=64){
+                        // time, start, distance, duration
+        y = easeOutBounce(frameNumber, -48, 48+48, 64);
+    }
+    drawMyBitmap(1, y, gameover_bitmap, gameover_mask);
+
+    char text[] = " Press A ";
+    game.display.setCursor(62,120);
+    game.display.color=3;
+    game.display.print(text);
+
+  if(_A[NEW]){
+    gameMode = 0;
+    frameNumber = 0;
+    score=0;
+    lines=0;
+    level=0;
+    splodeOK=0;
+    animSplode=0;
+  }
+
+}
+
+void playGame(){
+    #ifdef POK_SIM
+    #define SLIDECOUNT 6
+    #define DROPCOUNT 20
+    #else
+    #define SLIDECOUNT 1
+    #define DROPCOUNT 2
+    #endif
+
+    if(linesToRemove==0 && animSplode==0){
+
+        if (_Left[NEW]) {
+          if (check(px - 1, py, pr) == 0) {
+            px--;
+            slideTime = 0;
+          }
+        }
+        if (_Right[NEW]) {
+          if (check(px + 1, py, pr) == 0) {
+            px++;
+            slideTime = 0;
+          }
+        }
+        if (_Left[HELD] && slideTime++ > SLIDECOUNT) {
+          if (check(px - 1, py, pr) == 0) {
+            px--;
+            slideTime = 12;
+          }
+        }
+        if (_Right[HELD] && slideTime++ > SLIDECOUNT) {
+          if (check(px + 1, py, pr) == 0) {
+            px++;
+            slideTime = 12;
+          }
+        }
+
+        if ((_Down[HELD]) || (dropTime++ > DROPCOUNT - (level * 2))) {
+          dropTime = 0;
+          if (check(px, py+1, pr) == 0) {
+            py++;
+          } else {
+            // place shape and create new one
+            stamp(px, py, ps, pr);
+            checkLine();
+            py = 0; px = 6; ps = nextTile; nextTile = random(6); pr = 0;
+          }
+        }
+        if (_Up[NEW] && splodeOK==1) {
+                splodeOK=0;
+                animSplode=1;
+        }
+
+        if (_A[NEW]) {
+          if (check(px, py, (pr - 1) & 3) == 0) {
+            pr--;
+          } else if (check(px - 1, py, (pr - 1) & 3) == 0) {
+            pr--; px--;
+          } else if (check(px + 1, py, (pr - 1) & 3) == 0) {
+            pr--; px++;
+          } else if (check(px - 2, py, (pr - 1) & 3) == 0) {
+            pr--; px -= 2;
+          } else if (check(px + 2, py, (pr - 1) & 3) == 0) {
+            pr--; px += 2;
+          }
+          pr &= 3;
+        }
+
+        if (_B[NEW]) {
+          if (check(px, py, (pr + 1) & 3) == 0) {
+            pr++;
+          } else if (check(px - 1, py, (pr + 1) & 3) == 0) {
+            pr++; px--;
+          } else if (check(px + 1, py, (pr + 1) & 3) == 0) {
+            pr++; px++;
+          } else if (check(px - 2, py, (pr + 1) & 3) == 0) {
+            pr++; px -= 2;
+          } else if (check(px + 2, py, (pr + 1) & 3) == 0) {
+            pr++; px += 2;
+          }
+          pr &= 3;
+        }
+
+        animCount=0;
+    }
+
+        if(linesToRemove!=0){
+            // remove some lines
+            for(byte t=0; t<19; t++){
+                if(removeLine[t]==1){
+                    if(animCount<5){
+                        for (char x = 3; x < 13; x++) {
+                            playfield[x + 16 * t] = 5+animCount*6;
+                        } // x
+                    }else{
+                        removeLine[t]=0;
+                        linesToRemove--;
+                        for (char y1 = t; y1 > 0; y1--) {
+                            for (char x = 3; x < 13; x++) {
+                                playfield[x + 16 * y1] = playfield[x + 16 * (y1 - 1)];
+                            }
+                        }
+                    }
+                }
+            }
+            animCount++;
+        }
+
+        if(animSplode!=0){
+
+            if(animSplode<6){
+                for (char y = 0; y < 4; y++) {
+                    if (py + y >= 0) {
+                        for (char x = 0; x < 4; x++) {
+                            byte mt = pgm_read_byte(shapeMap + (x + 4 * y) + ps * 64 + (pr * 16));
+                            if (mt > 1) {
+                                playfield[(px + x) + 16 * (py + y)] = 5+animSplode*6;
+                            }
+                        }
+                    }
+                }
+                animSplode++;
+            }else{
+
+                for (char y = 0; y < 4; y++) {
+                    if (py + y >= 0) {
+                        for (char x = 0; x < 4; x++) {
+                            byte mt = pgm_read_byte(shapeMap + (x + 4 * y) + ps * 64 + (pr * 16));
+                            if (mt > 1) {
+                                playfield[(px + x) + 16 * (py + y)] = 0;
+                            }
+                        }
+                    }
+                }
+                py = 0; px = 6; ps = nextTile;
+                nextTile = random(6); pr = 0;
+                animSplode=0;
+            }
+        }
+
+    // render screen
+    drawPlayfield();
+}
+
+
+
+
+int main(){
+
+    game.begin();
+    game.display.width = 220; // full size
+    game.display.height = 176;
+    game.display.setFont(fontC64);
+    //game.display.charSpacingAdjust = 0; //needed for the non-proportional C64 font (normal value=1)
+    game.display.fixedWidthFont = true;
+
+    loadPal(1); // default green palette
+
+    px=6;
+    gameMode=0;
+    char oldMode = 50;
+    myDelay=40;
+
+    game.sound.playMusicStream(musicName);
+
+    frameNumber=0;
+    animCount=0;
+    splodeOK=0;
+    animSplode=0;
+
+   while (game.isRunning()) {
+
+        // if it is time to update the screen
+        if (game.update()){
+
+            frameNumber++;
+            game.sound.updateStream();
+            game.buttons.update();
+            myPad = updateButtons(myPad);
+            UpdatePad(myPad);
+
+            switch (gameMode) {
+            case 0:
+              titleScreen();
+                break;
+            case 1:
+                if (paused) {
+            //        pauseMenu();
+                } else {
+                    playGame();
+                }
+                break;
+            case 3:
+              gameOver();
+              break;
+            }
+
+        }
+    }
+    return 0;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tetris_gfx.h	Tue Oct 10 07:17:45 2017 +0000
@@ -0,0 +1,1492 @@
+
+unsigned short pallet[]={
+// 65535,50712,33808,0, // GREY
+ 0xFFFF, 0xD81B, 0xF440, 0x1514, // jonne
+ 50804,36013,27530,16904, // Gameboy
+ 0xd6d7, 0x9553, 0x3b0d, 0x19a8, // lcd?
+ 0xCF9D, 0x86D8, 0x25F2, 0x138A, // mint
+ 0xF6D8, 0x9DF7, 0x42D1, 0x1928, // dk blue
+ 0xFFDB, 0xF74E, 0xFD48, 0xEB06, // fire
+ 0xF7DF, 0xA698, 0xEAE9, 0x42EB, // future2
+
+0xFF59, 0xDC89, 0xA944, 0x30CA,
+0xDED8, 0xCD8E, 0xB282, 0x0000,
+0xFE1F, 0xECCA, 0x99CC, 0x39D3,
+0xFFD5, 0xC409, 0xF800, 0x50C0,
+0xFED6, 0x7E0F, 0x6C48, 0x59C4,
+0xDF5F, 0xE44A, 0xA800, 0x0202,
+0xFFCB, 0x7BC0, 0x051D, 0x000A,
+0xFF5C, 0xFDD1, 0x8200, 0x30C0,
+0xF654, 0xC449, 0x2BC0, 0x0000,
+0xFFDF, 0xFF4A, 0xF980, 0x500B,
+0xFE1F, 0xEC51, 0x799D, 0x2953,
+0xFFD4, 0x07C0, 0xF980, 0x000A,
+0xFE50, 0x959C, 0x288C, 0x1042,
+0xD7DF, 0xFC8A, 0xA000, 0x1800,
+0x6DC7, 0xE288, 0xE5D0, 0x00C0,
+0xFFDF, 0xBDD7, 0x738E, 0x0000,
+0xFE93, 0x7618, 0xFB05, 0x324C,
+0xDED8, 0xE404, 0x0280, 0x0082,
+0xE559, 0xFFCF, 0x05DF, 0x210B,
+0xF7D7, 0xE54F, 0x0E40, 0x0000,
+0xFFD8, 0xE58D, 0xB3C4, 0x524E,
+0x7BD9, 0xFB5F, 0xFE80, 0x4208,
+0xFFDF, 0x66CA, 0xC987, 0x3800,
+0xE7D4, 0x7E47, 0x4C43, 0x08C0,
+0xF54D, 0x7D5F, 0xD01A, 0x000F,
+0xF75E, 0xED0C, 0x43C7, 0x1841,
+0xFF1C, 0xDD1A, 0x9D1C, 0x0800,
+0xFFD7, 0x9659, 0x4B4F, 0x0909,
+0xFED5, 0xE54F, 0x7AD1, 0x0106,
+0xBE9A, 0xDC1B, 0x8014, 0x3800,
+0xB703, 0x040C, 0xB90B, 0x2880,
+0xFFD9, 0xBE0B, 0x8448, 0x4285,
+
+};
+
+byte playfield[]={
+  0,0,4,0,0,0,0,0,0,0,0,0,0,4,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,0,5,0,0,0,0,0,0,0,0,0,0,5,0,0,
+  0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,
+  0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,
+  0,1,1,0,0,0,0,0,0,0,0,0,0,1,1,0,
+};
+
+
+
+//Sprite sheet:1x42
+const uint8_t tile_gfx [][18] ={
+//[0] cell:0x0
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[1] cell:0x1
+{
+8,8,
+0,0,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+},
+//[2] cell:0x2
+{
+8,8,
+0,0,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+},
+//[3] cell:0x3
+{
+8,8,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+},
+//[4] cell:0x4
+{
+8,8,
+63,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+},
+//[5] cell:0x5
+{
+8,8,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+},
+//[6] cell:0x6
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[7] cell:0x7
+{
+8,8,
+0,0,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+},
+//[8] cell:0x8
+{
+8,8,
+0,0,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+},
+//[9] cell:0x9
+{
+8,8,
+46,238,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+},
+//[10] cell:0x10
+{
+8,8,
+46,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+},
+//[11] cell:0x11
+{
+8,8,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+},
+//[12] cell:0x12
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[13] cell:0x13
+{
+8,8,
+0,0,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+},
+//[14] cell:0x14
+{
+8,8,
+0,0,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+},
+//[15] cell:0x15
+{
+8,8,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+},
+//[16] cell:0x16
+{
+8,8,
+42,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+},
+//[17] cell:0x17
+{
+8,8,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+},
+//[18] cell:0x18
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[19] cell:0x19
+{
+8,8,
+0,0,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+},
+//[20] cell:0x20
+{
+8,8,
+0,0,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+},
+//[21] cell:0x21
+{
+8,8,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+},
+//[22] cell:0x22
+{
+8,8,
+25,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+},
+//[23] cell:0x23
+{
+8,8,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+},
+//[24] cell:0x24
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[25] cell:0x25
+{
+8,8,
+0,0,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+},
+//[26] cell:0x26
+{
+8,8,
+0,0,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+},
+//[27] cell:0x27
+{
+8,8,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+},
+//[28] cell:0x28
+{
+8,8,
+21,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+},
+//[29] cell:0x29
+{
+8,8,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+},
+//[30] cell:0x30
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[31] cell:0x31
+{
+8,8,
+0,0,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+},
+//[32] cell:0x32
+{
+8,8,
+0,0,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+},
+//[33] cell:0x33
+{
+8,8,
+4,68,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+},
+//[34] cell:0x34
+{
+8,8,
+4,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+},
+//[35] cell:0x35
+{
+8,8,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+},
+//[36] cell:0x36
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[37] cell:0x37
+{
+8,8,
+0,0,
+29,221,
+55,119,
+29,221,
+55,119,
+29,221,
+55,119,
+29,221,
+},
+//[38] cell:0x38
+{
+8,8,
+0,0,
+221,221,
+119,119,
+221,221,
+119,119,
+221,221,
+119,119,
+221,221,
+},
+//[39] cell:0x39
+{
+8,8,
+55,119,
+29,221,
+55,119,
+29,221,
+55,119,
+29,221,
+55,119,
+29,221,
+},
+//[40] cell:0x40
+{
+8,8,
+55,119,
+221,221,
+119,119,
+221,221,
+119,119,
+221,221,
+119,119,
+221,221,
+},
+//[41] cell:0x41
+{
+8,8,
+119,119,
+221,221,
+119,119,
+221,221,
+119,119,
+221,221,
+119,119,
+221,221,
+},
+};
+
+
+//Sprite sheet:1x49
+const uint8_t bg_gfx [][18] ={
+//[0] cell:0x0 
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[1] cell:0x1 
+{
+8,8,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+0,0,
+},
+//[2] cell:0x2 
+{
+8,8,
+0,0,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+},
+//[3] cell:0x3 
+{
+8,8,
+0,0,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+},
+//[4] cell:0x4 
+{
+8,8,
+4,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+},
+//[5] cell:0x5 
+{
+8,8,
+4,68,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+4,68,
+17,17,
+},
+//[6] cell:0x6 
+{
+8,8,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+68,68,
+17,17,
+},
+//[7] cell:0x7 
+{
+8,8,
+0,0,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+},
+//[8] cell:0x8 
+{
+8,8,
+0,0,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+},
+//[9] cell:0x9 
+{
+8,8,
+38,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+},
+//[10] cell:0x10 
+{
+8,8,
+0,0,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+},
+//[11] cell:0x11 
+{
+8,8,
+0,0,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+},
+//[12] cell:0x12 
+{
+8,8,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+21,85,
+},
+//[13] cell:0x13 
+{
+8,8,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+},
+//[14] cell:0x14 
+{
+8,8,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+38,102,
+25,153,
+},
+//[15] cell:0x15 
+{
+8,8,
+21,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+85,85,
+},
+//[16] cell:0x16 
+{
+8,8,
+0,0,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+},
+//[17] cell:0x17 
+{
+8,8,
+0,0,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+},
+//[18] cell:0x18 
+{
+8,8,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+42,170,
+},
+//[19] cell:0x19 
+{
+8,8,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+102,102,
+153,153,
+},
+//[20] cell:0x20 
+{
+8,8,
+0,0,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+},
+//[21] cell:0x21 
+{
+8,8,
+0,0,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+},
+//[22] cell:0x22 
+{
+8,8,
+46,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+},
+//[23] cell:0x23 
+{
+8,8,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+},
+//[24] cell:0x24 
+{
+8,8,
+46,238,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+46,238,
+59,187,
+},
+//[25] cell:0x25 
+{
+8,8,
+0,0,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+},
+//[26] cell:0x26 
+{
+8,8,
+0,0,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+},
+//[27] cell:0x27 
+{
+8,8,
+63,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+},
+//[28] cell:0x28 
+{
+8,8,
+42,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+170,170,
+},
+//[29] cell:0x29 
+{
+8,8,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+238,238,
+187,187,
+},
+//[30] cell:0x30 
+{
+8,8,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+},
+//[31] cell:0x31 
+{
+8,8,
+0,0,
+0,0,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+63,255,
+},
+//[32] cell:0x32 
+{
+8,8,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+255,255,
+},
+//[33] cell:0x33 
+{
+8,8,
+0,0,
+0,127,
+3,192,
+13,0,
+28,0,
+48,5,
+48,27,
+48,28,
+},
+//[34] cell:0x34 
+{
+8,8,
+0,0,
+255,255,
+0,0,
+0,0,
+0,0,
+85,85,
+255,255,
+0,0,
+},
+//[35] cell:0x35 
+{
+8,8,
+0,0,
+253,0,
+3,192,
+0,112,
+0,116,
+64,28,
+224,28,
+48,28,
+},
+//[36] cell:0x36 
+{
+8,8,
+48,28,
+48,28,
+48,28,
+48,28,
+48,28,
+48,28,
+48,28,
+48,28,
+},
+//[37] cell:0x37 
+{
+8,8,
+0,0,
+0,127,
+3,192,
+13,0,
+28,0,
+48,1,
+48,11,
+48,28,
+},
+//[38] cell:0x38 
+{
+8,8,
+48,28,
+224,28,
+0,28,
+0,28,
+0,28,
+64,28,
+224,28,
+48,28,
+},
+//[39] cell:0x39 
+{
+8,8,
+60,0,
+60,0,
+60,0,
+60,0,
+60,0,
+60,0,
+63,252,
+0,0,
+},
+//[40] cell:0x40 
+{
+8,8,
+15,240,
+3,192,
+3,192,
+3,192,
+3,192,
+3,192,
+15,240,
+0,0,
+},
+//[41] cell:0x41 
+{
+8,8,
+60,60,
+63,60,
+63,252,
+63,252,
+60,252,
+60,60,
+60,60,
+0,0,
+},
+//[42] cell:0x42 
+{
+8,8,
+63,252,
+60,0,
+60,0,
+63,192,
+60,0,
+60,0,
+63,252,
+0,0,
+},
+//[43] cell:0x43 
+{
+8,8,
+15,240,
+60,60,
+60,0,
+15,240,
+0,60,
+60,60,
+15,240,
+0,0,
+},
+//[44] cell:0x44 
+{
+8,8,
+48,28,
+48,11,
+48,0,
+48,0,
+48,0,
+48,1,
+48,11,
+48,28,
+},
+//[45] cell:0x45 
+{
+8,8,
+15,240,
+60,60,
+60,0,
+60,0,
+60,0,
+60,60,
+15,240,
+0,0,
+},
+//[46] cell:0x46 
+{
+8,8,
+15,240,
+60,60,
+60,60,
+60,60,
+60,60,
+60,60,
+15,240,
+0,0,
+},
+//[47] cell:0x47 
+{
+8,8,
+63,240,
+60,60,
+60,60,
+63,240,
+63,192,
+60,240,
+60,60,
+0,0,
+},
+//[48] cell:0x48 
+{
+8,8,
+48,28,
+48,11,
+48,0,
+28,0,
+13,64,
+3,213,
+0,127,
+0,0,
+},
+//[49] cell:0x49 
+{
+8,8,
+48,28,
+224,28,
+0,28,
+0,116,
+1,112,
+87,192,
+253,0,
+0,0,
+},
+//[50] cell:0x50 
+{
+8,8,
+60,60,
+60,60,
+60,60,
+60,60,
+60,60,
+15,240,
+3,192,
+0,0,
+},
+//[51] cell:0x51 
+{
+8,8,
+60,60,
+60,60,
+15,240,
+3,192,
+15,240,
+60,60,
+60,60,
+0,0,
+},
+//[52] cell:0x52 
+{
+8,8,
+63,252,
+3,192,
+3,192,
+3,192,
+3,192,
+3,192,
+3,192,
+0,0,
+},
+};
+
+const byte PROGMEM shapeMap[]={
+1,1,1,1, 2,3,3,3, 1,1,1,1, 1,1,1,1,
+1,2,1,1, 1,4,1,1, 1,4,1,1, 1,4,1,1,
+1,1,1,1, 2,3,3,3, 1,1,1,1, 1,1,1,1,
+1,2,1,1, 1,4,1,1, 1,4,1,1, 1,4,1,1,
+
+1,1,1,1, 2,3,1,1, 1,4,3,1, 1,1,1,1,
+1,1,2,1, 1,2,5,1, 1,4,1,1, 1,1,1,1,
+1,1,1,1, 2,3,1,1, 1,4,3,1, 1,1,1,1,
+1,1,2,1, 1,2,5,1, 1,4,1,1, 1,1,1,1,
+
+1,1,1,1, 1,2,3,1, 2,5,1,1, 1,1,1,1,
+1,2,1,1, 1,4,3,1, 1,1,4,1, 1,1,1,1,
+1,1,1,1, 1,2,3,1, 2,5,1,1, 1,1,1,1,
+1,2,1,1, 1,4,3,1, 1,1,4,1, 1,1,1,1,
+
+1,1,1,1, 1,2,3,1, 1,4,6,1, 1,1,1,1,
+1,1,1,1, 1,2,3,1, 1,4,6,1, 1,1,1,1,
+1,1,1,1, 1,2,3,1, 1,4,6,1, 1,1,1,1,
+1,1,1,1, 1,2,3,1, 1,4,6,1, 1,1,1,1,
+
+1,1,1,1, 2,3,3,1, 4,1,1,1, 1,1,1,1,
+2,3,1,1, 1,4,1,1, 1,4,1,1, 1,1,1,1,
+1,1,2,1, 2,3,5,1, 1,1,1,1, 1,1,1,1,
+1,2,1,1, 1,4,1,1, 1,4,3,1, 1,1,1,1,
+
+1,1,1,1, 2,3,3,1, 1,1,4,1, 1,1,1,1,
+1,2,1,1, 1,4,1,1, 2,5,1,1, 1,1,1,1,
+2,1,1,1, 4,3,3,1, 1,1,1,1, 1,1,1,1,
+1,2,3,1, 1,4,1,1, 1,4,1,1, 1,1,1,1,
+
+1,2,1,1, 2,5,3,1, 1,1,1,1, 1,1,1,1,
+1,2,1,1, 1,4,3,1, 1,4,1,1, 1,1,1,1,
+1,1,1,1, 2,3,3,1, 1,4,1,1, 1,1,1,1,
+1,2,1,1, 2,5,1,1, 1,4,1,1, 1,1,1,1,
+};
+
+const byte PROGMEM bg_map[]={
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,3,3,1,1,1,1,2,3,1,1,1,
+1,2,3,1,1,2,1,1,1,1,2,1,1,2,3,3,1,1,1,2,3,1,2,4,1,1,2,1,
+2,4,1,1,2,5,3,1,2,2,4,1,2,3,5,1,1,2,1,5,6,1,1,1,1,2,4,3,
+2,3,3,2,4,3,5,1,5,2,5,1,1,5,3,1,1,5,1,1,2,3,1,7,2,3,1,2,
+5,1,2,2,1,1,1,2,4,5,3,2,3,2,1,2,3,5,1,2,4,7,8,9,5,6,2,4,
+1,2,4,5,3,3,1,2,3,5,1,1,5,5,1,5,6,5,1,1,1,1,10,11,1,2,3,5,
+1,5,10,11,2,3,3,3,5,3,1,2,5,5,1,2,3,3,1,2,3,3,3,12,1,7,5,3,
+1,1,12,13,1,10,11,1,10,1,2,4,3,5,1,2,5,10,10,1,10,11,1,12,10,14,8,10,
+1,10,11,11,7,8,12,11,12,10,11,11,10,11,2,4,10,15,12,11,12,13,10,11,15,14,10,15,
+7,8,12,1,1,14,8,10,15,12,1,10,12,13,5,10,12,1,12,7,8,8,10,11,11,11,7,12,
+14,1,1,16,17,17,10,11,7,8,8,12,11,1,10,15,16,1,1,14,7,8,1,7,7,8,9,1,
+14,10,11,11,18,7,8,12,11,7,14,12,10,11,7,12,18,10,11,7,9,1,7,9,8,7,1,1,
+1,12,7,8,7,14,19,7,7,14,8,8,12,13,14,1,18,17,12,11,7,8,8,8,16,14,8,7,
+16,7,9,1,14,8,8,14,14,8,20,7,8,7,9,16,17,7,8,8,1,20,21,21,18,14,16,14,
+18,17,17,7,8,8,8,14,14,20,22,14,19,20,21,18,23,14,20,20,21,21,24,25,18,1,18,14,
+16,20,21,16,17,17,20,14,20,24,1,20,20,21,24,20,21,20,22,1,24,25,26,27,18,16,28,20,
+18,17,24,21,18,20,24,20,22,25,20,22,24,29,24,25,24,21,24,25,26,26,25,25,16,17,17,24,
+18,25,26,1,1,24,24,21,24,30,24,25,26,26,26,30,26,26,25,26,30,25,27,30,20,21,18,24,
+25,27,20,25,20,22,20,31,25,27,25,26,26,26,20,21,25,26,26,30,26,30,25,27,20,24,21,24,
+1,20,22,30,20,21,22,30,26,26,25,26,25,26,25,24,21,30,20,25,26,26,20,20,22,21,1,25,
+25,26,24,30,25,26,25,1,1,25,27,25,27,25,27,26,20,21,22,30,20,21,22,25,25,26,25,27,
+1,30,26,30,30,32,30,26,26,1,25,26,25,26,26,1,25,26,25,26,26,26,25,27,26,30,26,30,
+
+1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,3,3,1,1,1,1,2,3,1,1,1,
+1,2,3,1,1,2,1,33,34,34,34,34,34,34,34,34,34,34,35,2,3,1,2,4,1,1,2,1,
+2,4,1,1,2,5,3,36,1,1,1,1,1,1,1,1,1,1,36,5,6,1,1,1,1,2,4,3,
+2,3,3,2,4,3,5,36,1,1,1,1,1,1,1,1,1,1,36,1,2,3,1,7,2,3,1,2,
+5,37,34,34,34,34,34,38,1,1,1,1,1,1,1,1,1,1,36,2,4,7,8,9,5,6,2,4,
+1,36,39,40,41,42,43,36,1,1,1,1,1,1,1,1,1,1,44,34,34,34,34,34,35,2,3,5,
+1,36,1,1,1,1,1,36,1,1,1,1,1,1,1,1,1,1,36,43,45,46,47,42,36,7,5,3,
+1,48,34,34,34,34,34,38,1,1,1,1,1,1,1,1,1,1,36,1,1,1,1,1,36,14,8,10,
+1,10,11,11,7,8,1,36,1,1,1,1,1,1,1,1,1,1,44,34,34,34,34,34,49,14,10,15,
+7,8,12,1,1,14,8,36,1,1,1,1,1,1,1,1,1,1,36,7,8,8,10,11,11,11,7,12,
+14,37,34,34,34,34,34,38,1,1,1,1,1,1,1,1,1,1,36,14,7,8,1,7,7,8,9,1,
+14,36,39,42,50,42,39,36,1,1,1,1,1,1,1,1,1,1,36,7,9,1,7,9,8,7,1,1,
+1,36,1,1,1,1,1,36,1,1,1,1,1,1,1,1,1,1,44,34,34,34,34,35,16,14,8,7,
+16,48,34,34,34,34,34,38,1,1,1,1,1,1,1,1,1,1,36,41,42,51,52,36,18,14,16,14,
+18,17,17,7,8,8,8,36,1,1,1,1,1,1,1,1,1,1,36,1,1,1,1,36,18,1,18,14,
+16,20,21,16,17,17,16,36,1,1,1,1,1,1,1,1,1,1,36,1,1,1,1,36,18,16,28,20,
+18,17,24,21,18,20,18,36,1,1,1,1,1,1,1,1,1,1,36,1,1,1,1,36,16,17,17,24,
+18,25,26,1,1,24,18,36,1,1,1,1,1,1,1,1,1,1,36,1,1,1,1,36,20,21,18,24,
+25,27,20,25,20,22,20,36,1,1,1,1,1,1,1,1,1,1,44,34,34,34,34,49,20,24,21,24,
+1,20,22,30,20,21,22,36,1,1,1,1,1,1,1,1,1,1,36,25,26,26,20,20,22,21,1,25,
+25,26,24,30,25,26,25,48,34,34,34,34,34,34,34,34,34,34,49,30,20,21,22,25,25,26,25,27,
+1,30,26,30,30,32,30,26,26,1,25,26,25,26,26,1,25,26,25,26,26,26,25,27,26,30,26,30,
+};
+
+const uint8_t title_bitmap[] =
+{
+192,48,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,127,255,253,85,85,85,127,255,253,85,127,255,253,85,127,255,253,85,85,85,85,85,127,255,253,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,121,85,173,85,85,85,121,85,173,85,121,85,173,85,121,85,173,85,85,85,85,85,121,85,173,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,208,0,117,85,85,85,208,0,117,85,208,0,117,85,208,0,117,85,85,85,85,85,208,0,117,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,208,0,117,85,85,85,208,0,117,85,208,0,117,85,208,0,117,85,85,85,85,85,208,0,117,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,87,64,1,213,85,85,87,64,1,213,87,64,1,213,87,64,1,213,85,85,85,85,87,64,1,213,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,87,64,1,213,85,85,87,64,1,213,87,64,1,213,87,64,1,213,85,85,85,85,87,64,1,213,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,93,0,7,85,85,85,93,0,7,85,93,0,7,85,93,0,7,85,85,85,85,85,93,0,7,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,93,0,7,85,85,85,94,85,91,85,93,0,7,85,93,0,7,85,85,85,85,85,94,85,91,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,93,0,7,85,85,85,95,255,255,85,93,0,7,85,93,0,7,85,85,85,85,85,95,255,255,85,85,85,85,85,85,85,
+85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,116,0,29,85,85,85,85,85,85,85,116,0,29,85,116,0,29,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,85,85,85,85,127,255,253,85,85,85,127,255,253,85,85,116,0,31,255,255,255,255,255,255,255,244,0,31,255,244,0,31,255,255,255,255,255,255,255,253,127,255,255,255,255,213,85,
+85,85,85,85,87,213,85,87,245,85,87,213,85,87,245,85,208,0,5,85,85,86,229,85,185,85,180,0,5,85,180,0,5,86,249,85,85,86,229,85,191,213,85,85,85,86,213,85,
+85,85,85,85,93,64,0,1,95,85,93,64,0,1,95,85,208,0,0,0,0,1,208,0,116,0,116,0,0,0,116,0,0,1,244,0,0,1,208,0,125,64,0,0,0,1,213,85,
+85,85,85,85,116,0,0,0,5,213,116,0,0,0,5,215,64,0,0,0,0,7,64,1,208,0,116,0,0,0,116,0,0,7,180,0,0,7,64,1,228,0,0,0,0,7,85,85,
+85,85,85,85,244,0,0,0,0,117,244,0,0,0,0,119,64,0,0,0,0,7,64,1,208,0,29,0,0,0,29,0,0,7,157,0,0,7,64,1,208,0,0,0,0,7,85,85,
+85,85,85,87,180,0,0,0,0,119,180,0,0,0,0,127,64,0,0,0,0,7,64,1,208,0,29,0,0,0,29,0,0,7,93,0,0,7,64,1,208,0,0,0,0,7,85,85,
+85,85,85,93,93,0,0,0,0,29,93,0,0,0,0,31,64,0,0,0,0,29,0,7,64,0,29,0,0,0,29,0,0,29,29,0,0,29,0,7,64,0,0,0,0,29,85,85,
+85,85,85,93,29,0,0,0,0,29,29,0,0,0,0,31,64,0,0,0,0,29,0,7,64,0,7,80,0,0,7,80,0,29,7,80,0,29,0,7,64,0,0,0,0,29,85,85,
+85,85,85,116,7,85,85,0,0,116,7,85,85,0,0,123,64,0,85,85,85,180,0,30,149,80,1,245,85,80,1,245,85,180,1,245,85,180,0,29,0,5,85,85,85,181,85,85,
+85,85,85,116,7,191,255,64,0,116,7,191,255,64,0,117,208,0,255,255,255,244,0,31,255,240,0,111,255,240,0,111,255,244,0,111,255,244,0,29,0,63,255,255,255,245,85,85,
+85,85,85,208,1,213,85,208,1,208,1,213,85,208,1,209,208,0,117,85,85,224,0,117,85,224,0,117,85,224,0,117,85,224,0,117,85,224,0,116,0,5,85,91,213,85,85,85,
+85,85,85,208,1,213,85,208,1,208,1,213,85,208,1,209,208,0,29,85,85,208,0,117,85,208,0,117,85,208,0,117,85,208,0,117,85,208,0,116,0,0,0,1,117,85,85,85,
+85,85,85,208,1,213,85,208,1,208,1,213,85,208,1,208,116,0,7,85,85,208,0,117,85,208,0,117,85,208,0,117,85,208,0,117,85,208,0,180,0,0,0,0,29,85,85,85,
+85,85,87,64,7,85,87,64,7,64,7,85,87,64,7,64,116,0,7,85,87,64,1,213,87,64,1,213,87,64,1,213,87,64,1,213,87,64,1,244,0,0,0,0,29,85,85,85,
+85,85,87,64,7,85,87,64,7,64,7,85,87,64,7,64,29,0,1,213,87,64,1,213,87,64,1,213,87,64,1,213,87,64,1,213,87,64,1,221,64,0,0,0,7,85,85,85,
+85,85,93,0,29,85,93,0,29,0,29,85,93,0,29,0,29,0,0,117,93,0,7,85,93,0,7,85,93,0,7,85,93,0,7,85,93,0,7,87,213,0,0,0,7,85,85,85,
+85,85,93,0,29,85,93,0,29,0,29,85,93,0,29,0,23,64,0,117,93,0,7,85,93,0,7,85,93,0,7,85,93,0,7,85,93,0,7,85,127,85,64,0,29,85,85,85,
+85,85,92,0,7,255,244,0,116,0,7,255,244,0,116,0,29,208,0,29,116,0,29,85,116,0,29,85,116,0,29,85,116,0,29,85,116,0,31,255,255,255,240,0,29,85,85,85,
+85,85,116,0,1,86,224,0,116,0,1,86,224,0,116,0,29,116,0,7,244,0,29,85,116,0,29,85,116,0,29,85,116,0,29,85,116,0,29,85,85,85,64,0,117,85,85,85,
+85,85,116,0,0,1,208,0,116,0,0,1,208,0,116,0,29,116,0,1,180,0,29,85,116,0,29,85,116,0,29,85,116,0,29,85,116,0,29,0,0,0,0,0,117,85,85,85,
+85,85,116,0,0,0,116,1,221,0,0,0,116,1,208,0,117,93,0,1,208,0,117,85,208,0,117,85,208,0,117,85,208,0,117,85,208,0,116,0,0,0,0,1,213,85,85,85,
+85,85,208,0,0,0,116,7,93,0,0,0,116,7,64,0,117,87,64,1,208,0,117,85,208,0,117,85,208,0,117,85,208,0,117,85,208,0,116,0,0,0,0,7,85,85,85,85,
+85,85,208,0,0,0,29,29,87,80,0,0,29,31,64,1,213,87,64,7,64,1,213,87,64,1,213,87,64,1,213,87,64,1,213,87,64,1,208,0,0,0,0,29,85,85,85,85,
+85,87,64,0,0,0,30,117,85,245,64,0,30,123,64,1,213,85,212,7,64,1,213,87,64,1,213,87,64,1,213,87,64,1,213,87,64,1,208,0,0,0,1,117,85,85,85,85,
+85,87,64,0,85,85,107,213,85,95,213,85,107,222,149,91,85,85,125,110,149,91,85,94,149,91,85,94,149,91,85,94,149,91,85,94,149,91,165,85,85,85,87,213,85,85,85,85,
+85,93,0,1,255,255,253,85,85,85,127,255,253,95,255,255,85,85,87,255,255,255,85,95,255,255,85,95,255,255,85,95,255,255,85,95,255,255,255,255,255,255,253,85,85,85,85,85,
+85,93,0,7,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,93,0,7,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,116,0,29,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,116,0,29,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,208,0,117,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+85,208,0,117,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+87,165,86,213,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+87,255,255,213,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,
+};
+
+const uint8_t title_mask[] =
+{
+192,48,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,85,84,0,0,0,21,85,84,0,21,85,84,0,21,85,84,0,0,0,0,0,21,85,84,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,85,84,0,0,0,21,85,84,0,21,85,84,0,21,85,84,0,0,0,0,0,21,85,84,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,85,80,0,0,0,85,85,80,0,85,85,80,0,85,85,80,0,0,0,0,0,85,85,80,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,85,85,80,0,0,0,85,85,80,0,85,85,80,0,85,85,80,0,0,0,0,0,85,85,80,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,85,85,64,0,0,1,85,85,64,1,85,85,64,1,85,85,64,0,0,0,0,1,85,85,64,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,85,85,64,0,0,1,85,85,64,1,85,85,64,1,85,85,64,0,0,0,0,1,85,85,64,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,85,85,0,0,0,5,85,85,0,5,85,85,0,5,85,85,0,0,0,0,0,5,85,85,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,85,85,0,0,0,5,85,85,0,5,85,85,0,5,85,85,0,0,0,0,0,5,85,85,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,85,85,0,0,0,5,85,85,0,5,85,85,0,5,85,85,0,0,0,0,0,5,85,85,0,0,0,0,0,0,0,
+0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,21,85,84,0,0,0,0,0,0,0,21,85,84,0,21,85,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,0,0,0,0,21,85,84,0,0,0,21,85,84,0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,21,85,85,85,85,64,0,
+0,0,0,0,1,85,85,85,80,0,1,85,85,85,80,0,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,64,0,
+0,0,0,0,5,85,85,85,85,0,5,85,85,85,85,0,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,64,0,
+0,0,0,0,21,85,85,85,85,64,21,85,85,85,85,65,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,0,0,
+0,0,0,0,85,85,85,85,85,80,85,85,85,85,85,81,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,0,0,
+0,0,0,1,85,85,85,85,85,81,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,0,0,
+0,0,0,5,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,0,0,
+0,0,0,5,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,0,0,
+0,0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,80,0,0,
+0,0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,80,0,0,
+0,0,0,85,85,64,0,85,85,85,85,64,0,85,85,85,85,85,80,0,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,64,0,0,0,
+0,0,0,85,85,64,0,85,85,85,85,64,0,85,85,85,85,85,84,0,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,80,0,0,0,
+0,0,0,85,85,64,0,85,85,85,85,64,0,85,85,85,85,85,85,0,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,84,0,0,0,
+0,0,1,85,85,0,1,85,85,85,85,0,1,85,85,85,85,85,85,0,1,85,85,64,1,85,85,64,1,85,85,64,1,85,85,64,1,85,85,85,85,85,85,85,84,0,0,0,
+0,0,1,85,85,0,1,85,85,85,85,0,1,85,85,85,85,85,85,64,1,85,85,64,1,85,85,64,1,85,85,64,1,85,85,64,1,85,85,69,85,85,85,85,85,0,0,0,
+0,0,5,85,84,0,5,85,85,85,84,0,5,85,85,85,85,85,85,80,5,85,85,0,5,85,85,0,5,85,85,0,5,85,85,0,5,85,85,1,85,85,85,85,85,0,0,0,
+0,0,5,85,84,0,5,85,85,85,84,0,5,85,85,85,85,85,85,80,5,85,85,0,5,85,85,0,5,85,85,0,5,85,85,0,5,85,85,0,21,85,85,85,84,0,0,0,
+0,0,5,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,84,21,85,84,0,21,85,84,0,21,85,84,0,21,85,84,0,21,85,85,85,85,85,85,85,84,0,0,0,
+0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,84,21,85,85,85,85,84,0,21,85,84,0,21,85,84,0,21,85,84,0,21,85,85,85,85,85,85,85,80,0,0,0,
+0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,84,21,85,85,85,85,84,0,21,85,84,0,21,85,84,0,21,85,84,0,21,85,85,85,85,85,85,85,80,0,0,0,
+0,0,21,85,85,85,85,85,69,85,85,85,85,85,85,85,80,5,85,85,85,85,80,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,85,64,0,0,0,
+0,0,85,85,85,85,85,85,5,85,85,85,85,85,85,85,80,1,85,85,85,85,80,0,85,85,80,0,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,85,0,0,0,0,
+0,0,85,85,85,85,85,84,1,85,85,85,85,85,85,85,64,1,85,85,85,85,64,1,85,85,64,1,85,85,64,1,85,85,64,1,85,85,85,85,85,85,85,84,0,0,0,0,
+0,1,85,85,85,85,85,80,0,85,85,85,85,85,85,85,64,0,85,85,85,85,64,1,85,85,64,1,85,85,64,1,85,85,64,1,85,85,85,85,85,85,85,80,0,0,0,0,
+0,1,85,85,85,85,85,64,0,5,85,85,85,69,85,85,0,0,21,85,85,85,0,5,85,85,0,5,85,85,0,5,85,85,0,5,85,85,85,85,85,85,85,64,0,0,0,0,
+0,5,85,85,85,85,84,0,0,0,21,85,84,5,85,85,0,0,1,85,85,85,0,5,85,85,0,5,85,85,0,5,85,85,0,5,85,85,85,85,85,85,84,0,0,0,0,0,
+0,5,85,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,5,85,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,21,85,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,21,85,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,85,85,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+0,85,85,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1,85,85,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1,85,85,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};
+
+
+const uint8_t gameover_bitmap[] =
+{
+224,34,
+170,170,170,170,191,255,254,170,170,170,191,255,254,170,170,255,255,255,255,255,255,255,255,170,170,170,175,255,255,170,170,170,170,171,255,255,234,170,191,255,254,170,191,255,254,175,255,255,170,170,175,255,255,255,250,170,
+170,170,170,171,213,85,87,250,170,171,213,85,87,250,170,245,85,85,85,181,85,85,85,254,170,170,245,85,85,254,170,170,170,189,85,85,127,170,185,85,110,170,185,85,174,245,85,85,254,170,190,85,85,85,186,170,
+170,170,170,173,64,0,1,95,170,173,64,0,1,95,170,244,0,0,0,116,0,0,0,87,234,171,80,0,0,87,234,170,170,212,0,0,21,250,208,0,30,170,208,0,123,80,0,0,87,234,189,0,0,0,122,170,
+170,170,170,180,0,0,0,5,234,180,0,0,0,5,235,116,0,0,0,116,0,0,0,1,122,173,0,0,0,1,122,170,171,64,0,0,0,94,208,0,58,170,208,0,125,0,0,0,1,122,237,0,0,1,234,170,
+170,170,170,244,0,0,0,0,122,244,0,0,0,0,123,93,0,0,0,29,0,0,0,0,30,189,0,0,0,0,30,170,175,64,0,0,0,7,208,0,122,171,64,1,253,0,0,0,0,30,231,64,0,1,234,170,
+170,170,171,180,0,0,0,0,123,180,0,0,0,0,127,93,0,0,0,29,0,0,0,0,30,237,0,0,0,0,30,170,187,64,0,0,0,7,208,0,122,173,0,1,237,0,0,0,0,30,215,64,0,1,234,170,
+170,170,173,29,0,0,0,0,29,29,0,0,0,0,29,29,0,0,0,29,0,0,0,0,7,71,64,0,0,0,7,170,209,208,0,0,0,1,208,1,234,180,0,7,71,64,0,0,0,7,71,64,0,7,170,170,
+170,170,173,29,0,0,0,0,29,29,0,0,0,0,29,7,80,0,0,7,80,0,0,0,7,71,64,0,0,0,7,170,209,208,0,0,0,1,208,1,234,180,0,15,71,64,0,0,0,7,65,212,0,7,170,170,
+170,170,180,7,85,85,0,0,116,7,85,85,0,0,116,1,245,85,80,1,245,85,80,0,29,1,213,85,64,0,30,171,64,117,85,80,0,7,64,1,234,208,0,29,1,213,85,64,0,29,0,125,85,110,170,170,
+170,170,180,7,191,255,64,0,116,7,191,255,64,0,116,0,111,255,240,0,111,255,240,0,29,1,239,255,208,0,30,171,64,123,255,244,0,7,64,7,171,64,0,125,1,239,255,208,0,29,0,27,255,254,170,170,
+170,170,208,1,234,170,208,1,208,1,234,170,208,1,208,0,122,170,208,0,122,170,208,0,116,0,117,85,64,0,122,173,0,30,170,173,0,29,0,7,171,64,1,244,0,117,85,64,0,120,0,30,170,170,170,170,
+170,170,208,1,234,170,208,1,208,1,234,170,208,1,208,0,122,170,208,0,122,170,208,0,116,0,116,0,0,0,122,173,0,30,170,173,0,29,0,7,173,0,1,244,0,116,0,0,0,116,0,30,170,170,170,170,
+170,170,208,1,234,170,208,1,208,1,234,170,208,1,208,0,122,170,208,0,122,170,208,0,116,0,116,0,0,0,122,173,0,30,170,173,0,29,0,30,180,0,7,180,0,116,0,0,0,116,0,30,170,170,170,170,
+170,171,64,7,170,171,64,7,64,7,170,171,64,7,64,1,234,171,64,1,234,171,64,1,208,1,208,0,0,1,234,180,0,122,170,180,0,116,0,30,180,0,30,208,1,208,0,0,1,208,0,122,170,170,170,170,
+170,171,64,7,170,171,64,7,64,7,170,171,64,7,64,1,234,171,64,1,234,171,64,1,208,1,208,0,0,1,234,180,0,122,170,180,0,116,0,30,208,0,30,208,1,208,0,0,1,208,0,122,170,170,170,170,
+170,173,0,30,170,173,0,29,0,30,170,173,0,29,0,7,170,173,0,7,170,173,0,7,64,7,64,0,0,7,170,208,1,234,170,208,1,208,0,123,64,0,123,64,7,64,0,0,7,64,1,234,170,170,170,170,
+170,173,0,30,170,173,0,29,0,30,170,173,0,29,0,7,170,173,0,7,170,173,0,7,64,7,85,85,85,94,170,208,1,234,170,208,1,208,0,127,64,1,235,64,7,85,85,85,95,64,1,234,170,170,170,170,
+170,180,0,7,255,244,0,116,0,7,255,244,0,116,0,30,170,180,0,30,170,180,0,29,0,1,255,255,255,250,171,64,0,127,255,64,7,64,0,21,0,1,237,0,1,255,255,255,253,0,7,170,170,170,170,170,
+170,180,0,1,86,224,0,116,0,1,86,224,0,116,0,30,170,180,0,30,170,180,0,29,0,0,85,186,170,170,171,64,0,21,110,0,7,64,0,0,0,7,173,0,0,85,186,170,173,0,7,170,170,170,170,170,
+170,180,0,0,1,208,0,116,0,0,0,116,0,116,0,30,170,180,0,30,170,180,0,29,0,0,0,122,170,170,171,64,0,0,29,0,7,64,0,0,0,30,173,0,0,0,122,170,173,0,7,170,170,170,170,170,
+170,173,0,0,0,116,1,237,0,0,0,116,1,208,0,122,170,208,0,122,170,208,0,123,64,0,0,30,170,170,170,208,0,0,7,64,29,0,0,0,0,30,171,64,0,0,30,170,180,0,30,170,170,170,170,170,
+170,173,0,0,0,116,7,173,0,0,0,29,1,208,0,122,170,208,0,122,170,208,0,123,64,0,0,30,170,170,170,208,0,0,7,64,125,0,0,0,0,122,171,64,0,0,30,170,180,0,30,170,170,170,170,170,
+170,171,80,0,0,29,7,171,80,0,0,7,71,64,1,234,171,64,1,234,171,64,1,234,212,0,0,7,170,170,170,181,0,0,1,209,235,80,0,0,1,234,170,212,0,0,7,170,208,0,122,170,170,170,170,170,
+170,170,245,64,0,30,30,170,245,64,0,7,71,64,1,234,171,64,1,234,171,64,1,234,189,80,0,7,170,170,170,175,84,0,1,231,170,245,64,0,7,170,170,189,80,0,7,170,208,0,122,170,170,170,170,170,
+170,170,175,213,80,11,222,170,175,213,85,85,238,149,91,170,174,149,91,170,174,149,91,170,171,245,85,86,234,170,170,170,253,85,86,190,170,175,213,85,94,170,170,171,245,85,86,235,165,86,234,170,170,170,170,170,
+170,255,255,255,244,1,186,170,170,191,255,255,255,255,255,170,175,255,255,170,175,255,255,170,170,175,255,255,234,170,170,170,171,255,255,234,170,170,191,255,254,170,170,170,175,255,255,235,255,255,234,170,170,170,170,170,
+171,85,85,85,80,0,122,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+171,64,0,0,0,0,122,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+173,0,0,0,0,1,234,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+173,0,0,0,0,7,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+180,0,0,0,0,30,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+180,0,0,0,0,122,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+233,85,85,85,91,234,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+255,255,255,255,254,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,170,
+};
+
+
+const uint8_t gameover_mask[] =
+{
+224,34,
+0,0,0,0,21,85,84,0,0,0,21,85,84,0,0,85,85,85,85,85,85,85,85,0,0,0,5,85,85,0,0,0,0,1,85,85,64,0,21,85,84,0,21,85,84,5,85,85,0,0,5,85,85,85,80,0,
+0,0,0,1,85,85,85,80,0,1,85,85,85,80,0,85,85,85,85,85,85,85,85,84,0,0,85,85,85,84,0,0,0,21,85,85,85,0,21,85,84,0,21,85,84,85,85,85,84,0,21,85,85,85,80,0,
+0,0,0,5,85,85,85,85,0,5,85,85,85,85,0,85,85,85,85,85,85,85,85,85,64,1,85,85,85,85,64,0,0,85,85,85,85,80,85,85,84,0,85,85,81,85,85,85,85,64,21,85,85,85,80,0,
+0,0,0,21,85,85,85,85,64,21,85,85,85,85,65,85,85,85,85,85,85,85,85,85,80,5,85,85,85,85,80,0,1,85,85,85,85,84,85,85,80,0,85,85,85,85,85,85,85,80,85,85,85,85,64,0,
+0,0,0,85,85,85,85,85,80,85,85,85,85,85,81,85,85,85,85,85,85,85,85,85,84,21,85,85,85,85,84,0,5,85,85,85,85,85,85,85,80,1,85,85,85,85,85,85,85,84,85,85,85,85,64,0,
+0,0,1,85,85,85,85,85,81,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,85,85,85,85,85,84,0,21,85,85,85,85,85,85,85,80,5,85,85,85,85,85,85,85,84,85,85,85,85,64,0,
+0,0,5,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,0,85,85,85,85,85,85,85,85,64,21,85,85,85,85,85,85,85,85,85,85,85,85,0,0,
+0,0,5,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,0,85,85,85,85,85,85,85,85,64,21,85,85,85,85,85,85,85,85,85,85,85,85,0,0,
+0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,1,85,85,85,85,85,85,85,85,64,85,85,85,85,85,85,85,85,85,85,85,85,84,0,0,
+0,0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,85,84,1,85,85,85,85,85,85,85,85,1,85,85,85,85,85,85,85,85,85,85,85,85,84,0,0,
+0,0,85,85,64,0,85,85,85,85,64,0,85,85,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,85,80,5,85,84,0,5,85,85,85,85,1,85,85,85,85,85,85,85,85,85,85,84,0,0,0,0,
+0,0,85,85,64,0,85,85,85,85,64,0,85,85,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,85,80,5,85,84,0,5,85,85,85,85,5,85,85,85,85,85,85,85,85,85,85,84,0,0,0,0,
+0,0,85,85,64,0,85,85,85,85,64,0,85,85,85,85,80,0,85,85,80,0,85,85,85,85,85,85,85,85,80,5,85,84,0,5,85,85,85,84,21,85,85,21,85,85,85,85,85,85,85,84,0,0,0,0,
+0,1,85,85,0,1,85,85,85,85,0,1,85,85,85,85,64,1,85,85,64,1,85,85,85,85,85,85,85,85,64,21,85,80,0,21,85,85,85,84,21,85,84,85,85,85,85,85,85,85,85,80,0,0,0,0,
+0,1,85,85,0,1,85,85,85,85,0,1,85,85,85,85,64,1,85,85,64,1,85,85,85,85,85,85,85,85,64,21,85,80,0,21,85,85,85,84,85,85,84,85,85,85,85,85,85,85,85,80,0,0,0,0,
+0,5,85,84,0,5,85,85,85,84,0,5,85,85,85,85,0,5,85,85,0,5,85,85,85,85,85,85,85,85,0,85,85,64,0,85,85,85,85,81,85,85,81,85,85,85,85,85,85,85,85,64,0,0,0,0,
+0,5,85,84,0,5,85,85,85,84,0,5,85,85,85,85,0,5,85,85,0,5,85,85,85,85,85,85,85,84,0,85,85,64,0,85,85,85,85,85,85,85,65,85,85,85,85,85,85,85,85,64,0,0,0,0,
+0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,84,0,21,85,84,0,21,85,85,85,85,85,85,85,80,1,85,85,85,85,85,85,85,85,85,85,85,69,85,85,85,85,85,85,85,85,0,0,0,0,0,
+0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,84,0,21,85,84,0,21,85,85,85,85,85,80,0,0,1,85,85,85,85,85,85,85,85,85,85,85,5,85,85,85,80,0,5,85,85,0,0,0,0,0,
+0,21,85,85,85,85,85,85,85,85,85,85,85,85,85,84,0,21,85,84,0,21,85,85,85,85,85,80,0,0,1,85,85,85,85,85,85,85,85,85,85,84,5,85,85,85,80,0,5,85,85,0,0,0,0,0,
+0,5,85,85,85,85,85,69,85,85,85,85,85,85,85,80,0,85,85,80,0,85,85,81,85,85,85,84,0,0,0,85,85,85,85,85,85,85,85,85,85,84,1,85,85,85,84,0,21,85,84,0,0,0,0,0,
+0,5,85,85,85,85,85,5,85,85,85,85,85,85,85,80,0,85,85,80,0,85,85,81,85,85,85,84,0,0,0,85,85,85,85,85,85,85,85,85,85,80,1,85,85,85,84,0,21,85,84,0,0,0,0,0,
+0,1,85,85,85,85,85,1,85,85,85,85,85,85,85,64,1,85,85,64,1,85,85,64,85,85,85,85,0,0,0,21,85,85,85,85,65,85,85,85,85,64,0,85,85,85,85,0,85,85,80,0,0,0,0,0,
+0,0,85,85,85,85,84,0,85,85,85,85,85,85,85,64,1,85,85,64,1,85,85,64,21,85,85,85,0,0,0,5,85,85,85,85,0,85,85,85,85,0,0,21,85,85,85,0,85,85,80,0,0,0,0,0,
+0,0,5,85,85,85,84,0,5,85,85,85,85,85,85,0,5,85,85,0,5,85,85,0,1,85,85,85,64,0,0,0,85,85,85,84,0,5,85,85,84,0,0,1,85,85,85,65,85,85,64,0,0,0,0,0,
+0,85,85,85,85,85,80,0,0,21,85,85,85,85,85,0,5,85,85,0,5,85,85,0,0,5,85,85,64,0,0,0,1,85,85,64,0,0,21,85,84,0,0,0,5,85,85,65,85,85,64,0,0,0,0,0,
+1,85,85,85,85,85,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+1,85,85,85,85,85,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+5,85,85,85,85,85,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+5,85,85,85,85,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+21,85,85,85,85,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+21,85,85,85,85,80,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+85,85,85,85,85,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+85,85,85,85,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
+};