use VT100 escape characters to control display

This commit is contained in:
Laurent Vivier 2007-05-30 22:05:10 +00:00
parent d9edce894b
commit 93d4e46279
2 changed files with 26 additions and 21 deletions

View File

@ -1,6 +1,6 @@
/*
*
* (c) 2004 Laurent Vivier <Laurent@lvivier.info>
* (c) 2004-2007 Laurent Vivier <Laurent@lvivier.info>
*
*/
@ -8,8 +8,8 @@
#include <macos/lowmem.h>
#include "console.h"
#include "vga.h"
#include "console.h"
#include "serial.h"
#include "keyboard.h"
#include "config.h"
@ -72,37 +72,39 @@ int console_getchar()
c = serial_getchar();
return c;
}
void console_clear(void)
{
printf("\033[2J");
}
void console_cursor_on(void)
{
if (vga_enabled)
{
vga_cursor_on();
}
printf("\033[?25h");
}
void console_cursor_off(void)
{
if (vga_enabled)
{
vga_cursor_off();
}
printf("\033[?25l");
}
void console_cursor_restore(void)
{
if (vga_enabled)
{
vga_cursor_restore();
}
serial_cursor_restore();
printf("\0338");
}
void console_cursor_save(void)
{
if (vga_enabled)
{
vga_cursor_save();
}
serial_cursor_save();
printf("\0337");
}
void console_video_inverse(void)
{
printf("\033[7m");
}
void console_video_normal(void)
{
printf("\033[27m");
}
#endif

View File

@ -1,6 +1,6 @@
/*
*
* (c) 2004 Laurent Vivier <Laurent@lvivier.info>
* (c) 2004-2007 Laurent Vivier <Laurent@lvivier.info>
*
*/
@ -18,10 +18,13 @@ extern void console_putstring(const char *s);
#ifdef USE_CLI
extern int console_keypressed(int timeout);
extern int console_getchar(void);
extern void console_clear(void);
extern void console_cursor_on(void);
extern void console_cursor_off(void);
extern void console_cursor_save(void);
extern void console_cursor_restore(void);
extern void console_video_inverse(void);
extern void console_video_normal(void);
#endif
#endif