I have an error saying that "Exception thrown at 0x00D71026 in Lab13.exe: 0xC0000005: Access violation reading location 0x01AE8000" on "mov bl,array[si]" in right below of "x1:". I can build it successfully but it shows such error when I debbug it. Please help me why this makes error and how I can fix it.
Here is my code:
.data
array db 10h,20h,30h,40h,50h,'$'
sample db 50h
msg1 db " Element Found:$"
msg2 db " Element Not Found:$"
printmsg macro msg
mov ah, 09h
lea dx, msg
int 21h
int 3
endm
.code
search proc
mov ax, ds
mov ds, ax
mov al, sample
lea si, array
mov cx, 04H
x1:
mov bl,array[si]
cmp al,bl
jz x2
inc si
dec cx
jnz x1
printmsg msg2
jmp ex
x2:
printmsg msg1
ex:
int 3
search ENDP
END search
User contributions licensed under CC BY-SA 3.0