You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
547 B
28 lines
547 B
#include <windows.h> |
|
#include "ioport.h" |
|
|
|
void outport(unsigned int portid, unsigned int value) |
|
{ |
|
asm("out %%ax,%%dx" : : "a"(value), "d"(portid)); |
|
} |
|
void outportb(unsigned int portid, unsigned char value) |
|
{ |
|
asm("out %%al,%%dx" : : "a"(value), "d"(portid)); |
|
} |
|
|
|
unsigned char inportb(unsigned int portid) |
|
{ |
|
unsigned char value; |
|
|
|
asm("in %%dx,%%al" : "=a"(value) : "d"(portid)); |
|
return value; |
|
} |
|
|
|
unsigned int inport(unsigned int portid) |
|
{ |
|
int value=0; |
|
|
|
asm("in %%dx,%%ax" : "=a"(value) : "a"(value), "d"(portid)); |
|
return value; |
|
} |
|
|
|
|