汇编----串指令的使用

data segment
chgline db 0dh,0ah,24h
str1 db 500 dup(?)
str2 db 500 dup(?)
strY db 'Match',0dh,0ah,24h
strN db 'Not Match',0dh,0ah,24h
data ends

code segment
    assume cs:code,ds:data,es:data
main proc far
    mov ax,data
    mov ds,ax
    mov es,ax

    lea si,str1
    lea di,str2

    xor cx,cx

L1: mov ah,01h
    int 21h
    cmp al,0dh
    je L2
    inc cx
    mov [si],al
    inc si
    jmp L1

L2: lea dx,chgline
    mov ah,09h
    int 21h
    mov bx,cx
    xor cx,cx

L3: mov ah,01h
    int 21h
    cmp al,0dh
    je L4
    inc cx
    mov [di],al
    inc di
    jmp L3

L4: lea dx,chgline
    mov ah,09h
    int 21h
    mov bp,cx
    cmp bx,bp
    jne L5

    dec bp
    sub si,bp
    sub di,bp
    cld
    mov cx,bx
    repe cmpsb
    cmp cx,0
    je L6


L5: lea dx,strN
    mov ah,09h
    int 21h
    jmp L7

L6: lea dx,strY
    mov ah,09h
    int 21h
 
L7: mov ah,4ch
    int 21h
main endp
code ends
end main

   

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值