www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/06/02:01:41

Message-Id: <199808060600.HAA18999@sable.ox.ac.uk>
Comments: Authenticated sender is <mert0407 AT sable DOT ox DOT ac DOT uk>
From: George Foot <george DOT foot AT merton DOT oxford DOT ac DOT uk>
To: rylan AT inbtekom DOT co DOT za
Date: Thu, 6 Aug 1998 06:59:14 +0000
MIME-Version: 1.0
Subject: Re: How to generate an interrupt in AT&T asm
Reply-to: george DOT foot AT merton DOT oxford DOT ac DOT uk
CC: djgpp AT delorie DOT com

On  5 Aug 98 at 12:53, Rylan wrote:

> In DJGPP's inline assembler format, how can I generate a BIOS int?
> 
> If I cannot do it directly, how can I call __dpmi_int from an inline
> assembler function, i. e. how do I pass __dpmi_int the correct parameters
> while calling from inside an inline assembler statement?
> 
> Please reply by email if at all possible.

__dpmi_int is just a function, so you pass parameters in the usual 
way.  For the parameters to __dpmi_int, which are nice parameters, 
you just push them onto the stack, four bytes each, right-to-left, 
and then do the (near) call:

    movl   _regs, %eax     /* address of register block */
    pushl  %eax
    movl   $0x10, %eax     /* interrupt number (example) */
    pushl  %eax
    call   ___dpmi_int     /* (0x10, &regs) */
    addl   $8, %esp        /* or popl twice */
    /* now EAX is the return value */

Since you're calling GCC-compiled code (or rather, code written to
be called by GCC-compiled code) you must make sure the normal
assumptions hold, e.g. ES=DS=CS=SS.  Also note that it can clobber
ECX, EDX, FS and GS without restoring them; if you care about their
values, save them (perhaps on the stack before pushing parameters).

-- 
george DOT foot AT merton DOT oxford DOT ac DOT uk

- Raw text -


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