Re: A92: Re: A89: Re: Re: "Transfer" of values between C and ASM


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

Re: A92: Re: A89: Re: Re: "Transfer" of values between C and ASM




>is this called indirection, and sort of like indirection in TI-Basic?

It's sort of indirection...here's how it works (to answer all your previous
questions--or at least try).
When you define a variable as a pointer, you can think of it as an address
(like the a0-7 registers on the 68K).  It holds the address of something,
rather than its value (like a d register would).  You can define a pointer
at, say, the beginning of an array, and then use it sort of like
indirection to get the value at that address.  You can then add one to the
pointer to get the next location in memory.  It's a lot like how you'd use
the a0-7 registers in assembler.
When you pass something like "mylist" to a function, you pass the actual
value of mylist.  If you pass "&mylist", you pass a pointer to it--its
address.  In the case of a list like we're using, it's large and of unknown
size, so rather than cramming it into a register or onto a stack to pass
its actual content, it's easier to pass the address of it.  It's sort of
like LEA in 68k assembler.

If this didn't make sense to you (which it probably didn't, I'm not much of
a C man) I can try to rephrase it into Java or your language of choice. :-)
--Cliff Biffle





References: