Author Topic: DPMI question  (Read 4962 times)

Gunther

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
DPMI question
« on: July 05, 2013, 09:55:11 AM »
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
Get your facts first, and then you can distort them.

dedndave

  • Member
  • *****
  • Posts: 8734
  • Still using Abacus 2.0
    • DednDave
Re: DPMI question
« Reply #1 on: July 05, 2013, 12:57:00 PM »
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

  • Member
  • ****
  • Posts: 944
Re: DPMI question
« Reply #2 on: July 05, 2013, 11:15:50 PM »
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

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: DPMI question
« Reply #3 on: July 06, 2013, 01:15:44 AM »
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:

Code: [Select]
        ; 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
Get your facts first, and then you can distort them.

japheth

  • Guest
Re: DPMI question
« Reply #4 on: July 06, 2013, 02:32:50 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

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: DPMI question
« Reply #5 on: July 06, 2013, 03:35:16 AM »
Andreas,

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
Get your facts first, and then you can distort them.

japheth

  • Guest
Re: DPMI question
« Reply #6 on: July 06, 2013, 03:27:41 PM »
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

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: DPMI question
« Reply #7 on: July 06, 2013, 10:35:05 PM »
Andreas,

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
Get your facts first, and then you can distort them.

Gunther

  • Member
  • *****
  • Posts: 3515
  • Forgive your enemies, but never forget their names
Re: DPMI question
« Reply #8 on: July 08, 2013, 10:22:00 PM »
Andreas,

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

Gunther
Get your facts first, and then you can distort them.