delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/15/21:48:15

From: lonniem AT cs DOT utexas DOT edu (Lonnie McCullough)
Newsgroups: comp.os.msdos.djgpp
Subject: GAS craziness (not assembling legal instructions)
Date: Sat, 16 Aug 1997 01:04:11 GMT
Message-ID: <33f4f975.1565929@news.nol.net>
NNTP-Posting-Host: ip38-19.nol.net
Lines: 40
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Allright I'm having troubles with GAS.  I have a function that sets a
pixel at a given offset in a 8/15/16/24 bpp modes.  GAS seems to be
choking when I have a memory operand as the destination on certain
instructions.  Here's an example:

.globl _putpixeloffs24
  .align 4
_putpixeloffs24:
  pushl %eax
  pushl %ebx
  movl 12(%esp),%eax       /* point eax to SURFACE struct */
  movl 20(%esp),%ebx       /* put color in ebx */
  movl 4(%eax),%eax        /* get surface->offset into eax */
  andl $0xFFFFFF,%ebx      /* restrict color to lower 3 bytes */
  addl 16(%esp),%eax       /* add offset to eax */
  .byte 0x64               /* selector is assumed to be in fs */
  andl $0xFF000000,(%eax)  /* this is where it chokes */
  .byte 0x64
  orl %ebx,(%eax)      /* no error here */
  popl %ebx                /* restore regs */
  popl %eax
  ret

It gives an error like:
src/asm24.s: Assembler messages:
src/asm24.s:25: Error: Bad expression
src/asm24.s:25: Error: Missing ')' assumed
src/asm24.s:25: Error: Ignoring junk 'eax)' after expression

the line numbers are incorrect because there were other things in the
file before it but this is where it messes up.  It also did this on a
couple of other instructions in a different file.  But it was with a
movb and movw instruction with mem destinations (changed those to
stosb and stosw).  Notice it doesn't give an error for the or.  An
instruction like the one causing errors now assembles fine in inline
asm, which puzzles me even more.  Hope it's not a GAS bug.


Lonnie McCullough
lonniem AT cs DOT utexas DOT edu

- Raw text -


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