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-08-01 03:23
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » [Discussion] Can physical 32-bit addresses be accessed under MS-DOS? View 1,095 Replies 1
Original Poster Posted 2003-09-10 00:00 ·  中国 河南 郑州 联通
初级用户
Credits 117
Posts 5
Joined 2003-09-10 00:00
22-year member
UID 9664
Gender Male
Status Offline
I've recently needed to write a driver under DOS. Can someone tell me how to use assembly under DOS to access physical 32-bit addresses.
Floor 2 Posted 2003-09-12 00:00 ·  新加坡 星和视界(StarHub)宽带
初级用户
Credits 169
Posts 29
Joined 2003-07-09 00:00
23-year member
UID 6654
Gender Male
Status Offline
You definitely have to be in protected mode to access physical 32-bit addresses.
You need a DPMI host. Under Watcom C there's dos4g/w, and now you can also use dos32a and cwsdpmi, as well as the famous pmode. Then it's just flat mode memory access: define a pointer to the memory area you want to access, the simplest and most direct way.
Under djgpp use cwsdpmi and pmode, but you can't access it directly with pointers; you need to use the _far* family of functions.
BC certainly has its own DPMI host too, but I haven't worked with it, so I'm not too sure.

As for assembly, I'd still advise you to forget it. Switching from DOS real mode to protected mode and then accessing the specified memory segment is rather cumbersome to implement in assembly.
Forum Jump: