www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/03/03/00:13:36

From: enigma AT erols DOT com (enigma)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: DJGPP and ASM
Date: Mon, 03 Mar 1997 04:05:28 GMT
Organization: djgpp, i luv u ;)
Lines: 38
Message-ID: <331a4b7c.883291@news.erols.com>
References: <5f9kld$i1d AT boursy DOT news DOT erols DOT com>
NNTP-Posting-Host: dam-as8s08.erols.com
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Sat, 01 Mar 1997 19:11:45 GMT, donjr AT erols DOT com (No One Important)
wrote:

>Is it possible to use in-line assembly language with DJGPP v. 2.0?
>If it is, can somebody show me the proper method for it?
>I seem to be screwing it up a lot.
>
>David Loose
>donjr AT erols DOT com
>

i'm not going to explain it to you here.. (mostly because i'm no
expert) but yes, inline assembly is in djgpp (very easily for that
matter).  you use a function called asm().  djgpp shoves any assembly
(at&t asm sytax) direct to gas (gnu assembler).

a quick example is:

asm ( "movl %eax, %ecx\n"
         "movw %ax, %bx");

what this does is move a 32-bit integer from eax to ecx and then a
16-bit integer from ax to bx.  if you understand at&t syntax, that
should be obvious.  the only thing that should be new is the '\n'
you must provide a linefeed at the end of an inline asm statement, so
the asm compiler gets it properly formated.  a little anoying, but its
not that bad.  there are many faqs on at&t sytanx and and djgpp inline
assembly that can help you with more complex stuff like input and
output fields and more importantly "memory clean up."  REMEMBER, the
assembler assumes nothing.  if you took my example and you didn't
intend to modify those registers globally, then you should have put
them on the stack and pop'd them when you were done.

i hope other peeps will reply, cause i'm kinda dumb =)

mint
enigma AT erols DOT com

- Raw text -


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