汇编语言实验14访问CMOS RAM

编程,以“年/月旧时:分:秒”的格式,显示当前的日期、时间。 注意:CMOS RAM中存储着系统的配置信息,除了保存时间信息的单元外,不要向其他的单元中写入内容,否则将引起一些系统错误。

assume cs:code
    code segment
s1:    db 9,8,7,4,2,0
s2:    db 'yy/mm/dd hh:mm:ss','$'
start:    mov ax,cs
    mov ds,ax
    mov si,offset s1
    mov di,offset s2
    mov cx,6
s:    push cx
    mov al,ds:[si]
    out 70h,al
    in al,71h

    mov ah,al
    mov cl,4
    shr ah,cl
    and al,00001111b

    add ah,30h
    add al,30h

    mov ds:[di],ah
    mov ds:[di+1],al

    inc si
    add di,3
    pop cx
    loop s

    mov ah,2
    mov bh,0
    mov dh,5
    mov dl,12
    int 10h

    mov dx,offset s2
    mov ah,9
    int 21h

    mov ax,4c00h
    int 21h
    code ends
    end start

发布日期:

所属分类: 编程 标签: