cmos storage layout



00H-0dH used by real-time clock                                                 
0eH     POST diagnostics status byte                                            
0fH     shutdown status byte                                                    
10H     diskette drive type      Ŀ                                         
11H     reserved                                                               
12H     hard disk drive type                                                   
13H     reserved                       checksum-protected                    
14H     equipment byte                   configuration record (10H-20H)        
15H-16H Base memory size                                                       
17H-18H extended memory above 1M                                               
19H     hard disk 1 type (if > 15)                                             
1aH     hard disk 2 type (if > 15)                                             
1bH-2dH reserved                                                          
2eH-2fH storage for checksum of CMOS addresses 10H through 20H                  
30H-31H extended memory above 1M                                                
32H     current century in BCD (eg, 19H)                                        
33H     miscellaneous info.                                                     
34H-3fH reserved                                                                
                                                                                
Ŀ                                                              
Using CMOS Data                                                               
                                                              
To read a byte from CMOS, do an OUT 70H,addr; followed by IN 71H.               
To write a byte to CMOS,  do an OUT 70H,addr; followed by OUT 71H,value.        
                                                                                
Example: ;------- read what type of hard disk is installed                      
         mov     al,12H                                                         
         out     70H,al        ;select CMOS address 12H                         
         jmp     $+2           ;this forces a slight delay to settle things     
         in      al,71H        ;AL now has drive type (0-15)                    
                                                                                
Addresses 10H thru 20H are protected by a checksum methodology to be able to    
detect when the battery has died or invalid information has been written into   
the configuration record.  This a simple 16-bit sum of the protected bytes.     
                                                                                
Ŀ                                                    
CMOS Memory Layout Detail                                                     
                                                    
Addr Description                                                                
 
 0   current second for real-time clock           Ŀ
 1   alarm second                                  Note: for more info on the 
 2   current minute for real-time clock            real-time clock, refer to  
 3   alarm minute                                  Motorolla MC146818 specs.  
 4   current minute for real-time clock           
 5   alarm hour                                                                 
 6   current day of week for real-time clock                                    
 7   current date of month for real-time clock                                  
 8   current month for real-time clock                                          
 9   current year for real-time clock                                           
 
0aH  RTC status register A                                                      
     76543210                                                          
                                                                            
     Ľ                                                          
       ͼ  rate selector (set to 0110)                             
          22-stage divider (set to 010)                           
       Update in progress (UIP) flag.  0 means OK to read.     
 
0bH  RTC status register B                                                      
     76543210                                                          
                                                                       
     ҽ                                                          
              daylight savings enable.  0=standard time (set to 0)    
             12 or 24-hr.  0=12-hr mode (set to 1)                   
            BCD date mode. 1=binary, 0=BCD.  (set to 0)             
           Square wave enable. 1=turn on square wave. (set to 0)   
          enable update-ended int. 0 disables. (set to 0)         
         enable alarm int. 0 disables (set to 0) See INT 1aH     
        enable periodic int. 0 disables (set to 0)              
       Update in progress (UIP) flag.  0 means OK to read.     
 
0cH  RTC status register C.  Read-only interrupt status bits.                   
 
0dH  RTC status register D. Bit 7=1 when a CMOS-RAM is receiving power          
                                 =0 to indicate a dead battery.                 
 
0eH  POST diagnostics status byte                                               
     76543210                                                          
           0 0                                                          
     Ľ                                                          
            Time valid (After POST, 1 means it's not Feb 30)        
           Hard disk bad.  1 means can't boot from hard disk       
          RAM size not right. 1 = POST found different RAM size   
         Configuration record not right.  1=different equipment  
        Checksum invalid.  1 means bad checksum in CMOS RAM     
       Power Lost.  1 means real-time clock battery died       
 
0fH  shutdown status byte                                                       
     This byte is read upon startup after processor reset in order to determine 
     if the reset was used as a way to get out of 80286 protected mode.         
         0 = soft reset (Ctrl-Alt-Del) or unexpected shutdown                   
         1 = shutdown after memory size is determined                           
         2 = shutdown after memory test is performed                            
         3 = shutdown after memory error (parity check 1 or 2)                  
         4 = shutdown with bootstrap loader request                             
         5 = shutdown with FAR JMP (restart int controller and jmp to 0:[0467H])
     6,7,8 = shutdown after passing a protected mode test                       
         9 = shutdown after performing block move.  See INT 15H SubFn 87H       
       0aH = shutdown with FAR JMP (immediate jmp to address at 0:[0467H])      
 
10H  diskette drive type                                                        
     76543210                                                          
                                                                             
     Ľ                             0000 = no drive              
      ͼ  first diskette drive  0001 = 360K drive            
          second diskette drive ͼ   0000 = hi-capacity drive     
 
11H  reserved                                                                   
 
12H  hard disk drive type  (for drives C: and D:, when between 1 and 14)        
     76543210                                                          
                                                                             
     Ľ                                                          
      ͼ  first hard disk (drive C:)  0000 = not present     
          second hard disk (drive D:) ͼ   else = type ID (below) 
                                                         1111 = use Addr 19H/1aH
                                                                                
     These drive types are pre-defined by the ROM-BIOS. The vectors for INT 41H 
     and INT 46H are initially set to a ROM table containing the information for
     the types of drive(s) installed.  See Hard Disk Parameter Table            
                                                                                
                   Write   Land                       Write   Land              
     Type Cyls Hds PreComp Zone Size    Type Cyls Hds PreComp Zone Size         
                            
      1   306  4   128     305   10M    16   612  4   0        663  21M         
      2   615  4   300     615   21M    17   977  5   300      977  42M         
      3   615  4   300     615   32M    18   977  7   0ffffH   977  59M         
      4   940  8   512     940   65M    19  1024  7   512     1023  62M         
      5   940  6   512     940   49M    20   733  5   300      732  31M         
      6   615  4   0ffffH  733   21M    21   733  7   300      732  44M         
      7   462  8   256     511   32M    22   733  5   300      733  31M         
      8   733  5   0ffffH  733   31M    23   306  4   0        336  10M         
      9   900 15   0ffffH  901  117M    24-47 reserved                          
     10   820  3   0ffffH  820   21M                                            
     11   855  5   0ffffH  855   37M    If the disk-type nibble is 0fH (15),    
     12   855  7   0ffffH  855   52M    then the disk type is stored in CMOS    
     13   306  8   128     319   21M    address 19H (drive C:) or address 1AH   
     14   733  7   0ffffH  733   44M    (drive D:)                              
     15   reserveddon't use                                                   
                                                                                
     Notes:  Type 1 is the original XT hard disk                               
             Type 2 is the standard 20M AT hard disk (and a good first guess)  
             Types 16-23 were added to ROM-BIOS dated 11/15/85                 
 
13H  reserved                                                                   
 
14H  Equipment byte                                                             
     76543210                                                          
     drvdspn/a7d                                                          
     Ľ                                                          
      ˼ ˼       1 = diskette drive(s) installed                         
                 1 = 80287 math co-processor installed                   
           primary display 00 = none or EGA                      
                                       01 = 40-clm CGA                         
                                       10 = 80-clm CGA                         
                                       11 = TTL Monochrome                     
        diskette drives-1 (00=1, 01=2, 10=3, 11=4)              
 
15H  Base memory (low byte)   0100H=256K, 0200H=512K, 0280H=640K           
16H  Base memory (high byte)  ͼ                                                
17H  extended memory above 1M (low byte)   (in K bytes. 0-3c00H)           
18H  extended memory (high byte)  ͼ   See INT 15H SubFn 88H           
 
19H  disk 0 (drive C:) hard disk type if (CMOS addr 12H & 0fH) is 0fH           
1aH  disk 1 (drive D:) hard disk type if (CMOS addr 12H & f0H) is f0H           
 
1bH-2dH reserved                                                                
 
2eH  checksum of CMOS addresses 10H through 20H  (high byte)                    
2fH                                              (low byte)                     
 
30H  extended memory above 1M (low byte)   (in K bytes. 0-3c00H)           
31H  extended memory (high byte)  ͼ   See INT 15H SubFn 88H           
 
32H  century in BCD (eg, 19H)                                                   
 
33H  miscellaneous info.  Bit 7=IBM 128K memory option installed                
                          Bit 6=used by "Setup" utility                         
 
34H-3fH reserved.  Put your name here for everlasting amusement.                

