标签:col end change hang art segment class loop 相同
DATAS SEGMENT STR1 DB ‘ABCD$‘ STR2 DB ‘ABCD$‘ len equ $-str2 ;len DW str2-str1 match DB ‘EQU:‘,0DH,0AH,‘$‘ nomatch DB ‘NOEQU:‘, 0DH, 0AH, ‘$‘ change DB 0DH, 0AH, ‘$‘ E DB ‘0$‘ NTE DB ‘0$‘ DATAS ENDS STACKS SEGMENT ;此处输入堆栈段代码 STACKS ENDS CODES SEGMENT ASSUME CS:CODES,DS:DATAS,SS:STACKS START: MOV AX,DATAS MOV DS,AX mov si, 0 mov cx, len dec cx loop1: mov al, STR1[si] mov ah, STR2[si] cmp al, ah jne l1 inc E jmp l2 l1: inc NTE l2: inc si loop loop1 LEA dx,STR1;显示STR1和STR2两个字符串 MOV ah,09h INT 21H LEA dx,change MOV ah,09h INT 21H LEA dx,STR2 MOV ah,09h INT 21H LEA dx,change MOV ah,09h INT 21H LEA dx,match MOV ah,09h INT 21H lea dx, E mov ah, 09h int 21h LEA dx,change MOV ah,09h INT 21H LEA dx,nomatch MOV ah,09h INT 21H lea dx, NTE mov ah, 09h int 21h MOV AH,4CH INT 21H CODES ENDS END START
$代表的是当前的地址,所以当前地址减去str2的地址,就是str2的长度,同理len equ $-str1也是一样的。
标签:col end change hang art segment class loop 相同
原文地址:https://www.cnblogs.com/1-0001/p/12901897.html