delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/04/13:36:59

Date: Thu, 4 Sep 1997 20:34:40 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Nate Eldredge <eldredge AT ap DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: [Q] using int 0x21 to print text with inline asm
In-Reply-To: <199709040012.RAA03259@adit.ap.net>
Message-ID: <Pine.SUN.3.91.970904203418.27525H-100000@is>
MIME-Version: 1.0

On Wed, 3 Sep 1997, Nate Eldredge wrote:

> At 06:19  8/30/1997 +0200, Simon Schubert wrote:
>
> >That's wrong. What for is - if you were right - the dos-extender?
> >the dos-extender converts the interrupt calls from protected mode to the
> >right 
> >parameters and then calls the real mode int. So you just have to move
> >the *whole*
> >offset of myHappy into dx, which must be in protected mode edx, a 32 bit
> >offset.
>
> I'm not sure what you mean by "dos-extender". The code you list below (the
> first one) works under Windows 3.1 DOS box, but does not work under
> DOS/CWSDPMI (prints garbage). I can only surmise that the DPMI server
> understanding DOS functions and doing the memory copy is a Windows
> extension. Otherwise, that is only done transparently by the int86() family
> of functions, and only in certain cases.

Windows includes a built-in DOS extender.  It catches any real-mode
INTs and transparently translates them, including the necessary
copying of the data from protected-mode addresses to low memory and
back.

DJGPP programs should not depend on that behavior, because if they do,
they will only work on Windows.  DJGPP is an extender-less system, it
only requires a DPMI server, and these servers aren't required to be
extenders (most of them aren't).

> >> Furthermore, the asm instruction "int $0x21" generates an INT 21h in
> >> *protected mode*. If it's handled there, it will never get to
> >> real mode and DOS. 
> >it's handled there by the dos-extender and correcty (with the right
> >register values) reflected to dos.

Only when there is an extender (such as Windows).  DJGPP programs can
be run on plain DOS where no extender is available in the first place.

Bottom line, Nate was right on all counts, if the program in question
should run outside Windows.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019