nineTENdo wrote:
1. When an index register has finshed its loop and goes on the next instruction, does the that index register ,pardon my french ," stay closed" when it branches back to continue the loop?
I'm not sure I understand your question, but hopefully this will help.
Code:
Init LDX #$FF ; initialize the index register to 255
Loop LDA $C000,X ; load some data values in Accum.
...
... manipulate the data
DEX ; dec index register
BNE Loop ; if index <> 0, then do the loop again.
... post loop code starts here
The value of x will remain unchanged during the execution of the loop as long as the "manipulate the data" code does not alter it. The DEX will decrement its value by one on each pass through the loop.
Quote:
2. Do you have to clear out the index register everytime you want to load a new value, how long will the value stay in the register?
No, you can just load the index with the new value. The old value will be discarded. the value will stay there indefinitely as long as you don't use opcodes that modify it.
Quote:
3. Up to how much data or routines can the accumulator contain at any given time?
The accumulator is a single 8 bit register. It can hold only one data byte at a time. IF you wish to hold many values at once, you can either use zero-page addressing mode variables, absolute addressing mode variables, or use the stack to push and pop values. The best choice depends on your specific application.
Daryl