.MODEL small
.STACK 100h
.DATA
A dw 0
B dw 0
C Dw 0
.CODE
MAIN PROC
mov AX,@DATA
mov DS,AX
PROMPT:
mov AH,1
int 21h
mov A,Ax
mov AH,2
mov DL,20H
int 21H
mov AH,1
int 21h
mov B,Ax
mov AH,2
mov DL,20H
int 21H
mov Ax,A
;sub AL,'0'
mov Bx,B
;sub BL,'0'
cmp Ax,Bx
JE EXIT
JA GCD
JB EXCG
GCD:
MOV AH,0D
DIV AL
CMP AH,0D
JE EXIT
MOV Bx,Ax
MOV bL,AL
JMP GCD
EXCG:
MOV AH,0D
XCHG Ax,Bx
JMP GCD
EXIT:
MOV Dx,Ax
MOV AH,2
;MOV DL,AL
INT 21H
MOV AH,4CH
INT 21H
MAIN ENDP
END MAIN
I expect the output would be the greatest common divisor of the two numbers. but my code shows some ASCII value of unexpected characters.