home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / r / revlcd16.zip / CMOS.CPP < prev    next >
C/C++ Source or Header  |  1993-03-28  |  2KB  |  58 lines

  1. // cmos: a CMOS-RAM viewer
  2. //
  3. //   version 1.1  Mar. 28 1993
  4. //
  5. //   version 1.1  Initial version
  6. //                
  7. //    written by NoZomi Ytow
  8. //    Copyright(C) 1993 NoZomi Ytow
  9. //
  10. //
  11. //    This program is free software; you can redistribute it and/or modify
  12. //    it under the terms of the GNU General Public License as published by
  13. //    the Free Software Foundation; either version 1, or (at your option)
  14. //    any later version.
  15. //    
  16. //    This program is distributed in the hope that it will be useful,
  17. //    but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. //    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19. //    GNU General Public License for more details.
  20. //    
  21. //    You should have received a copy of the GNU General Public License
  22. //    along with this program; if not, write to the Free Software
  23. //    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25. #if defined __GNUC__
  26.  
  27.     #include    <asm/io.h>
  28.     #define inp inb_p
  29.     #define outp(port,value) outb_p((port),(value))
  30.  
  31. #else
  32. #include    <dos.h>
  33. #include    <stdio.h>
  34. #endif
  35.  
  36. int main(void)
  37. {
  38.     printf("                 ");
  39.     for(int addr = 0x0; addr < 0x10; addr++){
  40.         printf(" %2x",addr);
  41.     }
  42.     for(addr = 0x0; addr < 0x80;){
  43.         printf("\nCMOS RAM[%2x]   = ", addr);
  44.         for(int d =0; d < 0x10; d++, addr++){
  45.         outp(0x70, addr);
  46.         printf(" %2x", inp(0x71));
  47.         }
  48.     }
  49.     for(addr = 0x0; addr < 0x80;){
  50.         printf("\nexCMOS RAM[%2x] = ", addr);
  51.         for(int d =0; d < 0x10; d++, addr++){
  52.         outp(0x74, addr);
  53.         printf(" %2x", inp(0x76));
  54.         }
  55.     }
  56.     printf("\n\n");
  57.     return addr;
  58. }