Marty Billingsley wrote
Having trouble implementing arrays/pointers in assembly language. Seems like I had this figured out at one point a couple of years ago, but am stumped now.
Example: x[i] = 23
You need to arrive at the point where 23 is in the D register, and value x + what is in memory location i is in the A register.
Is there a way to do this without using a temporary variable? (I end up with x+M[i] in D and 23 in A, and need to swap them.)
The only way to get the constant into D is
@constant; D=A, so you must have the computed target address in memory so that you can load it into A. R13-R15 are reserved as temporary variables for this purpose.
--Mark