I’m trying to read two numbers from the keyboard and display a message if they are equal.
I think i’m not doing the right thing in order to display the messages. I get some compile erors (I wrote them as comments inline )
title Program1
data segment
mesajEgale db "equal$"
mesajInegale db "inequal$"
data ends
cod segment
assume cs:cod,ds:data
start :
read:
mov ah,01h
int 21h //read number
mov bl,al //move first number in bl
int 21h //read second nubmer
cmp al,bl //compare if the two numbers are equal
jnz unequal
equal:
mov ax,data
mov ds,ax
mov ds,mesajEgale // error here :Argument to operation or isntruction has illegal size
mov dx,offset mesajEgale
mov ah,09h
int 21h,4c00h
int 21h
//need to jump to end here
unequal:
mov ax,data
mov ds,ax
mov ds,mesajInegale
mov dx,offset mesajInegale
mov ah,09h
int 21h,4c00h
int 21h
cod ends
end start
Can you tell me what I’m doing wrong?
Thanks.
First of all, I’m assuming this is going to be running under DOS? Otherwise
int 21hisn’t going to work.Assuming DOS, I think the following should work (untested):