Detect DPMI

DOS specific questions.
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Detect DPMI

Postby DOS386 » Jul 04, 2006 23:44

I would like my prog to detect the DPMI it is running on.

Found out:

"Int 31H Function 0400H
Get Version [0.9]"

http://www.delorie.com/djgpp/doc/dpmi/api/310400.html

and

"Int 31H Function 0401H
Get DPMI Capabilities [1.0]"

http://www.delorie.com/djgpp/doc/dpmi/api/310401.html
Will fail on CWSDPMI, work on HDPMI (?)

How to use theese features in FB, having the result in BASIC
variables ?

Are there other possibilities of dection of DPMI config ?
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Postby MichaelW » Jul 05, 2006 3:31

IIRC those functions are available only if DPMI is installed. You would, at least normally, call Interrupt 2Fh function 1687h to determine if DPMI is installed. You can find the necessary information in Ralf Brown’s Interrupt list.

An HTML version is here:

http://www.ctyme.com/rbrown.htm

And the download version here:

http://www-2.cs.cmu.edu/~ralf/files.html

This is quick and dirty, and *not* tested:

Code: Select all

option explicit

dim as short rAX, rBX, rCX, rDX, rDI, rSI, rES

asm
    mov ax, &h1687
    int &h2f
    mov [rAX], ax
    mov [rBX], bx
    mov [rCX], cx
    mov [rDX], dx
    mov [rDI], di
    mov [rSI], si
    mov [rES], es
end asm

if rAX = 0 then
    if rBX and 1 then print "32-bit programs supported"
    print "processor type = "; rCX and &hff
    print "DPMI major version = "; rDX shr 8
    print "DPMI minor version = "; rDX and &hff
    print "paragraphs required for private data = "; rSI
    print "DPMI mode-switch entry point segment = "; rES
    print "DPMI mode-switch entry point offset = "; rDI
else
    print "DPMI not installed"
endif

sleep
DOS386
Posts: 798
Joined: Jul 02, 2005 20:55

Interesting, but ...

Postby DOS386 » Jul 05, 2006 9:07

"IIRC those functions are available only if DPMI is installed"

I had thought that FB would run ALWAYS uder DPMI in DOS.

What you suggest seems to be the REAL-MODE INT used by the "stub"
BEFORE switching into PM.
DrV
Site Admin
Posts: 2116
Joined: May 27, 2005 18:39
Location: Midwestern USA
Contact:

Postby DrV » Jul 05, 2006 12:39

Yes, if there is no DPMI host, then your program won't be running in the first place.

You can use the DJGPP DPMI wrapper functions to do this easily:

Code: Select all

#include "dos/dpmi.bi"

dim version as __dpmi_version_ret

__dpmi_get_version(@version)

with version
   print "major: "; .major
   print "minor: "; .minor
   print "flags: "; .flags
   print "cpu  : "; .cpu
end with

dim flags as integer
dim vendor_info as zstring * 128
dim vendor_name as zstring ptr

print "DPMI 1.0 capabilities: ";
if __dpmi_get_capabilities(@flags, @vendor_info) = 0 then
   print
   print "flags: "; flags
   print "major: "; vendor_info[0]
   print "minor: "; vendor_info[1]
   vendor_name = @vendor_info + 2
   print "name : "; *vendor_name
else
   print "not supported"
end if
MichaelW
Posts: 3500
Joined: May 16, 2006 22:34
Location: USA

Postby MichaelW » Jul 05, 2006 16:16

Yes, if there is no DPMI host, then your program won't be running in the first place.

Good point :)

Return to “DOS”

Who is online

Users browsing this forum: No registered users and 1 guest