|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
DATA SEGMENT
BUFFERA DB 32 DUP(?)
BUFFERB DB 32 DUP(?)
STRINGA DB 'input string A:',0AH,0DH,'$'
STRINGB DB 'input string B:',0AH,0DH,'$'
STRINGENTER DB 0AH,0DH,'$'
FOUNDSTRING DB 'FOUND',0AH,0DH,'$'
NOTFOUNDSTRING DB 'NOT FOUND',0AH,0DH,'$'
DATA ENDS
CODE SEGMENT
ASSUME CS:CODE,DS:DATA
START:
MOV DX,DATA
MOV DS,DX
;input string A
MOV DX,OFFSET STRINGA
MOV AH,09H
INT 21H
MOV DX,SEG BUFFERA
MOV DS,DX
MOV DX,OFFSET BUFFERA
MOV AH,0AH
INT 21H
;change line
MOV DX,OFFSET STRINGENTER
MOV AH,09H
INT 21H
;input string B
MOV DX,OFFSET STRINGB
MOV AH,09H
INT 21H
MOV DX,SEG BUFFERB
MOV ES,DX
MOV DX,OFFSET BUFFERB
MOV AH,0AH
INT 21H
;change line
MOV DX,OFFSET STRINGENTER
MOV AH,09H
INT 21H
;look for A in B
MOV SI,OFFSET BUFFERA
MOV DI,OFFSET BUFFERB
ADD SI,02H
ADD DI,01H
PUSH SI
PUSH DI
MOV BX,ES:[DI]
MOV BH,00H
MOV CX,DS:[SI-01H]
MOV CH,00H
PUSH CX
AGAIN:
POP CX
POP DI
INC DI
POP SI
PUSH SI
PUSH DI
PUSH CX
REPZ CMPSB
CMP CX,0
JZ FOUND
SUB BL,01H
JZ NOTFOUND
JMP AGAIN
FOUND: MOV DX,OFFSET FOUNDSTRING
MOV AH,09H
INT 21H
JMP ENDPRO ;if find,end the program
NOTFOUND: MOV DX,OFFSET NOTFOUNDSTRING
MOV AH,09H
INT 21H
ENDPRO: MOV AX,4C00H
INT 21H
CODE ENDS
END START
|
|