                       Pascal Source Code
                           04/09/97 -med

The sample programs included on this disk were written for 
Turbo Pascal Version 6.0 and Turbo Pascal for Windows V1.5.  
The programs will also work with Borland Pascal Version 7.0 
which incorporates the MSDOS version, the Windows version, 
plus a protected mode MSDOS version to allow use of extended 
memory. The sample programs provided will compile using 
any of the target compile modes, including the protected mode 
version. A Delphi version of the programs is also provided. 
Delphi is the current Windows version of Borland Pascal.

Note that at the start of the files you will find a series of 
compiler defines which control the way the code is compiled. 
The PLATFORM.INC file contains the common defines used in the
various source files.

Some code needs to know about protected mode or Windows 
operation. Specifically the code that communicates to the 
audiometer. The defines control the code generation for the
various system targets.

In protected mode, segment registers do not exist. They are 
replaced with selectors. A selector has no direct relationship to 
the physical memory location. Thus all code that relies on a 
direct relationship between the segment and the physical memory 
location will not work in protected mode. Where this usually 
shows up is in code that directly manipulates the segment 
register. The segment registers actually are selector registers 
in protected mode, and the can only hold a valid selector. If you 
try to put a undefined selector number into a segment register, 
you will get a memory violation error and the program will stop.

A selector is a handle (a number) that references (indexes) a 
table that contains the actual physical memory location that the 
selector is allocated to refer to. There is no direct 
relationship between the selector value and the memory location 
is points to. In addition, the selector table contains the 
specification about how much memory was allocated to the 
selector. A maximum of 64K can be allocated to the selector. 
A maximum of 8192 selectors can be allocated in the system at any 
one time. Thus selectors being a limited resource should be used 
with care. This is true in Windows 3.1 as well the MSDOS protected 
mode. In Windows 3.1 this is even more of a problem since many 
applications can be active at the same time, and they all take 
selectors from the limited pool of available selectors. Also keep 
in mind that the system preallocates a number of selectors for 
it's own use too.

In Windows NT and Windows 95 (32 bit version), the programs use
a flat memory model. Selectors still exist, but you are not 
allowed to touch them. Since memory is addressed on full 32 bit
memory map, there is no real need for selectors. All addresses 
in 32 bit flat mode are simple 32 bit offsets.


History:  02/11/92 -med original 
          04/09/97 -med revised  

<eof>
