Indexed addressing: addressing mode for accessing pieces of structured data representations like arrays, and for linked lists and pointers. Here's how it works: For indexed address I, X: The effective address is I + (X) The operand is (I + (X)) Example: LDAA 2,X means A <-- (2 + (X)) Don't worry, you'll get lots of practice using it Example program. 0001 0000 VARS EQU $00 0002 f800 INSTS EQU $F800 0003 fffe RESET EQU $FFFE 0004 0000 ORG VARS 0005 0000 03 04 ARRAY fdb $0304 0006 0002 10 10 fdb $1010 0007 0004 00 11 fdb $0011 0008 0006 01 0a fdb $010A 0009 0008 SUM1 rmb 1 0010 0009 SUM2 rmb 2 0011 0012 f800 ORG INSTS 0013 f800 ce 00 00 START LDX #ARRAY 0014 0015 * Calculate the sum of array elements, 0016 * treating each element as 1 byte 0017 0018 f803 a6 00 LDAA 0,X 0019 f805 ab 01 ADDA 1,X 0020 f807 ab 02 ADDA 2,X 0021 f809 ab 03 ADDA 3,X 0022 f80b ab 04 ADDA 4,X 0023 f80d ab 05 ADDA 5,X 0024 f80f ab 06 ADDA 6,X 0025 f811 ab 07 ADDA 7,X 0026 f813 97 08 STAA SUM1 0027 0028 * Now calculate the sum, 0029 * treating each element as 2 bytes 0030 0031 f815 ec 00 LDD 0,X 0032 f817 e3 02 ADDD 2,X 0033 f819 e3 04 ADDD 4,X 0034 f81b e3 06 ADDD 6,X 0035 f81d dd 09 STD SUM2 0036 f81f 7e f8 1f END JMP END 0037 fffe ORG RESET 0038 fffe f8 00 fdb START 0039 0040 Lecture: go over assembly and execution of the program Cycle-by-cycle instruction execution? START LDX #ARRAY 1. fetch opcode 2. fetch jj 3. fetch kk LDAA 0,X 1. fetch opcode 2. fetch the offset -- ff 3. calculate the effective address: (X) + ff; no memory transfer 4. read the operand, i.e., read ((X) + ff) ADDA 4,X 1. fetch opcode 2. fetch the offset -- ff 3. calculate the effective address: (X) + ff; no memory transfer 4. read the operand, i.e., read ((X) + ff) calculate (A) + operand (according to the manual, the final addition does not take a separate cycle) LDD 0,X 1. fetch opcode 2. fetch the offset -- ff 3. calculate the effective address: (X) + ff; no memory transfer 4. read high byte of operand, i.e., read ((X) + ff) 5. read low byte of operand, i.e., read ((X) + ff +1) ADDD 2,X 1. fetch opcode 2. fetch the offset -- ff 3. calculate the effective address: (X) + ff; no memory transfer 4. read high byte of operand, i.e., read ((X) + ff) 5. read low byte of operand, i.e., read ((X) + ff +1) 6. Perform the addition