关于IO端口和IO空间的关系请看这篇文章:http://www.cnblogs.com/hydah/archive/2012/04/10/2232117.html
我们通常所用的读写IO端口一般是从一个端口port写入偏移量offset,然后从port+1端口把这个偏移的值读出来,例如从70/71端口读写CMOS:
读CMOS:
outp(0x70,offset);
value = inp(0x71);
写CMOS:
outp(0x70,offset);
outp(0x71,value);
而读写IO空间只需在相应的端口读写值即可:读value = inp(port); 写outp(port,value);
在Windows下读写端口,可以用WinIo中的GetPortVal 和 SetPortVal方法。