// GPL License // TI-Planet.org /* Keep these headers */ #include #include #include #include #include /* Standard headers - it's recommended to leave them included */ #include #include #include #include /* Other available headers */ // stdarg.h, setjmp.h, assert.h, ctype.h, float.h, iso646.h, limits.h, errno.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; } pers_t; /* Put your function 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, uint8_t t); 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 canGo(uint8_t x, uint8_t y, uint8_t xold, uint8_t yold); // other void setAutoCanvas(); uint8_t getMapType(uint8_t x, uint8_t y); void addTarget(); void scanKeys(); void dispBack(); void SaveState(uint8_t maxlevel); uint8_t LoadState(); uint8_t* loadAppVar(); // program-specific macros #define printLevel() printSmall8bpp(uitoa(level, textbuffer, 2), 51, 0) #define printScore() printSmall8bpp(uitoa(score, textbuffer, 5), 275, STXT_HEIGHT) #define encodeCoords(x, y) ((((uint32_t)(y))<<16)|(x)) /* Put all your globals here */ #define MAXLEVEL 41 #define NTILES 5 #define NTILESP 4 #define SCR_WIDTH 320 #define SCR_HEIGHT 240 #define BACKCOL_ID 6 #define TILE_SIZE 16 #define SCR_COLS (SCR_WIDTH/TILE_SIZE) #define SCR_LINES (SCR_HEIGHT/TILE_SIZE) #define STXT_HEIGHT 8 #define NOP_WAIT 24575 // 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) unsigned int map_width = 0; unsigned int map_height = 0; unsigned int map_xoffset = 0; unsigned int map_yoffset = 0; uint8_t level = 1, oldlevel = 11, maxlevel = 1, oldmaxlevel = 0; uint32_t score = 0; uint8_t ntargets = 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 = {0,0,0,0,0}; uint16_t targets[64]={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 tries=0; uint16_t i=0, j=0; int8_t k=0, t=0, r=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(); if(!appvardata) { printSmall8bpp("Error : appvar BIBOXDAT.8xv not found :-(", 1, SCR_HEIGHT-STXT_HEIGHT); // bug FadeIn(); while(isAnyKeyPressed()); while(!isAnyKeyPressed()); } else { printSmall8bpp("[clear] restart [+/-] prv/nxt [mode] quit", 0, SCR_HEIGHT-STXT_HEIGHT); initTiles(tiles); initTilesP(tilesp); map = (uint8_t*)myMalloc(SCR_COLS*SCR_LINES); level=maxlevel; initMap(); screentiles = myMalloc(SCR_COLS*SCR_LINES); memset(screentiles, 0, SCR_COLS*SCR_LINES); printSmall8bpp("Level :", 0, 0); printSmall8bpp("Score", 275, 0); printLevel(); printScore(); scanKeys(); while (!isKeyPressed(KEY_MODE) && (appvardata)) { if (level!=oldlevel) { for (j=0;jmap_width) ? 0 : pers.x); pers.y = (pers.y==map_height) ? pers.yold : ( (pers.y>map_height) ? 0 : pers.y ); if (pers.y!=pers.yold && canGo(pers.xold, pers.y, pers.xold, pers.yold)) pers.x=pers.xold; else if (pers.x!=pers.xold && canGo(pers.x, pers.yold, pers.xold, pers.yold)) pers.y=pers.yold; else { pers.x=pers.xold; pers.y=pers.yold; } if (pers.x!=pers.xold || pers.y!=pers.yold) { tries++; t = getMapType(pers.x, pers.y); if(t==3 || t==2) { uint8_t x2=2*pers.x-pers.xold; uint8_t y2=2*pers.y-pers.yold; uint8_t t2=getMapType(x2,y2); map[pers.y*map_width+pers.x]=(t==3)?4:0; drawTile(pers.x+map_xoffset, pers.y+map_yoffset,(t==3)?4:0); map[y2*map_width+x2]=(t2==4)?3:2; drawTile(x2+map_xoffset, y2+map_yoffset,(t2==4)?3:2); } if (pers.x>pers.xold) pers.status = 1; else if (pers.xpers.yold) pers.status = 3; else pers.status=2; } r=1; // test win for (k=0;k>8; t=getMapType(i,j); if(t!=3) r=0; } kplus = isKeyPressed(KEY_PLUS) && level1; // test reset ? if (r || kplus || kminus || isKeyPressed(KEY_CLEAR)) // win test { FadeOut(); drawTile(pers.xold+map_xoffset, pers.yold+map_yoffset,getMapType(pers.xold,pers.yold)); if(0) // reset test { 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(r) { if (level>=maxlevel && level<=MAXLEVEL) { if(tries) score+=10000/tries; printScore(); tries=0; } level++; } else oldlevel=0; 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,\"BILBOXST\",0"); } void addTarget(uint8_t x, uint8_t y) { uint16_t val = (((uint16_t)y)<<8) | ((uint16_t)x); targets[ntargets]=val; ntargets++; } 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); } } uint8_t myRandInt(uint8_t n) { uint16_t bit = ((myRandSeed >> 0) ^ (myRandSeed >> 2) ^ (myRandSeed >> 3) ^ (myRandSeed >> 5) ) & 1; myRandSeed = (myRandSeed >> 1) | (bit << 15); return myRandSeed%n; } uint8_t canGo(uint8_t x, uint8_t y, uint8_t xold, uint8_t yold) { uint8_t t = getMapType(x, y); if (x>=map_width || y>=2*map_height-1) return 0; if(t!=1 && t!=2 && t!=3) return 1; else if(t==2 || t==3) { uint8_t x2=2*x-xold, y2=2*y-yold; uint8_t t2=getMapType(x2,y2); return canGo(x2,y2,x,y) && t2!=2 && t2!=3; } return 0; } uint8_t getMapType(uint8_t x, uint8_t y) { if(x>=map_width || y>=map_height) return 0; return map[y*map_width+x]; } 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++; } } 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,\"BIBOXDAT\",0"); } void decompLevel(uint8_t level) { uint8_t* map_C=appvardata; while(level) { map_C+=strlen(map_C)+1; level--; } map_height=*map_C; map_C++; map_width=*map_C; map_C++; decompMap(map, map_C); } void initMapLAST() { uint8_t map_C[] = {13,168,11,28,11,16,25,16,11,24,11,32,10,12,10,16,9,24,9,8,11,8,12,8,11,40,11,24,9,24,9,8,11,8,12,8,11,40,11,24,9,24,9,8,11,8,12,8,11,40,11,32,25,24,11,10,11,192,11,24,11,16,25,16,11,24,11,24,11,8,10,8,11,8,9,24,9,8,11,10,16,11,24,11,8,10,8,11,8,9,24,9,8,11,12,11,12,11,24,11,8,10,8,11,8,9,24,9,8,11,16,10,11,32,11,12,11,24,25,16,11,24,11,168,0}; map_width=20; map_height=13; decompMap(map, map_C); } void initMap() { uint8_t i=0, j=0; level=min(level,MAXLEVEL); decompLevel(level-1); map_xoffset=(SCR_COLS+1-map_width)*2/3; map_yoffset=SCR_LINES-map_height-1; ntargets=0; for (j=0;j=5) { pers.x=i; pers.y=j; pers.status=2; map[j*map_width+i]=(c==5)?0:4; } } } } void initTiles(uint8_t** tiles) { uint8_t i=0; for (i=0; i 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[] = {252,3,4,3,198,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,150,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,142,3,6,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,116,3,26,3,10,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,118,3,30,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,20,3,2,3,2,3,2,3,68,3,12,3,2,3,28,3,4,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,22,3,2,3,2,3,34,3,2,3,2,3,8,3,2,3,66,3,4,3,6,5,8,5,10,5,12,7,18,7,24,7,34,9,42,3,26,3,254,64,3,2,3,2,3,12,3,30,3,18,3,6,3,2,3,4,203,26,3,254,38,3,22,3,2,3,8,3,10,3,6,3,14,3,2,3,18,3,2,3,2,3,4,3,232,3,254,36,3,26,3,2,3,8,3,6,3,4,3,8,5,12,3,10,3,18,3,232,3,250,3,40,3,22,3,2,3,12,3,6,3,4,3,8,3,6,3,2,3,10,3,2,3,16,3,232,3,238,3,2,3,2,3,2,3,84,3,2,3,8,5,4,3,32,3,10,3,232,3,236,3,2,3,2,3,2,3,18,3,4,3,56,5,16,9,6,3,36,3,232,3,234,3,2,3,6,3,2,3,18,5,2,3,8,3,4,3,2,3,16,3,14,3,24,5,4,3,2,3,2,3,4,3,24,3,232,3,232,3,2,3,2,3,2,3,24,5,2,3,8,3,4,3,2,3,14,3,2,3,12,3,22,9,4,3,2,3,2,7,6,3,16,3,62,21,150,3,234,3,10,5,18,3,4,3,8,3,2,5,2,3,2,5,12,3,2,3,32,3,2,11,2,5,4,3,2,3,2,3,2,3,14,3,60,3,20,29,122,3,246,3,22,5,2,3,4,3,2,3,66,3,4,5,2,7,6,3,6,3,16,3,60,3,48,21,102,3,242,5,2,3,34,3,12,5,58,11,6,3,26,3,60,3,4,15,50,3,100,3,242,5,2,3,14,3,18,3,12,5,2,3,4,3,2,3,38,3,4,11,4,3,8,3,18,3,60,3,4,3,10,27,26,3,100,3,246,3,2,3,12,3,40,5,2,3,2,5,2,3,4,3,2,3,4,3,2,5,6,3,8,13,2,7,22,3,60,3,4,3,10,47,6,3,100,3,248,3,14,3,36,5,4,3,2,3,4,3,2,5,2,17,18,9,2,5,26,3,60,3,4,3,10,47,6,3,100,3,238,5,14,3,6,3,2,3,12,3,12,7,4,5,2,3,14,3,8,3,24,7,2,3,2,3,26,3,60,3,4,3,10,47,6,3,100,3,238,3,16,3,2,5,4,3,6,3,18,7,4,5,2,7,10,3,2,3,4,5,22,9,2,5,26,3,60,3,4,3,10,47,6,3,100,3,240,5,8,5,2,3,4,3,2,9,2,5,2,3,2,5,2,3,2,3,2,5,4,3,6,3,6,3,6,3,6,3,6,3,2,3,2,3,2,15,28,3,60,3,4,3,10,47,6,3,100,3,244,3,4,3,4,3,2,5,2,3,2,15,2,3,4,7,2,3,4,5,8,3,4,3,4,3,4,7,2,7,2,3,10,9,32,3,60,3,4,3,10,47,6,3,100,3,82,41,122,3,4,3,4,3,2,5,2,3,2,15,2,3,4,5,2,3,2,3,2,5,10,5,2,3,6,3,2,3,6,3,10,3,2,13,18,3,10,3,60,3,4,3,10,47,6,3,100,3,82,3,36,3,6,19,102,3,2,5,2,5,16,9,8,3,8,3,14,3,14,3,30,5,6,3,10,3,12,3,60,3,4,3,10,47,6,3,66,3,32,3,82,3,36,3,6,3,94,5,24,5,4,7,16,3,10,5,22,3,24,3,2,3,24,3,2,3,2,3,2,3,2,3,2,3,6,3,60,3,4,3,10,47,6,3,100,3,82,3,6,29,2,3,6,3,2,13,78,3,32,3,6,3,16,3,8,5,28,5,14,5,2,3,10,5,10,3,10,3,2,3,2,3,2,3,4,3,60,3,4,3,10,47,6,3,66,3,32,3,82,3,6,29,2,3,6,3,2,13,78,3,32,3,6,3,16,3,8,5,14,3,30,7,2,3,8,5,4,3,2,3,2,3,2,3,6,3,2,3,10,3,60,3,4,3,10,27,6,15,6,3,62,3,6,3,6,3,20,3,82,3,6,29,2,3,6,3,2,13,80,5,12,3,4,3,8,3,24,5,6,3,16,3,8,5,4,3,2,3,4,3,2,5,2,3,2,3,6,5,2,3,6,3,10,3,16,3,60,3,4,3,10,25,10,13,6,3,60,3,4,3,14,3,16,3,82,3,6,29,2,3,6,3,2,3,4,7,78,3,14,3,2,7,18,3,2,5,12,3,2,3,16,5,8,5,2,3,6,5,12,3,6,3,2,5,18,3,2,3,2,3,10,3,60,3,4,3,10,25,10,13,6,3,58,3,10,3,6,3,6,3,12,3,82,3,6,29,2,3,6,3,2,3,4,7,80,5,2,3,14,7,14,3,10,5,2,3,22,3,2,3,2,7,2,15,14,3,4,3,2,3,2,3,14,3,2,3,2,3,2,3,8,3,60,3,4,3,10,15,4,9,8,13,6,3,58,3,6,3,2,3,2,3,6,5,2,3,10,3,82,3,6,3,8,19,2,3,6,3,2,5,4,5,80,5,2,3,20,3,12,3,10,7,2,3,16,9,6,7,2,3,2,9,4,3,2,3,2,3,2,11,4,3,2,3,2,3,10,3,14,3,60,3,4,3,10,15,2,9,2,3,4,3,4,9,6,3,42,3,2,3,6,3,30,3,12,3,82,3,6,3,8,19,2,3,6,3,2,5,4,5,78,3,4,3,12,5,2,3,4,5,2,5,4,3,8,5,2,3,2,3,14,3,6,3,2,11,2,11,2,3,2,3,2,3,2,7,8,3,2,3,2,3,10,3,16,3,60,3,4,3,10,15,2,9,2,9,2,11,6,3,44,3,2,3,10,5,10,3,12,5,8,3,82,3,6,3,8,7,8,5,2,3,6,3,2,3,12,5,96,15,10,7,2,7,2,3,14,3,10,3,2,3,2,3,4,7,4,3,2,3,4,9,8,3,6,3,6,3,2,3,18,3,60,3,4,3,10,15,2,11,10,11,6,3,42,3,10,3,22,3,20,3,82,3,6,3,6,3,14,5,2,3,6,3,12,5,2,3,100,3,4,9,6,13,2,3,12,3,16,7,6,7,6,3,4,7,14,3,2,3,10,3,20,3,60,3,4,3,10,15,4,5,16,9,6,3,48,5,6,3,32,3,6,3,82,3,6,3,6,3,14,5,2,3,6,15,6,3,100,3,4,9,6,7,2,7,2,3,34,3,6,3,8,3,4,3,2,3,8,3,2,3,2,3,4,3,2,3,4,3,18,3,60,3,4,3,10,21,20,7,6,3,42,3,2,3,4,5,14,5,4,3,10,3,8,3,82,3,6,3,6,3,14,9,6,5,2,5,10,3,90,3,8,3,4,3,2,5,10,9,2,3,20,5,10,3,16,3,2,9,8,7,2,3,14,3,20,3,60,3,4,3,10,21,20,7,6,3,44,3,2,3,16,7,2,3,6,3,4,3,2,3,6,3,82,3,6,3,2,5,22,5,2,5,2,3,2,3,6,5,90,3,2,5,2,3,2,13,14,7,2,3,4,3,14,3,2,3,16,3,8,3,4,3,10,9,2,3,6,3,2,3,22,3,60,3,4,3,10,21,20,7,6,3,42,3,18,5,4,3,6,7,6,3,8,3,82,3,6,3,24,5,2,5,2,5,2,5,2,5,94,3,2,5,2,3,2,13,14,5,2,3,6,3,8,3,8,3,16,3,8,3,12,7,2,3,2,3,10,3,2,3,18,13,52,3,4,3,10,21,22,5,6,3,44,3,4,3,8,3,2,3,8,3,4,3,10,3,6,3,82,3,6,3,18,7,6,3,2,5,2,3,2,5,94,5,2,3,8,3,4,3,2,5,12,9,2,3,12,3,2,11,36,9,2,3,2,3,2,3,24,9,12,15,38,3,4,3,10,19,18,3,4,5,6,3,38,3,2,3,2,7,2,3,2,3,2,3,14,7,2,3,2,3,8,3,82,3,4,3,12,9,12,3,114,3,2,5,2,9,2,7,12,13,6,3,2,5,2,11,30,3,2,3,12,3,2,3,18,9,34,15,24,3,4,3,10,17,6,17,4,5,6,3,32,3,2,3,2,5,6,3,4,3,16,3,8,3,4,3,8,3,82,3,4,15,20,3,6,3,102,5,2,3,8,3,4,3,2,5,10,3,2,17,2,7,4,7,2,3,4,3,2,5,2,3,6,3,6,3,16,3,2,3,12,5,54,15,12,3,4,3,10,15,4,23,2,5,6,3,34,3,2,5,4,3,22,3,28,3,82,3,4,3,2,3,4,3,20,5,6,3,6,15,82,5,2,3,8,3,4,3,2,5,10,3,2,17,2,7,4,7,2,3,4,3,2,5,2,3,6,3,22,3,2,3,2,3,10,7,66,15,4,3,8,43,2,5,6,3,36,3,2,9,10,3,6,5,2,3,8,3,16,3,82,3,4,3,4,3,2,3,16,5,10,3,4,3,114,7,2,9,8,3,8,7,2,9,10,3,2,5,2,3,8,7,2,3,8,3,4,3,2,3,6,3,2,3,8,13,74,15,14,35,6,3,38,3,16,3,4,7,2,3,2,3,10,3,96,3,4,3,2,3,4,3,12,5,14,3,4,3,82,3,2,5,2,3,24,3,8,3,18,13,8,7,18,3,2,7,4,13,10,3,8,27,104,3,2,21,6,3,36,3,4,3,8,3,2,5,10,5,10,3,2,3,94,3,4,3,4,3,2,3,8,5,18,3,2,3,80,5,2,3,4,3,10,7,12,17,2,3,8,11,2,3,4,3,14,15,10,3,10,3,2,3,2,3,6,7,10,21,96,5,2,9,2,11,6,3,50,3,2,15,2,3,2,3,2,5,4,3,2,3,6,3,82,5,4,3,2,3,4,3,2,7,10,15,2,3,80,5,2,3,4,3,10,7,12,17,2,3,8,9,2,3,2,3,2,3,14,15,8,3,14,3,2,3,8,11,14,19,90,15,10,3,6,3,52,17,8,3,2,3,6,3,6,3,78,7,8,3,4,3,2,5,10,5,12,5,2,3,2,5,98,3,22,5,2,5,2,3,6,13,2,3,4,3,14,3,10,11,14,3,10,19,16,21,82,7,2,7,10,3,6,3,38,3,2,3,6,3,2,11,14,11,2,3,6,3,70,7,8,7,2,9,12,3,14,3,2,3,2,3,2,3,2,3,6,3,0}; decompTile(ptr,back, 6); } void dispBack2(uint8_t* ptr) { uint8_t back[] = {88,3,28,9,6,21,2,11,14,3,2,3,2,3,2,3,2,3,4,3,4,3,6,3,10,15,16,9,2,3,2,7,74,9,2,9,10,9,36,3,2,3,2,5,4,11,6,3,8,3,6,5,6,3,2,3,62,7,42,17,4,3,2,3,2,7,6,3,88,5,26,9,6,21,2,11,12,3,2,3,2,3,2,3,2,3,2,3,6,3,8,7,10,5,2,9,18,9,2,3,2,7,68,9,2,9,18,15,24,3,2,5,6,9,6,3,2,3,6,7,14,3,58,7,48,17,4,3,2,7,10,3,92,9,24,3,8,3,4,11,2,9,10,3,2,3,2,3,2,3,2,3,2,3,6,3,2,3,2,3,2,3,2,9,12,7,2,9,18,9,2,3,2,9,62,5,4,9,32,15,12,3,4,15,8,3,2,3,4,13,62,7,54,17,4,3,2,7,10,3,124,9,2,13,4,3,2,9,6,3,2,3,2,3,2,3,14,3,6,3,2,3,2,3,2,11,12,5,2,3,2,7,20,9,2,3,2,9,62,9,68,13,6,3,2,19,58,7,60,17,4,3,2,5,4,11,70,3,2,3,2,3,38,3,6,7,2,17,2,9,2,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6,3,8,7,8,3,4,3,254,82,81,4,83,2,15,4,7,4,21,18,7,2,3,2,3,2,9,6,3,10,7,6,3,6,3,254,120,3,10,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,10,3,6,3,10,3,16,5,2,3,2,3,2,3,2,5,10,7,8,3,4,3,254,126,3,10,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,10,3,6,3,10,3,18,5,2,3,2,3,2,3,2,7,2,5,6,3,6,3,6,3,254,124,3,10,3,2,3,10,3,14,3,14,3,14,3,14,3,14,3,30,3,14,3,18,3,10,3,22,7,2,3,2,3,2,3,2,3,6,3,4,3,6,3,254,124,71,4,25,4,27,4,23,4,21,4,33,8,5,2,3,2,3,2,5,6,3,6,3,254,140,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,30,3,14,3,14,3,20,9,2,3,2,3,2,3,4,3,254,146,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,8,13,2,3,254,152,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,30,3,14,3,10,11,254,128,33,12,5,4,13,12,37,4,89,4,19,6,15,6,7,254,180,3,30,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,14,3,22,3,254,200,3,30,3,14,3,14,3,14,3,14,3,14,3,14,3,254,254,2,3,30,3,30,3,14,3,14,3,14,3,14,3,14,3,14,3,254,196,29,8,29,14,39,4,49,2,3,2,3,14,3,254,198,3,14,3,14,3,26,3,18,3,14,3,30,3,14,3,14,3,254,224,3,14,3,14,3,26,3,18,3,14,3,14,3,14,3,14,3,14,3,254,254,2,3,26,3,18,3,14,3,14,3,14,3,14,3,14,3,254,254,30,3,18,3,14,3,14,3,254,254,22,37,20,3,18,3,14,3,14,3,254,254,78,3,18,3,14,3,14,3,254,254,112,29,12,5,2,3,2,3,254,254,88,3,14,3,14,3,254,254,114,3,14,3,254,254,114,3,14,3,254,254,114,3,14,3,254,254,114,3,14,3,14,3,254,118,0}; decompTile(ptr,back, 6); } void dispBack() { dispBack1(offscreen_ptr); dispBack2(offscreen_ptr+SCR_WIDTH*118/2); memcpy(screen_buf, offscreen_ptr, SCR_WIDTH*SCR_HEIGHT); } void initPalette() { palette[0] = rgb2color(0, 0, 0); palette[1] = rgb2color(255, 255, 0); palette[2] = rgb2color(255, 0, 255); palette[3] = rgb2color(0, 255, 255); palette[4] = rgb2color(255, 255, 255); palette[5] = rgb2color(226, 193, 0); palette[6] = 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) { 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 4"); // white asm("BackColor:"); asm(" DB 0"); // black 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");*/ }