中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-15 01:55
47,812 topics / 349,917 posts / today 0 new / 48,268 members
DOS开发编程 & 发展交流 (开发室) » [Help] How do I access 32-bit I/O ports under DOS?
Printable Version  1,110 / 2
Floor1 紫雪 Posted 2003-07-29 00:00
初级用户 Posts 1 Credits 105
Floor2 ATLaS Posted 2003-07-30 00:00
初级用户 Posts 29 Credits 169
Under Watcom C there are outpd() and inpd() for reading and writing 32-bit I/O, and under DJGPP there are outpl() and inpl().
Under BC you can:
1. Call the PCI BIOS Extension interrupt of int1A to do 32-bit read/write operations on PCI device registers;
2. Write your own oupd() and inpd() for BC, sample as follows:
static ULONG inpd(int portnum)
{
static ULONG value ;
asm mov dx,portnum ;
asm lea bx,value ;
__emit__(0x66,0x50, // push EAX
0x66,0xED, // in EAX,DX
0x66,0x89,0x07, // mov ,EAX
0x66,0x58) ; // pop EAX
return value ;
}

static void outpd(int portnum, ULONG val)
{
static ULONG value = 0 ;
value = val ;
asm mov dx,portnum ;
asm lea bx,value ;
__emit__(0x66,0x50, // push EAX
0x66,0x8B,0x07, // mov EAX,
0x66,0xEF, // out DX,EAX
0x66,0x58) ; // pop EAX
return ;
}
Floor3 wangnan16 Posted 2003-08-22 00:00
初级用户 Posts 15 Credits 143
Expert.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023