.model tiny		
.code
org 100h
s:
	mov	bl,ds:[80h]
	mov	di,81h
	xor	bh,bh
	add	di,bx
	mov	byte ptr [di],0

	mov	ah,3dh
	mov	al,0
	mov	dx,82h
	int	21h
	jc	err_exit

	mov	bx,ax
	mov	ah,3fh
	mov	cx,0ffh-10h
	mov	dx,offset buf
	int	21h
	jc	err_exit

	mov	ah,3eh
	int	21h
	jc	err_exit


	mov	cx,0ffh-10h
	mov	si,offset buf
	mov	bl,10h
do:
	mov	al,bl
	out	70h,al
	jmp	$+2
	jmp	$+2
	mov	al,[si]
	out	71h,al
	inc	bl
	inc	si
loop	do		


	int	20h
err_exit:
	mov	ah,9
	mov	dx,offset errstr
	int	21h
	mov	ax,4c01h
	int	21h
errstr	db	'For restore cmos info use: LOADCMOS.COM FILE.EXT$'
buf:
end s