mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-25 18:33:11 +00:00
54 lines
2.3 KiB
C
54 lines
2.3 KiB
C
|
|
#include "vcslib.h"
|
|
|
|
#pragma code-name (push, "ROM1")
|
|
#pragma rodata-name (push, "ROM1")
|
|
|
|
#define LoChar 41 // lowest character value
|
|
#define HiChar 90 // highest character value
|
|
|
|
/*{w:8,h:5,brev:1,flip:1,count:51}*/
|
|
const unsigned char TINYFONT[51*5] = {
|
|
0x22, 0x00, 0x22, 0x22, 0x22, 0x55, 0x22, 0x55, 0x00, 0x00, 0x22, 0x77, 0x22, 0x00, 0x00, 0x44,
|
|
0x22, 0x00, 0x00, 0x00, 0x77, 0x00, 0x00, 0x00, 0x00, 0x44, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44,
|
|
0x22, 0x11, 0x11, 0x66, 0x55, 0x55, 0x55, 0x33, 0x22, 0x22, 0x22, 0x66, 0x22, 0x77, 0x44, 0x22,
|
|
0x11, 0x66, 0x66, 0x11, 0x22, 0x11, 0x66, 0x11, 0x11, 0x77, 0x55, 0x55, 0x66, 0x11, 0x66, 0x44,
|
|
0x77, 0x77, 0x55, 0x77, 0x44, 0x33, 0x44, 0x44, 0x22, 0x11, 0x77, 0x77, 0x55, 0x77, 0x55, 0x77,
|
|
0x66, 0x11, 0x77, 0x55, 0x77, 0x44, 0x00, 0x44, 0x00, 0x00, 0x44, 0x22, 0x00, 0x22, 0x00, 0x11,
|
|
0x22, 0x44, 0x22, 0x11, 0x77, 0x00, 0x77, 0x00, 0x00, 0x44, 0x22, 0x11, 0x22, 0x44, 0x22, 0x00,
|
|
0x22, 0x11, 0x77, 0x33, 0x44, 0x77, 0x55, 0x22, 0x55, 0x55, 0x77, 0x55, 0x22, 0x66, 0x55, 0x66,
|
|
0x55, 0x66, 0x33, 0x44, 0x44, 0x44, 0x33, 0x66, 0x55, 0x55, 0x55, 0x66, 0x77, 0x44, 0x77, 0x44,
|
|
0x77, 0x44, 0x44, 0x77, 0x44, 0x77, 0x33, 0x55, 0x77, 0x44, 0x33, 0x55, 0x55, 0x77, 0x55, 0x55,
|
|
0x77, 0x22, 0x22, 0x22, 0x77, 0x22, 0x55, 0x11, 0x11, 0x11, 0x55, 0x55, 0x66, 0x55, 0x55, 0x77,
|
|
0x44, 0x44, 0x44, 0x44, 0x55, 0x55, 0x77, 0x77, 0x55, 0x55, 0x77, 0x77, 0x77, 0x55, 0x22, 0x55,
|
|
0x55, 0x55, 0x22, 0x44, 0x44, 0x66, 0x55, 0x66, 0x33, 0x77, 0x55, 0x55, 0x22, 0x55, 0x66, 0x77,
|
|
0x55, 0x66, 0x66, 0x11, 0x22, 0x44, 0x33, 0x22, 0x22, 0x22, 0x22, 0x77, 0x33, 0x55, 0x55, 0x55,
|
|
0x55, 0x22, 0x22, 0x55, 0x55, 0x55, 0x55, 0x77, 0x77, 0x55, 0x55, 0x55, 0x55, 0x22, 0x55, 0x55,
|
|
0x22, 0x22, 0x22, 0x55, 0x55, 0x77, 0x44, 0x22, 0x11, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00,
|
|
};
|
|
|
|
void tinyfont48_build_char(byte* dest, char ch1, char ch2) {
|
|
byte y;
|
|
byte font1 = 5*(ch1-LoChar);
|
|
byte font2 = 5*(ch2-LoChar);
|
|
for (y=0; y<5; y++) {
|
|
byte b1 = TINYFONT[font1++] & 0xf0;
|
|
byte b2 = TINYFONT[font2++] & 0x0f;
|
|
xramset(dest);
|
|
xramwrite(b1 | b2);
|
|
dest++;
|
|
}
|
|
}
|
|
|
|
// TODO: can we write when RAM is not selected?
|
|
void tinyfont48_build(byte* dest, const char str[12]) {
|
|
byte stri;
|
|
for (stri=0; stri<12; stri+=2) {
|
|
tinyfont48_build_char(dest, str[stri], str[stri+1]);
|
|
dest += 5;
|
|
}
|
|
}
|
|
|
|
#pragma code-name (pop)
|
|
#pragma rodata-name (pop)
|