Re: A89: recursion question


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

Re: A89: recursion question




This is very wrong.
the PC is the programcounter, and it is _always_ containing the address of the
instrunction carried out at the moment if you load anything onnto PC, that would
be a jump.. (in fact, what bra and thoose instructions really do, is to load the
address of the label specified, into PC)
what xxx(PC) does, is that it indicates a _relative_ address, relative to where
in the memory you are executing now.. (yes it is a bit advanced) 
You do this, to be able to have code that can be executed anywhere in memory..
you must remember that when the program is compiled, all the processor have to
go on is memorypositions.. if you putted a fixed position here, then if you
moved the program (and data in the program) to a new position, it wouldn't be
able to find the data again because you are still pointing to the sama area in
memory, where the data no longer is..  therefor you use this relative method.

it is like "the data you need is stored 234bytes away from this position"
instead of "the data is stored _here_."

//Olle


BLoWh0Le@aol.com wrote:
> 
> In a message dated 11/29/98 3:09:38 PM Pacific Standard Time,
> m_rayman@bigfoot.com writes:
> 
> << Can you explain the xxx(pc) thing to me again?  I didn't catch it the first
> time around. >>
> 
> I'm no expert, but from what I've gathered from looking at other people's
> code, the xxx(pc) loads the effective address of xxx into the Program Counter
> (PC).  Thus, when the appropriate ROM call is called, it looks to the PC for
> the address of xxx.


Follow-Ups: References: