1. 程式人生 > >8086彙編--實時(延時)讀取並顯示BIOS時間

8086彙編--實時(延時)讀取並顯示BIOS時間

assume cs:code
data segment
	FORMAT  db 'YY/MM/DD HH:MM/SS',0dh,0ah,'$'  ;si
	PRO 	db 9,8,7,4,2,0			;di
data ends

code segment
start:

bg:
	mov ax,data
	mov ds,ax
	mov si,0
	mov di,offset PRO

	mov cx,6
s0:
	push cx
	mov al,ds:[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
	inc di
	mov byte ptr ds:[si],ah
	mov byte ptr ds:[si+1],al
	add si,3
	pop cx
	loop s0
	jmp show

show:
	mov ax,data
	mov ds,ax
	mov dx,0
	mov cx,offset PRO-offset FORMAT
	mov ah,9
	int 21h

delay:
	MOV AX,09FH ;0000~0FFFFH
	REP2:
	MOV CX,5FFFH
	REP10MS:
	LOOP REP10MS
	DEC AX ;AX-1->AX
	CMP AX,0H 
	JNE REP2 
	jmp bg

code ends

end start