
 Area: FC_prog 
  Msg#: 1744                                         Date: 04-02-96  07:01
  From: Matthew Probert                              Read: Yes    Replied: No 
    To: All                                          Mark:                     
  Subj: Identifying ROM

                         Identifying ROM Code

                           Matthew  Probert
                           Servile Software



Have you ever wondered how to identify whether a memory address is 
mapped to ROM or RAM ? Well, ROM code may be identified by the 
signature word 55AA which occurs at the start of each ROM segment. 

This code fragment will scan the memory addresses from C0000 (segment 
C000) onwards untill it locates RAM (based upon the presumption that 
the first two bytes of the memory segment do not contain the values 
55 and AA). The pointer 'q' is a standard far pointer. 

    /*
       Initialise unsigned seg to the start of the PC ROM expansion 
       area
    */

    seg = 0xc000;

    /*
        Step past ROM untill RAM is found, or the BIOS whichever comes 
        first
    */
    for(;;)
    {
        q = MK_FP(seg,0);
        if (*q != 0x55 || *(q+1) != 0xAA)
            break;
        seg += 0x80;
    }



... [Servile Info Journal]
___ Blue Wave/QWK v2.12
