Listing 2 Memory map structures

/*
 * A structure is defined for each
 * area of memory on the target
 * board. The complete memory
 * map consists of an array of
 * these structures. Each element
 * is initialized to different
 * values, when running on MS-DOS
 * or running on the target board.
 */

struct MEM_AREA {
  DWORD boardOffset;
  DWORD baseAddress;
  DWORD areaSize;
  BYTE areaName[6];
};

/*
 * When running on the production
 * board, the variable 'boardBase'
 * is left to be zero, i.e. all
 * memory on the board starts at
 * location 0. When simulating on
 * a PC running MS-DOS, we do a
 * malloc() of a large chunk of
 * memory. 'boardBase' is set to
 * the address of this chunk. Then,
 * for each area of memory defined
 * in the following tables, we
 * add 'boardBase' to 'boardOffset'
 *  to get 'baseAddress'.
 */

 DWORD boardBase = 0;

#ifndef DOS_SIMULATION

 /*
  * Define the board's memory map
  * in the final production
  * version.
  */

 struct MEM_AREA memoryMap[4]=
  {
   {0x20000, 0, 64*1024, "RAM 1"},
   {0x30000, 0, 64*1024, "RAM 2"},
   {0x40000, 0, 64*1024, "RAM 3"},
   {0xE0000, 0,128*1024, "EPROM"},
  };

#else

 /*
  * Define the board's memory map
  * when simulating on DOS.
  */

 struct MEM_AREA memoryMap[4]=
  {
   {0x00000, 0,  8*1024, "RAM 1"},
   {0x02000, 0,  8*1024, "RAM 2"},
   {0x04000, 0,  8*1024, "RAM 3"},
   {0xF0000, 0, 64*1024, "EPROM"},
  };

#endif

/* End of File */