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

Recommended Answers

All 2 Replies

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.

Also, which compiler are you using? There are many flavors of assembly language...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.