Adding debian version 3.35-1.
[syslinux-debian/hramrach.git] / menu / libmenu / com32io.h
blob78ce72fa26d9ab4b81a493ef88b43be6ecb416c2
1 /* -*- c -*- ------------------------------------------------------------- *
3 * Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, Inc., 53 Temple Place Ste 330,
8 * Boston MA 02111-1307, USA; either version 2 of the License, or
9 * (at your option) any later version; incorporated herein by reference.
11 * ----------------------------------------------------------------------- */
13 #ifndef __COM32IO_H__
14 #define __COM32IO_H__
16 #include <com32.h>
18 #ifndef NULL
19 #define NULL ((void *)0)
20 #endif
22 /* BIOS Assisted output routines */
24 void cswprint(const char *str, char attr, char left);
25 // Print a C str (NUL-terminated) respecting the left edge of window
26 // i.e. \n in str will move cursor to column left
27 // Print a C str (NUL-terminated)
29 static inline void csprint(const char *str, char attr)
31 cswprint(str,attr,0);
34 void cprint(char chr,char attr,unsigned int times, char disppage); // Print a char
36 void setdisppage(char num); // Set the display page to specified number
38 char getdisppage(); // Get current display page
40 void gotoxy(char row,char col, char page);
42 void getpos(char * row, char * col, char page);
44 char inputc(char * scancode); // Return ASCII char by val, and scancode by reference
46 static inline void putch(char x, char attr, char page)
48 cprint(x,attr,1,page);
51 void setcursorshape(char start,char end); // Set cursor shape
52 void getcursorshape(char *start,char *end); // Get shape for current page
54 // Get char displayed at current position in specified page
55 unsigned char getcharat(char page);
57 static inline void cursoroff(void) /* Turns off cursor */
59 setcursorshape(32,33);
62 static inline void cursoron(void) /* Turns on cursor */
64 setcursorshape(6,7);
67 static inline unsigned char readbiosb(unsigned int ofs)
69 return *((unsigned char *)MK_PTR(0,ofs));
72 static inline char getnumrows()
74 return readbiosb(0x484); // Actually numrows - 1
77 static inline char getnumcols(void)
79 return readbiosb(0x44a); // Actually numcols
82 static inline char getshiftflags(void)
84 return readbiosb(0x417);
87 void scrollupwindow(char top, char left, char bot,char right,char attr,char numlines); //Scroll up given window
89 static inline void scrollup(void) //Scroll up display screen by one line
91 scrollupwindow(0,0,getnumrows(),getnumcols(),0x07,1);
94 void setvideomode(char mode); // Set the video mode.
96 static inline char getvideomode(void) // Get the current video mode
98 return readbiosb(0x449);
101 unsigned char sleep(unsigned int msec); // Sleep for specified time
103 void beep(); // A Bell
105 unsigned char checkkbdbuf(); // Check to see if there is kbd buffer is non-empty?
107 static inline void clearkbdbuf() // Clear the kbd buffer (how many chars removed?)
109 while (checkkbdbuf()) inputc(NULL);
112 #endif