我们的舞台简谱:急急急!!!请教一下汇编高手
来源:百度文库 编辑:高考问答 时间:2024/05/05 17:57:46
为什么老是输出"no match",我想知道哪里错了
(以前把str1,str2与m1,m2一起放es,结果打印"asdfg')
str SEGMENT
str1 DB 'asdfg'
s1 LABEL BYTE
str2 DB 'asdfg'
s2 LABEL BYTE
str ENDS
data SEGMENT
m1 label byte
DB 'no match',10,13,'$'
m2 label byte
DB 'match',10,13,'$'
data ENDS
code SEGMENT
ASSUME CS:code,DS:data,ES:str
start: MOV AX,str
MOV ES,AX
MOV AX,data
MOV DS,AX
LEA SI,ES:str1
SUB SI,ES:s1
LEA DI,ES:str2
SUB DI,ES:s2
CMP SI,DI ;比较str1,str2长度
JNE no_match
LEA SI,ES:str1
LEA DI,ES:str2
CLD
REPE cmpsb
CMP SI,ES:s1
JNb match
no_match: LEA DX,m1
MOV AH,09h
INT 21h
jmp out1
match: LEA DX,m2
MOV AH,09h
INT 21h
;
out1: MOV AH,4ch
INT 21h
code ENDS
END start
(以前把str1,str2与m1,m2一起放es,结果打印"asdfg')
str SEGMENT
str1 DB 'asdfg'
s1 LABEL BYTE
str2 DB 'asdfg'
s2 LABEL BYTE
str ENDS
data SEGMENT
m1 label byte
DB 'no match',10,13,'$'
m2 label byte
DB 'match',10,13,'$'
data ENDS
code SEGMENT
ASSUME CS:code,DS:data,ES:str
start: MOV AX,str
MOV ES,AX
MOV AX,data
MOV DS,AX
LEA SI,ES:str1
SUB SI,ES:s1
LEA DI,ES:str2
SUB DI,ES:s2
CMP SI,DI ;比较str1,str2长度
JNE no_match
LEA SI,ES:str1
LEA DI,ES:str2
CLD
REPE cmpsb
CMP SI,ES:s1
JNb match
no_match: LEA DX,m1
MOV AH,09h
INT 21h
jmp out1
match: LEA DX,m2
MOV AH,09h
INT 21h
;
out1: MOV AH,4ch
INT 21h
code ENDS
END start
21号中断的09号功能中dx所赋的值必须在数据段