// GPL License // TI-Planet.org /* Standard headers - it's recommended to leave them included */ // #include #include #include #include #include #include #include /* Other available headers */ // #include // #include // #include // #include // #include // #include // #include // #include /* Needed for the CE */ #include "CE.h" // general macros #define min(a,b) (((a)<(b))?(a):(b)) #define max(a,b) (((a)>(b))?(a):(b)) #define rgb2color(r, g, b) ((uint16_t)(((r << 8) & 0xf800) | ((g << 3) & 0x07e0) | (b >> 3))) #define LCD_Set_8BPP() asm("LD A,27h"); asm("LD (E30018h),A") #define LCD_Set_16BPP() asm("LD A,2Dh"); asm("LD (E30018h),A") /* Put your structures here */ typedef struct { uint8_t x; uint8_t xold; uint8_t y; uint8_t yold; uint8_t status; uint8_t action; } pers_t; /* Put all (ALL except main) the functions prototypes here */ // Utilities void printSmall8bpp(const char* string, uint16_t x, uint8_t y); void cleanUp(); void print(const char* string, uint8_t xpos, uint8_t ypos); void reverse(char* s); char* uitoa(uint24_t n, char* s, uint8_t zeropad_len); uint8_t myRandInt(uint8_t n); void nopwait(uint16_t n); uint8_t isKeyPressed(uint16_t key); uint8_t isAnyKeyPressed(); void FadeIn(); void FadeOut(); void initPalette(); // memory void* myMalloc(size_t size); void myFreeLast(); // Drawing stuff void drawTile(uint16_t x, uint16_t y); void gc_drawTileTranspColor(uint8_t* data, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t colid); void gc_drawTileTransp(uint8_t* data, uint16_t x, uint16_t y, uint16_t w, uint16_t h); // init void initTiles(uint8_t** tiles); void initTilesP(uint8_t** tilesp); void initMap(); uint8_t* decompTile(uint8_t* data_out, uint8_t* data_in, uint8_t colid); void decompMap(uint8_t* data_out, uint8_t* data_in); // logic uint8_t canFall(uint8_t p); uint8_t canSlide(uint8_t p); uint8_t canGo(uint8_t x, uint8_t y, uint8_t xold, uint8_t yold); uint8_t canHang(uint8_t x, uint8_t y); // other void setAutoCanvas(); void think(uint8_t k); uint8_t getMapType(uint8_t x, uint8_t y); void addCleared(); uint16_t updCleared(uint16_t i); void scanKeys(); void dispBack(); void SaveState(uint8_t maxlevel); uint8_t LoadState(); uint8_t* loadAppVar(); // program-specific macros #define printLevel() printSmall8bpp(uitoa(level, textbuffer, 3), 246, ystatus) #define printAllGifts() printSmall8bpp(uitoa(ngifts, textbuffer, 2), 175, ystatus) #define printGifts() printSmall8bpp(uitoa(gifts, textbuffer, 2), 150, ystatus) #define printScore() printSmall8bpp(uitoa(score, textbuffer, 6), 51, ystatus) #define encodeCoords(x, y) ((((uint32_t)(y))<<16)|(x)) #define yp2ym(yp) ((yp)/2 + ((yp)%2)) /* Put all your globals here */ #define MAXLEVEL 100 #define MAXPERS 13 #define NTILES 5 #define NTILESP 18 #define SCR_WIDTH 320 #define SCR_HEIGHT 240 #define BACKCOL_ID 6 #define MAP_WIDTH 40 #define MAP_HEIGHT 29 #define MAP_SIZE MAP_WIDTH*MAP_HEIGHT #define TILE_SIZE 8 #define SCR_COLS MAP_WIDTH #define SCR_LINES MAP_HEIGHT #define STXT_HEIGHT 8 #define NOP_WAIT 24575 #define CLEAR_DELAY 127 // key format : 2 bytes : keys group last addr byte + read mask #define KEY_2ND 0x1220 #define KEY_MODE 0x1240 #define KEY_DEL 0x1280 #define KEY_ALPHA 0x1480 #define KEY_PLUS 0x1C02 #define KEY_MINUS 0x1C04 #define KEY_CLEAR 0x1C40 #define KEY_DOWN 0x1E01 #define KEY_LEFT 0x1E02 #define KEY_RIGHT 0x1E04 #define KEY_UP 0x1E08 // Global non-pointers variables (DON'T FORGET TO INITIALIZE THEM) uint8_t level = 0, oldlevel = 11, maxlevel = 1, oldmaxlevel = 0; uint8_t npers = 0; uint32_t score = 0; uint8_t gifts = 0, ngifts = 0; uint8_t ystatus = SCR_HEIGHT-STXT_HEIGHT; uint16_t ncleared = 0; uint8_t backcolid = 0, backcolidold = 0; uint8_t* brightness = (uint8_t*)0xF60024; uint8_t minBrightness = 229; // Do NOT set higher, may damage the hardware. uint8_t maxBrightness = 49; // Do NOT set lower, may damage the hardware. uint8_t userBrightness = 100; // will get overwritten uint16_t myRandSeed = 0xACE1; // Global arrays (DON'T FORGET TO INITIALIZE THEM) uint8_t* screentiles = 0; uint8_t* map = 0; char textbuffer[7] = {0}; uint8_t* tiles[NTILES] = {0}; uint8_t* tilesp[NTILESP] = {0}; pers_t pers[MAXPERS] = {{0, 0, 0, 0, 0}}; uint32_t* cleared=0; // Pointers uint16_t* palette = (uint16_t*)0xE30200; static const uint8_t* screen_buf = (uint8_t*)0xD40000; static const uint8_t* offscreen_ptr = (uint8_t*)0xD52C00; // vram "back buffer" (free to use when LCD is in 8bpp) 76.8k static const uint8_t* safeRAM_orig_ptr = (uint8_t*)0xD07396; // 52.290k uint8_t* safeRAM_ptr = (uint8_t*)0xD07396; // safeRAM_orig_ptr uint16_t safeRAM_free = 52290; // D07396h: cmdPixelShadow (8400 b) + D09466h: plotSScreen (21945 b) + D0EA1Fh: saveSScreen (21945 b) uint8_t* safeRAM_ptr_old = (uint8_t*)0xD07396; uint8_t* appvardata = 0; /* Put all your code here */ void main() { uint16_t i=0, j=0; int8_t k=0, t=0, thigh=0, r=0, action=0, kplus=0, kminus=0; uint8_t s=1, ct=0; asm("CALL _DelRes"); asm("CALL _RunIndicOff"); asm("xor a,a"); asm("ld (kbdGetKy),a"); // flush keys asm("di"); userBrightness = *brightness; memset(screen_buf, 0, SCR_HEIGHT*SCR_WIDTH*2); *brightness = minBrightness; initPalette(); LCD_Set_8BPP(); memset(screen_buf, 0, SCR_HEIGHT*SCR_WIDTH); // splash screen dispBack(); maxlevel = max(1,LoadState()); oldmaxlevel = maxlevel; tiles[1] = myMalloc(TILE_SIZE*TILE_SIZE); appvardata=loadAppVar(); map = (uint8_t*)myMalloc(MAP_SIZE); initMap(); screentiles = myMalloc(SCR_COLS*SCR_LINES); cleared = myMalloc(SCR_COLS*SCR_LINES*4); memset(screentiles, 0, SCR_COLS*SCR_LINES); initTilesP(tilesp); initTiles(tiles); memset(screen_buf+(SCR_HEIGHT-TILE_SIZE)*SCR_WIDTH, 7, TILE_SIZE*SCR_WIDTH); if(!appvardata) printSmall8bpp("Error : appvar ANDRODAT.8xv not found :-(", 1, ystatus); else { printSmall8bpp("[alpha]+[]clear wall [+/-]prv/nxt [mode]quit", 1, ystatus); memset(screen_buf+(SCR_HEIGHT-TILE_SIZE/2-1)*SCR_WIDTH+60, 0, TILE_SIZE-1); memset(screen_buf+(SCR_HEIGHT-TILE_SIZE/2-1)*SCR_WIDTH+71, 0, TILE_SIZE-1); } scanKeys(); while (!isKeyPressed(KEY_MODE) && (!level || appvardata)) { if (level!=oldlevel) { for (j=0;j=0;k--) { gc_drawTileTranspColor((uint8_t*)tilesp[pers[k].status], pers[k].x*TILE_SIZE, pers[k].y*TILE_SIZE/2, TILE_SIZE, TILE_SIZE,(k==0)?3:7); pers[k].xold = pers[k].x; pers[k].yold = pers[k].y; } FadeIn(); oldlevel = level; } else { for (k=npers-1;k>=0;k--) { if (k==0 && action || pers[k].x!=pers[k].xold || pers[k].y!=pers[k].yold) { action=0; drawTile(pers[k].xold, yp2ym(pers[k].yold)); if (pers[k].yold%2) { drawTile(pers[k].xold, yp2ym(pers[k].yold)-1); } gc_drawTileTranspColor((uint8_t*)tilesp[pers[k].status], pers[k].x*TILE_SIZE, TILE_SIZE*pers[k].y/2, TILE_SIZE, TILE_SIZE,(k==0)?3:7); pers[k].xold = pers[k].x; pers[k].yold = pers[k].y; } } } nopwait(NOP_WAIT); for (k=0;k>6)&0x1F; map[j*MAP_WIDTH+i]=1; drawTile(i, j); ncleared--; } } for (k=npers-1;k>=0;k--) { if (canSlide(k)) { pers[k].y=(pers[k].y)-1; } else if (canFall(k)) { pers[k].y=pers[k].y+1; } else { if (k==0 && level>0) { // scanKeys(); if (isKeyPressed(KEY_ALPHA) || isKeyPressed(KEY_2ND)) { if (pers[0].x>0 && pers[0].y<2*MAP_HEIGHT-2 && isKeyPressed(KEY_LEFT) && getMapType(pers[0].x-1, yp2ym(pers[0].y+1))==1) { map[yp2ym(pers[0].y+1)*MAP_WIDTH+pers[0].x-1]=0; drawTile(pers[0].x-1, yp2ym(pers[0].y+1)); addCleared(pers[0].x-1, yp2ym(pers[0].y+1)); pers[0].status = 2; action = 1; } else if (pers[0].xMAP_WIDTH) ? 0 : pers[k].x); pers[k].y = (pers[k].y==2*MAP_HEIGHT-1) ? pers[k].yold : ( (pers[k].y>=2*MAP_HEIGHT) ? 0 : pers[k].y ); } if (pers[k].x!=pers[k].xold || pers[k].y!=pers[k].yold) { if (canGo(pers[k].xold, pers[k].yold, pers[k].x, pers[k].y) && (!canGo(pers[k].x, pers[k].y, pers[k].xold, pers[k].yold) || (pers[k].y4 || pers[k].status<=3) ? 4 : pers[k].status-1; else if (thigh==3 && pers[k].y%2) pers[k].status = (pers[k].status>7 || pers[k].status<=5) ? 7 : pers[k].status-1; else if (pers[k].x>pers[k].xold) pers[k].status = (pers[k].status>15 || pers[k].status<=12) ? 15 : pers[k].status-1; else if (pers[k].x11 || pers[k].status<=8) ? 11 : pers[k].status-1; else if (pers[k].y>pers[k].yold) pers[k].status = (pers[k].status>17 || pers[k].status<=16) ? 17 : pers[k].status-1; else pers[k].status=0; if (k==0) { if (level>=1 && level<=MAXLEVEL && level>=maxlevel && score>0) { score--; printScore(); } if (t==4 || thigh==4) { if (t==4) { map[yp2ym(pers[0].y)*MAP_WIDTH+pers[0].x]=0; drawTile(pers[0].x, yp2ym(pers[0].y)); } else { map[yp2ym(pers[0].y-1)*MAP_WIDTH+pers[0].x]=0; drawTile(pers[0].x, yp2ym(pers[0].y-1)); } if (level<=MAXLEVEL && level>=maxlevel) { score+=100; printScore(); } gifts++; printGifts(); } } } } } r=0; for (k=1; k1 && level; if (r || level==0 && isAnyKeyPressed() && !isKeyPressed(KEY_MODE) || level>0 && gifts>=ngifts || kplus || kminus) { FadeOut(); for (k=npers-1; k>=0; k--) { drawTile(pers[k].xold, yp2ym(pers[k].yold)); if (pers[k].yold%2) drawTile(pers[k].xold, yp2ym(pers[k].yold)-1); } if(r) { oldlevel=level-1; if (score && level>=maxlevel && level<=MAXLEVEL) { if(score>=200) score-=200; else score=0; printScore(); } } else { if(kminus) level--; else if(kplus) level++; else { if (!level) { memset(screen_buf+(SCR_HEIGHT-TILE_SIZE)*SCR_WIDTH, 7, TILE_SIZE*SCR_WIDTH); printSmall8bpp("Score : Gifts : / Level :", 1, ystatus); level=maxlevel; } else { if (level>=maxlevel && level<=MAXLEVEL) { score+=1000; printScore(); } level++; } } if(level>maxlevel) maxlevel=level; printLevel(); } if(appvardata) initMap(); } } if(maxlevel!=oldmaxlevel) SaveState(maxlevel); GetCSC(); cleanUp(); *brightness = userBrightness; } uint8_t LoadState() { asm(" ld hl,SaveString"); asm(" CALL _Mov9ToOP1"); asm(" CALL _ChkFindSym"); asm(" jp c,LError"); asm(" call _ChkInRam"); asm("ex hl,de"); asm(" jr z,LUnarchived"); // skips archived header asm("ld bc,18"); asm("add hl,bc"); asm("LUnarchived:"); // HL -> VAT, DE -> DATA // skips size asm("ld bc,2"); asm("add hl,bc"); asm("ex hl,de"); asm(" ld a,(de)"); asm(" ret"); asm("LError:"); asm(" ld a,1"); } void SaveState(uint8_t maxlevel) { asm(" ld hl,SaveString"); asm(" CALL _Mov9ToOP1"); asm(" CALL _ChkFindSym"); asm(" jp nc,Exists"); // Need To Make it... asm(" ld hl,1+17"); // app var size asm(" CALL _EnoughMem"); asm(" jp c,Error"); asm(" ld hl,1"); // app var data size asm(" CALL _CreateAppVar"); // -> DE asm("Exists:"); // DE -> DATA asm(" call _ChkInRam"); asm(" jr z,Unarchived"); // Need to unarchive it asm(" CALL _Arc_Unarc"); asm(" ld hl,SaveString"); asm(" CALL _Mov9ToOP1"); asm(" CALL _ChkFindSym"); asm(" jp c,Error"); asm("Unarchived:"); // HL -> VAT, DE -> DATA asm(" ld hl,SaveString"); asm(" CALL _Mov9ToOP1"); asm(" CALL _ChkFindSym"); asm(" inc de"); asm(" inc de"); // bypass size asm(" push de"); asm(" pop hl"); asm(" ld a,(IX+6)"); asm(" ld (hl),a"); asm("Error:"); asm("SaveString:"); asm(" DB 15h,\"ANDROIST\",0"); } void addCleared(uint8_t x, uint8_t y) { uint32_t val = (CLEAR_DELAY<<11) | (((uint32_t)y)<<6) | ((uint32_t)x); uint8_t i=0; for (i=ncleared;i>0;i--) cleared[i]=cleared[i-1]; ncleared++; cleared[0]=val; } uint16_t updCleared(uint16_t i) { uint32_t n = cleared[i]>>11; if (n>0) n--; cleared[i] = (cleared[i]&0x7FF) | (n<<11); return n; } void FadeIn() { uint8_t i=0; // increase brightness for (i=*brightness; i>=userBrightness; i--) // yes this is the good direction { *brightness = i; nopwait(2000); } } void FadeOut() { uint8_t i=0; // decrease brightness for (i=*brightness; i<=minBrightness; i++) // yes this is the good direction { *brightness = i; nopwait(2000); } } void think(uint8_t k) { uint8_t x = pers[k].x; uint8_t y = pers[k].y; uint8_t x0 = pers[0].xold; uint8_t y0 = pers[0].yold; uint8_t t = getMapType(x, yp2ym(y)); uint8_t tg = (x > 0) ? getMapType(x-1, yp2ym(y)) : 1; uint8_t td = (x < MAP_WIDTH-1) ? getMapType(x+1, yp2ym(y)) : 1; uint8_t thigh = (y > 0) ? getMapType(x, yp2ym(y-1)) : 1; uint8_t tdown = (y < MAP_HEIGHT-1) ? getMapType(x, yp2ym(y+1)) : 1; uint8_t tghigh = (y > 0 && x > 0) ? getMapType(x-1, yp2ym(y-1)) : 1; uint8_t tdhigh = (y > 0 && x < MAP_WIDTH-1) ? getMapType(x+1, yp2ym(y-1)) : 1; uint8_t* acts=0; uint8_t nact=0, act=0, oldnact=0, i=0; if (level>0) { acts=myMalloc(96); // 1:Left, 2:Right;3:Up;4:Down if(pers[k].action==1 && canGo(x-1,y,x,y) && x>=x0 || pers[k].action==2 && canGo(x+1,y,x,y) && x<=x0|| pers[k].action==3 && canGo(x,y-1,x,y) && y>=y0 && canHang(x,y-1) || pers[k].action==4 && canGo(x,y+1,x,y) && y<=y0) acts[nact++]=pers[k].action; oldnact=nact; for(i=0;iy0 && thigh==2 && canGo(x, y-1, x, y)) acts[nact++]=3; if (yx0 && ((thigh==3) && y%2) && canGo(x-1,y,x,y)) acts[nact++]=1; if (xx0) acts[nact++]=1; if (canGo(x+1, y, x, y) && xy0 && canHang(x, y-1) && canHang(x, y)) acts[nact++]=3; if (canGo(x, y+1, x, y) && y> 0) ^ (myRandSeed >> 2) ^ (myRandSeed >> 3) ^ (myRandSeed >> 5) ) & 1; myRandSeed = (myRandSeed >> 1) | (bit << 15); return myRandSeed%n; } uint8_t canHang(uint8_t x, uint8_t y) { uint8_t ym = yp2ym(y); uint8_t t = getMapType(x, ym); uint8_t thigh = (ym>0)?getMapType(x, ym-1):1; return t==2 || (thigh==2 && y%2) || (thigh==3 && y%2); } uint8_t canGo(uint8_t x, uint8_t y, uint8_t xold, uint8_t yold) { uint8_t ym = yp2ym(y); uint8_t t = getMapType(x, ym); uint8_t thigh = 0; if (x>=MAP_WIDTH || y>=2*MAP_HEIGHT-1) return 0; if (!(y%2)) return t!=1; thigh = getMapType(x, ym-1); return (thigh != 1) && (t!=1 || y==yold); } uint8_t getMapType(uint8_t x, uint8_t y) { return map[y*MAP_WIDTH+x]; } uint8_t canFall(uint8_t p) { pers_t per = pers[p]; uint8_t ym = yp2ym(per.y+1), ym2=1; uint8_t t = getMapType(per.x, ym); uint8_t tlowg=1, tlowd=1, r=0, k=0; if (!(per.y%2) && per.y<2*MAP_HEIGHT-2 && per.x>0 && per.x0 ? 1 : 0); } } } return !r && per.y<2*MAP_HEIGHT-2 && !canHang(per.x, per.y) && t!=1 && t!=2; } uint8_t canSlide(uint8_t p) { pers_t per = pers[p]; uint8_t ym = yp2ym(per.y); uint8_t t = getMapType(per.x, ym); return per.y>0 && t==1; } void nopwait(uint16_t n) { uint16_t j=0; for (j=0; j>3; id = (*data_in)%8; memset(data_out, id, n); data_out += n; data_in++; } } void initMap0() { uint8_t map_C[] = {251,75,10,248,64,10,248,56,13,10,248,64,10,8,17,16,9,16,9,8,25,16,25,24,17,16,9,8,25,16,25,16,17,10,9,16,9,8,17,8,9,8,9,16,9,8,9,16,9,8,9,16,9,24,9,16,9,8,9,24,9,16,10,9,16,9,8,33,8,9,16,9,8,25,16,9,16,9,8,9,8,9,16,9,8,17,24,9,8,10,33,8,9,8,17,8,9,16,9,8,9,16,9,8,9,16,9,8,9,8,9,16,9,8,9,40,9,10,9,16,9,8,9,16,9,8,25,16,9,16,9,16,17,16,9,8,25,16,25,8,17,8,10,248,56,13,10,248,64,10,16,25,8,9,32,25,16,9,32,17,16,9,16,9,8,25,8,25,16,10,24,9,56,9,16,9,8,9,24,9,16,9,8,17,8,9,8,9,32,9,24,10,24,9,16,9,8,17,8,25,16,9,24,9,16,9,8,33,8,17,24,9,24,10,24,9,16,9,32,9,32,9,24,33,8,9,8,17,8,9,32,9,24,10,24,9,16,9,32,9,32,25,8,9,16,9,8,9,16,9,8,25,16,9,24,10,248,56,13,10,248,64,10,248,64,10,248,64,10,248,64,10,248,64,10,248,64,10,248,56,13,10,248,64,10,248,64,10,248,64,10,32,13,104,13,104,13,48,249,73,0}; decompMap(map, map_C); } uint8_t* loadAppVar() { asm(" ld hl,LoadString0"); asm(" CALL _Mov9ToOP1"); asm(" CALL _ChkFindSym"); asm(" jp c,LError0"); asm(" call _ChkInRam"); asm("ex hl,de"); asm(" jr z,LUnarchived0"); asm("ld bc,18"); asm("add hl,bc"); asm("LUnarchived0:"); asm("ld bc,2"); asm("add hl,bc"); asm("ret"); asm("LError0:"); asm("ld hl,0"); asm("LoadString0:"); asm(" DB 15h,\"ANDRODAT\",0"); } void decompLevel(uint8_t level) { uint8_t* map_C=appvardata; while(level) { map_C+=strlen(map_C)+1; level--; } decompMap(map, map_C); } void initMapLAST() { uint8_t map_C[] = {9,251,59,17,10,176,14,104,10,17,10,248,40,10,17,10,248,40,10,17,10,248,40,10,17,10,72,9,24,9,32,17,32,9,16,9,64,10,17,10,80,9,8,9,32,9,16,9,24,9,16,9,64,10,17,10,88,9,40,9,16,9,24,9,16,9,64,10,17,10,88,9,40,9,16,9,24,9,16,9,64,10,17,10,88,9,48,17,40,17,72,10,17,10,248,40,10,17,10,248,40,10,17,10,248,40,10,17,10,248,40,10,17,10,72,9,24,9,32,17,32,9,16,9,64,10,17,10,72,9,8,9,8,9,24,9,16,9,24,17,8,9,64,10,17,10,72,9,8,9,8,9,24,9,16,9,24,33,64,10,17,10,72,9,8,9,8,9,24,9,16,9,24,9,12,17,64,10,17,10,80,9,12,9,12,32,17,32,9,20,9,64,10,17,10,88,36,64,36,72,10,17,10,88,132,72,10,17,10,104,100,88,10,17,10,104,36,9,20,9,36,88,10,17,10,104,36,9,20,9,36,88,10,17,10,104,12,9,68,9,12,88,10,17,10,104,20,17,36,17,20,88,10,17,10,104,36,33,36,88,10,17,10,104,100,88,10,249,81,0}; decompMap(map, map_C); } void initMap() { uint8_t tile_C[] = {15,2,15,2,15,18,9,2,15,2,15,2,7,16,0}; uint8_t i=0, j=0,levelbase=0; backcolidold = backcolid; npers=1; if(!level) backcolid=4; else { levelbase=level%10; backcolid = 4*(levelbase%8==1) + 3*(levelbase==2) + (levelbase%4==3) + 2*(levelbase%4==0) + 6*(levelbase==5) + 5*(levelbase==6)+(levelbase==0); } if (level==0) { initMap0(); npers=6; pers[0].x = 14; pers[0].y = 1; pers[1].x = 28; pers[1].y = 1; pers[2].x = 0; pers[2].y = 45; pers[3].x = 0; pers[3].y = 31; pers[4].x = 0; pers[4].y = 17; pers[5].x = 0; pers[5].y = 3; } else if (level 0); /* delete it */ for (; i size) { safeRAM_ptr_old = safeRAM_ptr; safeRAM_ptr += size; safeRAM_free -= size; return safeRAM_ptr-size; } else { cleanUp(); print("No RAM left... :(", 0, 0); asm("jp _RestoreStackAndExit"); // Force quit program return 0; } } void myFreeLast() { safeRAM_free += safeRAM_ptr - safeRAM_ptr_old; safeRAM_ptr = safeRAM_ptr_old; } void dispBack1(uint8_t* ptr) { uint8_t back[] = {254,254,48,13,68,5,254,254,48,13,68,5,254,254,40,9,12,9,52,9,254,254,44,9,12,9,52,9,254,254,32,13,28,9,36,9,254,254,40,13,28,9,36,9,254,254,32,9,48,9,16,13,254,254,40,9,48,9,16,13,254,254,28,13,64,17,254,254,40,13,64,17,254,254,32,9,8,9,56,13,28,13,254,254,9,8,9,56,13,28,13,254,242,13,20,9,40,13,8,5,16,13,254,254,13,20,9,40,13,8,5,16,13,196,5,254,42,13,40,9,28,5,20,5,8,17,200,5,254,42,13,40,9,28,5,20,5,8,17,120,17,64,5,254,34,9,60,9,4,17,24,13,12,5,120,17,64,5,254,34,9,60,9,4,17,24,13,12,5,116,9,4,13,40,9,36,9,248,13,72,9,36,9,20,5,116,9,4,13,40,9,36,9,248,13,72,9,36,9,20,5,116,13,8,5,48,5,8,13,8,5,248,9,12,9,56,17,24,13,28,5,8,9,100,13,8,5,48,5,8,13,8,5,248,9,12,9,56,17,24,13,28,5,8,9,92,13,4,13,4,5,48,13,4,9,244,13,28,9,36,13,12,5,16,9,40,13,100,13,4,13,4,5,48,13,4,9,244,13,28,9,36,13,12,5,16,9,40,13,100,5,8,9,4,13,48,5,4,9,4,5,236,9,48,9,16,17,20,5,4,13,4,5,32,13,108,5,8,9,4,13,48,5,4,9,4,5,236,9,48,9,16,17,20,5,4,13,4,5,32,13,112,9,4,13,4,5,20,5,20,9,4,21,220,13,64,17,36,9,16,5,24,9,124,9,4,13,4,5,20,5,20,9,4,21,220,13,64,17,36,9,16,5,24,9,124,21,4,5,20,13,20,5,4,17,212,13,8,9,56,13,32,13,24,5,12,17,128,21,4,5,20,13,20,5,4,17,212,13,8,9,56,13,32,13,24,5,12,17,128,5,4,5,4,5,4,5,16,5,4,13,4,9,8,13,12,9,192,9,24,9,40,13,8,5,24,9,36,5,4,9,144,5,4,5,4,5,4,5,16,5,4,13,4,9,8,13,12,9,192,9,24,9,40,13,8,5,24,9,36,5,4,9,144,29,12,9,8,5,4,5,48,5,176,13,40,9,28,5,20,5,16,9,40,13,152,29,12,9,8,5,4,5,48,5,176,13,40,9,28,5,20,5,16,9,40,13,156,21,16,9,12,5,24,5,196,9,60,9,4,17,24,5,8,17,32,9,168,21,16,9,12,5,24,5,196,9,60,9,4,17,24,5,8,17,32,9,168,5,4,13,12,5,4,5,4,13,24,5,188,9,72,9,40,13,12,5,24,9,176,5,4,13,12,5,4,5,4,13,24,5,188,9,72,9,40,13,12,5,24,9,172,9,8,13,4,5,12,9,224,5,4,9,56,17,36,9,20,5,16,9,180,9,8,13,4,5,12,9,224,5,4,9,56,17,36,9,20,5,16,9,176,21,12,9,8,5,232,5,8,13,36,13,12,5,24,13,28,5,4,13,184,21,12,9,8,5,232,5,8,13,36,13,12,5,24,13,28,5,4,13,180,9,12,9,4,5,4,5,4,5,236,5,8,5,8,5,28,9,20,5,16,9,40,9,192,9,12,9,4,5,4,5,4,5,236,5,8,5,8,5,28,9,20,5,16,9,40,9,184,9,4,17,8,9,4,9,240,5,4,9,4,17,4,17,28,5,4,13,4,5,32,9,192,9,4,17,8,9,4,9,240,5,4,9,4,17,4,17,28,5,4,13,4,5,32,9,192,5,4,13,16,13,248,13,4,5,8,5,4,5,44,9,16,5,24,9,200,5,4,13,16,13,248,13,4,5,8,5,4,5,44,9,16,5,24,9,200,21,16,5,192,9,56,5,4,5,4,5,8,5,4,5,32,13,24,5,12,17,204,21,16,5,192,9,56,5,4,5,4,5,8,5,4,5,32,13,24,5,12,17,204,5,8,17,4,9,180,13,4,9,16,9,28,5,4,5,4,5,8,5,4,5,24,9,36,5,4,9,220,5,8,17,4,9,180,13,4,9,16,9,28,5,4,5,4,5,8,5,4,5,24,9,36,5,4,9,224,37,168,13,20,21,4,9,24,5,4,5,4,5,8,5,4,5,12,13,40,13,232,37,168,13,20,21,4,9,24,5,4,5,4,5,8,5,4,5,12,13,40,13,244,5,4,9,4,5,160,9,40,9,8,13,24,9,4,5,8,13,4,9,8,5,32,9,254,2,5,4,9,4,5,160,9,40,9,8,13,24,9,4,5,8,13,4,9,8,5,32,9,254,6,21,148,13,56,13,4,5,28,5,4,5,8,5,4,9,16,5,24,9,254,14,21,148,13,56,13,4,5,28,5,4,5,8,5,4,9,16,5,24,9,254,6,9,12,9,140,9,12,9,56,5,4,5,28,5,4,5,8,5,4,5,20,5,16,9,254,14,9,12,9,140,9,12,9,56,5,4,5,28,5,4,5,8,5,4,5,20,5,16,9,254,14,5,4,13,4,5,128,13,28,5,48,9,4,5,28,5,4,5,8,5,4,5,20,5,4,13,254,22,5,4,13,4,5,128,13,28,5,48,9,4,5,28,5,4,5,8,5,4,5,20,5,4,13,254,22,5,4,9,8,5,120,9,44,9,28,13,4,5,4,5,20,21,8,5,4,5,20,9,254,34,5,4,9,8,5,120,9,44,9,28,13,4,5,4,5,20,21,8,5,4,5,20,9,254,34,17,4,9,108,13,60,9,12,9,16,5,4,5,12,17,4,9,8,13,12,9,254,42,17,4,9,108,13,60,9,12,9,16,5,4,5,12,17,4,9,8,13,12,9,254,42,5,4,5,4,13,96,17,76,13,24,5,4,25,12,9,8,5,4,17,88,5,212,5,4,5,4,13,96,17,76,13,24,5,4,25,12,9,8,5,4,17,88,5,212,5,8,5,8,9,84,9,12,9,64,9,4,5,28,5,4,9,4,5,12,9,4,5,8,5,104,9,16,5,192,5,8,5,8,9,84,9,12,9,64,9,4,5,28,5,4,9,4,5,12,9,4,5,8,5,104,9,16,5,192,9,4,5,16,5,68,13,28,13,40,13,12,5,24,9,4,29,4,5,4,5,8,5,96,9,16,9,196,9,4,5,16,5,68,13,28,13,40,13,12,5,24,9,4,29,4,5,4,5,8,5,96,9,16,9,196,5,4,9,16,9,56,9,52,9,24,13,20,5,16,9,4,5,4,5,8,9,12,5,4,5,8,5,254,70,5,4,9,16,9,56,9,52,9,24,13,20,5,16,9,4,5,4,5,8,9,12,5,4,5,8,5,254,70,5,8,9,12,13,40,13,64,13,4,13,32,5,4,13,4,5,4,5,4,13,20,5,4,5,8,5,80,9,16,5,24,9,184,5,8,9,12,13,40,13,64,13,4,13,32,5,4,13,4,5,4,5,4,13,20,5,4,5,8,5,80,9,16,5,24,9,180,9,4,9,4,9,4,5,4,5,32,13,80,9,44,9,16,5,4,5,4,5,28,5,4,5,8,5,76,5,24,9,12,9,188,9,4,9,4,9,4,5,4,5,32,13,80,9,44,9,16,5,4,5,4,5,28,5,4,5,8,5,76,5,24,9,12,9,188,5,8,5,16,17,20,13,8,17,56,13,4,5,32,13,24,5,4,5,4,5,28,5,4,5,8,5,72,5,24,5,44,9,164,5,8,5,16,17,20,13,8,17,56,13,4,5,32,13,24,5,4,5,4,5,28,5,4,5,8,5,72,5,24,5,44,9,164,17,20,5,4,5,12,9,36,9,40,9,16,5,24,9,36,5,4,5,4,5,28,5,4,5,8,5,56,5,12,5,20,5,16,5,20,9,172,17,20,5,4,5,12,9,36,9,40,9,16,5,24,9,36,5,4,5,4,5,28,5,4,5,8,5,56,5,12,5,20,5,16,5,20,9,172,17,20,5,4,17,52,13,20,13,20,5,16,9,44,13,4,5,28,5,4,5,8,5,48,9,12,5,20,5,12,9,4,5,196,17,20,5,4,17,52,13,20,13,20,5,16,9,44,13,4,5,28,5,4,5,8,5,48,9,12,5,20,5,12,9,4,5,192,9,4,5,24,5,4,5,76,21,32,5,4,13,4,5,36,17,8,5,20,21,8,5,36,5,28,5,16,5,12,9,4,5,4,5,188,9,4,5,24,5,4,5,76,21,32,5,4,13,4,5,36,17,8,5,20,21,8,5,36,5,28,5,16,5,12,9,4,5,4,5,188,5,4,9,12,17,4,5,76,9,44,9,16,5,28,9,4,5,4,5,8,5,12,17,4,9,8,5,32,5,4,5,20,5,4,21,12,5,4,13,4,5,184,5,4,9,12,17,4,5,76,9,44,9,16,5,28,9,4,5,4,5,8,5,12,17,4,9,8,5,32,5,4,5,20,5,4,21,12,5,4,13,4,5,180,9,4,5,4,13,12,5,4,13,56,13,4,5,32,13,24,5,16,13,12,5,4,5,8,25,4,17,8,5,28,5,4,5,4,5,16,9,12,13,8,5,4,17,184,9,4,5,4,13,12,5,4,13,56,13,4,5,32,13,24,5,16,13,12,5,4,5,8,25,4,17,8,5,28,5,4,5,4,5,16,9,12,13,8,5,4,17,184,5,4,13,24,17,4,9,40,9,16,5,24,9,36,5,8,9,24,5,4,5,8,17,8,5,4,5,4,5,8,5,24,21,4,5,8,5,4,5,12,9,4,5,8,5,4,9,60,5,124,5,4,13,24,17,4,9,40,9,16,5,24,9,36,5,8,9,24,5,4,5,8,17,8,5,4,5,4,5,8,5,24,21,4,5,8,5,4,5,12,9,4,5,8,5,4,9,60,5,124,5,4,5,28,13,8,9,4,13,16,17,20,5,12,13,44,13,32,5,4,5,8,9,4,13,8,5,4,5,8,5,28,25,8,25,4,13,8,13,4,9,40,13,128,5,4,5,28,13,8,9,4,13,16,17,20,5,12,13,44,13,32,5,4,5,8,9,4,13,8,5,4,5,8,5,28,25,8,25,4,13,8,13,4,9,40,13,120,21,24,17,8,5,20,17,36,5,4,9,8,5,36,9,44,5,4,5,8,13,20,5,4,5,8,5,12,9,8,21,12,5,8,5,4,9,8,9,4,5,4,9,8,9,12,9,8,5,132,21,24,17,8,5,20,17,36,5,4,9,8,5,36,9,44,5,4,5,8,13,20,5,4,5,8,5,12,9,8,21,12,5,8,5,4,9,8,9,4,5,4,9,8,9,12,9,8,5,120,13,4,5,4,5,32,21,20,13,40,13,16,5,24,13,52,5,4,5,8,5,28,5,4,5,8,5,8,5,4,17,12,21,4,13,4,13,4,9,8,9,16,25,128,13,4,5,4,5,32,21,20,13,40,13,16,5,24,13,52,5,4,5,8,5,28,5,4,5,8,5,8,5,4,17,12,21,4,13,4,13,4,9,8,9,16,25,120,13,12,21,56,9,8,5,32,9,28,5,16,9,64,5,4,5,8,5,28,5,4,5,8,5,4,5,16,5,4,5,4,5,16,9,12,9,12,5,8,17,8,5,12,5,128,13,12,21,56,9,8,5,32,9,28,5,16,9,64,5,4,5,8,5,28,5,4,5,8,5,4,5,16,5,4,5,4,5,16,9,12,9,12,5,8,17,8,5,12,5,116,13,20,17,4,9,40,13,16,5,20,17,32,5,4,13,72,5,4,5,8,5,28,5,4,5,8,5,4,17,4,9,4,13,12,5,12,5,20,5,4,5,4,9,4,13,8,5,72,9,40,13,20,17,4,9,40,13,16,5,20,17,32,5,4,13,72,5,4,5,8,5,28,5,4,5,8,5,4,17,4,9,4,13,12,5,12,5,20,5,4,5,4,9,4,13,8,5,72,9,32,9,28,9,4,9,4,5,4,9,24,9,28,5,12,13,44,9,84,5,4,5,8,5,28,5,4,5,8,5,16,5,4,17,4,13,4,5,8,17,12,9,4,13,4,5,8,5,4,9,56,17,36,9,28,9,4,9,4,5,4,9,24,9,28,5,12,13,44,9,84,5,4,5,8,5,28,5,4,5,8,5,16,5,4,17,4,13,4,5,8,17,12,9,4,13,4,5,8,5,4,9,56,17,28,9,40,21,12,9,12,9,36,5,8,9,4,5,36,13,88,5,4,5,8,5,28,5,4,5,8,5,4,9,4,5,4,9,4,13,8,17,4,5,4,21,8,5,12,5,8,9,4,13,44,5,16,5,24,9,40,21,12,9,12,9,36,5,8,9,4,5,36,13,88,5,4,5,8,5,28,5,4,5,8,5,4,9,4,5,4,9,4,13,8,17,4,5,4,21,8,5,12,5,8,9,4,13,44,5,16,5,12,13,88,13,40,17,12,5,24,13,100,5,4,5,8,5,20,21,8,5,8,9,4,5,8,21,12,5,4,17,12,5,12,13,20,13,32,17,36,13,88,13,40,17,12,5,24,13,100,5,4,5,8,5,20,21,8,5,8,9,4,5,8,21,12,5,4,17,12,5,12,13,20,13,32,17,28,13,88,17,40,5,28,5,20,5,112,5,4,5,8,5,12,17,4,9,8,5,12,9,12,5,4,5,4,5,8,13,20,13,80,9,44,13,88,17,40,5,28,5,20,5,112,5,4,5,8,5,12,17,4,9,8,5,12,9,12,5,4,5,4,5,8,13,20,13,80,9,40,5,12,13,64,13,8,9,24,17,32,5,4,17,116,5,4,5,8,25,4,17,8,5,36,13,12,5,8,21,8,5,68,13,48,5,12,13,64,13,8,9,24,17,32,5,4,17,116,5,4,5,8,25,4,17,8,5,36,13,12,5,8,21,8,5,68,13,76,13,44,9,20,9,16,13,44,9,132,5,4,5,8,17,8,5,4,5,4,5,8,5,60,5,36,5,60,9,88,13,44,9,20,9,16,13,44,9,132,5,4,5,8,17,8,5,4,5,4,5,8,5,60,5,36,5,60,9,96,13,24,13,28,9,4,17,4,5,32,17,136,5,4,5,8,9,4,13,8,5,4,5,8,5,60,13,20,13,12,9,28,13,60,9,36,13,24,13,28,9,4,17,4,5,32,17,136,5,4,5,8,9,4,13,8,5,4,5,8,5,60,13,20,13,12,9,28,13,60,9,48,9,8,9,40,13,20,5,24,9,152,5,4,5,8,13,20,5,4,5,8,5,72,13,4,9,16,5,28,9,8,9,52,5,56,9,8,9,40,13,20,5,24,9,152,5,4,5,8,13,20,5,4,5,8,5,72,13,4,9,16,5,28,9,8,9,52,5,60,13,44,9,28,5,16,9,160,5,4,5,8,5,28,5,4,5,8,5,76,5,4,5,8,5,32,13,20,13,28,17,64,13,44,9,28,5,16,9,160,5,4,5,8,5,28,5,4,5,8,5,76,5,4,5,8,5,32,13,20,13,28,17,12,0}; decompTile(ptr,back, 8); } void dispBack2(uint8_t* ptr) { uint8_t back[] = {44,9,4,5,36,13,36,5,4,13,168,5,4,5,8,5,28,5,4,5,8,5,72,5,20,5,24,9,40,9,16,9,72,9,4,5,36,13,36,5,4,13,168,5,4,5,8,5,28,5,4,5,8,5,72,5,20,5,24,9,40,9,16,9,60,13,12,5,28,9,48,9,180,5,4,5,8,5,28,5,4,5,8,5,72,9,12,13,4,17,56,21,64,13,12,5,28,9,48,9,180,5,4,5,8,5,28,5,4,5,8,5,72,9,12,13,4,17,56,21,56,9,24,5,20,13,44,9,188,5,4,5,8,5,28,5,4,5,8,5,72,5,4,9,12,9,68,17,64,9,24,5,20,13,44,9,188,5,4,5,8,5,28,5,4,5,8,5,72,5,4,9,12,9,68,17,56,13,28,5,8,13,8,5,32,13,196,5,4,5,8,5,28,5,4,5,8,5,68,9,24,5,64,13,4,9,56,13,28,5,8,13,8,5,32,13,196,5,4,5,8,5,28,5,4,5,8,5,68,9,24,5,64,13,4,9,44,13,40,13,20,5,24,9,208,5,4,5,8,5,28,5,4,5,8,5,68,9,28,5,44,17,16,9,32,9,4,13,40,13,20,5,24,9,208,5,4,5,8,5,28,5,4,5,8,5,68,9,28,5,44,17,16,9,32,13,44,13,28,5,16,9,216,5,4,5,8,5,24,17,8,5,72,9,16,9,4,9,32,9,28,9,24,9,8,5,44,13,28,5,16,9,216,5,4,5,8,5,24,17,8,5,72,9,16,9,4,9,32,9,28,9,24,9,44,13,40,21,224,5,4,5,8,5,12,29,8,5,60,17,4,17,8,5,4,17,4,17,36,9,12,17,48,13,40,21,224,5,4,5,8,5,12,29,8,5,60,17,4,17,8,5,4,17,4,17,36,9,12,17,44,9,48,9,236,5,4,5,8,5,8,9,4,5,8,9,8,5,52,9,12,5,4,9,8,9,4,5,16,5,52,9,4,9,12,5,44,9,48,9,236,5,4,5,8,5,8,9,4,5,8,9,8,5,52,9,12,5,4,9,8,9,4,5,16,5,52,9,4,9,12,5,28,17,44,13,244,5,4,5,8,13,4,21,4,5,8,5,40,13,24,5,8,13,12,21,48,17,20,5,28,17,44,13,244,5,4,5,8,13,4,21,4,5,8,5,40,13,24,5,8,13,12,21,48,17,20,5,24,5,12,5,36,9,254,2,5,4,5,8,5,4,17,8,5,4,5,8,5,32,9,12,9,16,5,4,5,20,5,16,5,44,5,36,5,24,5,12,5,36,9,254,2,5,4,5,8,5,4,17,8,5,4,5,8,5,32,9,12,9,16,5,4,5,20,5,16,5,44,5,36,5,12,13,16,5,24,13,254,10,5,4,5,8,17,16,5,4,5,8,5,20,13,28,9,4,5,16,17,20,5,32,13,40,5,4,21,16,5,24,13,254,10,5,4,5,8,17,16,5,4,5,8,5,20,13,28,9,4,5,16,17,20,5,32,13,40,5,4,9,28,5,16,9,254,22,5,4,5,8,9,24,5,4,5,8,5,12,9,48,9,8,9,36,5,20,13,52,9,36,5,16,9,254,22,5,4,5,8,9,24,5,4,5,8,5,12,9,48,9,8,9,36,5,20,13,52,9,36,5,4,13,254,30,5,4,5,8,5,28,5,4,5,8,17,60,17,40,5,12,17,44,17,40,5,4,13,254,30,5,4,5,8,5,28,5,4,5,8,17,60,17,40,5,12,17,44,17,40,9,254,42,5,4,5,8,5,28,5,4,5,8,5,64,17,48,17,12,5,40,5,56,9,254,42,5,4,5,8,5,28,5,4,5,8,5,64,17,48,17,12,5,40,5,48,9,254,50,5,4,5,8,5,28,5,4,5,8,5,56,9,8,5,52,5,24,5,32,9,52,9,254,50,5,4,5,8,5,28,5,4,5,8,5,56,9,8,5,52,5,24,5,32,9,40,13,254,58,5,4,5,8,5,20,21,4,21,32,13,16,5,36,17,28,5,16,17,48,13,254,58,5,4,5,8,5,20,21,4,21,32,13,16,5,36,17,28,5,16,17,40,9,254,70,5,4,5,8,5,12,9,12,13,20,9,16,9,28,5,28,9,44,5,12,9,52,9,254,70,5,4,5,8,5,12,9,12,13,20,9,16,9,28,5,28,9,44,5,12,9,254,130,5,4,5,8,17,60,17,36,5,16,17,48,17,254,138,5,4,5,8,17,60,17,36,5,16,17,48,17,254,138,5,4,5,8,5,68,13,44,5,8,9,12,5,44,5,254,154,5,4,5,8,5,68,13,44,5,8,9,12,5,44,5,254,154,5,4,5,4,9,56,13,8,5,44,13,20,5,28,17,254,158,5,4,5,4,9,56,13,8,5,44,13,20,5,28,17,254,154,9,4,9,4,9,40,13,20,5,32,13,32,5,20,9,254,170,9,4,9,4,9,40,13,20,5,32,13,32,5,20,9,254,162,9,8,9,12,13,24,13,28,5,24,13,40,5,8,17,254,166,9,8,9,12,13,24,13,28,5,24,13,40,5,8,17,254,154,13,48,9,4,13,40,5,12,17,48,13,254,170,13,48,9,4,13,40,5,12,17,48,13,254,162,9,64,9,52,5,4,9,8,5,44,13,254,170,9,64,9,52,5,4,9,8,5,44,13,254,158,13,60,13,4,5,48,13,16,5,32,13,254,170,13,60,13,4,5,48,13,16,5,32,13,254,162,9,12,9,44,9,16,5,40,9,28,5,28,9,254,170,9,12,9,44,9,16,5,40,9,28,5,28,9,254,158,13,28,9,24,17,20,5,32,13,32,5,20,9,254,166,13,28,9,24,17,20,5,32,13,32,5,20,9,254,154,13,48,9,8,9,36,5,20,13,44,5,8,17,254,158,13,48,9,8,9,36,5,20,13,44,5,8,17,254,150,9,64,17,40,5,12,17,48,13,254,166,9,64,17,40,5,12,17,48,13,254,154,13,64,17,48,17,12,5,40,13,254,162,13,64,17,48,17,12,5,40,13,254,150,13,12,9,48,9,8,5,52,5,24,5,32,9,254,162,13,12,9,48,9,8,5,52,5,24,5,32,9,254,154,9,32,9,28,13,16,5,36,17,28,5,16,17,254,162,9,32,9,28,13,16,5,36,17,28,5,16,17,254,150,13,44,9,16,9,28,5,28,9,44,5,12,9,254,162,13,44,9,16,9,28,5,28,9,44,5,12,9,254,154,9,64,17,36,5,16,17,48,17,254,162,9,64,17,36,5,16,17,48,17,254,150,13,68,13,44,5,8,9,12,5,44,5,254,166,13,68,13,44,5,8,9,12,5,44,5,254,158,9,12,9,48,13,8,5,44,13,20,5,28,17,254,162,9,12,9,48,13,8,5,44,13,20,5,28,17,254,150,13,28,9,28,13,20,5,32,13,32,5,20,9,254,166,13,28,9,28,13,20,5,32,13,32,5,20,9,254,154,13,48,9,12,13,28,5,24,13,40,5,8,17,254,158,13,48,9,12,13,28,5,24,13,40,5,8,17,254,150,9,64,17,40,5,12,17,48,13,254,166,9,64,17,40,5,12,17,48,13,254,154,13,64,17,48,5,4,9,8,5,44,13,254,162,13,64,17,48,5,4,9,8,5,44,13,254,154,9,12,9,48,9,8,5,48,13,16,5,32,13,254,166,9,12,9,48,9,8,5,48,13,16,5,32,13,254,158,9,28,9,28,13,16,5,40,9,28,5,28,9,254,166,9,28,9,28,13,16,5,40,9,28,5,28,9,254,158,13,36,9,16,9,28,5,32,13,32,5,20,9,254,166,13,36,9,16,9,28,5,32,13,32,5,20,9,254,154,13,48,9,8,9,36,5,20,13,44,5,8,17,254,158,13,48,9,8,9,36,5,20,13,44,5,8,17,254,150,9,64,17,40,5,12,17,48,13,254,166,9,64,17,40,5,12,17,48,13,254,154,13,64,17,48,17,12,5,40,13,254,162,13,64,17,48,17,12,5,40,13,254,150,13,12,9,48,9,8,5,52,5,24,5,32,9,254,162,13,12,9,48,9,8,5,52,5,24,5,32,9,254,154,9,32,9,28,13,16,5,36,17,28,5,16,17,254,162,9,32,9,28,13,16,5,36,17,28,5,16,17,254,150,13,44,9,16,9,28,5,28,9,44,5,12,9,254,162,13,44,9,16,9,28,5,28,9,44,5,12,9,254,154,9,64,17,36,5,16,17,48,17,254,162,9,64,17,36,5,16,17,48,17,254,150,13,68,13,44,5,8,9,12,5,44,5,254,166,13,68,13,44,5,8,9,12,5,44,5,254,158,9,12,9,48,13,8,5,44,13,20,5,28,17,254,162,9,12,9,48,13,8,5,44,13,20,5,28,17,254,150,13,28,9,28,13,20,5,32,13,32,5,20,9,254,166,13,28,9,28,13,20,5,32,13,32,5,20,9,254,162,5,48,9,12,13,28,5,24,13,40,5,8,17,254,166,5,48,9,12,13,28,5,24,13,40,5,8,17,254,222,17,40,5,12,17,48,13,254,238,17,40,5,12,17,48,13,254,230,17,48,5,4,9,8,5,44,13,254,238,17,48,5,4,9,8,5,44,13,254,230,9,8,5,48,13,16,5,32,13,254,242,9,8,5,48,13,16,5,32,13,254,230,13,16,5,40,9,28,5,28,9,254,238,13,16,5,40,9,28,5,28,9,254,210,5,16,9,28,5,28,13,36,5,12,17,254,218,5,16,9,28,5,28,13,36,5,12,17,254,218,5,4,13,40,5,12,17,44,17,254,234,5,4,13,40,5,12,17,44,17,254,234,0}; decompTile(ptr,back, 8); } void dispBack() { dispBack1(offscreen_ptr); dispBack2(offscreen_ptr+SCR_WIDTH*SCR_HEIGHT/2); memcpy(screen_buf, offscreen_ptr, SCR_WIDTH*SCR_HEIGHT); } void initPalette() { palette[0] = rgb2color(0, 0, 0); palette[1] = rgb2color(255, 0, 0); palette[2] = rgb2color(0, 255, 0); palette[3] = rgb2color(255, 255, 0); palette[4] = rgb2color(0, 0, 255); palette[5] = rgb2color(255, 0, 255); palette[6] = rgb2color(0, 255, 255); palette[7] = rgb2color(255, 255, 255); palette[8] = rgb2color(0, 63, 0); } uint8_t* decompTile(uint8_t* data_out, uint8_t* data_in, uint8_t cid) { uint8_t n=0, colid=0; while (*data_in>0) { n = *data_in >> 1; colid = (((*data_in) % 2)>0)?cid:0; memset(data_out, colid, n); data_out += n; data_in++; } return data_in+1; } void drawTile(uint16_t x, uint16_t y) { uint8_t ct = getMapType(x,y); int8_t h=TILE_SIZE-1; while(h>=0) { memcpy(screen_buf+(y*TILE_SIZE+h)*SCR_WIDTH+x*TILE_SIZE, offscreen_ptr+(y*TILE_SIZE+h)*SCR_WIDTH+x*TILE_SIZE, TILE_SIZE); h--; } gc_drawTileTransp(tiles[ct], x*TILE_SIZE, y*TILE_SIZE, TILE_SIZE, TILE_SIZE); screentiles[y*SCR_COLS+x] = ct; } void gc_drawTileTranspColor(uint8_t* data, uint16_t x, uint16_t y, uint16_t w, uint16_t h, uint8_t colid) { uint8_t* ptr_out = screen_buf; uint8_t* ptr_in = data; uint8_t i=0; ptr_out += y*SCR_WIDTH + x; while (h>0) { for (i=0;i0) { for (i=0;i Correct Character"); asm(" pop de ; de -> correct place to draw"); asm(" ld b,8"); asm("_iloop2:"); asm(" push bc"); asm(" ld c,(hl)"); asm(" ld b,8"); asm(" ex de,hl"); asm(" push de"); asm(" push hl"); asm(" ld de,(ForeColor)"); asm("_i2loop2:"); asm(" ld a,d"); asm(" rlc c"); asm(" jr nc,+_heh1"); asm(" ld a,e"); asm("_heh1:"); asm(" ld (hl),a"); asm(" inc hl"); asm(" ld (hl),a"); asm(" inc hl"); asm(" djnz _i2loop2"); asm(" ld bc,320-16"); asm(" add hl,bc ; next line"); asm(" ex de,hl"); asm(" pop hl"); asm(" ld bc,16"); asm(" ldir"); asm(" ex de,hl"); asm(" ld bc,320-16"); asm(" add hl,bc ; next line"); asm(" pop de"); asm(" ex de,hl"); asm(" inc hl"); asm(" pop bc"); asm(" djnz _iloop2"); asm(" pop bc"); asm(" pop de"); asm(" pop af ; character"); asm(" cp 128"); asm(" jr c,+_heh2"); asm(" xor a"); asm("_heh2:"); asm(" ld hl,CharSpacing"); asm(" call _AddHLAndA"); asm(" ld a,(hl) ; A holds the amount to increment per character"); asm(" add a,a"); asm(" jp AddToPosistion"); asm("DrawChar:"); asm(" ld bc,(posX)"); asm(" push hl"); asm(" push af"); asm(" push de"); asm(" push bc"); asm(" push af"); asm(" ld a,(posY)"); asm(" push bc ; Save X"); asm(" call compute8bpp"); asm(" pop de ; de = Y"); asm(" add hl,de ; Add X"); asm(" pop af"); asm(" push hl"); asm(" or a"); asm(" sbc hl,hl"); asm(" ld l,a"); asm(" add hl,hl"); asm(" add hl,hl"); asm(" add hl,hl"); asm(" ex de,hl"); asm(" ld hl,Char000"); asm(" add hl,de ; hl -> Correct Character"); asm(" pop de ; de -> correct place to draw"); asm(" ld b,8"); asm("_iloop:"); asm(" push bc"); asm(" ld c,(hl)"); asm(" ld b,8"); asm(" ex de,hl"); asm(" push de"); asm(" ld de,(ForeColor)"); asm("_i2loop:"); asm(" ld (hl),d"); asm(" rlc c"); asm(" jr nc,+_heh3"); asm(" ld (hl),e"); asm("_heh3:"); asm(" inc hl"); asm(" djnz _i2loop"); asm(" ld (hl),d"); asm("NextL:"); asm(" ld bc,320-8"); asm(" add hl,bc"); asm(" pop de"); asm(" ex de,hl"); asm(" inc hl"); asm(" pop bc"); asm(" djnz _iloop"); asm(" pop bc"); asm(" pop de"); asm(" pop af ; character"); asm(" cp 128"); asm(" jr c,+_"); asm(" xor a"); asm("_:"); asm(" ld hl,CharSpacing"); asm(" call _AddHLAndA"); asm(" ld a,(hl) ; A holds the amount to increment per character"); asm("AddToPosistion:"); asm(" or a,a"); asm(" sbc hl,hl"); asm(" ld l,a"); asm(" add hl,bc"); asm(" push hl"); asm(" pop bc"); asm(" inc bc"); asm(" ld (posX),bc"); asm(" pop hl"); asm(" ret"); asm("ForeColor:"); asm(" DB 0"); // black asm("BackColor:"); asm(" DB 7"); // white asm("compute8bpp:"); asm(" ld de,320"); asm(" call 000348h"); // MultDEA //asm(" ld de,vbuf2"); // off screen (vram + 320x240) asm(" ld de,vbuf1"); // direct screen (vram) asm(" add hl,de"); asm(" ret"); asm("CharSpacing:"); asm("; 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F"); asm(" DB 8,8,8,7,7,7,8,8,8,8,8,8,8,1,8,8"); asm(" DB 7,7,8,8,8,8,8,8,8,8,8,8,8,8,8,8"); asm(" DB 2,3,5,7,7,7,7,4,4,4,8,6,3,6,2,7"); asm(" DB 7,6,7,7,7,7,7,7,7,7,2,3,5,6,5,6"); asm(" DB 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7"); asm(" DB 7,7,7,7,8,7,7,7,7,7,7,4,7,4,7,8"); asm(" DB 3,7,7,7,7,7,7,7,7,4,7,7,4,7,7,7"); asm(" DB 7,7,7,7,6,7,7,7,7,7,7,6,2,6,7,7"); asm(" DB 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7"); asm("Char000: DB 0,0,0,0,0,0,0,0"); asm("Char001: DB 7Eh,81h,A5h,81h,BDh,BDh,81h,7Eh"); asm("Char002: DB 7Eh,FFh,DBh,FFh,C3h,C3h,FFh,7Eh"); asm("Char003: DB 6Ch,FEh,FEh,FEh,7Ch,38h,10h,00h"); asm("Char004: DB 10h,38h,7Ch,FEh,7Ch,38h,10h,00h"); asm("Char005: DB 38h,7Ch,38h,FEh,FEh,10h,10h,7Ch"); asm("Char006: DB 00h,18h,3Ch,7Eh,FFh,7Eh,18h,7Eh"); asm("Char007: DB 00h,00h,18h,3Ch,3Ch,18h,00h,00h"); asm("Char008: DB FFh,FFh,E7h,C3h,C3h,E7h,FFh,FFh"); asm("Char009: DB 00h,3Ch,66h,42h,42h,66h,3Ch,00h"); asm("Char010: DB FFh,C3h,99h,BDh,BDh,99h,C3h,FFh"); asm("Char011: DB 0Fh,07h,0Fh,7Dh,CCh,CCh,CCh,78h"); asm("Char012: DB 3Ch,66h,66h,66h,3Ch,18h,7Eh,18h"); asm("Char013: DB 3Fh,33h,3Fh,30h,30h,70h,F0h,E0h"); asm("Char014: DB 7Fh,63h,7Fh,63h,63h,67h,E6h,C0h"); asm("Char015: DB 99h,5Ah,3Ch,E7h,E7h,3Ch,5Ah,99h"); asm("Char016: DB 80h,E0h,F8h,FEh,F8h,E0h,80h,00h"); asm("Char017: DB 02h,0Eh,3Eh,FEh,3Eh,0Eh,02h,00h"); asm("Char018: DB 18h,3Ch,7Eh,18h,18h,7Eh,3Ch,18h"); asm("Char019: DB 66h,66h,66h,66h,66h,00h,66h,00h"); asm("Char020: DB 7Fh,DBh,DBh,7Bh,1Bh,1Bh,1Bh,00h"); asm("Char021: DB 3Fh,60h,7Ch,66h,66h,3Eh,06h,FCh"); asm("Char022: DB 00h,00h,00h,00h,7Eh,7Eh,7Eh,00h"); asm("Char023: DB 18h,3Ch,7Eh,18h,7Eh,3Ch,18h,FFh"); asm("Char024: DB 18h,3Ch,7Eh,18h,18h,18h,18h,00h"); asm("Char025: DB 18h,18h,18h,18h,7Eh,3Ch,18h,00h"); asm("Char026: DB 00h,18h,0Ch,FEh,0Ch,18h,00h,00h"); asm("Char027: DB 00h,30h,60h,FEh,60h,30h,00h,00h"); asm("Char028: DB 00h,00h,C0h,C0h,C0h,FEh,00h,00h"); asm("Char029: DB 00h,24h,66h,FFh,66h,24h,00h,00h"); asm("Char030: DB 00h,18h,3Ch,7Eh,FFh,FFh,00h,00h"); asm("Char031: DB 00h,FFh,FFh,7Eh,3Ch,18h,00h,00h"); asm("Char032: DB 00h,00h,00h,00h,00h,00h,00h,00h"); asm("Char033: DB C0h,C0h,C0h,C0h,C0h,00h,C0h,00h"); asm("Char034: DB D8h,D8h,D8h,00h,00h,00h,00h,00h"); asm("Char035: DB 6Ch,6Ch,FEh,6Ch,FEh,6Ch,6Ch,00h"); asm("Char036: DB 18h,7Eh,C0h,7Ch,06h,FCh,18h,00h"); asm("Char037: DB 00h,C6h,CCh,18h,30h,66h,C6h,00h"); asm("Char038: DB 38h,6Ch,38h,76h,DCh,CCh,76h,00h"); asm("Char039: DB 30h,30h,60h,00h,00h,00h,00h,00h"); asm("Char040: DB 30h,60h,C0h,C0h,C0h,60h,30h,00h"); asm("Char041: DB C0h,60h,30h,30h,30h,60h,C0h,00h"); asm("Char042: DB 00h,66h,3Ch,FFh,3Ch,66h,00h,00h"); asm("Char043: DB 00h,30h,30h,FCh,FCh,30h,30h,00h"); asm("Char044: DB 00h,00h,00h,00h,00h,60h,60h,C0h"); asm("Char045: DB 00h,00h,00h,FCh,00h,00h,00h,00h"); asm("Char046: DB 00h,00h,00h,00h,00h,C0h,C0h,00h"); asm("Char047: DB 06h,0Ch,18h,30h,60h,C0h,80h,00h"); asm("Char048: DB 7Ch,CEh,DEh,F6h,E6h,C6h,7Ch,00h"); asm("Char049: DB 30h,70h,30h,30h,30h,30h,FCh,00h"); asm("Char050: DB 7Ch,C6h,06h,7Ch,C0h,C0h,FEh,00h"); asm("Char051: DB FCh,06h,06h,3Ch,06h,06h,FCh,00h"); asm("Char052: DB 0Ch,CCh,CCh,CCh,FEh,0Ch,0Ch,00h"); asm("Char053: DB FEh,C0h,FCh,06h,06h,C6h,7Ch,00h"); asm("Char054: DB 7Ch,C0h,C0h,FCh,C6h,C6h,7Ch,00h"); asm("Char055: DB FEh,06h,06h,0Ch,18h,30h,30h,00h"); asm("Char056: DB 7Ch,C6h,C6h,7Ch,C6h,C6h,7Ch,00h"); asm("Char057: DB 7Ch,C6h,C6h,7Eh,06h,06h,7Ch,00h"); asm("Char058: DB 00h,C0h,C0h,00h,00h,C0h,C0h,00h"); asm("Char059: DB 00h,60h,60h,00h,00h,60h,60h,C0h"); asm("Char060: DB 18h,30h,60h,C0h,60h,30h,18h,00h"); asm("Char061: DB 00h,00h,FCh,00h,FCh,00h,00h,00h"); asm("Char062: DB C0h,60h,30h,18h,30h,60h,C0h,00h"); asm("Char063: DB 78h,CCh,18h,30h,30h,00h,30h,00h"); asm("Char064: DB 7Ch,C6h,DEh,DEh,DEh,C0h,7Eh,00h"); asm("Char065: DB 38h,6Ch,C6h,C6h,FEh,C6h,C6h,00h"); asm("Char066: DB FCh,C6h,C6h,FCh,C6h,C6h,FCh,00h"); asm("Char067: DB 7Ch,C6h,C0h,C0h,C0h,C6h,7Ch,00h"); asm("Char068: DB F8h,CCh,C6h,C6h,C6h,CCh,F8h,00h"); asm("Char069: DB FEh,C0h,C0h,F8h,C0h,C0h,FEh,00h"); asm("Char070: DB FEh,C0h,C0h,F8h,C0h,C0h,C0h,00h"); asm("Char071: DB 7Ch,C6h,C0h,C0h,CEh,C6h,7Ch,00h"); asm("Char072: DB C6h,C6h,C6h,FEh,C6h,C6h,C6h,00h"); asm("Char073: DB 7Eh,18h,18h,18h,18h,18h,7Eh,00h"); asm("Char074: DB 06h,06h,06h,06h,06h,C6h,7Ch,00h"); asm("Char075: DB C6h,CCh,D8h,F0h,D8h,CCh,C6h,00h"); asm("Char076: DB C0h,C0h,C0h,C0h,C0h,C0h,FEh,00h"); asm("Char077: DB C6h,EEh,FEh,FEh,D6h,C6h,C6h,00h"); asm("Char078: DB C6h,E6h,F6h,DEh,CEh,C6h,C6h,00h"); asm("Char079: DB 7Ch,C6h,C6h,C6h,C6h,C6h,7Ch,00h"); asm("Char080: DB FCh,C6h,C6h,FCh,C0h,C0h,C0h,00h"); asm("Char081: DB 7Ch,C6h,C6h,C6h,D6h,DEh,7Ch,06h"); asm("Char082: DB FCh,C6h,C6h,FCh,D8h,CCh,C6h,00h"); asm("Char083: DB 7Ch,C6h,C0h,7Ch,06h,C6h,7Ch,00h"); asm("Char084: DB FFh,18h,18h,18h,18h,18h,18h,00h"); asm("Char085: DB C6h,C6h,C6h,C6h,C6h,C6h,FEh,00h"); asm("Char086: DB C6h,C6h,C6h,C6h,C6h,7Ch,38h,00h"); asm("Char087: DB C6h,C6h,C6h,C6h,D6h,FEh,6Ch,00h"); asm("Char088: DB C6h,C6h,6Ch,38h,6Ch,C6h,C6h,00h"); asm("Char089: DB C6h,C6h,C6h,7Ch,18h,30h,E0h,00h"); asm("Char090: DB FEh,06h,0Ch,18h,30h,60h,FEh,00h"); asm("Char091: DB F0h,C0h,C0h,C0h,C0h,C0h,F0h,00h"); asm("Char092: DB C0h,60h,30h,18h,0Ch,06h,02h,00h"); asm("Char093: DB F0h,30h,30h,30h,30h,30h,F0h,00h"); asm("Char094: DB 10h,38h,6Ch,C6h,00h,00h,00h,00h"); asm("Char095: DB 00h,00h,00h,00h,00h,00h,00h,FFh"); asm("Char096: DB C0h,C0h,60h,00h,00h,00h,00h,00h"); asm("Char097: DB 00h,00h,7Ch,06h,7Eh,C6h,7Eh,00h"); asm("Char098: DB C0h,C0h,C0h,FCh,C6h,C6h,FCh,00h"); asm("Char099: DB 00h,00h,7Ch,C6h,C0h,C6h,7Ch,00h"); asm("Char100: DB 06h,06h,06h,7Eh,C6h,C6h,7Eh,00h"); asm("Char101: DB 00h,00h,7Ch,C6h,FEh,C0h,7Ch,00h"); asm("Char102: DB 1Ch,36h,30h,78h,30h,30h,78h,00h"); asm("Char103: DB 00h,00h,7Eh,C6h,C6h,7Eh,06h,FCh"); asm("Char104: DB C0h,C0h,FCh,C6h,C6h,C6h,C6h,00h"); asm("Char105: DB 60h,00h,E0h,60h,60h,60h,F0h,00h"); asm("Char106: DB 06h,00h,06h,06h,06h,06h,C6h,7Ch"); asm("Char107: DB C0h,C0h,CCh,D8h,F8h,CCh,C6h,00h"); asm("Char108: DB E0h,60h,60h,60h,60h,60h,F0h,00h"); asm("Char109: DB 00h,00h,CCh,FEh,FEh,D6h,D6h,00h"); asm("Char110: DB 00h,00h,FCh,C6h,C6h,C6h,C6h,00h"); asm("Char111: DB 00h,00h,7Ch,C6h,C6h,C6h,7Ch,00h"); asm("Char112: DB 00h,00h,FCh,C6h,C6h,FCh,C0h,C0h"); asm("Char113: DB 00h,00h,7Eh,C6h,C6h,7Eh,06h,06h"); asm("Char114: DB 00h,00h,FCh,C6h,C0h,C0h,C0h,00h"); asm("Char115: DB 00h,00h,7Eh,C0h,7Ch,06h,FCh,00h"); asm("Char116: DB 30h,30h,FCh,30h,30h,30h,1Ch,00h"); asm("Char117: DB 00h,00h,C6h,C6h,C6h,C6h,7Eh,00h"); asm("Char118: DB 00h,00h,C6h,C6h,C6h,7Ch,38h,00h"); asm("Char119: DB 00h,00h,C6h,C6h,D6h,FEh,6Ch,00h"); asm("Char120: DB 00h,00h,C6h,6Ch,38h,6Ch,C6h,00h"); asm("Char121: DB 00h,00h,C6h,C6h,C6h,7Eh,06h,FCh"); asm("Char122: DB 00h,00h,FEh,0Ch,38h,60h,FEh,00h"); asm("Char123: DB 1Ch,30h,30h,E0h,30h,30h,1Ch,00h"); asm("Char124: DB C0h,C0h,C0h,00h,C0h,C0h,C0h,00h"); asm("Char125: DB E0h,30h,30h,1Ch,30h,30h,E0h,00h"); asm("Char126: DB 76h,DCh,00h,00h,00h,00h,00h,00h"); asm("Char127: DB 00h,10h,38h,6Ch,C6h,C6h,FEh,00h"); asm("Char128: DB 7Ch,C6h,C0h,C0h,C0h,D6h,7Ch,30h"); asm("Char129: DB C6h,00h,C6h,C6h,C6h,C6h,7Eh,00h"); asm("Char130: DB 0Eh,00h,7Ch,C6h,FEh,C0h,7Ch,00h"); asm("Char131: DB 7Eh,81h,3Ch,06h,7Eh,C6h,7Eh,00h"); asm("Char132: DB 66h,00h,7Ch,06h,7Eh,C6h,7Eh,00h"); asm("Char133: DB E0h,00h,7Ch,06h,7Eh,C6h,7Eh,00h"); asm("Char134: DB 18h,18h,7Ch,06h,7Eh,C6h,7Eh,00h"); asm("Char135: DB 00h,00h,7Ch,C6h,C0h,D6h,7Ch,30h"); asm("Char136: DB 7Eh,81h,7Ch,C6h,FEh,C0h,7Ch,00h"); asm("Char137: DB 66h,00h,7Ch,C6h,FEh,C0h,7Ch,00h"); asm("Char138: DB E0h,00h,7Ch,C6h,FEh,C0h,7Ch,00h"); asm("Char139: DB 66h,00h,38h,18h,18h,18h,3Ch,00h"); asm("Char140: DB 7Ch,82h,38h,18h,18h,18h,3Ch,00h"); asm("Char141: DB 70h,00h,38h,18h,18h,18h,3Ch,00h"); asm("Char142: DB C6h,10h,7Ch,C6h,FEh,C6h,C6h,00h"); asm("Char143: DB 38h,38h,00h,7Ch,C6h,FEh,C6h,00h"); asm("Char144: DB 0Eh,00h,FEh,C0h,F8h,C0h,FEh,00h"); asm("Char145: DB 00h,00h,7Fh,0Ch,7Fh,CCh,7Fh,00h"); asm("Char146: DB 3Fh,6Ch,CCh,FFh,CCh,CCh,CFh,00h"); asm("Char147: DB 7Ch,82h,7Ch,C6h,C6h,C6h,7Ch,00h"); asm("Char148: DB 66h,00h,7Ch,C6h,C6h,C6h,7Ch,00h"); asm("Char149: DB E0h,00h,7Ch,C6h,C6h,C6h,7Ch,00h"); asm("Char150: DB 7Ch,82h,00h,C6h,C6h,C6h,7Eh,00h"); asm("Char151: DB E0h,00h,C6h,C6h,C6h,C6h,7Eh,00h"); asm("Char152: DB 66h,00h,66h,66h,66h,3Eh,06h,7Ch"); asm("Char153: DB C6h,7Ch,C6h,C6h,C6h,C6h,7Ch,00h"); asm("Char154: DB C6h,00h,C6h,C6h,C6h,C6h,FEh,00h"); asm("Char155: DB 18h,18h,7Eh,D8h,D8h,D8h,7Eh,18h"); asm("Char156: DB 38h,6Ch,60h,F0h,60h,66h,FCh,00h"); asm("Char157: DB 66h,66h,3Ch,18h,7Eh,18h,7Eh,18h"); asm("Char158: DB F8h,CCh,CCh,FAh,C6h,CFh,C6h,C3h"); asm("Char159: DB 0Eh,1Bh,18h,3Ch,18h,18h,D8h,70h"); asm("Char160: DB 0Eh,00h,7Ch,06h,7Eh,C6h,7Eh,00h"); asm("Char161: DB 1Ch,00h,38h,18h,18h,18h,3Ch,00h"); asm("Char162: DB 0Eh,00h,7Ch,C6h,C6h,C6h,7Ch,00h"); asm("Char163: DB 0Eh,00h,C6h,C6h,C6h,C6h,7Eh,00h"); asm("Char164: DB 00h,FEh,00h,FCh,C6h,C6h,C6h,00h"); asm("Char165: DB FEh,00h,C6h,E6h,F6h,DEh,CEh,00h"); asm("Char166: DB 3Ch,6Ch,6Ch,3Eh,00h,7Eh,00h,00h"); asm("Char167: DB 3Ch,66h,66h,3Ch,00h,7Eh,00h,00h"); asm("Char168: DB 18h,00h,18h,18h,30h,66h,3Ch,00h"); asm("Char169: DB 00h,00h,00h,FCh,C0h,C0h,00h,00h"); asm("Char170: DB 00h,00h,00h,FCh,0Ch,0Ch,00h,00h"); asm("Char171: DB C6h,CCh,D8h,3Fh,63h,CFh,8Ch,0Fh"); asm("Char172: DB C3h,C6h,CCh,DBh,37h,6Dh,CFh,03h"); asm("Char173: DB 18h,00h,18h,18h,18h,18h,18h,00h"); asm("Char174: DB 00h,33h,66h,CCh,66h,33h,00h,00h"); asm("Char175: DB 00h,CCh,66h,33h,66h,CCh,00h,00h"); asm("Char176: DB 22h,88h,22h,88h,22h,88h,22h,88h"); asm("Char177: DB 55h,AAh,55h,AAh,55h,AAh,55h,AAh"); asm("Char178: DB DDh,77h,DDh,77h,DDh,77h,DDh,77h"); asm("Char179: DB 18h,18h,18h,18h,18h,18h,18h,18h"); asm("Char180: DB 18h,18h,18h,18h,F8h,18h,18h,18h"); asm("Char181: DB 18h,18h,F8h,18h,F8h,18h,18h,18h"); asm("Char182: DB 36h,36h,36h,36h,F6h,36h,36h,36h"); asm("Char183: DB 00h,00h,00h,00h,FEh,36h,36h,36h"); asm("Char184: DB 00h,00h,F8h,18h,F8h,18h,18h,18h"); asm("Char185: DB 36h,36h,F6h,06h,F6h,36h,36h,36h"); asm("Char186: DB 36h,36h,36h,36h,36h,36h,36h,36h"); asm("Char187: DB 00h,00h,FEh,06h,F6h,36h,36h,36h"); asm("Char188: DB 36h,36h,F6h,06h,FEh,00h,00h,00h"); asm("Char189: DB 36h,36h,36h,36h,FEh,00h,00h,00h"); asm("Char190: DB 18h,18h,F8h,18h,F8h,00h,00h,00h"); asm("Char191: DB 00h,00h,00h,00h,F8h,18h,18h,18h"); asm("Char192: DB 18h,18h,18h,18h,1Fh,00h,00h,00h"); asm("Char193: DB 18h,18h,18h,18h,FFh,00h,00h,00h"); asm("Char194: DB 00h,00h,00h,00h,FFh,18h,18h,18h"); asm("Char195: DB 18h,18h,18h,18h,1Fh,18h,18h,18h"); asm("Char196: DB 00h,00h,00h,00h,FFh,00h,00h,00h"); asm("Char197: DB 18h,18h,18h,18h,FFh,18h,18h,18h"); asm("Char198: DB 18h,18h,1Fh,18h,1Fh,18h,18h,18h"); asm("Char199: DB 36h,36h,36h,36h,37h,36h,36h,36h"); asm("Char200: DB 36h,36h,37h,30h,3Fh,00h,00h,00h"); asm("Char201: DB 00h,00h,3Fh,30h,37h,36h,36h,36h"); asm("Char202: DB 36h,36h,F7h,00h,FFh,00h,00h,00h"); asm("Char203: DB 00h,00h,FFh,00h,F7h,36h,36h,36h"); asm("Char204: DB 36h,36h,37h,30h,37h,36h,36h,36h"); asm("Char205: DB 00h,00h,FFh,00h,FFh,00h,00h,00h"); asm("Char206: DB 36h,36h,F7h,00h,F7h,36h,36h,36h"); asm("Char207: DB 18h,18h,FFh,00h,FFh,00h,00h,00h"); asm("Char208: DB 36h,36h,36h,36h,FFh,00h,00h,00h"); asm("Char209: DB 00h,00h,FFh,00h,FFh,18h,18h,18h"); asm("Char210: DB 00h,00h,00h,00h,FFh,36h,36h,36h"); asm("Char211: DB 36h,36h,36h,36h,3Fh,00h,00h,00h"); asm("Char212: DB 18h,18h,1Fh,18h,1Fh,00h,00h,00h"); asm("Char213: DB 00h,00h,1Fh,18h,1Fh,18h,18h,18h"); asm("Char214: DB 00h,00h,00h,00h,3Fh,36h,36h,36h"); asm("Char215: DB 36h,36h,36h,36h,FFh,36h,36h,36h"); asm("Char216: DB 18h,18h,FFh,18h,FFh,18h,18h,18h"); asm("Char217: DB 18h,18h,18h,18h,F8h,00h,00h,00h"); asm("Char218: DB 00h,00h,00h,00h,1Fh,18h,18h,18h"); asm("Char219: DB FFh,FFh,FFh,FFh,FFh,FFh,FFh,FFh"); asm("Char220: DB 00h,00h,00h,00h,FFh,FFh,FFh,FFh"); asm("Char221: DB F0h,F0h,F0h,F0h,F0h,F0h,F0h,F0h"); asm("Char222: DB 0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0Fh,0Fh"); asm("Char223: DB FFh,FFh,FFh,FFh,00h,00h,00h,00h"); asm("Char224: DB 00h,00h,76h,DCh,C8h,DCh,76h,00h"); asm("Char225: DB 38h,6Ch,6Ch,78h,6Ch,66h,6Ch,60h"); asm("Char226: DB 00h,FEh,C6h,C0h,C0h,C0h,C0h,00h"); asm("Char227: DB 00h,00h,FEh,6Ch,6Ch,6Ch,6Ch,00h"); asm("Char228: DB FEh,60h,30h,18h,30h,60h,FEh,00h"); asm("Char229: DB 00h,00h,7Eh,D8h,D8h,D8h,70h,00h"); asm("Char230: DB 00h,66h,66h,66h,66h,7Ch,60h,C0h"); asm("Char231: DB 00h,76h,DCh,18h,18h,18h,18h,00h"); asm("Char232: DB 7Eh,18h,3Ch,66h,66h,3Ch,18h,7Eh"); asm("Char233: DB 3Ch,66h,C3h,FFh,C3h,66h,3Ch,00h"); asm("Char234: DB 3Ch,66h,C3h,C3h,66h,66h,E7h,00h"); asm("Char235: DB 0Eh,18h,0Ch,7Eh,C6h,C6h,7Ch,00h"); asm("Char236: DB 00h,00h,7Eh,DBh,DBh,7Eh,00h,00h"); asm("Char237: DB 06h,0Ch,7Eh,DBh,DBh,7Eh,60h,C0h"); asm("Char238: DB 38h,60h,C0h,F8h,C0h,60h,38h,00h"); asm("Char239: DB 78h,CCh,CCh,CCh,CCh,CCh,CCh,00h"); asm("Char240: DB 00h,7Eh,00h,7Eh,00h,7Eh,00h,00h"); asm("Char241: DB 18h,18h,7Eh,18h,18h,00h,7Eh,00h"); asm("Char242: DB 60h,30h,18h,30h,60h,00h,FCh,00h"); asm("Char243: DB 18h,30h,60h,30h,18h,00h,FCh,00h"); asm("Char244: DB 0Eh,1Bh,1Bh,18h,18h,18h,18h,18h"); asm("Char245: DB 18h,18h,18h,18h,18h,D8h,D8h,70h"); asm("Char246: DB 18h,18h,00h,7Eh,00h,18h,18h,00h"); asm("Char247: DB 00h,76h,DCh,00h,76h,DCh,00h,00h"); asm("Char248: DB 38h,6Ch,6Ch,38h,00h,00h,00h,00h"); asm("Char249: DB 00h,00h,00h,18h,18h,00h,00h,00h"); asm("Char250: DB 00h,00h,00h,00h,18h,00h,00h,00h"); asm("Char251: DB 0Fh,0Ch,0Ch,0Ch,ECh,6Ch,3Ch,1Ch"); asm("Char252: DB 78h,6Ch,6Ch,6Ch,6Ch,00h,00h,00h"); asm("Char253: DB 7Ch,0Ch,7Ch,60h,7Ch,00h,00h,00h"); asm("Char254: DB 00h,00h,3Ch,3Ch,3Ch,3Ch,00h,00h"); asm("Char255: DB 00h,10h,00h,00h,00h,00h,00h,00h"); } void printSmall8bpp(const char* string, uint16_t x, uint8_t y) { asm("LD DE,(IX+9)"); asm("LD (posX),DE"); asm("LD A,(IX+12)"); asm("LD (posY),A"); asm("LD HL,(IX+6)"); asm("CALL drawStringSmall"); } uint8_t isAnyKeyPressed() { uint8_t* addr = (uint8_t*)0xF50012; uint8_t* last = (uint8_t*)0xF5001E; for (;addr<=last;addr+=2) if (*addr) return 1; return 0; } uint8_t isKeyPressed(uint16_t key) { uint8_t* addr = (uint8_t*)(0xF50000 + (uint8_t)(key >> 8)); uint8_t mask = key & 0xFF; return ((*addr)&mask) ? 1 : 0; } void scanKeys() { asm("ld hl,0F50000h"); asm("ld (hl),3"); // Set Continuous Scan mode // asm("ld (hl),2"); // Set Single Scan mode /* asm("xor a,a"); asm("scan_wait:"); asm("cp a,(hl)"); // Wait for Idle mode asm("jr nz,scan_wait");*/ }