Mail Archives: cygwin/1997/08/24/09:12:00
Cygnus may have some of these already coded in their machine.h file, but if
you don't find it there, most folks usually just write their own using
GCC's inline asm; eg. in your very own machine.h file ...
static unsigned char inline
inb (const unsigned short port)
{
register unsigned char val;
__asm __volatile ("inb %%dx,%%al" : "=a" (val) : "d" (port));
return val;
}
If I managed to remember the gas syntax for inb correctly,
{
int x = inb(0x3f8);
}
Will produce the following assembly
movw %dx, $0x3f8
inb %dx, %al
movzbl %al, -4(%epb)
Or something quite similar -- GCC is smart enough to keep 0x3f8 in a
register and not reload it every time if you're in a loop. It will also
skip the move to automatic storage if it can and just use the value in AL.
There is some cryptic documentation on inline asm for GCC in the info files.
For the details, you will need to read the source -- particularly the
machine description file in gcc/config/i386/i386.md. This is the only
place you can find the descriptions for the various register fields (eg.
the "=a") to use in the asm lines.
- Tim
+----------------
| Date: Wed, 20 Aug 1997 16:31:39 -0400
| From: mark koi <koi AT ssa DOT crane DOT navy DOT mil>
| To: gnu-win32 AT cygnus DOT com
| Subject: Serial IO focusing
|
| method. Now I am trying to use gnu-win32, and I see no libraries for
| things like outp(), inp(). Can someone steer me in the right direction
| for examples/how-tos for controlling a serial port in WIN95. The
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -