david/ipxe
david
/
ipxe
Archived
1
0
Fork 0

[bios] Support displaying and hiding cursor

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown 2014-08-06 15:10:58 +01:00
parent 5c4f1da2ce
commit 6566690ba1
2 changed files with 44 additions and 0 deletions

View File

@ -21,6 +21,7 @@ FILE_LICENCE ( GPL2_OR_LATER );
#include <assert.h>
#include <realmode.h>
#include <bios.h>
#include <ipxe/console.h>
#include <ipxe/ansiesc.h>
#include <ipxe/keymap.h>
@ -148,11 +149,53 @@ static void bios_handle_sgr ( struct ansiesc_context *ctx __unused,
}
}
/**
* Handle ANSI DECTCEM set (show cursor)
*
* @v ctx ANSI escape sequence context
* @v count Parameter count
* @v params List of graphic rendition aspects
*/
static void bios_handle_dectcem_set ( struct ansiesc_context *ctx __unused,
unsigned int count __unused,
int params[] __unused ) {
uint8_t height;
/* Get character height */
get_real ( height, BDA_SEG, BDA_CHAR_HEIGHT );
__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
"int $0x10\n\t"
"cli\n\t" )
: : "a" ( 0x0100 ),
"c" ( ( ( height - 2 ) << 8 ) |
( height - 1 ) ) );
}
/**
* Handle ANSI DECTCEM reset (hide cursor)
*
* @v ctx ANSI escape sequence context
* @v count Parameter count
* @v params List of graphic rendition aspects
*/
static void bios_handle_dectcem_reset ( struct ansiesc_context *ctx __unused,
unsigned int count __unused,
int params[] __unused ) {
__asm__ __volatile__ ( REAL_CODE ( "sti\n\t"
"int $0x10\n\t"
"cli\n\t" )
: : "a" ( 0x0100 ), "c" ( 0x2000 ) );
}
/** BIOS console ANSI escape sequence handlers */
static struct ansiesc_handler bios_ansiesc_handlers[] = {
{ ANSIESC_CUP, bios_handle_cup },
{ ANSIESC_ED, bios_handle_ed },
{ ANSIESC_SGR, bios_handle_sgr },
{ ANSIESC_DECTCEM_SET, bios_handle_dectcem_set },
{ ANSIESC_DECTCEM_RESET, bios_handle_dectcem_reset },
{ 0, NULL }
};

View File

@ -9,5 +9,6 @@ FILE_LICENCE ( GPL2_OR_LATER );
#define BDA_REBOOT 0x0072
#define BDA_REBOOT_WARM 0x1234
#define BDA_NUM_DRIVES 0x0075
#define BDA_CHAR_HEIGHT 0x0085
#endif /* BIOS_H */