السلام عليكم ورحمة الله وبكاته
عندي استفسار انا حليت هذا السؤال بس طلع لي خطأيين ماني عارفه ايش فياليت تساعدوووني
السؤال :
Write an assembly language program that prompts the user for two input strings and computes the Hamming distance between the two strings. The Hamming distance is the number of bit positions where the two strings differ.
الكوود :
.MODEL SMALL
.STACK 100H
.DATA
MSGE1 DB 'Enter the two strings: $'
MSGE2 DB 0DH,0AH,'The Hamming distance between the following two strings is : $'
MSG DB 255 DUP('$')
MSG2 DB 255 DUP('$')
A DW ?
HMNG DB ?
.CODE
MAIN PROC
MOV AX, @DATA
MOV DS, AX
MOV AH, 9
LEA DX, MSGE1
INT 21H
MOV AH,2
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H
MOV CX,0
XOR BX,BX
MOV AH,1
INT 21H
WHILE_:
CMP AL,0DH
JE EXIT
MOV MSG[BX],AL
INT 21H
INC BX
LOOP WHILE_
EXIT:
MOV AH,2
MOV DL,0DH
INT 21H
MOV DL,0AH
INT 21H
XOR SI,SI
MOV AH,1
INT 21H
WHILE2_:
CMP AL,0DH
JE EXIT2
MOV MSG2[SI],AL
INT 21H
INC SI
JMP WHILE2_
EXIT2:
XOR DX,DX
XOR BX,BX
XOR SI,SI
XOR CX,CX
LOOP_:
CMP BX,0
JE END_
CMP SI,0
JE END_
MOV DX,MSG[BX]
MOV AX,MSG2[SI]
XOR AX,DX
JMP ONE
TOW:
INC BX
INC SI
JMP LOOP_
MOV CX,16
ONE:
SHL AX,1
JNC ONE
INC HMNG
LOOP ONE
JMP TOW
END_:
MOV AH, 9
LEA DX, MSGE1
INT 21H
MOV AL,HMNG
MOV AH,2
INT 21H
MOV AH, 4CH
INT 21H
MAIN ENDP
END MAIN
الأخطاء :
MAH.ASM(59): error A2070 invalid instruction operands
MAH.ASM (60) : error A2070: invalid instruction operands