delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/02/04:26:13

From: "Hargreaves, Shawn" <shawnh AT probe DOT co DOT uk>
To: "'djgpp AT delorie DOT com'" <djgpp AT delorie DOT com>
Subject: Re: Need help on pseudo registers
Date: Thu, 02 Oct 97 09:22:00 PDT
Message-ID: <3433CA8E@relay.probe.co.uk>
Encoding: 30 TEXT

Mauro <maurob AT ozemail DOT com DOT au> writes:
> I need help in using pseudo registers under DJGPP.
> How do I place a value in the actual registers without using asm ?

You don't :-) The only way to do this is by using inline asm...

> For example , I can just put a value into the register AX using the
> following code in Turbo C 2.0 :
>
>   _AX = 10 ;
>
> But how do I do that in DJGPP ???

That is a _very_ nonstandard Borland extension, which isn't
supported by gcc.

The only reason I can think why such a construct would be
useful is if you need to load parameters for a call to some
asm routine or interrupt service. But any decent optimising
compiler is liable to use that register for other purposes,
and there is no way for it to know how long you expect your
value to stay loaded, ie. at what point it is safe to clobber
your value. The only reason this feature was possible in
Borland is because their code generation was so bad :-)

See the gcc info pages (under "C extensions") for a
description of the inline asm syntax...

 Shawn.

- Raw text -


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