foo: LDX #2 ;load the desired index LDA array,x ;load the second (zero-indexed) entry in array, i.e. 9 RTS ;return. The return value is stored in A. array: ;this is the array we're reading from. db 3,6,9,12,15