use the apple font for the BIOS (reduce memory footprint, make prettier)

This commit is contained in:
Jorj Bauer 2021-01-09 07:14:14 -05:00
parent c0f105807c
commit 5c701b9418
9 changed files with 174 additions and 227 deletions

View File

@ -132,137 +132,137 @@ const unsigned char ucase_glyphs[512] =
const unsigned char lcase_glyphs[256] =
{
/* : 0x60 */
/* : 0x60 \ */
0x02, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
/* : 0x61 */
/* : 0x61 a */
0x00, 0x00, 0x1c, 0x20, 0x3c, 0x22, 0x3c, 0x00,
/* : 0x62 */
/* : 0x62 b */
0x02, 0x02, 0x1e, 0x22, 0x22, 0x22, 0x1e, 0x00,
/* : 0x63 */
/* : 0x63 c */
0x00, 0x00, 0x3c, 0x02, 0x02, 0x02, 0x3c, 0x00,
/* : 0x64 */
/* : 0x64 d */
0x20, 0x20, 0x3c, 0x22, 0x22, 0x22, 0x3c, 0x00,
/* : 0x65 */
/* : 0x65 e */
0x00, 0x00, 0x1c, 0x22, 0x3e, 0x02, 0x3c, 0x00,
/* : 0x66 */
/* : 0x66 f */
0x18, 0x24, 0x04, 0x0e, 0x04, 0x04, 0x04, 0x00,
/* : 0x67 */
/* : 0x67 g */
0x00, 0x00, 0x1c, 0x22, 0x22, 0x3c, 0x20, 0x1c,
/* : 0x68 */
/* : 0x68 h */
0x02, 0x02, 0x1e, 0x22, 0x22, 0x22, 0x22, 0x00,
/* : 0x69 */
/* : 0x69 i */
0x08, 0x00, 0x0c, 0x08, 0x08, 0x08, 0x1c, 0x00,
/* : 0x6a */
/* : 0x6a j */
0x10, 0x00, 0x18, 0x10, 0x10, 0x10, 0x12, 0x0c,
/* : 0x6b */
/* : 0x6b k */
0x02, 0x02, 0x22, 0x12, 0x0e, 0x12, 0x22, 0x00,
/* : 0x6c */
/* : 0x6c l */
0x0c, 0x08, 0x08, 0x08, 0x08, 0x08, 0x1c, 0x00,
/* : 0x6d */
/* : 0x6d m */
0x00, 0x00, 0x16, 0x2a, 0x2a, 0x2a, 0x2a, 0x00,
/* : 0x6e */
/* : 0x6e n */
0x00, 0x00, 0x1e, 0x22, 0x22, 0x22, 0x22, 0x00,
/* : 0x6f */
/* : 0x6f o */
0x00, 0x00, 0x1c, 0x22, 0x22, 0x22, 0x1c, 0x00,
/* : 0x70 */
/* : 0x70 p */
0x00, 0x00, 0x1e, 0x22, 0x22, 0x1e, 0x02, 0x02,
/* : 0x71 */
/* : 0x71 q */
0x00, 0x00, 0x3c, 0x22, 0x22, 0x3c, 0x20, 0x20,
/* : 0x72 */
/* : 0x72 r */
0x00, 0x00, 0x3a, 0x06, 0x02, 0x02, 0x02, 0x00,
/* : 0x73 */
/* : 0x73 s */
0x00, 0x00, 0x3c, 0x02, 0x1c, 0x20, 0x1e, 0x00,
/* : 0x74 */
/* : 0x74 t */
0x04, 0x04, 0x3e, 0x04, 0x04, 0x24, 0x18, 0x00,
/* : 0x75 */
/* : 0x75 u */
0x00, 0x00, 0x22, 0x22, 0x22, 0x32, 0x2c, 0x00,
/* : 0x76 */
/* : 0x76 v */
0x00, 0x00, 0x22, 0x22, 0x22, 0x14, 0x08, 0x00,
/* : 0x77 */
/* : 0x77 w */
0x00, 0x00, 0x22, 0x2a, 0x2a, 0x2a, 0x14, 0x00,
/* : 0x78 */
/* : 0x78 x */
0x00, 0x00, 0x22, 0x14, 0x08, 0x14, 0x22, 0x00,
/* : 0x79 */
/* : 0x79 y */
0x00, 0x00, 0x22, 0x22, 0x22, 0x3c, 0x20, 0x1c,
/* : 0x7a */
/* : 0x7a z */
0x00, 0x00, 0x3e, 0x10, 0x08, 0x04, 0x3e, 0x00,
/* : 0x7b */
/* : 0x7b { */
0x38, 0x0c, 0x0c, 0x06, 0x0c, 0x0c, 0x38, 0x00,
/* : 0x7c */
/* : 0x7c flat colon */
0x08, 0x08, 0x08, 0x00, 0x08, 0x08, 0x08, 0x00,
/* : 0x7d */
/* : 0x7d } */
0x0e, 0x18, 0x18, 0x30, 0x18, 0x18, 0x0e, 0x00,
/* : 0x7e */
/* : 0x7e ~ */
0x2c, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* : 0x7f */
/* : 0x7f delete block */
0x00, 0x2a, 0x14, 0x2a, 0x14, 0x2a, 0x00, 0x00
};
const unsigned char mousetext_glyphs[256] =
{
/* : 0x00 */
/* : 0x00 closed apple */
0x10, 0x08, 0x36, 0x7f, 0x3f, 0x3f, 0x7e, 0x36,
/* : 0x01 */
/* : 0x01 open apple */
0x10, 0x08, 0x36, 0x41, 0x21, 0x21, 0x4a, 0x36,
/* : 0x02 */
/* : 0x02 mouse pointer arrow */
0x00, 0x00, 0x02, 0x06, 0x0e, 0x1e, 0x36, 0x42,
/* : 0x03 */
/* : 0x03 hourglass */
0x7f, 0x22, 0x14, 0x08, 0x08, 0x14, 0x22, 0x7f,
/* : 0x04 */
/* : 0x04 checkmark */
0x00, 0x40, 0x20, 0x11, 0x0a, 0x04, 0x04, 0x00,
/* : 0x05 */
/* : 0x05 inverted checkmark */
0x7f, 0x3f, 0x5f, 0x6e, 0x75, 0x7b, 0x7b, 0x7f,
/* : 0x06 */
/* : 0x06 left half of running person */
0x70, 0x60, 0x7e, 0x31, 0x79, 0x30, 0x3f, 0x02,
/* : 0x07 */
/* : 0x07 right half of running person */
0x00, 0x18, 0x07, 0x00, 0x07, 0x0c, 0x08, 0x70,
/* : 0x08 */
/* : 0x08 left arrow */
0x08, 0x04, 0x02, 0x7f, 0x02, 0x04, 0x08, 0x00,
/* : 0x09 */
/* : 0x09 ... */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2a,
/* : 0x0a */
/* : 0x0a down arrow */
0x08, 0x08, 0x08, 0x08, 0x49, 0x2a, 0x1c, 0x08,
/* : 0x0b */
/* : 0x0b up arrow */
0x08, 0x1c, 0x2a, 0x49, 0x08, 0x08, 0x08, 0x08,
/* : 0x0c */
/* : 0x0c overscore */
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/* : 0x0d */
/* : 0x0d carriage return arrow */
0x40, 0x40, 0x40, 0x44, 0x46, 0x7f, 0x06, 0x04,
/* : 0x0e */
/* : 0x0e solid block */
0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f,
/* : 0x0f */
/* : 0x0f inline left arrow */
0x13, 0x18, 0x1c, 0x7e, 0x1c, 0x18, 0x10, 0x6f,
/* : 0x10 */
/* : 0x10 inline right arrow */
0x64, 0x0c, 0x1c, 0x3f, 0x1c, 0x0c, 0x04, 0x7b,
/* : 0x11 */
/* : 0x11 inline down arrow */
0x40, 0x48, 0x08, 0x7f, 0x3e, 0x1c, 0x48, 0x40,
/* : 0x12 */
/* : 0x12 inline up arrow */
0x40, 0x48, 0x1c, 0x3e, 0x7f, 0x08, 0x48, 0x40,
/* : 0x13 */
/* : 0x13 dash */
0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00,
/* : 0x14 */
/* : 0x14 left/bottom border */
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x7f,
/* : 0x15 */
/* : 0x15 right arrow */
0x08, 0x10, 0x20, 0x7f, 0x20, 0x10, 0x08, 0x00,
/* : 0x16 */
/* : 0x16 delete char 1 */
0x2a, 0x55, 0x2a, 0x55, 0x2a, 0x55, 0x2a, 0x55,
/* : 0x17 */
/* : 0x17 delete char 2 */
0x55, 0x2a, 0x55, 0x2a, 0x55, 0x2a, 0x55, 0x2a,
/* : 0x18 */
/* : 0x18 left half of folder */
0x00, 0x3e, 0x41, 0x01, 0x01, 0x01, 0x7f, 0x00,
/* : 0x19 */
/* : 0x19 right half of folder */
0x00, 0x00, 0x3f, 0x40, 0x40, 0x40, 0x7f, 0x00,
/* : 0x1a */
/* : 0x1a right border */
0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
/* : 0x1b */
/* : 0x1b diamond */
0x08, 0x1c, 0x3e, 0x7f, 0x3e, 0x1c, 0x08, 0x00,
/* : 0x1c */
/* : 0x1c top and bottom border */
0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f,
/* : 0x1d */
/* : 0x1d crosshairs */
0x14, 0x14, 0x77, 0x00, 0x77, 0x14, 0x14, 0x00,
/* : 0x1e */
/* : 0x1e top/right/bottom border with center dot */
0x7f, 0x40, 0x40, 0x4c, 0x4c, 0x40, 0x40, 0x7f,
/* : 0x1f */
/* : 0x1f left border */
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01
};
@ -333,3 +333,30 @@ const unsigned char interface_glyphs[256] =
/* : 0x1F ----------------------- glyph_nonactionable */
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
};
// Generic utility for anything trying to turn those glyph maps into
// characters based on ASCII input
static const unsigned char *asciiToAppleGlyph(unsigned char c)
{
if (c < 32) {
return &ucase_glyphs[32]; // space
} else if (c <= 63) {
// space through ?
return &ucase_glyphs[(c-32+32)*8];
} else if (c <= 95) {
// @ through Z to _
return &ucase_glyphs[(c-64)*8];
} else if (c <= 127) {
// Direct mapping of lcase_glyphs: ` through z to del
return &lcase_glyphs[(c-96)*8];
} else if (c <= 159) {
// map in the 32 mousetext_glyphs
return &mousetext_glyphs[(c-128)*8];
} else if (c <= 191) {
// map in the 32 interface_glyphs
return &interface_glyphs[(c-160)*8];
} else {
return &ucase_glyphs[32]; // space
}
}

View File

@ -1,107 +0,0 @@
// SmallFont.c from UTFT library
// Font Size : 8x12
// Memory usage : 1144 bytes
// # characters : 95
#ifndef TEENSYDUINO
#define PROGMEM
#endif
// xsize: 8; ysize: 0x0C; offset: 0x20; numchars: 0x5F
uint8_t BiosFont[1140] PROGMEM={
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // <Space>
0x00,0x00,0x20,0x20,0x20,0x20,0x20,0x20,0x00,0x20,0x00,0x00, // !
0x00,0x28,0x50,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // "
0x00,0x00,0x28,0x28,0xFC,0x28,0x50,0xFC,0x50,0x50,0x00,0x00, // #
0x00,0x20,0x78,0xA8,0xA0,0x60,0x30,0x28,0xA8,0xF0,0x20,0x00, // $
0x00,0x00,0x48,0xA8,0xB0,0x50,0x28,0x34,0x54,0x48,0x00,0x00, // %
0x00,0x00,0x20,0x50,0x50,0x78,0xA8,0xA8,0x90,0x6C,0x00,0x00, // &
0x00,0x40,0x40,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
0x00,0x04,0x08,0x10,0x10,0x10,0x10,0x10,0x10,0x08,0x04,0x00, // (
0x00,0x40,0x20,0x10,0x10,0x10,0x10,0x10,0x10,0x20,0x40,0x00, // )
0x00,0x00,0x00,0x20,0xA8,0x70,0x70,0xA8,0x20,0x00,0x00,0x00, // *
0x00,0x00,0x20,0x20,0x20,0xF8,0x20,0x20,0x20,0x00,0x00,0x00, // +
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x40,0x80, // ,
0x00,0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, // -
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x40,0x00,0x00, // .
0x00,0x08,0x10,0x10,0x10,0x20,0x20,0x40,0x40,0x40,0x80,0x00, // /
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // 0
0x00,0x00,0x20,0x60,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // 1
0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x40,0x80,0xF8,0x00,0x00, // 2
0x00,0x00,0x70,0x88,0x08,0x30,0x08,0x08,0x88,0x70,0x00,0x00, // 3
0x00,0x00,0x10,0x30,0x50,0x50,0x90,0x78,0x10,0x18,0x00,0x00, // 4
0x00,0x00,0xF8,0x80,0x80,0xF0,0x08,0x08,0x88,0x70,0x00,0x00, // 5
0x00,0x00,0x70,0x90,0x80,0xF0,0x88,0x88,0x88,0x70,0x00,0x00, // 6
0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x20,0x20,0x20,0x00,0x00, // 7
0x00,0x00,0x70,0x88,0x88,0x70,0x88,0x88,0x88,0x70,0x00,0x00, // 8
0x00,0x00,0x70,0x88,0x88,0x88,0x78,0x08,0x48,0x70,0x00,0x00, // 9
0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x00,0x20,0x00,0x00, // :
0x00,0x00,0x00,0x00,0x00,0x20,0x00,0x00,0x00,0x20,0x20,0x00, // ;
0x00,0x04,0x08,0x10,0x20,0x40,0x20,0x10,0x08,0x04,0x00,0x00, // <
0x00,0x00,0x00,0x00,0xF8,0x00,0x00,0xF8,0x00,0x00,0x00,0x00, // =
0x00,0x40,0x20,0x10,0x08,0x04,0x08,0x10,0x20,0x40,0x00,0x00, // >
0x00,0x00,0x70,0x88,0x88,0x10,0x20,0x20,0x00,0x20,0x00,0x00, // ?
0x00,0x00,0x70,0x88,0x98,0xA8,0xA8,0xB8,0x80,0x78,0x00,0x00, // @
0x00,0x00,0x20,0x20,0x30,0x50,0x50,0x78,0x48,0xCC,0x00,0x00, // A
0x00,0x00,0xF0,0x48,0x48,0x70,0x48,0x48,0x48,0xF0,0x00,0x00, // B
0x00,0x00,0x78,0x88,0x80,0x80,0x80,0x80,0x88,0x70,0x00,0x00, // C
0x00,0x00,0xF0,0x48,0x48,0x48,0x48,0x48,0x48,0xF0,0x00,0x00, // D
0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x48,0xF8,0x00,0x00, // E
0x00,0x00,0xF8,0x48,0x50,0x70,0x50,0x40,0x40,0xE0,0x00,0x00, // F
0x00,0x00,0x38,0x48,0x80,0x80,0x9C,0x88,0x48,0x30,0x00,0x00, // G
0x00,0x00,0xCC,0x48,0x48,0x78,0x48,0x48,0x48,0xCC,0x00,0x00, // H
0x00,0x00,0xF8,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // I
0x00,0x00,0x7C,0x10,0x10,0x10,0x10,0x10,0x10,0x90,0xE0,0x00, // J
0x00,0x00,0xEC,0x48,0x50,0x60,0x50,0x50,0x48,0xEC,0x00,0x00, // K
0x00,0x00,0xE0,0x40,0x40,0x40,0x40,0x40,0x44,0xFC,0x00,0x00, // L
0x00,0x00,0xD8,0xD8,0xD8,0xD8,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // M
0x00,0x00,0xDC,0x48,0x68,0x68,0x58,0x58,0x48,0xE8,0x00,0x00, // N
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0x88,0x88,0x70,0x00,0x00, // O
0x00,0x00,0xF0,0x48,0x48,0x70,0x40,0x40,0x40,0xE0,0x00,0x00, // P
0x00,0x00,0x70,0x88,0x88,0x88,0x88,0xE8,0x98,0x70,0x18,0x00, // Q
0x00,0x00,0xF0,0x48,0x48,0x70,0x50,0x48,0x48,0xEC,0x00,0x00, // R
0x00,0x00,0x78,0x88,0x80,0x60,0x10,0x08,0x88,0xF0,0x00,0x00, // S
0x00,0x00,0xF8,0xA8,0x20,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // T
0x00,0x00,0xCC,0x48,0x48,0x48,0x48,0x48,0x48,0x30,0x00,0x00, // U
0x00,0x00,0xCC,0x48,0x48,0x50,0x50,0x30,0x20,0x20,0x00,0x00, // V
0x00,0x00,0xA8,0xA8,0xA8,0x70,0x50,0x50,0x50,0x50,0x00,0x00, // W
0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x50,0x50,0xD8,0x00,0x00, // X
0x00,0x00,0xD8,0x50,0x50,0x20,0x20,0x20,0x20,0x70,0x00,0x00, // Y
0x00,0x00,0xF8,0x90,0x10,0x20,0x20,0x40,0x48,0xF8,0x00,0x00, // Z
0x00,0x38,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x38,0x00, // [
0x00,0x40,0x40,0x40,0x20,0x20,0x10,0x10,0x10,0x08,0x00,0x00, // <Backslash>
0x00,0x70,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x70,0x00, // ]
0x00,0x20,0x50,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ^
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFC, // _
0x00,0x20,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // '
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x38,0x48,0x3C,0x00,0x00, // a
0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0x70,0x00,0x00, // b
0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x40,0x40,0x38,0x00,0x00, // c
0x00,0x00,0x18,0x08,0x08,0x38,0x48,0x48,0x48,0x3C,0x00,0x00, // d
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x78,0x40,0x38,0x00,0x00, // e
0x00,0x00,0x1C,0x20,0x20,0x78,0x20,0x20,0x20,0x78,0x00,0x00, // f
0x00,0x00,0x00,0x00,0x00,0x3C,0x48,0x30,0x40,0x78,0x44,0x38, // g
0x00,0x00,0xC0,0x40,0x40,0x70,0x48,0x48,0x48,0xEC,0x00,0x00, // h
0x00,0x00,0x20,0x00,0x00,0x60,0x20,0x20,0x20,0x70,0x00,0x00, // i
0x00,0x00,0x10,0x00,0x00,0x30,0x10,0x10,0x10,0x10,0x10,0xE0, // j
0x00,0x00,0xC0,0x40,0x40,0x5C,0x50,0x70,0x48,0xEC,0x00,0x00, // k
0x00,0x00,0xE0,0x20,0x20,0x20,0x20,0x20,0x20,0xF8,0x00,0x00, // l
0x00,0x00,0x00,0x00,0x00,0xF0,0xA8,0xA8,0xA8,0xA8,0x00,0x00, // m
0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0xEC,0x00,0x00, // n
0x00,0x00,0x00,0x00,0x00,0x30,0x48,0x48,0x48,0x30,0x00,0x00, // o
0x00,0x00,0x00,0x00,0x00,0xF0,0x48,0x48,0x48,0x70,0x40,0xE0, // p
0x00,0x00,0x00,0x00,0x00,0x38,0x48,0x48,0x48,0x38,0x08,0x1C, // q
0x00,0x00,0x00,0x00,0x00,0xD8,0x60,0x40,0x40,0xE0,0x00,0x00, // r
0x00,0x00,0x00,0x00,0x00,0x78,0x40,0x30,0x08,0x78,0x00,0x00, // s
0x00,0x00,0x00,0x20,0x20,0x70,0x20,0x20,0x20,0x18,0x00,0x00, // t
0x00,0x00,0x00,0x00,0x00,0xD8,0x48,0x48,0x48,0x3C,0x00,0x00, // u
0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x00,0x00, // v
0x00,0x00,0x00,0x00,0x00,0xA8,0xA8,0x70,0x50,0x50,0x00,0x00, // w
0x00,0x00,0x00,0x00,0x00,0xD8,0x50,0x20,0x50,0xD8,0x00,0x00, // x
0x00,0x00,0x00,0x00,0x00,0xEC,0x48,0x50,0x30,0x20,0x20,0xC0, // y
0x00,0x00,0x00,0x00,0x00,0x78,0x10,0x20,0x20,0x78,0x00,0x00, // z
0x00,0x18,0x10,0x10,0x10,0x20,0x10,0x10,0x10,0x10,0x18,0x00, // {
0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10,0x10, // |
0x00,0x60,0x20,0x20,0x20,0x10,0x20,0x20,0x20,0x20,0x60,0x00, // }
0x40,0xA4,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, // ~
};

View File

@ -6,6 +6,7 @@
#include "physicalkeyboard.h"
#include "physicaldisplay.h"
#include "cpu.h"
#include "appledisplay.h"
#ifdef TEENSYDUINO
#include <Bounce2.h>
@ -32,6 +33,8 @@ uint16_t numCacheEntries = 0;
char fileFilter[16]; // FIXME length & Strcpy -> strncpy
uint16_t fileSelectionFor; // define what the returned name is for
#define LINEHEIGHT 10
// menu screen enums
enum {
BIOS_AIIE = 0,
@ -129,9 +132,9 @@ void BIOS::DrawMenuBar()
for (int i=0; i<NUM_TITLES; i++) {
for (int x=0; x<titleWidths[i] + 2*XPADDING; x++) {
g_display->drawUIPixel(xpos+x, 0, 0xFFFF);
g_display->drawUIPixel(xpos+x, 16, 0xFFFF);
g_display->drawUIPixel(xpos+x, 10, 0xFFFF);
}
for (int y=0; y<=16; y++) {
for (int y=0; y<=10; y++) {
g_display->drawUIPixel(xpos, y, 0xFFFF);
g_display->drawUIPixel(xpos + titleWidths[i] + 2*XPADDING, y, 0xFFFF);
}
@ -275,7 +278,7 @@ uint16_t BIOS::AiieMenuHandler(bool needsRedraw, bool performAction)
selectedMenuItem %= sizeof(aiieActions);
if (needsRedraw || localRedraw) {
g_display->clrScr();
g_display->clrScr(c_darkblue);
DrawMenuBar();
DrawAiieMenu();
g_display->flush();
@ -300,7 +303,7 @@ uint16_t BIOS::VmMenuHandler(bool needsRedraw, bool performAction)
selectedMenuItem %= sizeof(vmActions);
if (needsRedraw || localRedraw) {
g_display->clrScr();
g_display->clrScr(c_darkblue);
DrawMenuBar();
DrawVMMenu();
@ -334,7 +337,7 @@ uint16_t BIOS::VmMenuHandler(bool needsRedraw, bool performAction)
localRedraw = true;
return BIOS_VM;
case ACT_SUSPEND:
g_display->clrScr();
g_display->clrScr(c_darkblue);
g_display->drawString(M_SELECTED, 80, 100,"Suspending VM...");
g_display->flush();
// CPU is already suspended, so this is safe...
@ -342,7 +345,7 @@ uint16_t BIOS::VmMenuHandler(bool needsRedraw, bool performAction)
localRedraw = true;
return BIOS_VM;
case ACT_RESTORE:
g_display->clrScr();
g_display->clrScr(c_darkblue);
g_display->drawString(M_SELECTED, 80, 100,"Resuming VM...");
g_display->flush();
((AppleVM *)g_vm)->Resume("suspend.vm");
@ -363,7 +366,7 @@ uint16_t BIOS::HardwareMenuHandler(bool needsRedraw, bool performAction)
selectedMenuItem %= sizeof(hardwareActions);
if (needsRedraw || localRedraw) {
g_display->clrScr();
g_display->clrScr(c_darkblue);
DrawMenuBar();
DrawHardwareMenu();
g_display->flush();
@ -451,7 +454,7 @@ uint16_t BIOS::DisksMenuHandler(bool needsRedraw, bool performAction)
selectedMenuItem %= sizeof(diskActions);
if (needsRedraw || localRedraw) {
g_display->clrScr();
g_display->clrScr(c_darkblue);
DrawMenuBar();
DrawDisksMenu();
g_display->flush();
@ -519,7 +522,7 @@ uint16_t BIOS::AboutScreenHandler(bool needsRedraw, bool performAction)
selectedMenuItem = 0;
if (needsRedraw || localRedraw) {
g_display->clrScr();
g_display->clrScr(c_darkblue);
g_display->drawString(M_SELECTED,
0,
@ -569,7 +572,7 @@ uint16_t BIOS::PaddlesScreenHandler(bool needsRedraw, bool performAction)
if (needsRedraw || localRedraw) {
char buf[50];
g_display->clrScr();
g_display->clrScr(c_darkblue);
sprintf(buf, "Paddle X: %d ", lastPaddleX);
g_display->drawString(M_NORMAL, 0, 12, buf);
sprintf(buf, "Paddle Y: %d ", lastPaddleY);
@ -776,9 +779,9 @@ void BIOS::DrawAiieMenu()
}
if (isActionActive(aiieActions[i])) {
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + LINEHEIGHT * i, buf);
} else {
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + 14 * i,
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + LINEHEIGHT * i,
buf);
}
}
@ -852,9 +855,9 @@ void BIOS::DrawVMMenu()
}
if (isActionActive(vmActions[i])) {
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + LINEHEIGHT * i, buf);
} else {
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + LINEHEIGHT * i, buf);
}
}
}
@ -931,9 +934,9 @@ void BIOS::DrawHardwareMenu()
}
if (isActionActive(hardwareActions[i])) {
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + LINEHEIGHT * i, buf);
} else {
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + LINEHEIGHT * i, buf);
}
}
@ -1001,9 +1004,9 @@ void BIOS::DrawDisksMenu()
}
if (isActionActive(diskActions[i])) {
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTED : M_NORMAL, 10, 20 + LINEHEIGHT * i, buf);
} else {
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + 14 * i, buf);
g_display->drawString(selectedMenuItem == i ? M_SELECTDISABLED : M_DISABLED, 10, 20 + LINEHEIGHT * i, buf);
}
}
}
@ -1046,7 +1049,7 @@ void BIOS::stripDirectory()
uint16_t BIOS::DrawDiskNames(uint8_t page, int8_t selection, const char *filter)
{
uint16_t fileCount = GatherFilenames(page, filter);
g_display->clrScr();
g_display->clrScr(c_darkblue);
g_display->drawString(M_NORMAL, 0, 12, "BIOS Configuration - pick disk");
if (page == 0) {
@ -1058,18 +1061,18 @@ uint16_t BIOS::DrawDiskNames(uint8_t page, int8_t selection, const char *filter)
uint8_t i;
for (i=0; i<BIOS_MAXFILES; i++) {
if (i < fileCount) {
g_display->drawString((i == selection-1) ? M_SELECTED : M_NORMAL, 10, 50 + 14 * (i+1), fileDirectory[i]);
g_display->drawString((i == selection-1) ? M_SELECTED : M_NORMAL, 10, 50 + LINEHEIGHT * (i+1), fileDirectory[i]);
} else {
g_display->drawString((i == selection-1) ? M_SELECTDISABLED : M_DISABLED, 10, 50+14*(i+1), "-");
g_display->drawString((i == selection-1) ? M_SELECTDISABLED : M_DISABLED, 10, 50+LINEHEIGHT*(i+1), "-");
}
}
// FIXME: this doesn't accurately say whether or not there *are* more.
if (fileCount < BIOS_MAXFILES) {
g_display->drawString((i+1 == selection) ? M_SELECTDISABLED : M_DISABLED, 10, 50 + 14 * (i+1), "<Next>");
g_display->drawString((i+1 == selection) ? M_SELECTDISABLED : M_DISABLED, 10, 50 + LINEHEIGHT * (i+1), "<Next>");
} else {
g_display->drawString(i+1 == selection ? M_SELECTED : M_NORMAL, 10, 50 + 14 * (i+1), "<Next>");
g_display->drawString(i+1 == selection ? M_SELECTED : M_NORMAL, 10, 50 + LINEHEIGHT * (i+1), "<Next>");
}
g_display->flush();
@ -1089,7 +1092,7 @@ uint16_t BIOS::cacheAllEntries(const char *filter)
strcpy(cachedFilter, filter);
// This could be a lengthy process, so...
g_display->clrScr();
g_display->clrScr(c_darkblue);
g_display->drawString(M_SELECTED,
0,
0,

View File

@ -26,7 +26,7 @@ class PhysicalDisplay {
virtual void drawUIPixel(uint16_t x, uint16_t y, uint16_t color) = 0;
virtual void clrScr() = 0;
virtual void clrScr(uint8_t coloridx) = 0;
// methods to draw in to the buffer - not directly to the screen.

View File

@ -1,13 +1,19 @@
#include <ctype.h> // isgraph
#include "sdl-display.h"
#include "bios-font.h"
#include "images.h"
#include "globals.h"
#include "applevm.h"
#include "apple/appleui.h"
// FIXME should be able to omit this include and relay on the xterns, which
// would prove it's linking properly
#include "apple/font.h"
extern const unsigned char ucase_glyphs[512];
extern const unsigned char lcase_glyphs[256];
extern const unsigned char mousetext_glyphs[256];
extern const unsigned char interface_glyphs[256];
#define SCREENINSET_X (18*SDLDISPLAY_SCALE)
#define SCREENINSET_Y (13*SDLDISPLAY_SCALE)
@ -173,11 +179,7 @@ void SDLDisplay::drawPixel(uint16_t x, uint16_t y, uint8_t r, uint8_t g, uint8_t
void SDLDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c)
{
int8_t xsize = 8,
ysize = 0x0C,
offset = 0x20;
uint16_t temp;
c -= offset;// font starts with a space
ysize = 0x07;
uint16_t offPixel, onPixel;
switch (mode) {
@ -200,20 +202,19 @@ void SDLDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c)
break;
}
temp=(c*ysize);
// This does not scale, because drawPixel scales.
// This does not scale when drawing, because drawPixel scales.
const unsigned char *ch = asciiToAppleGlyph(c);
for (int8_t y_off = 0; y_off <= ysize; y_off++) {
uint8_t ch = BiosFont[temp];
for (int8_t x_off = 0; x_off <= xsize; x_off++) {
if (ch & (1 << (7-x_off))) {
if (*ch & (1 << (x_off))) {
drawUIPixel(x + x_off, y + y_off, onPixel);
} else {
drawUIPixel(x + x_off, y + y_off, offPixel);
}
}
temp++;
ch++;
}
}
void SDLDisplay::drawString(uint8_t mode, uint16_t x, uint8_t y, const char *str)
@ -227,9 +228,13 @@ void SDLDisplay::drawString(uint8_t mode, uint16_t x, uint8_t y, const char *str
}
}
void SDLDisplay::clrScr()
void SDLDisplay::clrScr(uint8_t coloridx)
{
SDL_SetRenderDrawColor(renderer, 0, 0, 0, 255); // set to white
const uint8_t *rgbptr = &loresPixelColors[0][0];
if (coloridx <= 16)
rgbptr = loresPixelColors[coloridx];
SDL_SetRenderDrawColor(renderer, rgbptr[0], rgbptr[1], rgbptr[2], 255); // select a color
SDL_RenderClear(renderer); // clear it to the selected color
SDL_RenderPresent(renderer); // perform the render
}

View File

@ -34,7 +34,7 @@ class SDLDisplay : public PhysicalDisplay {
virtual void drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c);
virtual void drawString(uint8_t mode, uint16_t x, uint8_t y, const char *str);
virtual void clrScr();
virtual void clrScr(uint8_t coloridx);
virtual void cachePixel(uint16_t x, uint16_t y, uint8_t color);
virtual void cacheDoubleWidePixel(uint16_t x, uint16_t y, uint8_t color);

View File

@ -1 +0,0 @@
../bios-font.h

View File

@ -3,8 +3,15 @@
#include "teensy-display.h"
#include "bios-font.h"
#include "appleui.h"
// FIXME should be able to omit this include and relay on the xterns, which
// would prove it's linking properly
#include "font.h"
extern const unsigned char ucase_glyphs[512];
extern const unsigned char lcase_glyphs[256];
extern const unsigned char mousetext_glyphs[256];
extern const unsigned char interface_glyphs[256];
#include <SPI.h>
#define _clock 75000000
@ -126,9 +133,27 @@ void TeensyDisplay::redraw()
}
}
void TeensyDisplay::clrScr()
void TeensyDisplay::clrScr(uint8_t coloridx)
{
if (coloridx == c_black) {
memset(dmaBuffer, 0x00, sizeof(dmaBuffer));
} else if (coloridx == c_white) {
memset(dmaBuffer, 0xFF, sizeof(dmaBuffer));
} else {
const uint8_t *rgbptr = &loresPixelColors[0][0];
if (coloridx <= 16)
rgbptr = loresPixelColors[coloridx];
uint16_t color16 = ((rgbptr[0] & 0xF8) << 8) |
((rgbptr[1] & 0xFC) << 3) |
((rgbptr[2] & 0xF8) >> 3);
// This could be faster - make one line, then memcpy the line to the other
// lines?
for (uint8_t y=0; y<sizey; y++) {
for (uint16_t x=0; x<sizex; x++) {
dmaBuffer[y][x] = color16;
}
}
}
}
void TeensyDisplay::drawUIPixel(uint16_t x, uint16_t y, uint16_t color)
@ -180,11 +205,7 @@ void TeensyDisplay::blit(AiieRect r)
void TeensyDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c)
{
int8_t xsize = 8,
ysize = 0x0C,
offset = 0x20;
uint16_t temp;
c -= offset;// font starts with a space
ysize = 0x07;
uint16_t offPixel, onPixel;
switch (mode) {
@ -207,14 +228,13 @@ void TeensyDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c)
break;
}
temp=(c*ysize);
// This does not scale when drawing, because drawPixel scales.
const unsigned char *ch = asciiToAppleGlyph(c);
for (int8_t y_off = 0; y_off <= ysize; y_off++) {
uint8_t ch = pgm_read_byte(&BiosFont[temp]);
if (y + y_off < 240) { // FIXME constant
for (int8_t x_off = 0; x_off <= xsize; x_off++) {
if (x+x_off < 320) { // FIXME constant
if (ch & (1 << (7-x_off))) {
if (*ch & (1 << (x_off))) {
dmaBuffer[y+y_off][x+x_off] = onPixel;
} else {
dmaBuffer[y+y_off][x+x_off] = offPixel;
@ -222,7 +242,7 @@ void TeensyDisplay::drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c)
}
}
}
temp++;
ch++;
}
}

View File

@ -19,7 +19,7 @@ class TeensyDisplay : public PhysicalDisplay {
virtual void blit(AiieRect r);
virtual void redraw();
virtual void clrScr();
virtual void clrScr(uint8_t coloridx);
virtual void flush();
virtual void drawCharacter(uint8_t mode, uint16_t x, uint8_t y, char c);