I'm new to assembly trying to compare two 5 byte long strings together from user input. For example, the user types EEEEE then enter then ABCDE then the program compares the 2 strings together. I'm looping it until it finds a wrong character or loops 5 times. The problem I have is that it will not point to the next character after the first character. For example, If you input AAAAA and ABCDE then the program will output that its identical to each other, but if you input AAAAA and BBCDE it will out not identical to each other. How do I get to point to the next letters in the string to compare them?
section .data
output1: db 'IDENTICAL',10
outputLen1: equ $-output1
output2: db 'NOT INDENTICAL',10
outputLen2: equ $-output2
newline: db 10
section .bss
string1 resb 5 ;hold first string
string2 resb 5 ;hold 2nd string
filler resb 5 ; take space
counter resb 1 ;countdown from 5
section .text
global _start
_start:
;read first input
mov eax,3
mov ebx,0
mov ecx,string1
mov edx,5
int 80h
;take space
mov eax,3
mov ebx,0
mov ecx,filler
mov edx,2
int 80h
;read second input
mov eax,3
mov ebx,0
mov ecx,string2
mov edx,5
int 80h
;move address
mov eax, string1
mov ebx, string2
;amount of times to loop
mov [counter], byte '5'
;Loop 5 times without being unidentical = true
;if al and bl equals each other keep looping
loop:
mov al, [eax] ; load a character from string1
mov bl, [ebx] ; load charcter from string2
cmp al, bl
jne false ; if not eqaul, cout << "Not identical"
inc eax ;move to next letter in string
inc ebx ;move to next letter in string
;count down from 5
DEC byte [counter]
cmp [counter] , byte '0' ;count down to zero
jz true; if both strings match
jmp loop
false:
;display message
mov eax,4
mov ebx,1
mov ecx,output2
mov edx,outputLen2
int 80h
jmp end
true:
;display message
mov eax,4
mov ebx,1
mov ecx,output1
mov edx,outputLen1
int 80h
jmp end
end:
;end program
mov eax,1
mov ebx,0
int 80h;