China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-06-25 08:07
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » [Help] How do I access 32-bit I/O ports under DOS? View 988 Replies 2
Original Poster Posted 2003-07-29 00:00 ·  中国 陕西 西安 电信
初级用户
Credits 105
Posts 1
Joined 2003-07-29 00:00
22-year member
UID 7715
Gender Female
Status Offline
Floor 2 Posted 2003-07-30 00:00 ·  新加坡 星和视界(StarHub)宽带
初级用户
Credits 169
Posts 29
Joined 2003-07-09 00:00
22-year member
UID 6654
Gender Male
Status Offline
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 ;
}
Floor 3 Posted 2003-08-22 00:00 ·  中国 湖南 株洲 电信
初级用户
Credits 143
Posts 15
Joined 2003-05-25 00:00
23-year member
UID 2416
Gender Male
Status Offline
Expert.
Forum Jump: