Date : Wed, 27 Jul 1994 08:55:28 WET DST
From : Bonfield James <jkb@...>
Subject: Re: JB's macros!
Stephen Quan writes:
>And I was just wondering, (actually I had thought of this before),
>with C, you could use imbedded assebly. Keep the macro as it is
>above, but you could have
>
> #ifdef _386_
> #define inc_PC(len) \
> _asm add si,len
> #endif
>
> #ifdef _SPARC_
> #define inc_PC(len) \
> _asm add %o1,len,%o1
> #endif
Is there a document available (preferably online) that describes how to use
asm? It always struck me as odd that you can do:
_asm add %o1,len,%o1.
This uses the first of the output registers (%o1) for the addition. How do we
know which register to use!? Isn't that the compilers task and not ours? Is
there a standard way of requesting PC to be register %o1? (There is in gcc -
just).
>#define Jmp(label) _asm jmp @label
>#define Label(label) _asm @label:
>#define Equw(label) _asm @label
Is this @label notation part of the _asm semantics? Or is it architecture (and
maybe even 'as' (the UNIX assembler)) dependant?
If I could use assembly in the macros of my code it would enable, amongst
other things, the use of using the 386 status register as discussed in earlier
threads.
James B