delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/10/14/18:40:39

From: Thomas Harte <T DOT Harte AT btinternet DOT com>
Newsgroups: comp.os.msdos.djgpp
Subject: ASM Queries
Date: Wed, 14 Oct 1998 23:27:02 +0100
Organization: BT Internet
Lines: 30
Message-ID: <36252536.148EA3@btinternet.com>
NNTP-Posting-Host: host5-171-231-215.btinternet.com
Mime-Version: 1.0
X-Mailer: Mozilla 4.06 [en] (Win95; I)
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Hi,

	I'm just playing around with extended inline assembler, and because I
am using more variables than I can count on my fingers (bitchy moan
there), I cannot afford the luxury of loading them all to registers. So
what I though I would do is define my variables as :

int r, g, b, radd, badd, gadd;

	Stick a pointer to r into a register, and get the others via memory
adjustments. For example, if I put the pointer into eax then within my
extended inline asm, shrl -4(%%eax) would find g and so on. Anyway, of
course, this works fine if I do a normal compile.

	However, having regular C code around the extended assembler in the
same source files, I could quite do with using optimisations. Which of
course do not just leave a set of defined integers in memory
contiguously . . . . so the -4(%%eax) gets something completely random.
At least, this is what I think is going on . . .

	So what are my alternatives? Is there a standard way to do something
like this such that the compiler understands I'd quite like the
variables to be contiguous in memory - or should I be using different
syntax?

	I'm fairly new to DJGPP inline, and I wasn't able to find anything in
the FAQ (from faq202b - am I out of date?) nor the thing on Brennan's
site . . . so thanks for any help. Feel free to forward.

		-Thomas

- Raw text -


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