不信你试试,呵呵........可能在DOS里不可以吧
谁叫我是菜鸟呢,呵呵所以乱写的.
DATA SEGMENT
S1 DB 'Please input string1: $'
S2 DB 'Please input string2: $'
S3 DB 'MATCH$'
S4 DB 'NO MATCH$'
S5 DB 10,0,10 DUP(0)
S6 DB 10,0,10 DUP(0)
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA,ES:DATA
START: MOV AX,DATA ;put data to DS
MOV DS,AX
LEA DX,S1 ;show message1
MOV AH,09H
INT 21H
LEA DX,S5 ;input string1
MOV AH,0AH
INT 21H
CALL CLRF
LEA DX,S2 ;show message2
MOV AH,09H
INT 21H
LEA DX,S6 ;input string2
MOV AH,0AH
INT 21H
CALL CLRF
MOV SI,2
OK: MOV DI,OFFSET S6+2
MOV AL,S5[SI]
MOV CL,S6[1]
MOV CH,0
CLD
LP: SCASB
JZ MATCH
DEC CX
JNZ LP
MOV CL,S5[1] ;characters of s5
CMP CX,SI ;the end of s5?
INC SI
JNB OK
LEA DX,S4 ;show no match
MOV AH,09H
INT 21H
JMP FINISH ;go to finish
CLRF PROC NEAR
MOV DL,0DH ;cr
MOV AH,02H
INT 21H
MOV DL,0AH ;next line
MOV AH,02H
INT 21H
RET
CLRF ENDP
MATCH: LEA DX,S3 ;show info of match
MOV AH,09H
INT 21H
FINISH: MOV AH,4CH ;return to Dos
INT 21H
CODE ENDS
END START
啊,总算可以了呀.现在要多谢谢爱以走远.
我要好好学习!