void SMS_loadSTMcompressedTileMapArea (unsigned char x, unsigned char y, unsigned char *src, unsigned char width) { unsigned int HH=0x0000; unsigned int oldHH=0x0000; unsigned int dest=XYtoADDR(x,y); unsigned char cur; unsigned char cnt; unsigned char ttw=width; bool needRestore=false; SMS_setAddr(dest); while (true) { cur=*src++; if (cur & 0x01) { if (cur & 0x02) { /* RLE of successive words */ HH=(HH & 0xFF00)|*src++; cnt=(cur>>2)+2; while (cnt>0) { SMS_setTile(HH); if (--ttw==0) { dest+=64; // skip to next line SMS_setAddr(dest); ttw=width; } if (cnt>1) HH++; cnt--; } } else { /* RLE of same words */ HH=(HH & 0xFF00)|*src++; cnt=(cur>>2)+2; while (cnt>0) { SMS_setTile(HH); if (--ttw==0) { dest+=64; // skip to next line SMS_setAddr(dest); ttw=width; } cnt--; } } } else {
void VDP_printText(char *text, unsigned char x, unsigned char y, unsigned int baseTile) { char *currentChar; SMS_setNextTileatXY(x,y); currentChar = text; while(*currentChar != 0) { SMS_setTile(baseTile + *currentChar -32); currentChar++; } }