Add vga_cursor_save(), vga_cursor_save() and correct backspace

This commit is contained in:
Laurent Vivier 2005-08-28 21:39:54 +00:00
parent 5e7b54d562
commit 83f79b299b
2 changed files with 27 additions and 4 deletions

View File

@ -60,8 +60,10 @@ static unsigned char bits_depth8[2] = {
static vga_handler_t vga;
#define CURSOR_POS 14
#define CURSOR_HIGH 2
static unsigned long cursor_save_x, cursor_save_y;
#define CURSOR_POS 0
#define CURSOR_HIGH 16
static int cursor_on = 0;
static int cursor_state = 0;
@ -122,6 +124,20 @@ void vga_cursor_off(void)
vga_cursor(0);
}
void vga_cursor_save(void)
{
cursor_save_x = vga.pos_x;
cursor_save_y = vga.pos_y;
}
void vga_cursor_restore(void)
{
vga_cursor(0);
vga.pos_x = cursor_save_x;
vga.pos_y = cursor_save_y;
vga_cursor(1);
}
static void
draw_byte_1(unsigned char *glyph, unsigned char *base)
{
@ -380,7 +396,6 @@ vga_init()
vga.siz_h = vga.height / 16;
vga_clear();
vga_cursor_on();
}
void
@ -397,7 +412,13 @@ vga_put(char c)
vga.pos_y++;
break;
case '\b':
if (vga.pos_x > 0)
vga.pos_x--;
else if (vga.pos_y > 0)
{
vga.pos_y--;
vga.pos_x = vga.siz_w - 1;
}
break;
default:
draw_byte((unsigned char)c, vga.pos_x++, vga.pos_y);

View File

@ -14,6 +14,8 @@ extern void vga_print(char *s);
extern void vga_cursor_refresh(void);
extern void vga_cursor_on(void);
extern void vga_cursor_off(void);
extern void vga_cursor_save(void);
extern void vga_cursor_restore(void);
extern unsigned long vga_get_videobase();
extern unsigned long vga_get_row_bytes();