A92: Re: Re: "Transfer" of values between C and ASM
[Prev][Next][Index][Thread]
A92: Re: Re: "Transfer" of values between C and ASM
> > 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).
>
> whoa! that's pretty cool. What would happen if a function returned two
> values...would l do
> index1,index2 = function();
> or something else?
I don't know if gcc supports this with asm functions... but it would be great if
it did!
> Also, what would an example of getting a pointer returned be? (instead of a
> value, like in d0). Thanks!
An example from Prosit:
#define List_Find prosit__0012
list_header *List_Find(list_pointer *pointer, USHORT ID);
You can now do this:
list *mylist;
...
list_header *alistitem;
alistitem = List_Find(&mylist, 42);
<alistitem> now points to the item in the list which has an ID = 42.
/ Niklas Brunlid
Check out Prosit for the TI-89 / TI-92 Plus at http://c625.sparta.lu.se
Random PQF Quote follows:
That seems to point up a significant difference between Europeans and
Americans. A European says: "I can't understand this, what's wrong with
me?" An American says: "I can't understand this, what's wrong with him?"
-- (Terry Pratchett, alt.fan.pratchett)
References: