1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-10 14:02:43 +00:00

Use a array to convert from a attribute for AT to one for PC98.

(merged from sys/pc98/pc98/scvtbpc98.c)
This commit is contained in:
Yoshihiro Takahashi 2001-10-17 15:15:01 +00:00
parent 48dfd764e1
commit aa0abed214
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=85065

View File

@ -76,9 +76,44 @@ static int esc;
static unsigned short *crtat, *Crtat;
static int row = 25, col = 80;
#ifdef TERM_EMU
unsigned int at2pc98(unsigned int fg_at, unsigned int bg_at);
#endif
#endif
static u_int8_t ibmpc_to_pc98[256] = {
0x01, 0x21, 0x81, 0xa1, 0x41, 0x61, 0xc1, 0xe1,
0x09, 0x29, 0x89, 0xa9, 0x49, 0x69, 0xc9, 0xe9,
0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25, 0x25,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85, 0x85,
0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5, 0xa5,
0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45, 0x45,
0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65,
0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65, 0x65,
0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5,
0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5, 0xc5,
0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5,
0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5, 0xe5,
0x03, 0x23, 0x83, 0xa3, 0x43, 0x63, 0xc3, 0xe3,
0x0b, 0x2b, 0x8b, 0xab, 0x4b, 0x6b, 0xcb, 0xeb,
0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f, 0x2f,
0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f, 0x8f,
0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf, 0xaf,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f, 0x4f,
0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f,
0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f, 0x6f,
0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf,
0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf, 0xcf,
0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef,
0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef, 0xef,
};
#define at2pc98(fg_at, bg_at) ibmpc_to_pc98[((bg_at) << 4) | (fg_at)]
#endif /* TERM_EMU */
#endif /* PC98 */
struct console vidconsole = {
"vidconsole",
@ -794,42 +829,3 @@ probe_keyboard(void)
}
#endif /* PC98 */
#endif /* KEYBOARD_PROBE */
#ifdef TERM_EMU
#ifdef PC98
static u_char ibmpc_to_pc98[16] = {
0x01,0x21,0x81,0xa1,0x41,0x61,0xc1,0xe1,
0x09,0x29,0x89,0xa9,0x49,0x69,0xc9,0xe9
};
static u_char ibmpc_to_pc98rev[16] = {
0x05,0x25,0x85,0xa5,0x45,0x65,0xc5,0xe5,
0x0d,0x2d,0x8d,0xad,0x4d,0x6d,0xcd,0xed
};
unsigned int
at2pc98(unsigned int fg_at, unsigned int bg_at)
{
unsigned int at;
if (bg_at) {
if (bg_at & 0x80) {
if (bg_at & 0x70) {
/* reverse & blink */
at = ibmpc_to_pc98rev[bg_at >> 4] | 0x02;
} else {
/* normal & blink */
at = ibmpc_to_pc98[fg_at] | 0x02;
}
} else {
/* reverse */
at = ibmpc_to_pc98rev[bg_at >> 4];
}
} else {
/* normal */
at = ibmpc_to_pc98[fg_at];
}
at |= ((fg_at | bg_at) << 8);
return (at);
}
#endif /* PC98 */
#endif /* TERM_EMU */