A92: Re: "Transfer" of values between C and ASM
[Prev][Next][Index][Thread]
A92: Re: "Transfer" of values between C and ASM
> how can l "transfer" register values between my C programming and the library
> funcions? For example, how can l get the output of the userlib::idleloop()
> into my C program on the calculator? (the idleloop function returns the key
> value in register d0) What l tried doing in my program was this:
>
> register int d0;
> .......
> idle_loop();
> DrawChar(2,2,d0,0)
>
> but all that it prints is the char(1) value (d0 is always 1) lt must not be
> using the same assembly register. Can anyone help?
If idle_loop is properly defined you shoule be able to write:
int key;
key = idle_loop();
DrawChar(2,2,key,0);
or just
DrawChar(2,2,idle_loop(),0);
gcc expects data to be returned in d0 (for values) or a0 (for pointers).
/ Niklas Brunlid
Check out Prosit for the TI-89 / TI-92 Plus at http://c625.sparta.lu.se
Random PQF Quote follows:
"I used to think that *I* was stupid, and then I met philosophers."
-- (Terry Pratchett, Small Gods)
References: