I am attempting to test if the random value generated in eax is the same as any value in an array I have allocated. The outer loop generates the array and writes it to the screen and in to the array, The inner loop is then supposed to test if the value exists in the array. I know i am not doing the inner loop correctly but I am not sure how to fix it.
It assembles just fine but when I try to run I only get a blank cmd window screen. Also I am using Irvine32 libraries. My code is below:
EDIT: I appreciate your guys help so far but now I Have two problems. The first is that when I try to evaluate the number in eax for uniqueness against my array I actually get an access violation error. My code for generating the array and testing it is below:
RandomArray PROC uses EAX
call Randomize
mov esi, OFFSET arr
mov edi, OFFSET arr
mov ebx, TYPE arr
mov ecx, 15
L1:
mov eax, [79 - 19]
push eax
call RandomRange
add eax, 19
search1:
mov edx,[esi]
cmp eax,edx ; compares the values in the array and the random int
je L1 ; jumps if the values are equal
add esi,4 ; moves to next byte to check again
loop search1 ; repeats loop
mov [esi],eax
pop eax
add esi, ebx
loop L1
ret
RandomArray ENDP
pop ecx
loop OUTER_LOOP
jmp FINISHED
SWAP:
mov bl, [esi]
mov dl, [esi+1]
xchg bl,dl
mov [esi],dl
mov [esi+1],bl
jmp CONTINUE
FINISHED:
ret
Thanks for your help in advance.