汇编网首页登录博客注册
masmaster的学习博客
博客首页博客互动【做检测题】论坛求助

我的博客

个人首页 |  我的文章 |  我的相册 |  我的好友 |  最新访客 |  文章收藏 |  论坛提问 |  友情链接 |  给我留言  
图片载入中
文章收藏

[2010-09-23 11:50] 习题5.33

图片载入中
写一个程序判断屏幕上是否显示字符串“AB”。在屏幕的最低行显示提示信息。

答:
;----------------------------------------------------;
assume        cs:code,ds:data,ss:stack
data        segment
_str        db        'A','B'
buff        db        0,0
msg1        db        'Found:$'
data        ends
stack        segment stack
        db 128 dup (0)
stack        ends
code        segment
start:
        mov ax,data
        mov ds,ax
        mov ah,2
        mov bh,0
        mov dx,0
        int 10h
        mov cx,25*80
s:        
        mov ah,8
        int 10h
        mov buff,al
        inc dl
        mov ah,2
        int 10h
        mov ah,8
        int 10h
        mov buff+1,al
        cmp dl,79
        ja newline
        mov ax,word ptr _str
        cmp ax,word ptr buff
        jz ok
        dec cx
        jcxz over
        jmp s
newline:
        inc dh
        mov dl,0
        mov ah,2
        int 10h
        dec cx
        jcxz over
        jmp s
ok:        
        push dx                ;colum=dh,row=dl
        mov ah,2
        mov dh,24
        mov dl,0
        int 10h
        mov dx,offset msg1
        mov ah,9
        int 21h
        pop ax
        xchg ah,al
        push ax
        and ax,0ffh
        call show
        mov dl,','
        mov ah,2
        int 21h

        pop ax
        mov cl,8
        rol ax,cl
        and ax,0ffh
        call show        
over:        
        mov ah,4ch
        int 21h
;
show        proc
        mov cx,10
        xor dx,dx
        div cx
        push dx
        mov dl,al
        add dl,30h
        mov ah,2
        int 21h
        pop dx
        add dx,30h
        mov ah,2
        int 21h
        ret
show        endp
;
code        ends
end        start
;----------------------------------------------------;
评论次数(0)  |  浏览次数(609)  |  类型(汇编习题集) |  收藏此文  | 
 
 请输入验证码  (提示:点击验证码输入框,以获取验证码