Lift 255x255 erminal sie restriction to 65535x65535. Also change from
bitmasks to small structures of size chosen to fit in registers.
This commit is contained in:
parent
7abdac8e13
commit
e89c2d48a9
24 changed files with 266 additions and 244 deletions
|
@ -51,8 +51,7 @@ put (struct grub_term_output *term __attribute__ ((unused)), const int c)
|
|||
struct grub_terminfo_output_state grub_cbmemc_terminfo_output =
|
||||
{
|
||||
.put = put,
|
||||
.width = 80,
|
||||
.height = 24
|
||||
.size = { 80, 24 }
|
||||
};
|
||||
|
||||
static struct grub_term_output grub_cbmemc_term_output =
|
||||
|
|
|
@ -47,7 +47,7 @@ int10_9 (grub_uint8_t ch, grub_uint16_t n)
|
|||
*/
|
||||
|
||||
|
||||
static grub_uint16_t
|
||||
static struct grub_term_coordinate
|
||||
grub_console_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
|
@ -57,7 +57,8 @@ grub_console_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
|||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x10, ®s);
|
||||
|
||||
return ((regs.edx & 0xff) << 8) | ((regs.edx & 0xff00) >> 8);
|
||||
return (struct grub_term_coordinate) {
|
||||
(regs.edx & 0xff), ((regs.edx & 0xff00) >> 8) };
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -69,14 +70,14 @@ grub_console_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
|||
*/
|
||||
static void
|
||||
grub_console_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
struct grub_term_coordinate pos)
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
|
||||
/* set page to 0 */
|
||||
regs.ebx = 0;
|
||||
regs.eax = 0x0200;
|
||||
regs.edx = (y << 8) | x;
|
||||
regs.edx = (pos.y << 8) | pos.x;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x10, ®s);
|
||||
}
|
||||
|
@ -94,7 +95,7 @@ static void
|
|||
grub_console_putchar_real (grub_uint8_t c)
|
||||
{
|
||||
struct grub_bios_int_registers regs;
|
||||
grub_uint16_t pos;
|
||||
struct grub_term_coordinate pos;
|
||||
|
||||
if (c == 7 || c == 8 || c == 0xa || c == 0xd)
|
||||
{
|
||||
|
@ -112,14 +113,14 @@ grub_console_putchar_real (grub_uint8_t c)
|
|||
int10_9 (c, 1);
|
||||
|
||||
/* check the column with the width */
|
||||
if ((pos & 0xff00) >= (79 << 8))
|
||||
if (pos.x >= 79)
|
||||
{
|
||||
grub_console_putchar_real (0x0d);
|
||||
grub_console_putchar_real (0x0a);
|
||||
}
|
||||
else
|
||||
grub_console_gotoxy (NULL, ((pos & 0xff00) >> 8) + 1, (pos & 0xff));
|
||||
|
||||
grub_console_gotoxy (NULL, (struct grub_term_coordinate) { pos.x + 1,
|
||||
pos.y });
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -141,13 +142,13 @@ static void
|
|||
grub_console_cls (struct grub_term_output *term)
|
||||
{
|
||||
/* move the cursor to the beginning */
|
||||
grub_console_gotoxy (term, 0, 0);
|
||||
grub_console_gotoxy (term, (struct grub_term_coordinate) { 0, 0 });
|
||||
|
||||
/* write spaces to the entire screen */
|
||||
int10_9 (' ', 80 * 25);
|
||||
|
||||
/* move back the cursor */
|
||||
grub_console_gotoxy (term, 0, 0);
|
||||
grub_console_gotoxy (term, (struct grub_term_coordinate) { 0, 0 });
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -247,10 +248,10 @@ grub_console_getkeystatus (struct grub_term_input *term __attribute__ ((unused))
|
|||
return bios_data_area->keyboard_flag_lower & ~0x80;
|
||||
}
|
||||
|
||||
static grub_uint16_t
|
||||
static struct grub_term_coordinate
|
||||
grub_console_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (80 << 8) | 25;
|
||||
return (struct grub_term_coordinate) { 80, 25 };
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -42,7 +42,7 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
#define COLS 80
|
||||
#define ROWS 25
|
||||
|
||||
static int grub_curr_x, grub_curr_y;
|
||||
static struct grub_term_coordinate grub_curr_pos;
|
||||
|
||||
#ifdef __mips__
|
||||
#define VGA_TEXT_SCREEN ((grub_uint16_t *) 0xb00b8000)
|
||||
|
@ -75,7 +75,7 @@ screen_read_char (int x, int y)
|
|||
static void
|
||||
update_cursor (void)
|
||||
{
|
||||
unsigned int pos = grub_curr_y * COLS + grub_curr_x;
|
||||
unsigned int pos = grub_curr_pos.y * COLS + grub_curr_pos.x;
|
||||
cr_write (pos >> 8, GRUB_VGA_CR_CURSOR_ADDR_HIGH);
|
||||
cr_write (pos & 0xFF, GRUB_VGA_CR_CURSOR_ADDR_LOW);
|
||||
}
|
||||
|
@ -83,9 +83,9 @@ update_cursor (void)
|
|||
static void
|
||||
inc_y (void)
|
||||
{
|
||||
grub_curr_x = 0;
|
||||
if (grub_curr_y < ROWS - 1)
|
||||
grub_curr_y++;
|
||||
grub_curr_pos.x = 0;
|
||||
if (grub_curr_pos.y < ROWS - 1)
|
||||
grub_curr_pos.y++;
|
||||
else
|
||||
{
|
||||
int x, y;
|
||||
|
@ -100,10 +100,10 @@ inc_y (void)
|
|||
static void
|
||||
inc_x (void)
|
||||
{
|
||||
if (grub_curr_x >= COLS - 1)
|
||||
if (grub_curr_pos.x >= COLS - 1)
|
||||
inc_y ();
|
||||
else
|
||||
grub_curr_x++;
|
||||
grub_curr_pos.x++;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -113,17 +113,17 @@ grub_vga_text_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
|||
switch (c->base)
|
||||
{
|
||||
case '\b':
|
||||
if (grub_curr_x != 0)
|
||||
screen_write_char (grub_curr_x--, grub_curr_y, ' ');
|
||||
if (grub_curr_pos.x != 0)
|
||||
screen_write_char (grub_curr_pos.x--, grub_curr_pos.y, ' ');
|
||||
break;
|
||||
case '\n':
|
||||
inc_y ();
|
||||
break;
|
||||
case '\r':
|
||||
grub_curr_x = 0;
|
||||
grub_curr_pos.x = 0;
|
||||
break;
|
||||
default:
|
||||
screen_write_char (grub_curr_x, grub_curr_y,
|
||||
screen_write_char (grub_curr_pos.x, grub_curr_pos.y,
|
||||
c->base | (cur_color << 8));
|
||||
inc_x ();
|
||||
}
|
||||
|
@ -131,18 +131,17 @@ grub_vga_text_putchar (struct grub_term_output *term __attribute__ ((unused)),
|
|||
update_cursor ();
|
||||
}
|
||||
|
||||
static grub_uint16_t
|
||||
static struct grub_term_coordinate
|
||||
grub_vga_text_getxy (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (grub_curr_x << 8) | grub_curr_y;
|
||||
return grub_curr_pos;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_vga_text_gotoxy (struct grub_term_output *term __attribute__ ((unused)),
|
||||
grub_uint8_t x, grub_uint8_t y)
|
||||
struct grub_term_coordinate pos)
|
||||
{
|
||||
grub_curr_x = x;
|
||||
grub_curr_y = y;
|
||||
grub_curr_pos = pos;
|
||||
update_cursor ();
|
||||
}
|
||||
|
||||
|
@ -152,7 +151,7 @@ grub_vga_text_cls (struct grub_term_output *term)
|
|||
int i;
|
||||
for (i = 0; i < ROWS * COLS; i++)
|
||||
VGA_TEXT_SCREEN[i] = grub_cpu_to_le16 (' ' | (cur_color << 8));
|
||||
grub_vga_text_gotoxy (term, 0, 0);
|
||||
grub_vga_text_gotoxy (term, (struct grub_term_coordinate) { 0, 0 });
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -203,10 +202,10 @@ grub_vga_text_fini_real (struct grub_term_output *term)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_uint16_t
|
||||
static struct grub_term_coordinate
|
||||
grub_vga_text_getwh (struct grub_term_output *term __attribute__ ((unused)))
|
||||
{
|
||||
return (80 << 8) | 25;
|
||||
return (struct grub_term_coordinate) { 80, 25 };
|
||||
}
|
||||
|
||||
#ifndef MODE_MDA
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue