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

我的博客

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

[2011-10-14 10:29] 实验十一

图片载入中
assume cs:codesg, ds:datasg
datasg segment
    db "Beginner's All-purpose Symbolic Instruction Code.",0
datasg ends

codesg segment
start:
        mov ax, datasg
        mov ds, ax
        mov ax, 0B800h
        mov es, ax
        
        mov si,0
        mov dh, 4
        mov dl, 0
        mov ch, 0
        mov cl, 00000100B
        call show_str
        call letterc
        
        mov si,0
        mov dh, 5
        mov dl, 0
        mov ch, 0
        mov cl, 00000100B
        call show_str
        
        mov ax,4c00h
        int 21h
letterc:
        push si
        push cx
        dec si
     @@:inc si
        mov cl, ds:[si]
        mov ch,0
        jcxz @F
        cmp cl,'a'
        jb @B
        cmp cl,'z'
        ja @B
        and cl, 11011111B
        mov ds:[si],cl
        jmp @B
     @@:pop cx
        pop si
        ret

;;function : show a string with 0 ended at certain position and color
;;dh--line no.    dl--column no.
;;cl--color       ds:si--the beginning of the string
;;return none
show_str:
        push bx
        push di 
        push ax
        push si
        push cx  
        
        
        ;;calculate the first address of the string in video memory
        mov al, dh
        mov bl, 160
        mul bl
        mov bx, ax        
        mov ah, 0
        mov al, dl
        add bx, ax
        add bx, ax
        
@@: 
        mov cl, ds:[si]
        mov ch, 0
        jcxz @F        

        mov es:[bx], cl
        pop cx
        mov es:[bx+1], cl
        push cx
        inc si
        inc bx
        inc bx
        jmp @B
                
    @@: pop cx
        pop si
        pop ax
        pop di
        pop bx
        ret


codesg ends
end start
评论次数(0)  |  浏览次数(312)  |  类型(汇编作业) |  收藏此文  | 
 
 请输入验证码  (提示:点击验证码输入框,以获取验证码