News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

DPMI question

Started by Gunther, July 05, 2013, 09:55:11 AM

Previous topic - Next topic

Gunther

Assuming a DOS client is running under a DPMI host (for example Windows). Is it possible for the client to manipulate the hardware with IN and OUT? Is there a chance, for example, to update the screen cursor position or must it use the DPMI interrupt translation service?

Gunther
You have to know the facts before you can distort them.

dedndave

my understanding is that, if you boot up in control, you can do almost anything with IN and OUT
the question is, what can i do in real mode ?
some things have to be accessed in protected mode
that means you have a lot of code to write to make it do what you want
well - maybe not a lot - but some of it is tricky   :P

i haven't played too much with that area
i am in a "learn windows" mode, at the moment
when i get more comfortable with that, i will move on

FORTRANS

Hi,

   One of my books has a list of DMPI functions.  None reference
input/output.  And the only reference to a device is mapping it to
a memory block.  So I would assume that DMPI has little to do
with I/O, and the OS would determine what happens at a low level.

   As far as the screen cursor, the program should be able to use
a DMPI function to call the video BIOS.  (As you mention.)  I do
not think accessing the video card's registers would have all that
more utility for that task.  Using some of the video character
generator resources will require low level access to registers, and
tend to fail under Windows.  I do not see DMPI helping in that case.
Though I may be missing something, of course.

   I have not had much luck with I/O with DOS programs under
Windows (2K, XP).  This link; Parallel Port Central
seems to have help for Windows programs, but not DOS programs.

HTH,

Steve N.

Gunther

Steve,

thank you for your reply. The point is: there are contradictory information about interrupts in protected mode. There is the DPMI translation service (function 300 with INT 31h). That works fine with DOS interrupts. Some information says that BIOS interrupts are simply reflected; but that's not true. For example: updating the screen cursor (INT 10h, FUNCTION 02h) needs the DPMI translation service or you have to live with a GPF (at least under XP, SP 3 running under VirtualPC and under DOS Box).

That's the first point. But the keyboard interrupt (INT 16h, function 0h - read key) gives a GPF by using the DPMI translation service; one has to use it without that and it'll be simply reflected. That's all a bit strange.

Therefore I had the idea to update the screen cursor directly in that way:


        ; cursor index to index register

        mov al, 0fh         
mov dx, 03D4h
out dx, al

        ; set low byte

    mov al, bl                 ; al contains the low byte address
        mov dx, 03D5h
        out dx, al                 ; low byte

        etc.


I'm not sure if that works.

Gunther
You have to know the facts before you can distort them.

japheth

Quote from: Gunther on July 06, 2013, 01:15:44 AM
For example: updating the screen cursor (INT 10h, FUNCTION 02h) needs the DPMI translation service or you have to live with a GPF (at least under XP).

You only need to use the DPMI translation service if the BIOS API expects a pointer in a register (pair). Int 10h, ah=02 doesn't use a pointer, so it is safe to call it directly in protected-mode ( I just tried in SP3 ).

Gunther

Andreas,

Quote from: japheth on July 06, 2013, 02:32:50 AM
You only need to use the DPMI translation service if the BIOS API expects a pointer in a register (pair). Int 10h, ah=02 doesn't use a pointer, so it is safe to call it directly in protected-mode ( I just tried in SP3 ).

that was my original assumption, but the cursor update works only with translation service. It's possible that VirtualPC has a bug or feature, but CWSDPMI shows the same behavior.

By the way is your DOS extender a stand alone application or must it be linked into the EXE?

Gunther
You have to know the facts before you can distort them.

japheth

Quote from: Gunther on July 06, 2013, 03:35:16 AM
that was my original assumption, but the cursor update works only with translation service. It's possible that VirtualPC has a bug or feature, but CWSDPMI shows the same behavior.

VirtualPC has no built-in DPMI host - so you'll have to tell us what host you used inside VirtualPC.



Gunther

Andreas,

Quote from: japheth on July 06, 2013, 03:27:41 PM
VirtualPC has no built-in DPMI host - so you'll have to tell us what host you used inside VirtualPC.

yes, of course. I'm running XP, SP 3 under VirtualPC (see thread post #3). The situation is: the direct call to INT 10h works fine under native XP (other machine) and doesn't work with VirtualPC.

Gunther
You have to know the facts before you can distort them.

Gunther

Andreas,

by the way: your DOS extender works very well under plain DOS and DOSbox. :t

Gunther
You have to know the facts before you can distort them.