FreeBASIC  0.91.0
io_getxy.c
Go to the documentation of this file.
1 #include "../fb.h"
2 #include "fb_private_console.h"
3 #include <go32.h>
4 #include <dpmi.h>
5 #include <sys/farptr.h>
6 
7 void fb_ConsoleGetXY_BIOS( int *col, int *row )
8 {
9 #if 0
10  __dpmi_regs regs;
11  regs.x.ax = 0x0300;
12  regs.x.bx = __fb_con.active;
13  __dpmi_int(0x10, &regs);
14  if( col!=NULL )
15  *col = regs.h.dl;
16  if( row!=NULL )
17  *row = regs.h.dh;
18 #else
19  unsigned short usPos = _farpeekw( _dos_ds, 0x450 + __fb_con.active * sizeof( short ) );
20  if( col )
21  *col = usPos & 0xFF;
22  if( row )
23  *row = (usPos >> 8) & 0xFF;
24 #endif
25 }
26 
27 FBCALL void fb_ConsoleGetXY( int *col, int *row )
28 {
29  fb_ConsoleGetXY_BIOS( col, row );
30  if( col )
31  ++*col;
32  if( row )
33  ++*row;
34 }