Home | History | Annotate | Download | only in libmenu
      1 /* -*- c -*- ------------------------------------------------------------- *
      2  *
      3  *   Copyright 2004-2005 Murali Krishnan Ganapathy - All Rights Reserved
      4  *
      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.
     10  *
     11  * ----------------------------------------------------------------------- */
     12 
     13 #ifndef __COM32IO_H__
     14 #define __COM32IO_H__
     15 
     16 #include <com32.h>
     17 #include <stdio.h>
     18 #include <libansi.h>
     19 
     20 #ifndef NULL
     21 #define NULL ((void *)0)
     22 #endif
     23 
     24 /* Bits representing ShiftFlags, See Int16/Function 2 or Mem[0x417] to get this info */
     25 
     26 #define INSERT_ON     (1<<7)
     27 #define CAPSLOCK_ON   (1<<6)
     28 #define NUMLOCK_ON    (1<<5)
     29 #define SCRLLOCK_ON   (1<<4)
     30 #define ALT_PRESSED   (1<<3)
     31 #define CTRL_PRESSED  (1<<2)
     32 // actually 1<<1 is Left Shift, 1<<0 is right shift
     33 #define SHIFT_PRESSED (1<<1 | 1 <<0)
     34 
     35 /* BIOS Assisted output routines */
     36 
     37 void getpos(char *row, char *col, char page);
     38 
     39 char inputc(char *scancode);	// Return ASCII char by val, and scancode by reference
     40 
     41 void setcursorshape(char start, char end);	// Set cursor shape
     42 void getcursorshape(char *start, char *end);	// Get shape for current page
     43 
     44 // Get char displayed at current position in specified page
     45 unsigned char getcharat(char page);
     46 
     47 static inline unsigned char readbiosb(unsigned int ofs)
     48 {
     49     return *((unsigned char *)MK_PTR(0, ofs));
     50 }
     51 
     52 static inline char getshiftflags(void)
     53 {
     54     return readbiosb(0x417);
     55 }
     56 
     57 void scrollupwindow(char top, char left, char bot, char right, char attr, char numlines);	//Scroll up given window
     58 
     59 void setvideomode(char mode);	// Set the video mode.
     60 
     61 static inline char getvideomode(void)	// Get the current video mode
     62 {
     63     return readbiosb(0x449);
     64 }
     65 
     66 #endif
     67