assume cs:code
code segment
start:
mov bx,0b800h
mov es,bx
mov di,160*11+30
;年
mov al,9
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 byte ptr es:[di],ah
mov byte ptr es:[di+1],2
mov byte ptr es:[di+2],al
mov byte ptr es:[di+3],2
;月工资
mov al,8
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 byte ptr es:[di+4],ah
mov byte ptr es:[di+5],2
mov byte ptr es:[di+6],al
mov byte ptr es:[di+7],2
;日
mov al,7
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 byte ptr es:[di+8],ah
mov byte ptr es:[di+9],2
mov byte ptr es:[di+10],al
mov byte ptr es:[di+11],2
;时
mov al,4
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 byte ptr es:[di+12],ah
mov byte ptr es:[di+13],2
mov byte ptr es:[di+14],al
mov byte ptr es:[di+15],2
;分
mov al,2
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 byte ptr es:[di+16],ah
mov byte ptr es:[di+17],2
mov byte ptr es:[di+18],al
mov byte ptr es:[di+19],2
;秒
mov al,0
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 byte ptr es:[di+20],ah
mov byte ptr es:[di+21],2
mov byte ptr es:[di+22],al
mov byte ptr es:[di+23],2
mov ah,4ch
int 21h
code ends
end start
- [游客] 好! 07/18 08:52
- [xiaomk7758] 顶 07/17 12:52
- [black] en 要是存储的是绝对地址呢? 想过没 05/11 13:51
- [游客] ESC 05/08 13:44
- [black] 恩,挺好,继续学习 05/08 09:10
- [black] 不错 05/07 19:01
- [ppt] 在实现功能的前提下精简一下程序. 04/28 20:49
- [240420643] 看看我的,用到了循环和jcxz http://www.asmedu.net/blog/user/p 04/27 18:22
- [starrynight] 结果怎么保证正确,有进位怎么办 ---------------------------- 如果 04/26 23:27
- [yigeling] 写的不错 04/26 23:26
[ yigeling 发表于 2008-04-26 23:18 ]
mov al,9
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 byte ptr es:[di],ah
mov byte ptr es:[di+1],2
mov byte ptr es:[di+2],al
mov byte ptr es:[di+3],2
这段代码被重复用了6遍,可以仔细看看,有没有更好的办法使程序变得简洁,例如考虑循环,重复性的,有规律的事情都可以考虑用循环解决。
[ 240420643 发表于 2008-04-27 18:22 ]
看看我的,用到了循环和jcxz
http://www.asmedu.net/blog/user/postcontent.jsp?neighborId=8747&kindId=10299&postId=16324&readSg=1&vs=1
[ ppt 发表于 2008-04-28 20:49 ]
在实现功能的前提下精简一下程序.