2003-09-25 Yoshinori K. Okuji <okuji@enbug.org>
I forgot to check in these changes for a long time. This adds incomplete support for VGA console, and this is still very buggy. Also, a lot of consideration is required for I18N, UNICODE, and VGA font issues. Therefore, assume that this is such that "better than nothing". * font/manager.c: New file. * include/pupa/font.h: Likewise. * include/pupa/i386/pc/vga.h: Likewise. * term/i386/pc/vga.c: Likewise. * util/unifont2pff.rb: Likewise. * conf/i386-pc.rmk (kernel_img_HEADERS): Added machine/vga.h. (pkgdata_MODULES): Added vga.mod and font.mod. (vga_mod_SOURCES): New variables. (vga_mod_CFLAGS): Likewise. (font_mod_SOURCES): Likewise. (font_mod_CFLAGS): Likewise. * include/pupa/err.h (PUPA_ERR_BAD_FONT): New constant. * include/pupa/term.h: Include pupa/err.h. (struct pupa_term): Added init and fini. Changed the argument of putchar to pupa_uint32_t. * include/pupa/i386/pc/console.h: Include pupa/symbol.h. (pupa_console_real_putchar): New prototype. (pupa_console_putchar): Removed. (pupa_console_checkkey): Exported. (pupa_console_getkey): Likewise. * kern/misc.c (pupa_vsprintf): Add support for UNICODE characters. * kern/term.c (pupa_term_set_current): Rewritten. (pupa_putchar): Likewise. (pupa_putcode): New function. * kern/i386/pc/startup.S (pupa_console_putchar): Renamed to ... (pupa_console_real_putchar): ... this. (pupa_vga_set_mode): New function. (pupa_vga_get_font): Likewise. * normal/command.c: Include pupa/term.h. (terminal_command): New function. (pupa_command_init): Register the command "terminal". * normal/menu.c (DISP_LEFT): Changed to a UNICODE value. (DISP_UP): Likewise. (DISP_RIGHT): Likewise. (DISP_DOWN): Likewise. (DISP_HLINE): Likewise. (DISP_VLINE): Likewise. (DISP_UL): Likewise. (DISP_UR): Likewise. (DISP_LL): Likewise. (DISP_LR): Likewise. * term/i386/pc/console.c (pupa_console_putchar): New function.
This commit is contained in:
parent
977329f5fa
commit
18d9c7cd53
17 changed files with 1443 additions and 50 deletions
|
@ -23,15 +23,16 @@
|
|||
|
||||
/* FIXME: These below are all runaround. */
|
||||
|
||||
#define DISP_UP 0x18
|
||||
#define DISP_DOWN 0x19
|
||||
#define DISP_RIGHT 0x1a
|
||||
#define DISP_HLINE 0xc4
|
||||
#define DISP_VLINE 0xb3
|
||||
#define DISP_UL 0xda
|
||||
#define DISP_UR 0xbf
|
||||
#define DISP_LL 0xc0
|
||||
#define DISP_LR 0xd9
|
||||
#define DISP_LEFT 0x2190
|
||||
#define DISP_UP 0x2191
|
||||
#define DISP_RIGHT 0x2192
|
||||
#define DISP_DOWN 0x2193
|
||||
#define DISP_HLINE 0x2501
|
||||
#define DISP_VLINE 0x2503
|
||||
#define DISP_UL 0x250F
|
||||
#define DISP_UR 0x2513
|
||||
#define DISP_LL 0x2517
|
||||
#define DISP_LR 0x251B
|
||||
|
||||
static void
|
||||
draw_border (void)
|
||||
|
@ -41,10 +42,10 @@ draw_border (void)
|
|||
pupa_setcolorstate (PUPA_TERM_COLOR_NORMAL);
|
||||
|
||||
pupa_gotoxy (1, 3);
|
||||
pupa_putchar (DISP_UL);
|
||||
pupa_putcode (DISP_UL);
|
||||
for (i = 0; i < 73; i++)
|
||||
pupa_putchar (DISP_HLINE);
|
||||
pupa_putchar (DISP_UR);
|
||||
pupa_putcode (DISP_HLINE);
|
||||
pupa_putcode (DISP_UR);
|
||||
|
||||
i = 1;
|
||||
while (1)
|
||||
|
@ -54,17 +55,17 @@ draw_border (void)
|
|||
if (i > 12)
|
||||
break;
|
||||
|
||||
pupa_putchar (DISP_VLINE);
|
||||
pupa_putcode (DISP_VLINE);
|
||||
pupa_gotoxy (75, 3 + i);
|
||||
pupa_putchar (DISP_VLINE);
|
||||
pupa_putcode (DISP_VLINE);
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
pupa_putchar (DISP_LL);
|
||||
pupa_putcode (DISP_LL);
|
||||
for (i = 0; i < 73; i++)
|
||||
pupa_putchar (DISP_HLINE);
|
||||
pupa_putchar (DISP_LR);
|
||||
pupa_putcode (DISP_HLINE);
|
||||
pupa_putcode (DISP_LR);
|
||||
|
||||
pupa_setcolorstate (PUPA_TERM_COLOR_STANDARD);
|
||||
}
|
||||
|
@ -73,8 +74,8 @@ static void
|
|||
print_message (int nested)
|
||||
{
|
||||
pupa_printf ("\n\
|
||||
Use the %c and %c keys to select which entry is highlighted.\n",
|
||||
DISP_UP, DISP_DOWN);
|
||||
Use the %C and %C keys to select which entry is highlighted.\n",
|
||||
(pupa_uint32_t) DISP_UP, (pupa_uint32_t) DISP_DOWN);
|
||||
pupa_printf ("\
|
||||
Press enter to boot the selected OS, \'e\' to edit the\n\
|
||||
commands before booting, or \'c\' for a command-line.");
|
||||
|
@ -113,7 +114,7 @@ print_entry (int y, int highlight, pupa_menu_entry_t entry)
|
|||
if (*title && x <= 72)
|
||||
{
|
||||
if (x == 72)
|
||||
pupa_putchar (DISP_RIGHT);
|
||||
pupa_putcode (DISP_RIGHT);
|
||||
else
|
||||
pupa_putchar (*title++);
|
||||
}
|
||||
|
@ -134,7 +135,7 @@ print_entries (pupa_menu_t menu, int first, int offset)
|
|||
pupa_gotoxy (77, 4);
|
||||
|
||||
if (first)
|
||||
pupa_putchar (DISP_UP);
|
||||
pupa_putcode (DISP_UP);
|
||||
else
|
||||
pupa_putchar (' ');
|
||||
|
||||
|
@ -150,7 +151,7 @@ print_entries (pupa_menu_t menu, int first, int offset)
|
|||
pupa_gotoxy (77, 4 + 12);
|
||||
|
||||
if (e)
|
||||
pupa_putchar (DISP_DOWN);
|
||||
pupa_putcode (DISP_DOWN);
|
||||
else
|
||||
pupa_putchar (' ');
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue