delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/04/16:33:12

Date: Fri, 4 Oct 1996 15:20:08 GMT
Message-Id: <199610041520.PAA22016@gauss.logicnet.com.mx>
Mime-Version: 1.0
To: Farhan Yousaf <farhany AT interlog DOT com>
From: "YOMERO SOFTWARE LTD." <inarnet AT gauss DOT logicnet DOT com DOT mx>
Subject: Re: Optimization and Inline ASM
Cc: djgpp AT delorie DOT com

At 18:53 3/10/96 -0400, you wrote:
>Dear DJGPPers,
>
>I am puzzled at this error:
>c:/djgpp/tmp\cccaaaaa: Assembler messages:
>c:/djgpp/tmp\cccaaaaa:66: Fatal error:Symbol loc1 already defined.
>
>This error only occurs if I use the optimize switch:
>
>gcc myfile.cpp -O3
>
>Compiles flawlessly if I use just:
>gcc myfile.cpp
>
>The code giving me the problem is:
>
>void myproc()
>{
>  __asm__ __volatile__("
>        cli\n
>        movw $0x3DA, %dx\n
>loc1:\n
>        inb  %dx, %al\n
>        andb $8,  %al\n
>        jnz loc1\n
>loc2:\n
>        inb  %dx, %al\n
>        andb $8, %al\n
>        jz loc2\n");
>}
>
>What am I doing wrong? Help me, or I'll be bold soon! This error has driven
>me NUTS!!!
>--
>Farhan Yousaf    "We were never feeling bored         <farhany AT interlog DOT com>
>PSBFreak          because we were never being boring."   <ca337 AT torfree DOT net>
>PSB, Hit Music:   http://www.interlog.com/~farhany/
>
>
>
Farhan:

        I am new at programming with DJGPP, just like you. This was my first
error too, the solution appears to be puting the labels in the same line
with the code, like that:

void myproc()
{
  __asm__ __volatile__("
        cli\n
        movw $0x3DA, %dx\n
loc1: inb  %dx, %al\n
        andb $8,  %al\n
        jnz loc1\n
loc2:   inb  %dx, %al\n
        andb $8, %al\n
        jz loc2\n");
}

        That's the way I did it, hope it works for you too! let me know about. 


                                                Yomero.

- Raw text -


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