www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/06/07/13:04:57

Xref: news2.mv.net comp.os.msdos.djgpp:4698
From: Enrico Horn <enrico DOT horn AT prakinf DOT tu-ilmenau DOT de>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Newbie Inline ASM
Date: Fri, 07 Jun 1996 09:43:36 +0200
Organization: Technische Universitaet Ilmenau
Lines: 35
Message-ID: <31B7DDA8.1CD5@prakinf.tu-ilmenau.de>
References: <31B4BF08 DOT 5FC3 AT ix DOT netcom DOT com>
NNTP-Posting-Host: ipisparc4.prakinf.tu-ilmenau.de
Mime-Version: 1.0
To: Brian Drum <drum AT ix DOT netcom DOT com>
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Brian Drum wrote:

> main() {
> asm("movl $4,%eax"
>     ://No output
>     ://No input
>     :"%eax" );
> return 0;
> }

Instead movl $4,%eax try movl $4,%%eax.
This should work. If you only write one %, the DJGPP compiler searches
for a number after it, which refers to a operand. 
Example:
main() {
  int hallo;
asm("movl %0,%%eax"
    :
    : r (hallo)
    : "%eax"); 
return 0;
}
This program does nothing more than fill the eax register with the value
of hallo.(THIS IS NOT EXPLICITLY TESTED , but should work)
So the %0 operand refers to the variable int hallo, because it is the
first operand (number 0) coming from outside the asm part.
 
Regards,
Enrico.
-- 
/---------------------------------------------------------------------\
|Enrico Horn               Tel. 036738/41929                          |
|07426 Lichta              E-mail: enrico DOT horn AT prakinf DOT tu-ilmenau DOT de  |
|Ortsstrasse Nr. 14        http://www.prakinf.tu-ilmenau.de/~ehorn    |
\---------------------------------------------------------------------/

- Raw text -


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