Adding upstream version 4.00~pre61+dfsg.
[syslinux-debian/hramrach.git] / com32 / cmenu / libmenu / com32io.c
blob6a27d1a113f768928246dec5b454204f1eed7776
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 #include <string.h>
14 #include <com32.h>
15 #include "com32io.h"
16 #include "tui.h"
17 #include "syslnx.h"
19 com32sys_t inreg, outreg; // Global register sets for use
21 void getpos(char *row, char *col, char page)
23 REG_AH(inreg) = 0x03;
24 REG_BH(inreg) = page;
25 __intcall(0x10, &inreg, &outreg);
26 *row = REG_DH(outreg);
27 *col = REG_DL(outreg);
30 unsigned char sleep(unsigned int msec)
32 unsigned long micro = 1000 * msec;
34 REG_AH(inreg) = 0x86;
35 REG_CX(inreg) = (micro >> 16);
36 REG_DX(inreg) = (micro & 0xFFFF);
37 __intcall(0x15, &inreg, &outreg);
38 return REG_AH(outreg);
41 char inputc(char *scancode)
43 syslinux_idle(); /* So syslinux can perform periodic activity */
44 REG_AH(inreg) = 0x10;
45 __intcall(0x16, &inreg, &outreg);
46 if (scancode)
47 *scancode = REG_AH(outreg);
48 return REG_AL(outreg);
51 void getcursorshape(char *start, char *end)
53 char page = 0; // XXX TODO
54 REG_AH(inreg) = 0x03;
55 REG_BH(inreg) = page;
56 __intcall(0x10, &inreg, &outreg);
57 *start = REG_CH(outreg);
58 *end = REG_CL(outreg);
61 void setcursorshape(char start, char end)
63 REG_AH(inreg) = 0x01;
64 REG_CH(inreg) = start;
65 REG_CL(inreg) = end;
66 __intcall(0x10, &inreg, &outreg);
69 void setvideomode(char mode)
71 REG_AH(inreg) = 0x00;
72 REG_AL(inreg) = mode;
73 __intcall(0x10, &inreg, &outreg);
76 // Get char displayed at current position
77 unsigned char getcharat(char page)
79 REG_AH(inreg) = 0x08;
80 REG_BH(inreg) = page;
81 __intcall(0x16, &inreg, &outreg);
82 return REG_AL(outreg);