aboutsummaryrefslogtreecommitdiffstats
path: root/com32/cmenu/libmenu/com32io.h
diff options
context:
space:
mode:
authorPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-04 16:54:24 -0700
committerPierre-Alexandre Meyer <pierre@mouraf.org>2009-09-04 16:54:24 -0700
commit4873366ee31786f10381427c5522543a82a9e2ab (patch)
tree5b06032be46ab178a1f4a81b78302d1ba2d254d0 /com32/cmenu/libmenu/com32io.h
parent9c111b3eb8f35bae1f6268eaa1b5f1808acd7d66 (diff)
parentfde17fb11b78a31d97653569acf8255a621e791a (diff)
downloadsyslinux-4873366ee31786f10381427c5522543a82a9e2ab.tar.gz
syslinux-4873366ee31786f10381427c5522543a82a9e2ab.tar.xz
syslinux-4873366ee31786f10381427c5522543a82a9e2ab.zip
Merge branch 'cmenu-video' of git://git.zytor.com/users/pam/hdt-pierre into cmenu-video
Diffstat (limited to 'com32/cmenu/libmenu/com32io.h')
-rw-r--r--com32/cmenu/libmenu/com32io.h64
1 files changed, 38 insertions, 26 deletions
diff --git a/com32/cmenu/libmenu/com32io.h b/com32/cmenu/libmenu/com32io.h
index ba955e99..91324d77 100644
--- a/com32/cmenu/libmenu/com32io.h
+++ b/com32/cmenu/libmenu/com32io.h
@@ -14,40 +14,64 @@
#define __COM32IO_H__
#include <com32.h>
+#include <stdio.h>
#ifndef NULL
#define NULL ((void *)0)
#endif
+#define CSI "\e["
+
+static inline void beep(void)
+{
+ fputs("\007", stdout);
+}
+
/* BIOS Assisted output routines */
-void cswprint(const char *str, char attr, char left);
// Print a C str (NUL-terminated) respecting the left edge of window
// i.e. \n in str will move cursor to column left
// Print a C str (NUL-terminated)
-static inline void csprint(const char *str, char attr)
+void csprint(const char *, const char);
+
+//static inline void cswprint(const char *str, const char attr)
+//{
+// csprint(str, attr);
+//}
+
+void cprint(const char, const char, unsigned int);
+
+static inline void putch(const char x, char attr)
{
- cswprint(str, attr, 0);
+ cprint(x, attr, 1);
}
-void cprint(char chr, char attr, unsigned int times, char disppage); // Print a char
-
-void setdisppage(char num); // Set the display page to specified number
+void clearwindow(const char, const char, const char, const char,
+ const char, const char);
-char getdisppage(); // Get current display page
+/*
+ * cls - clear and initialize the entire screen
+ *
+ * Note: when initializing xterm, one has to specify that
+ * G1 points to the alternate character set (this is not true
+ * by default). Without the initial printf "\033)0", line drawing
+ * characters won't be displayed.
+ */
+static inline void cls(void)
+{
+ fputs("\033e\033%@\033)0\033(B\1#0\033[?25l\033[2J", stdout);
+}
-void gotoxy(char row, char col, char page);
+static inline void gotoxy(const char row, const char col)
+{
+ printf(CSI "%d;%dH", row + 1, col + 1);
+}
void getpos(char *row, char *col, char page);
char inputc(char *scancode); // Return ASCII char by val, and scancode by reference
-static inline void putch(char x, char attr, char page)
-{
- cprint(x, attr, 1, page);
-}
-
void setcursorshape(char start, char end); // Set cursor shape
void getcursorshape(char *start, char *end); // Get shape for current page
@@ -69,16 +93,6 @@ static inline unsigned char readbiosb(unsigned int ofs)
return *((unsigned char *)MK_PTR(0, ofs));
}
-static inline char getnumrows()
-{
- return readbiosb(0x484); // Actually numrows - 1
-}
-
-static inline char getnumcols(void)
-{
- return readbiosb(0x44a); // Actually numcols
-}
-
static inline char getshiftflags(void)
{
return readbiosb(0x417);
@@ -88,7 +102,7 @@ void scrollupwindow(char top, char left, char bot, char right, char attr, char n
static inline void scrollup(void) //Scroll up display screen by one line
{
- scrollupwindow(0, 0, getnumrows(), getnumcols(), 0x07, 1);
+ printf(CSI "S");
}
void setvideomode(char mode); // Set the video mode.
@@ -100,8 +114,6 @@ static inline char getvideomode(void) // Get the current video mode
unsigned char sleep(unsigned int msec); // Sleep for specified time
-void beep(); // A Bell
-
unsigned char checkkbdbuf(); // Check to see if there is kbd buffer is non-empty?
static inline void clearkbdbuf() // Clear the kbd buffer (how many chars removed?)