delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/01/28/22:53:46

From: nikki AT gameboutique DOT co (nikki)
Newsgroups: comp.os.msdos.djgpp
Subject: assembler question
Date: 28 Jan 1997 22:09:19 GMT
Organization: GameBoutique Ltd.
Lines: 29
Message-ID: <5cltef$2l1@flex.uunet.pipex.com>
Reply-To: nikki AT gameboutique DOT co
NNTP-Posting-Host: www.gameboutique.com
Keywords: assembler
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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


- Raw text -


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