汇编语言改错。。。

2024-11-30 20:11:52
推荐回答(2个)
回答1:

已修改好,自己看错误处!!!

DATA SEGMENT
INFOR1 DB 0AH,0DH,"Are you really want to exit?:$"
INFOR2 DB 0AH,0DH,"Thank you for your using!$"
INFOR3 DB 0AH,0DH,"Let's continue!$"
INFOR4 DB 0AH,0DH,"You press an error key!$"
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX

MOV DX,OFFSET INFOR1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H

CMP AL,'Y'
; JE OTHER

JE YES
CMP AL,'N'
; JMP OTHER

JE NO
CMP AL,'y'
; JB OTHER

JE YES
CMP AL,'n'
; JB OTHER

JE NO

; JMP PEND
JMP OTHER

YES:
MOV DX,OFFSET INFOR2
MOV AH,09H
INT 21H
JMP PEND
NO:
MOV DX,OFFSET INFOR3
MOV AH,09H
INT 21H
JMP PEND
OTHER:
MOV DX,OFFSET INFOR4
MOV AH,09H
INT 21H
JMP PEND
PEND: MOV AH,4CH
INT 21H
CODE ENDS
END START

回答2:

不多说了,你直接用这个算了。

DATA SEGMENT
INFOR1 DB 0AH,0DH,"Are you really want to exit?:$"
INFOR2 DB 0AH,0DH,"Thank you for your using!$"
INFOR3 DB 0AH,0DH,"Let's continue!$"
INFOR4 DB 0AH,0DH,"You press an error key!$"
DATA ENDS

CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START: MOV AX,DATA
MOV DS,AX

MOV DX,OFFSET INFOR1
MOV AH,09H
INT 21H
MOV AH,01H
INT 21H

CMP AL,'A' ;大写字母转小写
JB COMPARE
CMP AL,'Z'
JA COMPARE
OR AL,20H
COMPARE:
CMP AL,'y'
JE YES
CMP AL,'n'
JE NO

OTHER:
MOV DX,OFFSET INFOR4
MOV AH,09H
INT 21H
JMP PEND

YES:
MOV DX,OFFSET INFOR2
MOV AH,09H
INT 21H
JMP PEND
NO:
MOV DX,OFFSET INFOR3
MOV AH,09H
INT 21H
JMP PEND

PEND: MOV AH,4CH
INT 21H
CODE ENDS
END START