delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/09/11:19:40

Sender: nate AT cartsys DOT com
Message-ID: <35CDB258.6CF827BA@cartsys.com>
Date: Sun, 09 Aug 1998 07:29:44 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
MIME-Version: 1.0
To: Endlisnis <s257m AT unb DOT ca>
CC: Rylan <rylan AT inbtekom DOT co DOT za>, djgpp AT delorie DOT com
Subject: Re: How to generate an interrupt in AT&T asm
References: <6qbcfi$pn7$1 AT news2 DOT saix DOT net> <35CA4690 DOT 3BEBD45A AT cartsys DOT com> <35CB309A DOT 69AE696C AT unb DOT ca>

Endlisnis wrote:
> 
> Nate Eldredge wrote:
> 
> > Rylan wrote:
> > Somebody correct me if I'm wrong, but a normal `int' instruction should
> > work, as long as you haven't installed a protected-mode interrupt
> > handler for that int (unlikely).  Ex:
> 
> main()
> {
>  asm volatile ("movw $0x0013, %%ax; int $0x10" : : : "ax");
>  return 0;
>  }
> 
>     This program compiled and ran as I expected, changing the display into
> VGA
> mode.  I thought you had to switch to real-mode to execute an interrupt, or
> is
> that done in this case by the DPMI server?? 

I believe that an interrupt is issued in real mode if there is no
protected mode handler for it.  I'm not sure of this, however.  The DPMI
spec might discuss it.

> And is this dangerous in any
> way?
> [Something about no stack for the interrupt?] 

I'm not enough of a DPMI guru to answer this, but I haven't *heard* of
problems with it.  __dpmi_int is probably safer overall, though, due to
the above issue.

> And is it OK to just put ";"
> between commands in inline asm or do you really need "\n\t"?

Yes.  From the `as' docs, node "Statements":

#    A "statement" ends at a newline character (`\n') or line separator
# character.  (The line separator is usually `;' [...])

-- 

Nate Eldredge
nate AT cartsys DOT com


- Raw text -


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