//------------------------------------------------------------------- // cmosdump.cpp // // This program reads the Real-Time Clock's nonvolatile memory- // locations and displays their contents in hexadecimal format. // // NOTE: run the 'iopl3' utility before executing this program. // // programmer: ALLAN CRUSE // written on: 02 APR 2004 //------------------------------------------------------------------- #include // for printf(), perror() #include // for exit() #include // for iopl() int main( int argc, char **argv ) { // change i/o privilege-level to allow i/o-port access if ( iopl( 3 ) ) { perror( "iopl" ); exit(1); } // display contents of the 128 CMOS storage-locations printf( "\nCMOS Non-Volatile Memory \n" ); for (int i = 0; i < 128; i++) { if ( ( i % 16 ) == 0 ) printf( "\n%03X: ", i ); outb( i, 0x70 ); short val = inb( 0x71 ); printf( "%02X ", val ); } printf( "\n\n" ); }