I am trying to fill an array with 10 numbers, 1 through 10. In the loopArray below, i load a 32 bit DWORD size array with the 32 bit register ebx, which is incremented by 1 each iteration. In PrintLoop2 i am loading ecx with each element of the array so that i can see these values in visual studio, and confirm that my array is filled with the values 1-10. My problem is that ecx is showing huge values like "04030201" on the first loop and "05040302" on the second, ect. What am i doing wrong?
.586
.MODEL FLAT
.STACK 4096
n=10
.data
prime DWORD n DUP(?)
.code
main PROC
mov ebx, 1
loopArray:
mov prime[ebx], ebx
cmp ebx, n
inc ebx
jb loopArray
mov ebx, 1
mov ecx, 0
PrintLoop2:
mov ecx, prime[ebx]
cmp ebx, n
inc ebx
jb PrintLoop2