2
* GRUB -- GRand Unified Bootloader
3
* Copyright (C) 2002,2003,2005 Free Software Foundation, Inc.
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20
#include <grub/machine/console.h>
21
#include <grub/term.h>
22
#include <grub/types.h>
24
grub_uint8_t grub_console_cur_color = 0x7;
25
static grub_uint8_t grub_console_standard_color = 0x7;
26
static grub_uint8_t grub_console_normal_color = 0x7;
27
static grub_uint8_t grub_console_highlight_color = 0x70;
30
map_char (grub_uint32_t c)
34
/* Map some unicode characters to the VGA font, if possible. */
37
case 0x2190: /* left arrow */
40
case 0x2191: /* up arrow */
43
case 0x2192: /* right arrow */
46
case 0x2193: /* down arrow */
49
case 0x2501: /* horizontal line */
52
case 0x2503: /* vertical line */
55
case 0x250F: /* upper-left corner */
58
case 0x2513: /* upper-right corner */
61
case 0x2517: /* lower-left corner */
64
case 0x251B: /* lower-right corner */
78
grub_console_putchar (grub_uint32_t c)
80
grub_console_real_putchar (map_char (c));
84
grub_console_getcharwidth (grub_uint32_t c __attribute__ ((unused)))
86
/* For now, every printable character has the width 1. */
91
grub_console_getwh (void)
93
return (80 << 8) | 25;
97
grub_console_setcolorstate (grub_term_color_state state)
100
case GRUB_TERM_COLOR_STANDARD:
101
grub_console_cur_color = grub_console_standard_color;
103
case GRUB_TERM_COLOR_NORMAL:
104
grub_console_cur_color = grub_console_normal_color;
106
case GRUB_TERM_COLOR_HIGHLIGHT:
107
grub_console_cur_color = grub_console_highlight_color;
115
grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color)
117
grub_console_normal_color = normal_color;
118
grub_console_highlight_color = highlight_color;
121
static struct grub_term grub_console_term =
126
.putchar = grub_console_putchar,
127
.getcharwidth = grub_console_getcharwidth,
128
.checkkey = grub_console_checkkey,
129
.getkey = grub_console_getkey,
130
.getwh = grub_console_getwh,
131
.getxy = grub_console_getxy,
132
.gotoxy = grub_console_gotoxy,
133
.cls = grub_console_cls,
134
.setcolorstate = grub_console_setcolorstate,
135
.setcolor = grub_console_setcolor,
136
.setcursor = grub_console_setcursor,
142
grub_console_init (void)
144
grub_term_register (&grub_console_term);
145
grub_term_set_current (&grub_console_term);
149
grub_console_fini (void)
151
grub_term_unregister (&grub_console_term);