mirror of
https://github.com/sehugg/8bitworkshop.git
synced 2024-11-26 10:49:17 +00:00
119 lines
8.5 KiB
C
119 lines
8.5 KiB
C
|
|
#include "williams.h"
|
|
|
|
#define LOCHAR 0x20
|
|
#define HICHAR 0x7e
|
|
|
|
const byte CH_32[] = { 0x21,0x51,0x00 };
|
|
const byte CH_33[] = { 0x21,0x55,0xf0,0xf0,0xf0,0x00,0xf0 };
|
|
const byte CH_34[] = { 0x42,0x52,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_35[] = { 0x42,0x55,0xf0,0xf0,0xff,0xf0,0xf0,0xf0,0xff,0xf0,0xf0,0xf0 };
|
|
const byte CH_36[] = { 0x42,0x55,0x0f,0xf0,0xff,0x00,0x0f,0xf0,0xff,0x00,0x0f,0x00 };
|
|
const byte CH_37[] = { 0x42,0x55,0xf0,0x00,0x00,0xf0,0x0f,0x00,0xf0,0x00,0x00,0xf0 };
|
|
const byte CH_38[] = { 0x42,0x55,0xff,0x00,0xff,0x00,0xff,0xf0,0xf0,0xf0,0x0f,0xf0 };
|
|
const byte CH_39[] = { 0x21,0x52,0xf0,0xf0 };
|
|
const byte CH_40[] = { 0x32,0x55,0x0f,0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x0f,0x00 };
|
|
const byte CH_41[] = { 0x32,0x55,0xf0,0x00,0x0f,0x00,0x0f,0x00,0x0f,0x00,0xf0,0x00 };
|
|
const byte CH_42[] = { 0x42,0x53,0xf0,0xf0,0x0f,0x00,0xf0,0xf0 };
|
|
const byte CH_43[] = { 0x42,0x43,0x0f,0x00,0xff,0xf0,0x0f,0x00 };
|
|
const byte CH_44[] = { 0x32,0x22,0x0f,0x00,0xf0,0x00 };
|
|
const byte CH_45[] = { 0x42,0x31,0xff,0xf0 };
|
|
const byte CH_46[] = { 0x21,0x11,0xf0 };
|
|
const byte CH_47[] = { 0x42,0x55,0x00,0xf0,0x00,0xf0,0x0f,0x00,0xf0,0x00,0xf0,0x00 };
|
|
const byte CH_48[] = { 0x42,0x55,0x0f,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xff,0x00 };
|
|
const byte CH_49[] = { 0x32,0x55,0x0f,0x00,0xff,0x00,0x0f,0x00,0x0f,0x00,0x0f,0x00 };
|
|
const byte CH_50[] = { 0x42,0x55,0xff,0x00,0x00,0xf0,0x0f,0x00,0xf0,0x00,0xff,0xf0 };
|
|
const byte CH_51[] = { 0x42,0x55,0xff,0x00,0x00,0xf0,0x0f,0x00,0x00,0xf0,0xff,0x00 };
|
|
const byte CH_52[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0xff,0xf0,0x00,0xf0,0x00,0xf0 };
|
|
const byte CH_53[] = { 0x42,0x55,0xff,0xf0,0xf0,0x00,0xff,0x00,0x00,0xf0,0xff,0x00 };
|
|
const byte CH_54[] = { 0x42,0x55,0x0f,0xf0,0xf0,0x00,0xff,0xf0,0xf0,0xf0,0xff,0xf0 };
|
|
const byte CH_55[] = { 0x42,0x55,0xff,0xf0,0x00,0xf0,0x0f,0x00,0xf0,0x00,0xf0,0x00 };
|
|
const byte CH_56[] = { 0x42,0x55,0xff,0xf0,0xf0,0xf0,0xff,0xf0,0xf0,0xf0,0xff,0xf0 };
|
|
const byte CH_57[] = { 0x42,0x55,0xff,0xf0,0xf0,0xf0,0xff,0xf0,0x00,0xf0,0xff,0x00 };
|
|
const byte CH_58[] = { 0x21,0x43,0xf0,0x00,0xf0 };
|
|
const byte CH_59[] = { 0x32,0x44,0x0f,0x00,0x00,0x00,0x0f,0x00,0xf0,0x00 };
|
|
const byte CH_60[] = { 0x42,0x55,0x00,0xf0,0x0f,0x00,0xf0,0x00,0x0f,0x00,0x00,0xf0 };
|
|
const byte CH_61[] = { 0x42,0x43,0xff,0xf0,0x00,0x00,0xff,0xf0 };
|
|
const byte CH_62[] = { 0x42,0x55,0xf0,0x00,0x0f,0x00,0x00,0xf0,0x0f,0x00,0xf0,0x00 };
|
|
const byte CH_63[] = { 0x42,0x55,0xff,0xf0,0x00,0xf0,0x0f,0x00,0x00,0x00,0x0f,0x00 };
|
|
const byte CH_64[] = { 0x42,0x55,0x0f,0x00,0xf0,0xf0,0xff,0xf0,0xf0,0x00,0x0f,0xf0 };
|
|
const byte CH_65[] = { 0x42,0x55,0x0f,0x00,0xf0,0xf0,0xff,0xf0,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_66[] = { 0x42,0x55,0xff,0x00,0xf0,0xf0,0xff,0x00,0xf0,0xf0,0xff,0x00 };
|
|
const byte CH_67[] = { 0x42,0x55,0x0f,0xf0,0xf0,0x00,0xf0,0x00,0xf0,0x00,0x0f,0xf0 };
|
|
const byte CH_68[] = { 0x42,0x55,0xff,0x00,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xff,0x00 };
|
|
const byte CH_69[] = { 0x42,0x55,0xff,0xf0,0xf0,0x00,0xff,0xf0,0xf0,0x00,0xff,0xf0 };
|
|
const byte CH_70[] = { 0x42,0x55,0xff,0xf0,0xf0,0x00,0xff,0xf0,0xf0,0x00,0xf0,0x00 };
|
|
const byte CH_71[] = { 0x42,0x55,0x0f,0xf0,0xf0,0x00,0xff,0xf0,0xf0,0xf0,0x0f,0xf0 };
|
|
const byte CH_72[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0xff,0xf0,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_73[] = { 0x42,0x55,0xff,0xf0,0x0f,0x00,0x0f,0x00,0x0f,0x00,0xff,0xf0 };
|
|
const byte CH_74[] = { 0x42,0x55,0x00,0xf0,0x00,0xf0,0x00,0xf0,0xf0,0xf0,0x0f,0x00 };
|
|
const byte CH_75[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0xff,0x00,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_76[] = { 0x42,0x55,0xf0,0x00,0xf0,0x00,0xf0,0x00,0xf0,0x00,0xff,0xf0 };
|
|
const byte CH_77[] = { 0x42,0x55,0xf0,0xf0,0xff,0xf0,0xff,0xf0,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_78[] = { 0x42,0x55,0xf0,0xf0,0xff,0xf0,0xff,0xf0,0xff,0xf0,0xf0,0xf0 };
|
|
const byte CH_79[] = { 0x42,0x55,0x0f,0x00,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0x0f,0x00 };
|
|
const byte CH_80[] = { 0x42,0x55,0xff,0x00,0xf0,0xf0,0xff,0x00,0xf0,0x00,0xf0,0x00 };
|
|
const byte CH_81[] = { 0x42,0x55,0x0f,0x00,0xf0,0xf0,0xf0,0xf0,0xff,0xf0,0x0f,0xf0 };
|
|
const byte CH_82[] = { 0x42,0x55,0xff,0x00,0xf0,0xf0,0xff,0xf0,0xff,0x00,0xf0,0xf0 };
|
|
const byte CH_83[] = { 0x42,0x55,0x0f,0xf0,0xf0,0x00,0x0f,0x00,0x00,0xf0,0xff,0x00 };
|
|
const byte CH_84[] = { 0x42,0x55,0xff,0xf0,0x0f,0x00,0x0f,0x00,0x0f,0x00,0x0f,0x00 };
|
|
const byte CH_85[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0x0f,0xf0 };
|
|
const byte CH_86[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0x0f,0x00,0x0f,0x00 };
|
|
const byte CH_87[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0xff,0xf0,0xff,0xf0,0xf0,0xf0 };
|
|
const byte CH_88[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0x0f,0x00,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_89[] = { 0x42,0x55,0xf0,0xf0,0xf0,0xf0,0x0f,0x00,0x0f,0x00,0x0f,0x00 };
|
|
const byte CH_90[] = { 0x42,0x55,0xff,0xf0,0x00,0xf0,0x0f,0x00,0xf0,0x00,0xff,0xf0 };
|
|
const byte CH_91[] = { 0x42,0x55,0xff,0xf0,0xf0,0x00,0xf0,0x00,0xf0,0x00,0xff,0xf0 };
|
|
const byte CH_92[] = { 0x42,0x43,0xf0,0x00,0x0f,0x00,0x00,0xf0 };
|
|
const byte CH_93[] = { 0x42,0x55,0xff,0xf0,0x00,0xf0,0x00,0xf0,0x00,0xf0,0xff,0xf0 };
|
|
const byte CH_94[] = { 0x42,0x52,0x0f,0x00,0xf0,0xf0 };
|
|
const byte CH_95[] = { 0x42,0x11,0xff,0xf0 };
|
|
const byte CH_96[] = { 0x32,0x52,0xf0,0x00,0x0f,0x00 };
|
|
const byte CH_97[] = { 0x42,0x44,0xff,0x00,0x0f,0xf0,0xf0,0xf0,0xff,0xf0 };
|
|
const byte CH_98[] = { 0x42,0x55,0xf0,0x00,0xff,0x00,0xf0,0xf0,0xf0,0xf0,0xff,0x00 };
|
|
const byte CH_99[] = { 0x42,0x44,0x0f,0xf0,0xf0,0x00,0xf0,0x00,0x0f,0xf0 };
|
|
const byte CH_100[] = { 0x42,0x55,0x00,0xf0,0x0f,0xf0,0xf0,0xf0,0xf0,0xf0,0x0f,0xf0 };
|
|
const byte CH_101[] = { 0x42,0x44,0x0f,0xf0,0xf0,0xf0,0xff,0x00,0x0f,0xf0 };
|
|
const byte CH_102[] = { 0x42,0x55,0x00,0xf0,0x0f,0x00,0xff,0xf0,0x0f,0x00,0x0f,0x00 };
|
|
const byte CH_103[] = { 0x42,0x45,0x0f,0xf0,0xf0,0xf0,0xff,0xf0,0x00,0xf0,0x0f,0x00 };
|
|
const byte CH_104[] = { 0x42,0x55,0xf0,0x00,0xff,0x00,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_105[] = { 0x21,0x55,0xf0,0x00,0xf0,0xf0,0xf0 };
|
|
const byte CH_106[] = { 0x42,0x56,0x00,0xf0,0x00,0x00,0x00,0xf0,0x00,0xf0,0xf0,0xf0,0x0f,0x00 };
|
|
const byte CH_107[] = { 0x42,0x55,0xf0,0x00,0xf0,0xf0,0xff,0x00,0xff,0x00,0xf0,0xf0 };
|
|
const byte CH_108[] = { 0x42,0x55,0xff,0x00,0x0f,0x00,0x0f,0x00,0x0f,0x00,0xff,0xf0 };
|
|
const byte CH_109[] = { 0x42,0x44,0xff,0xf0,0xff,0xf0,0xff,0xf0,0xf0,0xf0 };
|
|
const byte CH_110[] = { 0x42,0x44,0xff,0x00,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0 };
|
|
const byte CH_111[] = { 0x42,0x44,0x0f,0x00,0xf0,0xf0,0xf0,0xf0,0x0f,0x00 };
|
|
const byte CH_112[] = { 0x42,0x45,0xff,0x00,0xf0,0xf0,0xf0,0xf0,0xff,0x00,0xf0,0x00 };
|
|
const byte CH_113[] = { 0x42,0x45,0x0f,0xf0,0xf0,0xf0,0xf0,0xf0,0x0f,0xf0,0x00,0xf0 };
|
|
const byte CH_114[] = { 0x42,0x44,0x0f,0xf0,0xf0,0x00,0xf0,0x00,0xf0,0x00 };
|
|
const byte CH_115[] = { 0x42,0x44,0x0f,0xf0,0xff,0x00,0x0f,0xf0,0xff,0x00 };
|
|
const byte CH_116[] = { 0x42,0x55,0x0f,0x00,0xff,0xf0,0x0f,0x00,0x0f,0x00,0x0f,0xf0 };
|
|
const byte CH_117[] = { 0x42,0x44,0xf0,0xf0,0xf0,0xf0,0xf0,0xf0,0x0f,0xf0 };
|
|
const byte CH_118[] = { 0x42,0x44,0xf0,0xf0,0xf0,0xf0,0xff,0xf0,0x0f,0x00 };
|
|
const byte CH_119[] = { 0x42,0x44,0xf0,0xf0,0xff,0xf0,0xff,0xf0,0xff,0xf0 };
|
|
const byte CH_120[] = { 0x42,0x44,0xf0,0xf0,0x0f,0x00,0x0f,0x00,0xf0,0xf0 };
|
|
const byte CH_121[] = { 0x42,0x45,0xf0,0xf0,0xf0,0xf0,0x0f,0xf0,0x00,0xf0,0x0f,0x00 };
|
|
const byte CH_122[] = { 0x42,0x44,0xff,0xf0,0x0f,0xf0,0xff,0x00,0xff,0xf0 };
|
|
const byte CH_123[] = { 0x42,0x55,0x0f,0xf0,0x0f,0x00,0xf0,0x00,0x0f,0x00,0x0f,0xf0 };
|
|
const byte CH_124[] = { 0x21,0x55,0xf0,0xf0,0x00,0xf0,0xf0 };
|
|
const byte CH_125[] = { 0x42,0x55,0xff,0x00,0x0f,0x00,0x00,0xf0,0x0f,0x00,0xff,0x00 };
|
|
const byte CH_126[] = { 0x42,0x52,0x0f,0xf0,0xff,0x00 };
|
|
const byte* const FONT_TABLE[95] = { CH_32, CH_33, CH_34, CH_35, CH_36, CH_37, CH_38, CH_39, CH_40, CH_41, CH_42, CH_43, CH_44, CH_45, CH_46, CH_47, CH_48, CH_49, CH_50, CH_51, CH_52, CH_53, CH_54, CH_55, CH_56, CH_57, CH_58, CH_59, CH_60, CH_61, CH_62, CH_63, CH_64, CH_65, CH_66, CH_67, CH_68, CH_69, CH_70, CH_71, CH_72, CH_73, CH_74, CH_75, CH_76, CH_77, CH_78, CH_79, CH_80, CH_81, CH_82, CH_83, CH_84, CH_85, CH_86, CH_87, CH_88, CH_89, CH_90, CH_91, CH_92, CH_93, CH_94, CH_95, CH_96, CH_97, CH_98, CH_99, CH_100, CH_101, CH_102, CH_103, CH_104, CH_105, CH_106, CH_107, CH_108, CH_109, CH_110, CH_111, CH_112, CH_113, CH_114, CH_115, CH_116, CH_117, CH_118, CH_119, CH_120, CH_121, CH_122, CH_123, CH_124, CH_125, CH_126, };
|
|
|
|
byte draw_char(char ch, word x, byte y, byte color) {
|
|
const byte* shape;
|
|
if (ch < LOCHAR || ch > HICHAR) return 1;
|
|
shape = FONT_TABLE[ch - LOCHAR];
|
|
draw_copy_solid((byte)x, y - (shape[1]>>4),
|
|
shape[0] & 0xf, shape[1] & 0xf,
|
|
shape+2, color);
|
|
return shape[0] >> 4;
|
|
}
|
|
|
|
void draw_string(const char* str, word x, byte y, byte color) {
|
|
while (*str) {
|
|
x += draw_char(*str++, x, y, color);
|
|
}
|
|
}
|