王爽.汇编.第三版.实验14.答案

来源:互联网 发布:珠海网络电视台 编辑:程序博客网 时间:2024/04/30 14:11
; 显示cmos timeassume  cs:codedata segment    db 9,8,7,4,2,0  ; 端口中时间的字节偏移    db '// :: ' ; 间隔符data endscode segmentstart:;此处是为了一直显示时间,此程序是不能退出的!!!   alwaysshow:     ; 写入的位置    mov ax, 0b800h    mov es, ax    mov di, 12    ; cmos偏移    mov ax, data    mov ds, ax    mov si, 0    mov cx, 6looptime:    push cx    ;偏移    mov al, byte ptr ds:[si]    out 70h, al    in al, 71h    ;十位的计算    mov bh, al    and bh, 11110000b    mov cl, 4    shr bh, cl    add bh, 30h    mov byte ptr es:[di], bh    mov byte ptr es:[di+1], 00000010b    ;个位的计算    mov bl, al    and bl, 00001111b    add bl, 30h    mov byte ptr es:[di+2], bl    mov byte ptr es:[di+3], 00000010b    ;显示分隔符    mov al, byte ptr ds:[si+6]    mov byte ptr es:[di+4], al    mov byte ptr es:[di+5], 00000010b    add di, 6    inc si    pop cx    loop looptime    ; 一直显示时间    jmp short alwaysshow    mov ax, 4c00h    int 21hcode endsend start
原创粉丝点击