delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/29/00:35:00

Message-ID: <32EEE110.20FC@rangenet.com>
Date: Tue, 28 Jan 1997 23:33:04 -0600
From: Dan Hedlund <markiv AT rangenet DOT com>
Reply-To: markiv AT rangenet DOT com
Organization: Range Net
MIME-Version: 1.0
To: nikki AT gameboutique DOT co
CC: djgpp AT delorie DOT com
Subject: Re: assembler question
References: <5cltef$2l1 AT flex DOT uunet DOT pipex DOT com>

nikki wrote:
> 
> i'm trying to code the following line in inline assembler, but i made a booboo.
> 
> a=*((unsigned short *)(EBX<<1));
> 
> where EBX is an unsigned long and a is an unsigned short
> EBX<<1 points to a correct memory location incidentally, that line is supposed to
> look like that ;)
> 
> i coded this as..
> 
> asm ("movw (%%ebx,2),%%ax"
>         : "=a" (a)
>         : "b" (EBX)
>         : "%eax");
> 
> but it has the effect of doing a=*((unsigned short *)(EBX)); instead.
> it's ignoring the ,2 bit totally and i can't see why. how should i be doing this?
> movw ($0,%%ebx,2),%%ax won't work either ;(
> 
> nik
> 
> --
> Graham Tootell           GameBoutique Ltd. - THE online gaming experience
> nikki AT gameboutique DOT com   http://www.gameboutique.com

try : movw (,%%ebx,2),%%ax

-- 

*****      ***   **    **       Dan M. Hedlund
 ** **    *****  ***   **       <markiv AT rangenet DOT com>
 **  **  **   ** ****  **       http://www.rangenet.com/markiv
 **   ** **   ** ** ** **
 **   ** ******* **  ****
 **  **  **   ** **   ***
 ** **   **   ** **    **
*****    **   ** **    **

- Raw text -


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