[求助]我都看晕了,也没找出错误!
DATA SEGMENTX DB ?
Y DB ?
S DB ?,?
mess1 db "Input x=(0 quit)","$"
mess3 db 'Input y=','$'
mess2 db 'x+y=$'
DATA ENDS
stack segment para stack 'stack'
dw 100 dup(?)
stack ends
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ss:stack
START: MOV AX,DATA
MOV DS,AX
l1: lea dx,mess1
mov ah,9
int 21h
MOV AH,1
INT 21H
cmp al,'0'
jl exit
cmp al,'9'
ja exit
cmp al,'0'
je l2
MOV X,AL
call cr_lf
lea dx,mess3
l4: mov ah,9
int 21h
MOV AH,1
INT 21H
cmp al,'0'
jl l3
cmp al,'9'
ja l3
MOV Y,AL
MOV AL,X
AND AL,0FH
MOV BL,Y
AND BL,0FH
ADD AL,BL
cbw
mov bl,10
div bl
or al,30h
mov s,al
or ah,30h
mov [s+1],ah
call cr_lf
mov dx,offset mess2
mov ah,9
int 21h
MOV AH,2
MOV DL,s
INT 21H
mov ah,2
mov dl,[s+1]
int 21h
call cr_lf
jmp l1
exit : mov ah,61h
int 21h
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
jmp l1
l3: mov ah,61h
int 21h
mov dl,0ah
mov ah,2
int 21h
mov dl,0dh
mov ah,2
int 21h
jmp l4
l2: MOV AH,4CH
INT 21H
cr_lf proc
push ax
push dx
mov ah,2
mov dl,0ah
int 21h
mov ah,2
mov dl,0dh
int 21h
pop dx
pop ax
ret
cr_lf endp
CODE ENDS
END START