0

How coul I compare 2 strings, one that is given by a use and the other one from data segment in memor, in assembler?
for exemple:

assume cs:code,ds:data

data segment
 parola db 'mananca$'
 introdu db 20,?, 20 dup (?)
 gresit db 'Mai incearca$'
 corect db 'Ai ghicit$'
 linieNoua db 10,13,'$'

data ends

code segment
 start:
 mov ax,data
 mov ds,ax
 mov ah,09h
 mov dx, offset parola
 int 21h
 repeta:
   mov ah,0Ah
   int 21h 
   mov al,parola
   cmp al,introdu ; here is sth wrong
   jne next
   mov ah,09h
   mov dx,offset linieNoua
   int 21h
   mov ah,09h
   mov dx,offset corect
   int 21h
   mov ax,4c00h
   int 21h
   next:
   mov ah,09h
   mov dx,offset linieNoua
   int 21h
   mov ah,09h
   mov dx,offset gresit
   int 21h
   mov ah,09h
   mov dx,offset linieNoua
   int 21h
   jmp repeta
code ends
end start
3
Contributors
2
Replies
13
Views
9 Months
Discussion Span
Last Post by Taywin
0

First, comment each line with what you are intending it to do. Next, I havent been doing serious x86 assembler programming in 20 years so I need your comments in order to understand your intentions.

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.