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

我的博客

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

[2015-11-01 13:18] 实验14 访问CMOS RAM

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


assume cs:code
code segment
begin:mov bx,9
      mov si,7c0h   ;屏幕中间,年开头,60×12+32×2
                    ;=1984=7c0h
      mov cx,6
      push cx

    s:push cx
      mov al,bl
      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 dx,0b800h
      mov ds,dx
      mov [si],ah
      mov [si+2],al
      jmp s1
   s0:add si,6
      pop cx
      loop s
      
      mov ax,4c00h
      int 21h
     
   s1:cmp bx,7
      ja s2
      je s3
      jb s4
      
   s2:dec bx
      mov byte ptr [si+4],'/'
      jmp short s0
 
   s3:sub bx,3
      jmp short s0

   s4:cmp bx,0
      je s5
      sub bx,2
      mov byte ptr [si+4],':'
      jmp short s0
   
   s5:jmp short s0

code ends
end begin

实验结果如图:
评论次数(0)  |  浏览次数(624)  |  类型(实验) |  收藏此文  | 
 
 请输入验证码  (提示:点击验证码输入框,以获取验证码