|
发表于 2012-11-24 21:24:33
|
显示全部楼层
- assume cs:code
- code segment
- ;初始化
- start:
- mov ax,0b800h
- mov es,ax
- mov di,160*12+24*2
- mov dh,9 ;年
- mov cx,3
- ;读年月日
- ymd:
- push cx
- mov al,dh
- out 70h,al
- in al,71h
-
- year: mov ah,al
- and al,00001111b
- add al,30h
- mov cl,4
- shr ah,cl
- add ah,30h
-
- mov es:[di],ah
- inc di
- mov byte ptr es:[di],4
- inc di
- mov es:[di],al
- inc di
- mov byte ptr es:[di],4
- inc di
-
- add di,4
- mov bp,sp
- cmp byte ptr ss:[bp],1
- je y_end
- mov byte ptr es:[di],'/'
- inc di
- mov byte ptr es:[di],2
- inc di
- add di,4
-
- dec dh
- y_end: pop cx
- loop ymd
-
- ;以下读时间
- mov dh,4
- mov cx,3
- fm:
- push cx
- mov al,dh
- out 70h,al
- in al,71h
-
- mov ah,al
- and al,00001111b
- add al,30h
- mov cl,4
- shr ah,cl
- add ah,30h
-
- mov es:[di],ah
- inc di
- mov byte ptr es:[di],6
- inc di
- mov es:[di],al
- inc di
- mov byte ptr es:[di],6
- inc di
-
- add di,4
- mov bp,sp
- cmp byte ptr ss:[bp],1
- je fm_end
- mov byte ptr es:[di],':'
- inc di
- mov byte ptr es:[di],2
- inc di
- add di,4
-
- sub dh,2
- fm_end: pop cx
- loop fm
-
-
- mov ah,01
- int 21h
-
- ;做一个循环,显示年月日
-
- code ends
- end start
复制代码 嘻嘻 |
|