 |
LPT端口地址保存在BIOS存储器的40:06到40:0F。下面是一个例子(只能在Win9x下运行):
short __stdcall GetLPTPortAddress(short PortNo)
{
int lPortNo = PortNo;
__asm
{
push es
push ebx
mov ebx, lPortNo
shl ebx,1
mov ax,40h // Dos segment adress
mov es,ax
mov ax,ES:[ebx+6] // get port adress in 16Bit way :)
pop ebx
pop es
}
}
对于Win NT/2000/XP的用户可以使用NTPort Library(http://china.zealsoft.com/cn/ntport/)的函数获得端口地址。
此问题由李海回答。
附加关键字:编程, 源程序, programming, source code, C/C++, MFC, C++ Builder, Borland C++, Turbo C, C, BCB, DDK与硬件设备, hardware, ddk, vtoolsd, driver studio, winrt。
|