FreeBASIC  0.91.0
sys_portio.c
Go to the documentation of this file.
1 /* ports I/O functions */
2 
3 #include "../fb.h"
4 #include "../unix/fb_private_console.h"
5 
6 int fb_hIn( unsigned short port )
7 {
8 #if defined HOST_X86 || defined HOST_X86_64
9  unsigned char value;
10  if (!__fb_con.has_perm)
12  __asm__ volatile ("inb %1, %0" : "=a" (value) : "d" (port));
13  return (int)value;
14 #else
16 #endif
17 }
18 
19 int fb_hOut( unsigned short port, unsigned char value )
20 {
21 #if defined HOST_X86 || defined HOST_X86_64
22  if (!__fb_con.has_perm)
24  __asm__ volatile ("outb %0, %1" : : "a" (value), "d" (port));
25  return FB_RTERROR_OK;
26 #else
28 #endif
29 }