screenshot of textbook (The code is an example of adding a list of numbers together and storing the answer using a loop)
100 LDM #0 ; Load 0 into ACC
101 STO total
102 STO counter
103 LDR #0 ; Load 0 into IX
104 loop:
105 LDX number ; Load the number indexed by IX into ACC
106 ADD total
107 STO total
108 INC IX
109 LDD counter
110 INC ACC
111 STO counter
112 CMP #3
113 JPN loop
114 END
115 number: #5
116 #7
117 #3
118 counter:
119 total:
If zero is stored in the index register instead of the address at which "number" is defined, I don't see how the intended number would be loaded into the accumulator.
If line 105, "LDX number" is loading the address into IX, the comment next to it "Load the number indexed by IX into ACC" confuses me. Is it loading the address to IX, and the number at this address into ACC at the same time?