diff options
author | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-08-18 21:09:09 -0700 |
---|---|---|
committer | Pierre-Alexandre Meyer <pierre@mouraf.org> | 2009-09-01 11:43:37 -0700 |
commit | 1d57e4b1eb5b5ec2c93784cb48705ab5c4f14419 (patch) | |
tree | 8cd27b9842788af8f70eef7418a013700d359575 /com32/cmenu | |
parent | 0859aaf6e9e8cccd8c67cca35d0d6998a71ab388 (diff) | |
download | syslinux-1d57e4b1eb5b5ec2c93784cb48705ab5c4f14419.tar.gz syslinux-1d57e4b1eb5b5ec2c93784cb48705ab5c4f14419.tar.xz syslinux-1d57e4b1eb5b5ec2c93784cb48705ab5c4f14419.zip |
cmenu: implement gotoxy using escape sequences
Use ansicon and the ANSI CUP - CUrsor Position escape sequence
to implement the gotoxy function.
Note: page switching is not supported (yet).
Testing Done: ran com32/cmenu/test.c32 in qemu.
Signed-off-by: Pierre-Alexandre Meyer <pierre@mouraf.org>
Diffstat (limited to 'com32/cmenu')
-rw-r--r-- | com32/cmenu/libmenu/com32io.c | 8 | ||||
-rw-r--r-- | com32/cmenu/libmenu/com32io.h | 9 | ||||
-rw-r--r-- | com32/cmenu/libmenu/menu.c | 4 |
3 files changed, 12 insertions, 9 deletions
diff --git a/com32/cmenu/libmenu/com32io.c b/com32/cmenu/libmenu/com32io.c index d99eb87f..a53b614d 100644 --- a/com32/cmenu/libmenu/com32io.c +++ b/com32/cmenu/libmenu/com32io.c @@ -51,14 +51,6 @@ void getpos(char *row, char *col, char page) *col = REG_DL(outreg); } -void gotoxy(char row, char col, char page) -{ - REG_AH(inreg) = 0x02; - REG_BH(inreg) = page; - REG_DX(inreg) = (row << 8) + col; - __intcall(0x10, &inreg, &outreg); -} - unsigned char sleep(unsigned int msec) { unsigned long micro = 1000 * msec; diff --git a/com32/cmenu/libmenu/com32io.h b/com32/cmenu/libmenu/com32io.h index cdaf0a84..55d01896 100644 --- a/com32/cmenu/libmenu/com32io.h +++ b/com32/cmenu/libmenu/com32io.h @@ -14,11 +14,14 @@ #define __COM32IO_H__ #include <com32.h> +#include <stdio.h> #ifndef NULL #define NULL ((void *)0) #endif +#define CSI "\e[" + /* BIOS Assisted output routines */ void cswprint(const char *str, char attr, char left); @@ -37,7 +40,11 @@ void setdisppage(char num); // Set the display page to specified number char getdisppage(); // Get current display page -void gotoxy(char row, char col, char page); +static inline void gotoxy(char row, char col, char page) +{ + // XXX page + printf(CSI "%d;%dH", row + 1, col + 1); +} void getpos(char *row, char *col, char page); diff --git a/com32/cmenu/libmenu/menu.c b/com32/cmenu/libmenu/menu.c index cfe8f39f..4abc7b5a 100644 --- a/com32/cmenu/libmenu/menu.c +++ b/com32/cmenu/libmenu/menu.c @@ -13,6 +13,7 @@ #include "menu.h" #include "com32io.h" #include <stdlib.h> +#include <console.h> // Local Variables static pt_menusystem ms; // Pointer to the menusystem @@ -851,6 +852,9 @@ pt_menusystem init_menusystem(const char *title) // Set up the look of the box set_box_type(MENUBOXTYPE); + + openconsole(&dev_stdcon_r, &dev_ansiserial_w); + return ms; } |