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

我的博客

个人首页 |  我的文章 |  我的相册 |  我的好友 |  最新访客 |  文章收藏 |  论坛提问 |  友情链接 |  给我留言  
图片载入中
  •  突然感觉,汇编语言很好玩。
  • 『姓名』:hls
  • 『性别』:男『发送消息
  • 个人说明:其实计算机没有我们想像的那么难,亦没有我们想象的那么简单。
  • 详细信息『加为好友』
学习动态
最新留言
好友圈
友情链接

[2009-05-22 20:02] 实验14

图片载入中
assume cs:codesg,ds:datasg

datasg segment
db 'yy/mm/dd hh:mm:ss','$'

datasg ends

codesg segment
start: mov ax,datasg
       mov ds,ax
       mov si,0
       
       ;处理年,月,日数据
       mov cx,3
       mov bl,9
       
   s:  mov al,bl
       out 70h,al
       in al,71h
       mov ah,al
       push cx
       mov cl,4
       shr ah,cl  ;十位数字
       and al,00001111b
       add ah,30h
       add al,30h
       mov [si],ah
       mov [si+1],al
       dec bl
       add si,3
       pop cx
       loop s
      
      
       ;处理时分秒数据
       mov cx,3
       mov bl,4
      s1:  mov al,bl
       out 70h,al
       in al,71h
       mov ah,al
       push cx
       mov cl,4
       shr ah,cl  ;十位数字
       and al,00001111b
       add ah,30h
       add al,30h
       mov [si],ah
       mov [si+1],al
       sub bl,2
       add si,3
       pop cx
       loop s1 
       
       ;调用dos中断显示时间数据
       mov dx,0
       mov ah,9
       int 21h
       ;程序退出
       mov ax,4c00h
       int 21h
codesg ends
end start
评论次数(1)  |  浏览次数(914)  |  类型(汇编作业) |  收藏此文  | 

[  tomato   发表于  2009-05-31 11:35  ]

正确。不过,还可以调整成为一个循环。

 
 请输入验证码  (提示:点击验证码输入框,以获取验证码