0

I have an array of strings. I want to find an element of array How do I do that? Here is what I tried, it should print out anything but its still does.

.model small
.stack
.data
goldenboard db      "1$","2$","3$","4$","5$","6$","7$","8$","9$","A$","B$","C$","D$","E$","F$","_$"
var db "1$"
.code
mov al,[goldenboard]
mov bl,[var]
cmp al,bl	
je quit	
 
mov cx,0
ny: mov dx,OFFSET goldenboard
add dx,cx
mov ax,SEG goldenboard	
       cmp dl,"-"
       je quit
       mov ds, ax
       mov ah,09h             
       int 21h
       inc cx
       cmp cx,32
       je quit
       jne ny
quit:	mov ax,4C02h            ;end program with an errorlevel =2 
       int 21h 
end
2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by jt_murphree
0

I am not sure exactly what you are trying to do with the last section of code but if you want to search for a string you need to use the esi register. You have an array of bytes, in other word a string. If you use lea to load the address of goldenboard into the esi register you can then increment esi to look at elements of the string. As you move through the string you can move each element out to al to do a comparison for the element you are looking for. At least that is the way I am used to doing it. Hope this helps

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.