;***********************************************
;this is cmos asm file,it could backup your cmos
;***********************************************
title first
data segment
na db 'cmos.dat',0
buffer db 80H dup(?)
handle dw ?
data ends
code segment
assume ds:data,cs:code
main proc far
start: push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov cx,0
lea bx,buffer
mov ax,0
get: out 70H,al ;get your cmos configuration(得到你的cmos配置信息)
in al,71H
mov [bx],al
inc cx
inc bx
mov ax,cx
cmp cx,80H
jb get
mov ah,3cH ;create a new file(调用int21H新建一个文件)
lea dx,na
mov cx,20H
int 21H
mov handle,ax
mov ah,40H ;write to the new file(调用int21H向这个文件写cmos的配置信息)
mov bx,handle
lea dx,buffer
mov cx,80H
int 21H
ret
main endp
code ends
end start
http://www.acnow.net/ giWcCdiO
http://www.acnow.net/ giWcCdiO
;***************************************************
;this is restore asm file,it could restore your cmos
;***************************************************
title restore
data segment
na db "cmos.dat",0
buffers db 80H dup(?)
data ends
code segment
assume cs:code,ds:data
main proc far
begin: push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
lea dx,na ;get the file handle and open the file(得到cmos.dat文件的文件号后,打开该文件)
mov al,0
mov ah,3dH
int 21H
mov bx,ax ;read the file(读文件内容)
mov cx,80H
mov ah,3fH
lea dx,buffers
int 21H
mov cx,0
mov ax,0
lea bx,buffers
write: out 70H,al ;restore cmos (恢复cmos的配置)
mov ax,[bx]
out 71H,al
inc cx
inc bx
mov ax,cx
cmp cx,80H
jb write
ret
main endp
code ends
end begin