调用dos中断显示以$符结束的字符串

assume cs:codesg


;    秒: 0  分:2 时: 4 日 : 7 月:8 年:9
codesg segment
    str1:    db '20yy/mm/dd hh:mm:ss','$'
    row:    db 9,8,7,4,2,0
    start:
        mov ax, cs
        mov ds, ax
        mov di, offset str1 + 2
        mov si, offset row
        mov cx, 5

    s:    mov al, [si]
        out 70h, al
        in  al, 71h
        call do_addstr
        add di, 3
        inc si
        loop s
        
    ;    调用dos中断
        mov ah, 2
        mov bh, 0
        mov dh, 12
        mov dl, 12
        int 10h
        
        mov dx, 0
        mov ah, 9
        int 21h

        mov ax, 4c00h
        int 21h
    ;    参数al, 将al中bcd放到ds:si指定处
do_addstr:
    push di
    push ax
        mov ah, al
        mov cl, 4
        shr ah, cl
        add ah, 30h
        and al, 00001111b
        add al, 30h
        mov [di], ah
        mov [di + 1], al
    pop ax
    pop di
    ret

codesg ends
end start

posted on 2014-05-10 22:24  Notflybird  阅读(113)  评论(0)    收藏  举报