现在的位置: 首页 > 综合 > 正文

DOS汇编显示当前时间

2013年09月21日 ⁄ 综合 ⁄ 共 413字 ⁄ 字号 评论关闭
assume cs:codesg

datasg segment
	format db 'yy/MM/dd HH:mm:ss','$'
	yMdHms	db 9, 8, 7, 4, 2, 0
datasg ends

codesg segment
	start:
		mov ax, datasg
		mov ds, ax
		mov si, offset format
		
		mov di, offset yMdHms
		mov cx, 6
	deal:
		push cx
		mov al, [di]		;指定要访问的内存地址,处理年份
		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 [si], ah
		mov byte ptr [si+1], al
		add si, 3
		inc di
		pop cx
	loop deal
	
	mov dx, offset format
	mov ah, 09H
	int 21H
	
	mov ax, 4c00H
	int 21H
codesg ends

end start

抱歉!评论已关闭.