#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <time.h>
#include <string.h>
#include <unistd.h>

#  define SCREEN1               0xE000
#  define ADDR_RAM_COLOR       	0xD800
#  define ADDR_RAM_PANTALLA     0XC000
#  define CHARSET               0XE000
#  define outb(addr,val)       	(*(addr)) = (val)
#  define outw(addr,val)	(*(addr)) = (val)
#  define inb(addr)             (*(addr))
#  define TRUE                  1
#  define FALSE                 0

//notas 

 # define C1	    0X0225
 # define CB1	0X0245
 # define D1     0X0268
 # define DB1    0X028C
 # define E1     0X02B3
 # define F1     0X02DC
 # define FB1    0X0308
 # define G1     0X0336
 # define GB1    0X0367
 # define A1     0X039B
 # define AB1    0X03D2
 # define B1	    0X040C
 # define C2	    0X0449
 # define CB2	0X048B
 # define D2     0X04D0
 # define DB2    0X0519
 # define E2     0X0567
 # define F2     0X05B9
 # define FB2    0X06FF
 # define G2     0X066C
 # define GB2    0X06CE
 # define A2     0X0735
 # define AB2    0X07A3
 # define B2	    0X0817
 # define C3	    0X0893
 # define CB3	0X0915
 # define D3	    0X099F
 # define DB3    0X0A3C
 # define E3	    0X0ACD
 # define F3	    0X0B72 
 # define FB3    0X0C20
 # define G3	    0X0CD8
 # define GB3    0X0D9C
 # define A3	    0X0E6B
 # define AB3    0X0F46
 # define B3	    0X102F
 # define C4     0X1125
 # define CB4	0X122A
 # define D4	    0X133F
 # define DB4    0X1464
 # define E4	    0X159A
 # define F4	    0X16E3
 # define FB4    0X183F
 # define G4	    0X19B1
 # define GB4    0X1B38
 # define A4	    0X1CF1
 # define AB4    0X1E8D
 # define B4	    0X205E
 # define C5	    0X224B
 # define CB5	0X2455
 # define D5     0X267E
 # define DB5    0X28C8
 # define E5	    0X2B34
 # define F5	    0X2DC6
 # define FB5    0X307F
 # define G5     0X3361
 # define GB5    0X376F
 # define A5	    0X3966
 # define AB5    0X3D7E
 # define B5	    0X40BC
 # define C6	    0X4495


static const unsigned char Portada[8000]={
    0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,12
   , 0,0,0,0,0,0,48,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,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 3,3,14,1,51,0,0,0
   , 64,80,244,240,240,96,104,8
   , 0,0,0,0,39,255,255,255
   , 0,0,0,159,255,255,255,255
   , 0,0,159,255,255,255,255,255
   , 0,149,255,255,255,255,255,255
   , 0,255,255,255,255,255,255,255
   , 21,255,255,255,255,255,255,255
   , 84,255,255,255,255,255,255,255
   , 0,255,255,255,255,255,255,255
   , 0,87,255,255,255,255,254,254
   , 0,0,245,255,255,255,255,0
   , 0,0,64,249,255,255,255,255
   , 0,0,0,0,228,255,255,255
   , 0,0,0,0,0,144,253,255
   , 0,0,0,0,0,0,0,208
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,3,13
   , 0,0,0,1,11,127,255,240
   , 0,9,31,255,255,255,3,0
   , 111,255,255,255,255,255,255,255
   , 89,90,72,64,12,63,63,63
   , 255,255,255,255,15,83,87,84
   , 255,255,255,255,255,255,255,247
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,240
   , 255,255,255,255,255,255,255,0
   , 223,208,208,208,208,208,208,208
   , 255,95,15,15,15,15,15,0
   , 255,255,255,255,255,255,255,31
   , 253,253,253,253,253,253,253,253
   , 0,0,0,0,0,0,0,0
   , 15,0,0,0,0,208,208,208
   , 255,255,255,63,63,15,15,15
   , 255,255,255,255,255,255,255,255
   , 249,255,255,255,255,255,255,255
   , 0,224,244,255,255,255,255,255
   , 0,0,0,64,208,254,255,255
   , 0,0,0,0,0,0,64,224
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,2,7,31
   , 0,1,7,31,127,255,255,255
   , 149,208,192,192,192,240,112,112
   , 0,0,0,4,13,13,15,3
   , 0,0,0,0,0,0,0,0
   , 252,252,252,49,49,241,241,241
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 172,44,44,76,76,76,76,76
   , 0,0,7,7,7,7,7,7
   , 0,3,3,3,3,3,3,3
   , 0,192,192,192,192,192,192,192
   , 112,112,112,112,112,112,112,112
   , 8,7,7,7,7,7,7,7
   , 3,3,3,3,3,3,3,3
   , 253,253,253,253,253,253,253,253
   , 0,0,0,0,0,0,0,0
   , 208,208,208,208,208,0,0,3
   , 15,15,13,61,61,61,252,244
   , 255,255,255,15,3,3,3,3
   , 255,255,255,127,79,64,64,64
   , 255,255,255,255,255,255,55,52
   , 255,255,255,255,255,255,255,255
   , 253,255,255,255,255,255,255,255
   , 0,128,208,244,253,255,255,255
   , 0,0,0,0,0,64,208,244
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,3
   , 0,0,3,11,31,127,255,255
   , 127,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 208,208,212,244,244,244,244,244
   , 3,0,0,3,3,3,3,0
   , 2,0,0,192,192,64,112,112
   , 82,18,18,60,12,12,14,15
   , 255,255,255,255,255,255,63,192
   , 223,87,223,255,255,252,240,2
   , 132,132,52,52,60,255,255,255
   , 13,13,13,15,63,255,255,255
   , 3,3,3,3,255,255,255,255
   , 64,64,64,192,255,255,255,255
   , 208,208,240,255,255,255,255,255
   , 12,0,0,255,255,255,255,255
   , 3,3,15,255,255,255,255,255
   , 253,253,253,255,255,255,255,255
   , 0,1,1,3,243,255,255,255
   , 3,0,0,64,64,208,240,255
   , 244,244,244,52,52,4,4,253
   , 3,13,13,13,13,13,0,0
   , 192,0,0,0,0,0,0,0
   , 48,112,112,112,112,192,192,192
   , 5,0,0,12,12,28,28,28
   , 255,255,63,15,3,3,3,3
   , 255,255,255,255,255,255,255,255
   , 253,255,255,255,255,255,255,255
   , 0,64,192,240,248,253,255,255
   , 0,0,0,0,0,0,0,192
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0        

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,2,3,7
   , 7,15,47,127,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 245,253,253,253,253,253,255,255
   , 0,0,0,0,0,64,204,255
   , 208,208,0,0,15,255,255,255
   , 14,15,15,79,79,79,79,79
   , 241,253,252,255,255,255,255,255
   , 255,255,255,255,255,63,63,63
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,252,241,213,26
   , 170,161,149,31,95,127,255,255
   , 15,127,255,255,255,255,255,255
   , 1,241,241,240,252,252,252,252
   , 64,192,192,240,255,255,255,255
   , 52,16,16,208,192,192,240,255
   , 15,15,15,15,15,15,63,63
   , 255,255,255,255,255,255,255,151
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 208,240,252,254,255,255,255,255
   , 0,0,0,0,0,64,192,208
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0 

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,2,1,3
   , 15,31,63,191,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 79,79,79,79,79,95,95,83
   , 255,255,255,127,127,127,255,127
   , 5,197,241,253,252,255,254,254
   , 255,255,255,255,252,49,133,134
   , 255,255,255,192,42,165,85,85
   , 255,255,255,255,63,63,63,63
   , 255,255,255,255,255,255,245,196
   , 255,255,255,255,255,240,0,1
   , 255,255,255,255,255,0,0,80
   , 255,255,255,255,255,63,4,16
   , 255,255,255,255,255,252,242,1
   , 84,86,82,74,43,175,191,255
   , 127,127,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 252,252,252,252,241,241,241,241
   , 255,255,255,255,255,255,255,252
   , 255,255,255,255,255,255,63,15
   , 167,175,159,127,127,127,127,127
   , 255,255,255,215,85,85,255,255
   , 255,253,253,253,253,246,246,218
   , 191,255,255,255,255,255,223,223
   , 255,255,255,255,255,255,255,255
   , 240,244,252,253,255,255,255,255
   , 0,0,0,0,0,64,192,192
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0 

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 11,7,15,31,31,63,191,127
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 240,252,252,252,252,252,252,252
   , 127,127,127,127,127,127,127,127
   , 255,255,255,255,255,255,255,255
   , 80,87,245,255,255,255,255,255
   , 63,195,252,255,255,255,255,255
   , 21,20,0,252,255,255,255,255
   , 12,60,48,48,48,240,255,255
   , 0,0,0,0,0,0,192,255
   , 16,3,3,15,12,12,12,204
   , 240,192,0,0,0,0,0,0
   , 1,0,240,60,12,0,0,0
   , 255,255,63,15,15,3,60,255
   , 255,255,255,255,255,255,255,63
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,252,252
   , 79,79,79,63,63,63,255,255
   , 252,240,241,241,241,193,200,200
   , 79,79,79,79,15,63,63,255
   , 127,127,127,127,127,127,127,159
   , 255,95,95,95,95,255,255,255
   , 229,229,229,229,234,255,255,255
   , 95,255,255,255,191,111,111,111
   , 255,95,95,95,127,255,255,255
   , 255,255,255,255,255,255,255,255
   , 208,240,248,244,252,254,253,253
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0 

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,2,1,1,3,3,11
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,252
   , 252,255,255,252,241,5,22,26
   , 63,63,127,127,127,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 240,255,255,255,255,255,255,255
   , 0,255,255,255,255,255,255,255
   , 255,92,220,244,240,242,242,194
   , 10,21,85,85,127,255,255,255
   , 170,85,85,95,255,255,255,255
   , 168,88,84,213,245,253,255,255
   , 255,255,255,255,255,127,95,87
   , 196,8,35,19,19,19,35,3
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 0,128,64,64,192,192,224,208
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0 

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 7,7,11,15,15,15,15,15
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,252,240,241,241,242
   , 160,129,5,23,95,127,255,255
   , 95,127,255,255,255,255,255,255
   , 255,255,255,254,255,252,252,193
   , 255,235,171,175,255,5,85,85
   , 255,255,255,255,63,3,80,85
   , 255,255,255,255,255,255,255,207
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 70,78,79,15,63,63,63,63
   , 255,255,255,255,127,127,127,95
   , 255,255,255,252,252,240,241,240
   , 0,4,16,16,0,5,63,255
   , 0,0,128,0,1,253,253,125
   , 79,79,79,207,15,63,63,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 208,208,240,240,240,240,248,248
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 31,31,31,31,31,31,31,31
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 240,252,255,255,255,255,255,255
   , 85,21,0,255,255,255,255,255
   , 80,3,63,255,255,255,255,255
   , 63,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 193,240,252,255,255,255,255,252
   , 255,255,255,15,79,79,63,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,252,252,252
   , 63,63,63,60,49,49,241,241
   , 95,95,0,60,255,255,255,255
   , 240,240,80,0,255,255,255,255
   , 127,127,127,127,255,255,255,255
   , 92,220,245,244,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 248,248,244,244,244,244,248,248
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 15,15,15,15,15,11,7,7
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,253,253,249,217
   , 85,89,121,187,251,251,191,255
   , 255,255,255,255,255,127,95,159
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,252,252,241,245
   , 83,79,79,63,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,253,253,245,245,245,213,85
   , 85,253,253,253,253,253,245,213
   , 252,252,252,252,252,252,240,5
   , 241,252,255,255,255,255,255,15
   , 85,85,10,192,255,255,255,255
   , 85,90,160,0,0,192,252,255
   , 130,4,4,12,192,252,0,20
   , 252,252,252,252,252,244,244,20
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,253,253
   , 255,255,255,251,214,85,117,85
   , 255,255,255,255,255,255,191,95
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 248,248,240,240,240,240,208,208
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0        

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 7,3,3,3,2,1,0,0
   , 255,255,255,255,255,255,255,255
   , 255,255,247,246,246,231,214,245
   , 255,119,119,255,183,231,235,255
   , 215,122,255,255,219,191,255,223
   , 255,255,183,127,223,251,127,127
   , 255,255,255,191,127,95,95,95
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,252,252,240,197,197,213
   , 79,63,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,253,253,245,85
   , 87,95,127,255,255,245,213,85
   , 85,87,95,127,255,252,242,202
   , 84,83,79,63,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 197,193,240,252,255,255,255,255
   , 191,191,175,47,3,80,85,85
   , 255,255,255,255,252,0,85,85
   , 87,84,80,65,7,255,255,255
   , 52,52,23,23,55,55,63,63
   , 255,255,63,63,63,15,79,79
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,253,249,253
   , 167,183,191,119,119,119,127,119
   , 255,215,154,123,251,247,183,119
   , 118,254,119,255,255,247,255,253
   , 255,255,255,127,95,95,95,95
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 208,224,192,192,64,64,128,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0           

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 127,127,63,47,31,15,11,7
   , 237,253,222,237,253,223,157,245
   , 231,215,239,255,223,223,254,237
   , 91,222,223,223,95,223,223,223
   , 127,119,127,191,123,119,125,127
   , 250,250,246,246,245,245,245,245
   , 255,255,255,175,87,103,213,85
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,252,253,241,193,197,21,21
   , 63,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,253,213,85,95
   , 253,245,213,85,87,95,127,255
   , 87,95,95,127,252,252,194,42
   , 85,84,83,79,63,255,255,255
   , 63,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 79,79,75,75,75,75,75,74
   , 143,143,143,79,79,79,79,79
   , 255,255,255,255,255,255,255,255
   , 127,123,111,127,127,127,123,127
   , 119,255,119,119,119,127,119,119
   , 247,214,103,119,247,231,119,119
   , 255,255,189,237,213,253,253,223
   , 255,215,250,253,237,253,189,237
   , 170,174,158,221,221,213,221,255
   , 255,254,254,252,120,120,80,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
   , 3,1,2,0,0,0,0,0
   , 245,127,117,117,183,63,39,11
   , 223,223,253,237,221,239,253,221
   , 87,221,223,223,95,223,223,223
   , 247,247,191,87,247,245,253,127
   , 111,111,95,95,95,95,159,175
   , 223,127,254,223,255,255,87,187
   , 127,127,111,95,159,111,95,111
   , 255,255,255,255,255,255,255,255
   , 255,255,252,252,252,252,252,255
   , 63,63,255,255,255,255,255,15
   , 255,255,255,255,255,255,255,255
   , 253,245,247,255,255,255,252,242
   , 191,255,255,252,241,197,21,85
   , 84,83,79,63,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 241,241,252,255,255,255,255,255
   , 79,143,15,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 123,123,127,127,123,127,127,123
   , 255,127,119,119,127,127,118,251
   , 157,175,253,221,221,222,253,217
   , 221,223,95,215,222,255,223,255
   , 249,253,253,249,255,111,230,249
   , 213,214,247,230,245,252,244,240
   , 64,128,192,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0          

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 7,3,2,0,0,0,0,0
   , 93,159,191,253,45,29,15,1
   , 95,87,221,239,239,111,107,191
   , 247,247,247,183,215,249,245,247
   , 111,95,159,95,95,95,223,191
   , 255,219,251,251,215,118,247,247
   , 159,95,111,95,95,95,223,111
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 197,240,255,255,255,255,255,255
   , 85,0,255,255,255,255,255,255
   , 15,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,253,249
   , 169,173,189,189,253,253,253,253
   , 255,127,127,91,107,89,155,233
   , 255,255,255,255,255,127,127,111
   , 123,127,127,123,127,127,127,123
   , 191,127,117,181,127,127,125,250
   , 213,218,239,249,213,214,215,223
   , 255,255,111,215,249,255,255,255
   , 247,119,119,127,126,92,248,224
   , 224,192,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,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 3,0,0,0,0,0,0,0
   , 255,255,159,37,13,3,0,0
   , 247,251,247,247,183,103,250,247
   , 95,159,223,175,95,159,219,247
   , 254,93,93,254,221,93,93,253
   , 95,95,111,95,155,171,111,95
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,254,253,245,245,213
   , 247,247,117,255,127,122,223,255
   , 234,122,122,118,119,127,247,117
   , 255,255,255,255,255,127,191,103
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,253,249
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,253
   , 95,127,127,238,255,251,255,255
   , 237,253,126,255,223,253,254,215
   , 125,93,223,125,93,159,253,125
   , 223,239,221,215,247,255,231,119
   , 95,95,159,223,223,223,255,251
   , 251,123,126,117,254,127,127,126
   , 247,215,215,215,255,247,215,214
   , 247,255,254,124,112,192,128,0
   , 192,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0     

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 57,13,3,0,0,0,0,0
   , 253,125,125,189,45,9,2,0
   , 187,247,86,103,187,123,87,251
   , 237,233,253,253,173,249,253,189
   , 255,255,255,255,255,255,255,255
   , 255,255,253,253,253,253,253,250
   , 255,253,247,119,255,255,191,119
   , 189,189,253,253,189,249,237,189
   , 126,123,117,125,127,253,125,110
   , 223,221,222,254,221,223,223,221
   , 255,255,255,255,255,255,127,127
   , 255,255,255,255,254,246,245,230
   , 246,215,215,246,215,219,255,247
   , 213,229,245,253,255,255,191,255
   , 255,255,255,255,255,255,127,95
   , 255,255,255,255,255,255,255,255
   , 255,255,255,255,255,255,255,255
   , 255,255,253,253,245,245,213,150
   , 171,235,95,223,127,95,223,127
   , 127,255,253,253,247,239,125,255
   , 239,127,221,223,223,223,222,219
   , 95,223,237,223,223,223,255,239
   , 187,247,183,127,187,247,118,127
   , 127,127,255,127,127,255,255,175
   , 254,251,123,125,180,208,64,0
   , 228,208,128,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0           
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 15,1,0,0,0,0,0,0
   , 254,214,22,14,0,0,0,0
   , 254,246,246,214,214,22,1,0
   , 253,125,126,125,125,255,126,125
   , 255,119,123,215,119,191,123,119
   , 189,253,253,189,253,245,221,189
   , 95,253,125,95,93,253,125,95
   , 219,215,255,223,215,183,255,247
   , 127,125,190,255,117,118,182,117
   , 221,223,222,221,253,223,221,157
   , 215,215,247,231,215,239,247,231
   , 255,255,255,255,255,127,239,247
   , 245,253,253,253,239,255,251,255
   , 255,255,255,255,255,255,254,125
   , 255,255,255,255,255,255,255,255
   , 247,255,253,255,254,118,221,254
   , 95,223,127,94,239,127,95,95
   , 223,255,254,247,239,95,253,255
   , 239,111,223,223,223,223,255,255
   , 219,215,215,239,215,212,128,0
   , 246,245,124,144,64,0,0,0
   , 112,192,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0 

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 13,0,0,0,0,0,0,0
   , 239,94,1,0,0,0,0,0
   , 126,254,253,13,0,0,0,0
   , 93,221,127,95,173,0,0,0
   , 247,123,191,183,247,87,0,0
   , 253,149,127,255,249,127,42,0
   , 239,223,93,189,223,93,93,0
   , 215,223,247,215,215,223,255,170
   , 251,255,255,251,255,255,255,85
   , 255,117,191,247,245,127,255,0
   , 247,251,246,247,255,245,84,0
   , 213,245,245,254,190,239,0,0
   , 185,253,253,245,239,0,0,0
   , 191,175,93,216,0,0,0,0
   , 255,246,96,0,0,0,0,0
   , 112,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0         

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0         

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0           

   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0         


};

static const unsigned char ColorA[1000]={
   
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,34,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,23,121,137,137,137,137,119,153,153,119,129,136,152,154,152,153,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,119,152,137,154,121,34,17,119,119,119,17,153,153,17,0,17,119,119,154,137,137,138,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,152,153,121,17,0,34,34,34,39,119,119,17,119,121,119,17,0,17,17,119,17,17,119,153,137,136,0,0,0,0,0,0,0
   , 0,0,0,0,0,136,152,153,119,17,119,120,114,34,23,18,17,119,17,17,119,119,17,17,17,17,17,17,119,119,119,119,153,152,119,0,0,0,0,0
   , 0,0,0,0,137,152,119,119,119,17,17,17,114,119,119,119,119,119,119,119,119,119,119,119,178,183,187,119,17,17,119,33,119,119,137,136,0,0,0,0
   , 0,0,0,137,137,119,119,119,119,119,119,119,119,187,122,178,43,119,34,17,17,34,43,123,187,34,34,119,119,119,23,119,22,113,119,136,153,0,0,0
   , 0,0,0,137,119,119,119,119,119,119,119,119,119,187,34,170,34,119,34,34,17,34,34,34,34,34,34,34,241,255,23,119,97,113,102,119,137,0,0,0
   , 0,0,137,119,119,119,119,119,119,119,119,119,178,187,34,34,34,34,34,34,34,34,34,161,242,242,242,255,31,119,119,119,119,119,119,119,119,137,0,0
   , 0,0,138,119,119,119,119,119,119,119,178,183,187,122,122,119,34,34,34,34,34,34,34,33,255,204,187,252,17,119,119,119,119,119,119,119,119,137,0,0
   , 0,0,153,119,119,119,119,119,119,119,119,34,34,119,119,119,34,119,34,34,34,34,34,17,255,255,255,255,119,119,119,119,119,119,119,119,119,137,0,0
   , 0,0,138,119,119,31,113,253,119,119,119,119,119,119,119,34,119,34,34,34,170,34,119,17,31,31,177,255,119,119,119,17,253,253,119,119,119,137,0,0
   , 0,0,152,119,29,253,29,209,253,119,119,119,119,119,34,119,34,34,170,34,167,34,119,255,127,119,204,255,255,119,29,247,29,215,255,119,119,137,0,0
   , 0,0,0,138,253,253,29,209,23,241,119,119,119,34,34,34,170,170,167,34,119,119,119,119,119,119,119,127,31,119,125,255,29,209,29,247,249,0,0,0
   , 0,0,0,171,252,253,17,209,253,29,253,119,119,34,34,167,122,34,119,119,119,119,119,119,119,119,119,255,31,119,127,253,253,209,29,253,223,0,0,0
   , 0,0,0,0,188,253,29,209,253,29,253,119,119,34,34,119,119,119,119,119,119,119,119,119,119,119,253,23,241,31,127,253,253,29,219,207,0,0,0,0
   , 0,0,0,0,0,204,28,209,253,253,253,119,119,253,209,247,31,119,119,29,119,119,119,119,119,221,125,209,253,253,125,253,252,219,255,0,0,0,0,0
   , 0,0,0,0,0,0,0,253,28,29,125,119,241,209,29,253,253,17,31,253,125,255,119,119,253,247,209,209,253,253,253,253,207,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,187,215,253,253,209,29,255,253,31,253,253,209,125,209,119,209,253,209,209,253,253,17,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,255,191,209,252,253,223,253,251,189,209,253,125,29,223,203,255,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};
static const unsigned char ColorB[1000]={
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,2,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,2,1,7,7,7,7,7,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,8,7,7,7,2,7,7,7,7,7,7,7,7,7,0,7,7,7,7,7,7,7,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,7,7,1,7,0,7,2,2,1,1,7,1,1,1,7,7,0,7,7,7,7,7,7,7,7,7,0,0,0,0,0,0,0
   , 0,0,0,0,0,8,7,7,7,7,7,1,11,2,2,7,7,7,7,7,7,7,7,7,7,7,7,1,1,1,7,7,7,7,7,0,0,0,0,0
   , 0,0,0,0,7,7,7,7,7,7,7,7,11,2,7,7,7,7,7,7,7,7,7,7,7,2,2,2,7,7,7,7,7,7,7,7,0,0,0,0
   , 0,0,0,7,7,7,7,7,7,7,7,7,11,2,2,7,7,7,7,7,7,7,7,2,2,2,2,2,7,7,2,2,7,6,7,7,7,0,0,0
   , 0,0,0,7,7,7,7,7,7,7,7,7,7,2,2,2,2,2,2,2,2,2,1,2,2,2,2,7,7,7,2,2,7,6,7,7,7,0,0,0
   , 0,0,7,7,7,7,7,7,7,7,7,7,7,2,2,2,2,2,2,2,2,2,2,2,1,1,1,7,7,7,7,7,7,7,7,7,7,7,0,0
   , 0,0,7,7,7,7,7,7,7,7,7,2,2,2,2,2,2,2,2,2,2,2,2,15,1,1,15,1,7,7,7,7,7,7,7,7,7,7,0,0
   , 0,0,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,2,2,2,2,2,2,15,1,1,1,1,7,7,7,7,7,7,7,7,7,7,0,0
   , 0,0,7,7,7,7,15,7,7,7,7,7,7,7,7,7,2,2,2,2,2,10,2,15,12,12,12,12,7,7,7,7,7,7,7,7,7,7,0,0
   , 0,0,7,7,7,1,15,15,7,7,7,7,7,7,7,2,2,2,2,10,2,7,7,7,12,12,7,1,7,7,7,1,15,15,7,7,7,7,0,0
   , 0,0,0,7,1,1,15,15,15,7,7,7,7,7,2,2,2,2,2,7,7,7,7,7,7,7,7,1,7,7,1,1,15,15,15,1,7,0,0,0
   , 0,0,0,7,1,1,15,15,1,15,7,7,7,2,2,2,2,7,7,7,7,7,7,7,7,7,7,7,7,7,1,1,1,15,15,1,11,0,0,0
   , 0,0,0,0,1,1,15,15,1,15,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,15,7,7,1,1,1,15,15,1,0,0,0,0
   , 0,0,0,0,0,12,15,15,1,1,7,7,7,7,15,1,7,7,7,7,7,7,7,7,7,7,15,15,1,1,1,1,1,15,15,0,0,0,0,0
   , 0,0,0,0,0,0,0,11,15,15,1,7,7,15,15,1,1,7,7,1,15,7,7,7,7,1,15,15,1,1,1,1,1,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,15,15,7,1,15,15,1,1,7,1,1,15,15,7,7,15,1,15,15,1,1,15,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,11,13,15,1,1,1,1,1,15,15,1,15,15,1,15,11,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
   , 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
};

static const unsigned char txt[344]={
   12,51,51,51,51,51,51,12,   60,12,12,12,12,12,12,63,   63,63,3,63,63,48,63,63,    63,3,3,15,15,3,3,63,       48,51,51,63,63,3,3,3,
   63,48,48,63,3,3,63,63,     63,51,48,48,63,51,51,63,   63,3,15,15,60,48,48,48,    63,51,51,63,63,51,51,63,   63,51,51,63,3,3,3,63,
   0,0,12,0,0,12,0,0,         0,0,12,0,0,12,48,0,        0,0,3,12,48,12,3,0,        0,0,0,60,0,60,0,0,         0,0,48,12,3,12,48,0,
   12,51,3,3,12,12,0,12,      0,0,0,0,0,0,0,0,           12,51,51,51,63,51,51,51,   60,51,51,60,60,51,51,60,   63,51,48,48,48,48,51,63,
   60,51,51,51,51,51,51,60,   63,48,48,60,60,48,48,63,   63,48,48,60,60,48,48,48,   63,48,48,48,48,51,51,63,   51,51,51,63,51,51,51,51,
   63,12,12,12,12,12,12,63,   63,3,3,3,3,3,51,63,        51,51,51,60,60,60,51,51,   48,48,48,48,48,48,48,63,   51,63,51,51,51,51,51,51,
   63,51,51,51,51,51,51,51,   12,51,51,51,51,51,51,12,   60,51,51,51,60,48,48,48,   12,51,51,51,51,51,63,15,   60,51,51,60,60,51,51,51,
   15,60,48,63,3,3,15,60,     63,12,12,12,12,12,12,12,   51,51,51,51,51,51,51,63,   51,51,51,51,51,51,12,12,   51,51,51,51,51,51,63,51,
   51,51,51,12,12,51,51,51,   51,51,51,63,12,12,12,12,   63,3,3,12,12,48,48,63
};

static const unsigned char Avion0[63]={
 80,0,0,80,0,0,84,0,0,20,0,0,42,0,0,21,84,0,21,65,
 0,42,130,3,42,170,131,21,85,83,85,85,92,85,85,95,15,255,252,7,
 119,115,3,119,115,0,221,195,0,0,0,0,0,0,0,0,0,0,0,0,
 0,0,0
};
 
 static const unsigned char Avion1[63]={
80,0,0,80,0,0,84,0,0,20,0,0,42,0,0,21,84,0,21,65,
0,42,130,0,42,170,128,21,85,80,85,85,92,85,85,95,15,255,252,7,
119,112,3,119,112,0,221,192,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0
};

static const unsigned char Bomba0[63]={
10,0,0,8,0,0,3,0,0,12,0,0,20,0,0,85,0,0,85,0,
0,85,0,0,93,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0
};

static const unsigned char Bomba1[63]={
32,0,0,2,0,0,11,0,0,14,0,0,20,0,0,85,0,0,85,0,
0,85,0,0,93,0,0,20,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0
};

static const unsigned char Bomba2[63]={
20,0,0,21,0,0,102,0,0,153,0,0,104,0,0,169,0,0,123,0,
0,189,0,0,190,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0
};

static const unsigned char Bomba3[63]={
16,0,0,21,0,0,170,0,0,89,0,0,100,0,0,101,0,0,170,0,
0,185,0,0,190,0,0,60,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0
};

   
static const unsigned char casa[8] = {171,87,171,87,171,87,171,87};
static const unsigned char Copete1[8] = {16,20,84,85,171,87,171,87};
static const unsigned char Copete2[8] = {4,20,85,85,171,87,171,87};
static const unsigned char Copete3[8] = {4,4,4,4,4,43,171,87};
static const unsigned char Copete4[8] = {4,4,4,20,21,85,171,87};
static const unsigned char carretera[8] = {255,255,170,170,165,170,170,170};
static const unsigned char dummy[8] = {0,0,0,0,0,0,0,0};
static const unsigned char Pwup1[8] = {0,0,0,104,98,104,96,0};
static const unsigned char Pwup2[8] = {106,98,106,0,98,98,106,98};
unsigned char Background[6] = {COLOR_BLUE,COLOR_GREEN,COLOR_YELLOW,COLOR_ORANGE,COLOR_RED,COLOR_BLACK};



#pragma staticlocals (1);

struct Notas{int nota;unsigned char dur;}
Tema[98]={
    {D5,10},{E5,10},{C5,10},{A4,20},{B4,10},{G4,20},{D4,10},
	{E4,10},{C4,10},{A3,20},{B3,10},{G3,20},{D3,10},{E3,10},
	{C3,10},{A2,20},{B2,10},{A2,10},{GB2,10},{G2,40},{G4,60},
	{D4,10},{DB4,10},{E4,10},{C5,20},{E4,10},{C5,20},{E4,10},
	{C5,50},{C5,10},{D5,10},{DB5,10},{E5,10},{C5,10},{D5,10},
	{E5,20},{B4,10},{D5,20},{C5,60},{D4,10},{DB4,10},{E4,10},
	{C5,20},{E4,10},{C5,20},{E4,10},{C5,50},{A4,10},{G4,10},
	{FB4,10},{A4,10},{C5,10},{E5,20},{D5,10},{C5,10},{A4,10},
	{D5,60},{D4,10},{DB4,10},{E4,10},{C5,20},{E4,10},{C5,20},
	{E4,10},{C5,50},{C5,10},{D5,10},{DB5,10},{E5,10},{C5,10},
	{D5,10},{E5,20},{B4,10},{D5,20},{C5,60},{C5,10},{D5,10},
	{E5,10},{C5,10},{D5,10},{E5,20},{C5,10},{D5,10},{C5,10},
	{E5,10},{C5,10},{D5,10},{E5,20},{C5,10},{D5,10},{C5,10},
	{E5,10},{C5,10},{D5,10},{E5,20},{B4,10},{D5,20},{C5,250},
		
},

FinPantalla[10]={
	
    {C5,10},{D5,10},{DB5,10},{E5,10},{C5,10},{D5,10},
	{E5,20},{B4,10},{D5,20},{C5,60}
};


struct Sprite{
	unsigned char* Pointer;
	unsigned char* Addr;
    unsigned char Frame;
	unsigned char Color;
	unsigned char Offset;
	int X;
	int Y;
	int Atime;
	int Rtime;
	unsigned char Colide;
}Avion,Bomba;

struct CtrlGame
{
	unsigned char* AddrCasa;
	unsigned char HayCasa;
	int Destruida;
	
}StatCasas[40];

struct CtrlPowerUp
{
	unsigned char Pintado;
	unsigned char Activo;
}PowerUp;


int Score=0;
int HiScore=0;
char BufferItoa[6];
unsigned char tecla;
unsigned char CheckSum=0;
unsigned char Level=1;
unsigned char Dummycont=0;
unsigned char HayBomba=FALSE;
static unsigned char done=TRUE;
int Altura=7;
unsigned char speed=1;
unsigned char sw=0;
int MAsync;
int MRsync;
static unsigned char PunTema;
unsigned char fondo;


static void PintaPortada(){
	
unsigned char* scrn=(unsigned char*)SCREEN1;
memcpy ((unsigned char*)SCREEN1,Portada,8000);
memcpy ((unsigned char*)ADDR_RAM_PANTALLA,ColorA,1000);
memcpy ((unsigned char*)ADDR_RAM_COLOR,ColorB,1000);
}
    
static void IniciaModo()
{
	 unsigned char banco;
			
	 banco = inb (&CIA2.pra);                                        // REGISTRO DE CONTROL "PRA" DEL CHIP" CIA2" BITS 1 Y 2
	 outb (&CIA2.pra, (banco & 0xFC) | ((SCREEN1 >> 14) ^ 0x03));   //  A 0, ACTIVA EL BANCO DE VIDEO EN 49152 (BANCO 3)
	 outb (&VIC.ctrl1, (VIC.ctrl1|32));
	 outb (&VIC.ctrl2, (VIC.ctrl2|16));
	 outb (&VIC.addr, 0x0a);
}
  unsigned char* PintaTile (const unsigned char tile[8],unsigned char x,unsigned char y,unsigned char c1,unsigned char c2)
{	 
	 unsigned char* scrn=(unsigned char*)SCREEN1;
	 unsigned char* color11=(unsigned char*)ADDR_RAM_COLOR;
	 unsigned char* color0110=(unsigned char*)ADDR_RAM_PANTALLA;
	 	
	 color11=color11+x+(40*y);
	 color0110=color0110+x+(40*y);
	 *color11=c1;
	 *color0110=c2;
	 scrn=scrn+(x*8)+(320*y);
	 memcpy(scrn,tile,8);
	 return scrn;
}

static void SoundTema(){
	
	MAsync=clock();
	MRsync=clock()-MAsync;
	outb (&SID.v1.ad,0x1b);
	outb (&SID.v1.ctrl,0x20);
	outb (&SID.v1.ctrl,0x11);
	outw(&SID.v1.freq,Tema[PunTema].nota);
	while (MRsync<Tema[PunTema].dur){
			MRsync=clock()-MAsync;
	}
	if(PunTema<98){
	++PunTema;
	bordercolor(PunTema);
	}else{ PunTema=0;}
	
}

static void SoundFinpantalla(){
	int i;
	MAsync=clock();
	MRsync=clock()-MAsync;
	outb (&SID.v1.ad,0x1b);
	
	for (i=0;i<10;++i){
		outb (&SID.v1.ctrl,0x20);
		outb (&SID.v1.ctrl,0x11);
		outw(&SID.v1.freq,FinPantalla[i].nota);
			while (MRsync<FinPantalla[i].dur){
			MRsync=clock()-MAsync;
			}
			MAsync=clock();
			MRsync=clock()-MAsync;
	}
			
}

static void SoundBomba(int i){
	
	outb (&SID.v1.ad,0x13);
	outb (&SID.v1.ctrl,0x20);
	outb (&SID.v1.ctrl,0x11);
	outw(&SID.v1.freq,i);
	
	
}

static void SoundExplo(){
	
	outb (&SID.v2.ctrl,0x20);
	outb (&SID.v2.ctrl,0x81);
	outw (&SID.v2.freq,0x400);
	
}
static void SoundPow(){
	outb (&SID.v2.ctrl,0x20);
	outb (&SID.v2.ctrl,0x21);
	outw (&SID.v2.freq,0xaa00);
}
static void SoundAvion(){
	outb (&SID.v3.ctrl,0x20);
	outb (&SID.v3.ctrl,0x21);
	outw (&SID.v3.freq,0x2000);
}

static void PintaTexto(unsigned char x, unsigned char y, unsigned char color,char texto[])
{
	unsigned char* scrn=(unsigned char*)SCREEN1;
	unsigned char* color11=(unsigned char*)ADDR_RAM_COLOR;
	unsigned char* color0110=(unsigned char*)ADDR_RAM_PANTALLA;
	unsigned char i;
	int indice;
	
	color11=color11+x+(40*y);
	scrn=scrn+(x*8)+(320*y);
	 for (i=0;i<strlen(texto);++i,++color11){
		 *color11=color;
		 indice=texto[i];
		 indice=(indice-48)*8;
		 memcpy(scrn,txt+indice,8);
		 scrn=scrn+8;
	}
}


static void PintaPantalla()
{
     unsigned char x,y,i,ii;
	 unsigned char color1,color2,n,nn;
	 int alt;
			
	 PintaTexto(0,0,COLOR_LIGHTRED,"score:");
	 PintaTexto(27,0,COLOR_LIGHTRED,"hi@score:");
	 PintaTexto(36,0,COLOR_WHITE,itoa(HiScore,BufferItoa,10));
	 y=24;
	 x=0;
	 for (i=0;i<40;++i,++x){
	     color1=0x0f;
	     color2=0x1b;
		 PintaTile (carretera,x,y,color1,color2);
		  }
	 x=0;
	 y=23;
     for (i=0;i<40;++i,++x){
		 n=(rand()&0x03);
			 switch (n)
			     {case 0:
				 color1=0x05;
				 color2=0x1d;
				 break;
			     case 1:
				 color1=0x0b;
				 color2=0x1f;
				 break;
				 case 2:
				 color1=0x02;
				 color2=0x1a;  
				 break;
				 case 3:
				 color1=0x06;
				 color2=0x13;
				 break;
			 }
			  
		 alt=rand()%Altura;
		 
		 
		 for (ii=0 ;ii<alt;++ii,y--){
			 			 
			 PintaTile (casa,x,y,color1,color2);
			 
			 }
		
		 if (alt !=0){	
            CheckSum++;
			//PintaTexto(23,0,COLOR_WHITE,itoa(CheckSum,BufferItoa,10));
			StatCasas[i].HayCasa=TRUE;
			StatCasas[i].AddrCasa=PintaTile (Copete4,x,y,color1,color2);
		    nn=(rand()%3);
			
			 switch (nn){
				 case 0:
				       StatCasas[i].AddrCasa=PintaTile (Copete1,x,y,color1,color2);
				       break;
			     case 1:
				       StatCasas[i].AddrCasa=PintaTile (Copete2,x,y,color1,color2);
				       break;
				 case 2:
				       StatCasas[i].AddrCasa=PintaTile (Copete3,x,y,color1,color2);
				       break;
				 case 3:
				       StatCasas[i].AddrCasa=PintaTile (Copete4,x,y,color1,color2);
				       break;
				 case 4:
				       StatCasas[i].AddrCasa=PintaTile (Copete4,x,y,color1,color2);
				       break;
			
			    }
		    y=23;
		 }else{StatCasas[i].HayCasa=FALSE;}
		 
		 
	 }
	 
}		
static void LimpiaPantalla () 
{	
	int i;
	unsigned char* screen1=(unsigned char*)SCREEN1;
	unsigned char* color11=(unsigned char*)ADDR_RAM_COLOR;
	unsigned char* color0110=(unsigned char*)ADDR_RAM_PANTALLA;
	  bgcolor (COLOR_BLACK);
	 
	 for (i=0; i<1024;++i,++color11){
		 outb(color11,0x00);
	 }
	 
	 for (i=0; i<1024;++i,++color0110){
		 outb(color0110,0x00);
	 }
	 for (i=0; i<8000;++i,++screen1){
		 
		 outb(screen1,0x00);
	 }
}
static void MueveAvion()
{
     if (Avion.Rtime>=speed){
		 //SoundAvion();
		 outb(Avion.Pointer,((0x10)+Avion.Frame));
         if (Avion.X>255){
				outb(&VIC.spr_hi_x,VIC.spr_hi_x | 0x01);
		 }
		if (Avion.X>338){
				Avion.X=0;
			    Avion.Y=Avion.Y+8;
				outb(&VIC.spr_hi_x, VIC.spr_hi_x & 0xfe);
		 }
		 outb (&VIC.spr0_x,Avion.X);outb(&VIC.spr0_y,Avion.Y);
		 if((VIC.spr_bg_coll & 0x01) && StatCasas[(Avion.X)/8].HayCasa ){Avion.Colide=1;}
		 ++Avion.X;
		 Avion.Frame=++Avion.Frame%2;		     
		 Avion.Atime=clock();
	 }
}
static void TiraBomba(){
	if (!HayBomba & Avion.X>=24){
		sw=0;
		Bomba.X=Avion.X-(Avion.X%8);Bomba.Y=Avion.Y+10;
		if (Bomba.X>255){outb(&VIC.spr_hi_x,VIC.spr_hi_x | 0x02);}else{outb(&VIC.spr_hi_x,VIC.spr_hi_x & 0xfd);}
		outb (&VIC.spr1_x,Bomba.X);outb(&VIC.spr1_y,Bomba.Y);
		outb(Bomba.Pointer,0x12);
		HayBomba=TRUE;
		
	}
}
static void FinBomba(){
Bomba.X=0;Bomba.Y=0;
outb (&VIC.spr1_x,Bomba.X);outb(&VIC.spr1_y,Bomba.Y);
outb(Bomba.Pointer,(Bomba.Offset+ Bomba.Frame));
Dummycont=0;
Bomba.Offset=0x12;
HayBomba=FALSE;

}

static void MueveBomba()
{
unsigned char* PuntBorrado;

int n=0;

int freq=0xff00;

	 if (Bomba.Rtime >=1){
		 freq=freq-(Bomba.Y*128);
		 if (sw==0){SoundBomba(freq);}
		 
		 
		 outb (&VIC.spr1_x,Bomba.X);outb(&VIC.spr1_y,Bomba.Y);
		 outb (Bomba.Pointer,(Bomba.Offset+ Bomba.Frame ));
		 if (VIC.spr_bg_coll & 0x02){
			 
            if (!StatCasas[(Bomba.X-24)/8].HayCasa)
			{
				SoundPow();
				Avion.Y=Avion.Y-8;
				PowerUp.Pintado=FALSE;
				PintaTile(dummy,(Bomba.X-24)/8,22,0x00,0x00);
				PintaTile(dummy,(Bomba.X-24)/8,23,0x00,0x00);
				
			}else{
			SoundExplo();
			sw=1;
			PuntBorrado=StatCasas[(Bomba.X-24)/8].AddrCasa;
			memcpy(PuntBorrado+(320*Dummycont),dummy,8);
			Bomba.Offset=0x14;
			++Dummycont;
			Score++; }
		 } 
		  if (Bomba.Y>232){
			 if ((StatCasas[(Bomba.X-24)/8].HayCasa)){
				 CheckSum--;
				 //PintaTexto(20,0,COLOR_WHITE,"@@");
	 
				 //PintaTexto(20,0,COLOR_WHITE,itoa(CheckSum,BufferItoa,10));
	 
				 
				StatCasas[(Bomba.X-24)/8].HayCasa=FALSE;
			    n=(rand()%10);
									
				if (n<1){
					
					PintaTile(Pwup1,(Bomba.X-24)/8,22,0x05,0x24);
					PintaTile(Pwup2,(Bomba.X-24)/8,23,0x05,0x24);
					PowerUp.Pintado=TRUE;
				}
			 }
			FinBomba();
	     } 
		Bomba.Y++;
		Bomba.Frame=++Bomba.Frame%2;
	    Bomba.Atime=clock();
   	 }
}
static void ResetGame()
{
	Avion.Pointer=(unsigned char *)0xc3f8;
	Avion.Addr=(unsigned char*)0xc400;
	Avion.Frame=2;
	Avion.Color=COLOR_LIGHTRED;
	Avion.X=0;
	Avion.Y=58;
	Avion.Offset=0x10;
	Avion.Atime=clock();
	Avion.Colide=0;
	Bomba.Pointer=(unsigned char *)0xc3f9;
    Bomba.Addr=(unsigned char*)0xc480;
	Bomba.Frame=2;
	Bomba.Color=COLOR_YELLOW;
	Bomba.X=0;
	Bomba.Y=0;
	Bomba.Offset=0x12;
	Bomba.Atime=clock();
	HayBomba=FALSE;
	tecla=89;
	PunTema=0;
	
	Dummycont=0;
    CheckSum=0;
	VIC.spr_bg_coll & 0x03;
	outb(&VIC.spr_hi_x, 0X00);
	outb (&SID.amp,0xf);
	outb (&SID.v1.ad,0x05);
	outb (&SID.v1.sr,0x00);
	outb (&SID.v2.ad,0x09);
	outb (&SID.v2.sr,0x00);
}
static void Gameloop()
{
	unsigned char BufferStr[20];
	unsigned char tecla;	
	LimpiaPantalla();
	PintaPantalla();
	strcat(BufferStr,"entering@level@");
	strcat(BufferStr,itoa(Level,BufferItoa,10));
	PintaTexto(9,0,COLOR_GREEN,BufferStr);
	memset(BufferStr,0,20);
	sleep(2);
	PintaTexto(9,0,COLOR_BLACK,"@@@@@@@@@@@@@@@@@");
	while (!Avion.Colide && CheckSum !=0){//(Avion.X<320 || Avion.Y<225)){	
			Avion.Rtime=clock()-Avion.Atime;
			Bomba.Rtime=clock()-Bomba.Atime;
			MueveAvion();
			PintaTexto(6,0,COLOR_WHITE,itoa(Score,BufferItoa,10));
			if (kbhit()){
				tecla=cgetc();
				if (tecla==32){	TiraBomba();}
			}
			if (HayBomba){MueveBomba();}
	}
	//if (Avion.X>310 && Avion.Y>220){
		if (CheckSum==0){
		done=TRUE;
		PintaTexto(15,12,COLOR_WHITE,"well@done");
		SoundFinpantalla();
		}else{done=FALSE;}
	}
static void Activasprites()
{
	//DATOS SPRITES GENERAL
	outb(&VIC.spr_mcolor,VIC.spr_mcolor|0x03);//ACTIVA SPRITES MULTICOLOR
	outb (&VIC.spr_ena,(VIC.spr_ena| 0x03));//ACTIVA LOS SPRITES 
	
    outb(&VIC.spr_mcolor0,COLOR_RED);
	outb(&VIC.spr_mcolor1,COLOR_WHITE);
	
	//DATOS SPRITE AVION
	outb(&VIC.spr0_color,Avion.Color);
	memcpy(Avion.Addr,Avion0,63);
	memcpy(Avion.Addr+64,Avion1,63);
    //DATOS SPRITE BOMBA
	outb(&VIC.spr1_color,COLOR_YELLOW);
	memcpy(Bomba.Addr,Bomba0,63);
	memcpy(Bomba.Addr+64,Bomba1,63);
	memcpy(Bomba.Addr+128,Bomba2,63);
	memcpy(Bomba.Addr+192,Bomba3,63);
}


static void Intro()
{
	done=1;Score=0;Altura=5;Level=1;PowerUp.Pintado=FALSE;speed=1;fondo=0;
	LimpiaPantalla();
	PintaPortada();
	 PintaTexto(9,1,COLOR_GREEN,"picaro@games@presents");
	PintaTexto(10,23,COLOR_LIGHTRED,"<hit@a@key@to@start>");
    while (!kbhit()){
		    SoundTema();
			
			
	}
	bordercolor(Background[fondo]);
	(void) cgetc();
	ResetGame();
}
static void GameOver()
{
	PintaTexto(16,10,COLOR_WHITE,"ooooooops");
		SoundExplo();
		bgcolor(COLOR_YELLOW);
		sleep(1);
		bgcolor(COLOR_BLACK);
		sleep(1);
		bgcolor(COLOR_YELLOW);
		sleep(1);
		bgcolor(COLOR_BLACK);
		PintaTexto(16,10,COLOR_WHITE,"game@over");
		if (Score>HiScore){
			HiScore=Score;
			PintaTexto(14,13,COLOR_YELLOW,"new@recoooord");
			sleep(2);
			PintaTexto(36,0,COLOR_WHITE,itoa(Score,BufferItoa,10));
		
		}
		cgetc();
}

int main (void)
{
	clock_t       t;
	int valor=0;
	t=clock();
	srand(t);
	IniciaModo();
	ResetGame();
	Activasprites();
	Intro();
	while(1){
		
		while(done){
			
			Gameloop();
			if (Level<6){
				Altura=Altura+3;
				
			}else{Altura=6;speed--;}
			Level++;
			fondo=++fondo%6;
			bordercolor(Background[fondo]);
			ResetGame();
			 }
		GameOver();
		Intro();
	}	
    return EXIT_SUCCESS;	
}

		
		