"Portable" asm

David Keppel pardo at june.cs.washington.edu
Wed Mar 9 08:50:01 AEST 1988


Assuming that you want asm...

To increase the portability of the "asm" directive, there should
be some way of telling the compiler which globals, which special
registers, etc. you want to use.  The syntax is bogus, but here's
the idea:

  + state (prototype) all the resources you need
  + hide access to everything else

    #include <asm.h>

    struct foo { ... }	glob1, glob2;

    anotherfunc() { ... }

    myfunc()
    {
	int	locvar;

	/* code */

	start_asm( glob1, glob2, anotherfunc, asm_tmps(3), locvar ) {
#ifdef ASM_VAX
	    /* high-level assembly code goes here */
#elseif ASM_MC68000
	    /* high-level assembly code goes here */
#else
	    ASM_FAILED
#endif
	}

	/* code */
    }


	;-D on  (The program is dead, but the code lives on)  Pardo



More information about the Comp.lang.c mailing list