1 STA SEGMENT STACK
2 DW 40H DUP(?)
3 TOP LABEL WORD
4 STA ENDS
5
6 DATA SEGMENT
7 STRING1 DB 60H,?,60H DUP(?)
8 STRING2 DB 60H,?,60H DUP(?)
9 CRLF DB 0DH,0AH,24H
10 STRING3 DB 'MATCH',24H
11 STRING4 DB 'NO MATCH',24H
12 DATA ENDS
13
14 CODE SEGMENT
15 ASSUME CS:CODE,DS:DATA,SS:STA,ES:DATA
16 MAIN PROC FAR
17 MOV AX,STA
18 MOV SS,AX
19 LEA SP,TOP
20 MOV AX,DATA
21 MOV DS,AX
22 MOV AX,DATA
23 MOV ES,AX
24 ;--------------------------------------------------------------------------------
25   MOV AH,0AH
26 LEA DX,STRING1
27 INT 21H
28
29 MOV AH,9
30 LEA DX,CRLF
31 INT 21H
32
33
34 MOV AH,0AH
35 LEA DX,STRING2
36 INT 21H
37
38 MOV AH,9
39 LEA DX,CRLF
40 INT 21H
41
42 ;-----------------------------------------------------------------利用A号功能实现缓冲区的输入功能
43  
44 LEA SI,STRING1
45 LEA DI,STRING2
46 MOV BX,[DI]
47
48 CMP [SI],BX
49 JNE L2
50 XOR CX,CX
51 MOV CX,[SI]
52 AND CX,0FFH
53
54
55 ADD SI,1
56 ADD DI,1
57 CLD
58 REPE CMPSB
59
60 ;---------------------------------------------------------------利用CMPSB比较字符串
61 CMP CX,0
62 JNE L2
63 LEA DX,STRING3
64 MOV AH,9
65 INT 21H
66 JMP L3
67
68 L2:LEA DX,STRING4
69 MOV AH,9
70 INT 21H
71 L3:
72 MOV AH,4CH
73 INT 21H
74 MAIN ENDP
75 CODE ENDS
76 END MAIN
77

 

posted on 2010-04-28 22:08  KuSiuloong  阅读(563)  评论(0编辑  收藏  举报