On Tue, 31 Aug 1999, John Marshall wrote:

> static __inline__ char *
> in_strcpy (char *d, const char *s) {
>   __asm__ ("0: move.b (%1)+,(%0)+; bne.s 0b" : : "a" (d), "a" (s) : "cc");
>   return d;
>   }
> 
> This is strcpy() in less bytes than it takes to call the systrap :-).
> The `"a"'s say to put the parameters (s and d) into _a_ddress registers,
> the %k notation refers to whichever register it chose for the corresponding
> parameter,

Is it safe to assume that this is integrated with the compiler's register
allocation scheme?  Or is this obscure syntax precisely the same as the
compiler's intermediate representation that's fed to the assembler?

Is there any alternative syntax available for situations where the
programmer wants to take responsibility to allocating registers
him/herself?  I have some functions I'd like to rewrite in assembler,
from the LINK down to the RTS.  I'd love to be able to use macros to
give symbolic names to local variables and formal parameters, etc., but
perhaps that's asking too much.

Thanks, John, for this example.  I too have been looking for a better
explanation than what's in the info files, but maybe it was (also)
asking too much to be able to write the kind of 68K code I once fed to
MPW and Think C.  Or maybe I could get used to this if I tried. :-)

--Eric House

******************************************************************************
* From the desktop of: Eric House, [EMAIL PROTECTED]                            *
*     Check out Crosswords for PalmOS: <http://www.peak.org/~fixin/xwords>   *
*          "The instructions said 'Win98 or better' -- so I installed Linux" *
******************************************************************************

Reply via email to