FreeBASIC  0.91.0
io_input.c
Go to the documentation of this file.
1 /* console input helpers */
2 
3 #include "../fb.h"
4 #include "fb_private_console.h"
5 #include <sys/farptr.h>
6 #include <go32.h>
7 
9 static unsigned short usCircBufferStatus = 0;
10 
12 {
13  int is_changed;
14  unsigned short usNewStatus;
15 
16  FB_LOCK();
17 
18  /* This is required to ensure that SLEEP still works even when
19  * the input buffer is full (QB quirk) */
21 
24  usCircBufferStatus = _farpeekw( _dos_ds, 0x41C );
25  }
26 
27  usNewStatus = _farpeekw( _dos_ds, 0x41C );
28  is_changed = usNewStatus!=usCircBufferStatus;
29  if( is_changed )
30  usCircBufferStatus = usNewStatus;
31 
32  /* Ensure that no IRQ disturbs us ... */
33  fb_dos_cli();
34  is_changed |= __fb_con.forceInpBufferChanged;
36  fb_dos_sti();
37 
38  FB_UNLOCK();
39 
40  return is_changed;
41 }