#include "charmap_8x12.h" #include "screen.h" #include "string.h" #include "stdarg.h" #include "utils.h" #define SCR_HEIGHT 240 #define SCR_WIDTH 320 #define CHAR_SCR_HEIGHT SCR_HEIGHT/CHAR_HEIGHT #define CHAR_SCR_WIDTH SCR_WIDTH/CHAR_WIDTH void putChar(char* scrbuf, int x, int y, unsigned char ch) { int i, j, pixelOn; for(i = 0; i < CHAR_HEIGHT; i++) { for(j = 0; j < CHAR_WIDTH; j++) { pixelOn = charMap_ascii[ch][i] << j ; pixelOn = pixelOn & 0x80 ; if (pixelOn) { setPixelBuf(scrbuf, x + j, y + i, 0); } else { setPixelBuf(scrbuf, x + j, y + i, 15); } } } } void drawStr(char* scrbuf, int x, int y, unsigned char* str) { int l = strlen(str); int i; for (i = 0; i < l; i++) { if (str[i] == 0x0A) { x = 0; y += 12; } else { putChar(scrbuf, x, y, str[i]); } x += 8; if (x >= 312) { x = 0; y += 12; } } }