[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Mixing ORCA/M and ORCA/C



>Has anyone tried this: I want to call an ASM routine from C, but I need
>to set the A,X,Y registers to a specific value. The assmebly code sets
>the registers to new values and then returns to the C code. How can I
>set the registers with a C statement without asm (if possible) commands?
>And how can I read them?

Some code tricks could set the registers, like

long setax(long x)
{
	return x;
}

setax(xvalue<<16 + avalue);

but I think asm is the way to go. Try macros (which don't seem to always
work for assembly) like:

#define loada(x) asm{lda x}

fwiw, when I was thinking of porting assembly to C, one of the biggest problems
was passing values in registers instead of on the stack.

To read the values, try like:

#define storea(x) asm{sta x}

immediately after the function returns.


--
  --Jay, jay.krell@cornell.edu