View Single Post
Old Oct 17th, 2007, 8:31 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Re: Help: Indexed addressing mode (MC68HC11A8)

You're making this more difficult than it is. Forget your specific microprocessor. Suppose you want to fetch some value from memory. You have to eventually wind up with the specific address of that value.

You might use a specific address. You might add some base address to some offset. Either or both of those may be located in registers or in memory.

You might fetch some address from memory and then use it directly, or modify it with some offset, or use it to fetch another address, and then modify it, or not.

Two plus two plus one equals five. Four plus one equals five. Five equals five. The number of operations may vary, but the answer is the same.

Some microprocessors will give you fewer options than others. Forget that. Follow the chain that yields the answer. Don't wish you had some way that your microprocessor won't support. Look at the architecture. Read the specifications. Live the code.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote