delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/10/22/16:25:14

From: elf AT netcom DOT com (Marc Singer)
Message-Id: <199610222015.NAA28362@netcom8.netcom.com>
Subject: Re: Simple At&t help
To: verner AT freenet DOT hut DOT fi (Andreas Vernersson)
Date: Tue, 22 Oct 1996 13:15:32 -0700 (PDT)
Cc: djgpp AT delorie DOT com (DJGPP List Alias)
In-Reply-To: <1.5.4.16.19961022181124.36579d84@freenet.hut.fi> from "Andreas Vernersson" at Oct 22, 96 06:12:50 pm
MIME-Version: 1.0

> 
> How do i make al = a[ebx] where a is a *char in at&t inline syntax?

I'm not sure that I understang what you are trying to do.  Is a a
pointer to a character?  Is ebx the index in the character array?  In
the Intel assember format, you might do this:

int ib;		/* Index in array */
char* rgb;	/* Pointer to base of byte array */

/* Entering ASM land */

  mov ebx, rgb
  add ebx, ib
  mov al, [ebx]

This is a naive coding, but it will work.  If we want to do the same
thin in AT&T syntax...

  movl rgb, %ebx
  addl ib, %ebx
  movb (%ebx), al

If you are doing this in a GCC program, you will want to look into the
assembler stuff in GCC because it is really good about letting you
insert assembly language instructions into the output stream BEFORE it
begins optimization.  MS can't do that and I believe that Watcom
cannot either.

- Raw text -


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