//////////////////////////////////////////////////////////
// Port I/O under Borland Win95 (Win32) enviroment //
// www.luigibianchi.com
//////////////////////////////////////////////////////////
#include <dos.h>
void Win95Outportb(unsigned short int port, unsigned char value)
{
__emit__(0x8B, 0x95, &port); // mov edx, *(&port)
__emit__(0x8A, 0x85, &value); // mov al, *(&value)
__emit__(0x66, 0xEE); // out dx, al
}
void Win95Outportw(unsigned short int port, unsigned short int value)
{
__emit__(0x8B, 0x95, &port); // mov edx, *(&port)
__emit__(0x66, 0x8B, 0x85, &value); // mov al, *(&value)
__emit__(0xEF); // out dx, al
}
unsigned char Win95Inportb(unsigned short int port)
{
unsigned char value;
__emit__(0x8B, 0x95, &port); // mov edx, *(&port)
__emit__(0x66, 0xEC); // in dx, al
__emit__(0x88, 0x85, &value); // mov al, *(&value)
return value;
}
unsigned short int Win95Inportw(unsigned short int port)
{
unsigned short int value;
__emit__(0x8B, 0x95, &port); // mov edx, *(&port)
__emit__(0xED); // in ax, dx
__emit__(0x66, 0x89, 0x85, &value); // mov al, *(&value)
return value;
}