ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2002/04/08/09:15:03

X-Authentication-Warning: delorie.com: mailnull set sender to djgpp-bounces using -f
From: "Jacky Luk" <luckie AT netvigator DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Declaring variables in GAS
Date: Mon, 8 Apr 2002 21:00:17 +0800
Organization: IMS Netvigator
Lines: 48
Message-ID: <a8s4h6$72p2@imsp212.netvigator.com>
References: <a8okc7$n057 AT imsp212 DOT netvigator DOT com> <a8p52l$qj71648 AT imsp212 DOT netvigator DOT com> <a8rsi9$lt$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE>
NNTP-Posting-Host: pcd653040.netvigator.com
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

"Hans-Bernhard Broeker" <broeker AT physik DOT rwth-aachen DOT de> glsD
:a8rsi9$lt$1 AT nets3 DOT rz DOT RWTH-Aachen DOT DE...
> Jacky Luk <luckie AT netvigator DOT com> wrote:
> > This is the first time I get it->
>
> You got it wrong.  You were asking about a *global* variable and how
> to declare it in asm.  But your C example only has a variable local to

Could you show me also how to do it with a local var.?
Thanks a lot

> function main.
>
> Try this instead:
>
> #include <stdio.h>
>
> int foo1 = 100;
>
> int main()
> {
>
>  printf ("%d\n", foo1);
>  return 0;
>
>
> }
>
> And the important fragments of the assembly output you'll get are:
>
> .globl foo1
> .data
> foo1:
>         .align 4
>         .long 100
>
> And to get it into a register:
>
>         movl foo1,%eax
>
>
>
> --
> Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de)
> Even if all the snow were burnt, ashes would remain.


- Raw text -


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