delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/05/12/10:46:20

From: "John S. Fine" <johnfine AT erols DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How works inline asm in DJGPP
Date: Tue, 12 May 1998 10:33:36 -0400
Organization: Erol's Internet Services
Lines: 31
Message-ID: <35585D8B.3A49@erols.com>
References: <35582E82 DOT 41C6 AT fi DOT muni DOT cz>
Reply-To: johnfine AT erols DOT com
NNTP-Posting-Host: 207-172-241-222.s31.as8.bsd.erols.com
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Tomas Kratochvil wrote:

> I have problem with inline assembler in DJGPP.
> I write this procedure in Borland C++ and I don`t how can I rewrite it
> to DJGPP. Please help me.
. . .
>   asm { mov ax,0a000h
>         mov es,ax

Actually, you have a few problems with inline assembler in DJGPP.

First there is the syntax.  It is AT&T syntax, which is very different
from the Intel syntax you are used to.  Either look at:
http://www.rt66.com/~brennan/djgpp/bgtia.html
to see how to use inline assembler in AT&T syntax, or change your
assembler code to be a callable subroutine rather than a piece of
a C routine.  Then you can assemble the code with NASM (which is
close to the syntax you are used to) and link the resulting .o
file into a C program with djgpp.

Second, you should switch from 16 bit instructions to 32 bit
instructions.  DJGPP runs all 32-bit.  Every 16 bit instruction
requires one or two slow prefixes.

Third, you can't access physical addresses that way.  Sorry I don't
have a URL handy to give the details, but it is in the FAQ.
-- 
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/


- Raw text -


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