; > Doc.MonLead

 Title:         MonLead
 Author:        Tim Dobson
 Version:       0.04
 Started:       19-Mar-91
 Last updated:  24-Apr-92
 Status:        Incomplete
 History:
  19-Mar-91 TMD Created
  19-Mar-91 TMD Updated
  10-Apr-91 TMD Added documentation of Service_MonitorLeadTranslation
  24-Apr-92 TMD Corrected information to match bodge for LiteOn monitor

 Automatic detection of monitor type from monitor lead ID pins
 =============================================================

Some RISC OS computers have circuitry which allows the detection of the
state of ID pins on the monitor connector. This allows the computer to
distinguish between most types of monitor, and adjust its video output
accordingly.

To support this, a number of changes have been made to RISC OS:-

a) To simplify the interface, the commands *Configure Mode and
*Configure WimpMode have been merged. Both commands control the same CMOS
location. Therefore the same screen mode will be selected on startup
irrespective of whether the desktop is being used.

b) The commands *Configure Mode/WimpMode, *Configure MonitorType, and
*Configure Sync now take the keyword Auto as an alternative to a numeric
parameter. If this option is configured, then RISC OS will determine a
reasonable default for the particular parameter, based on the type of
monitor plugged in.

As the default is for all three to be set to Auto, the user should only have
to change the settings if he has a type of monitor which is not recognised
properly, or if he wishes to use a different screen mode from the chosen
default.

c) The effect of holding certain keys down on power-on is slightly changed:-

Key held down on power-on       Settings of CMOS RAM

R or Delete                     MonitorType Auto, Mode/WimpMode Auto, Sync Auto, and all the rest it used to
T or Copy                       MonitorType Auto, Mode/WimpMode Auto, Sync 0 (separate syncs), and all the rest
Keypad 0 to 9                   MonitorType 0 to 9
Keypad dot                      MonitorType Auto, Mode/WimpMode Auto, Sync Auto

d) A new service has been added which allows unknown values of the monitor
ID to be recognised by modules and converted into the appropriate monitor
type number, sync type and default mode, as follows:-

Service_MonitorLeadTranslation (&76)

 in:    R1 = service code (&76)
        R2 = monitor lead ID (see below)

 out:   If monitor lead ID is recognised, then the module should set
        R1 = 0 (claim service)
        R3 = default screen mode number to use on this type of monitor
        R4 = monitor type number to use (as used in *Configure MonitorType)
        R5 = sync type to use on this type of monitor
         (0 => separate syncs, 1 => composite sync)
        All other registers must be preserved.

        If the monitor lead ID is not recognised, the module should preserve
        all registers.

The monitor connector provides 4 ID pins, ID0-ID3. Each of these may be
connected to 0v, +5v or to the Hsync pin. The monitor lead ID therefore
represents the state of the 4 ID pins by 8 bits as follows:-

 Bit 0  Bit 1   State of ID0
 Bit 2  Bit 3   State of ID1
 Bit 4  Bit 5   State of ID2
 Bit 6  Bit 7   State of ID3

   0      0     Tied to 0v
   1      0     Tied to +5v
   0      1     Tied to Hsync
   1      1     Inderminate - either the state is fluctuating
                or machine is not capable of reading the ID

The service is issued when SWI OS_ReadSysInfo is called with R0=1 (see
document 'ReadSysInf') if any of the configured Mode/MonitorType/Sync are
set to Auto.

If the service is not claimed, then RISC OS checks the monitor lead ID
against the following list of recognised IDs:-

Monitor ID pins         Monitor type            Sync type       Default mode
0=0v,1=+5v,H=Hsync,
X=don't care
 Pin 0 1 2 3

     1 1 H X            1 (Multisync)           1 (composite)       27
     1 0 1 X            3 (Mono VGA)            0 (separate)        27
     0 1 1 X            3 (Colour VGA)          0 (separate)        27
     0 1 0 X            1 (Multisync) *         0 (separate)        27
     H 1 1 X            0 (TV standard)         1 (composite)       12

For all other ID values RISC OS uses the TV standard monitor settings.

* This entry should really be monitor type 4 (Super VGA). However the LiteOn
monitor returns this monitor ID, even though it can do the TV standard
modes. RISC OS therefore selects monitor type 1 instead, so the TV standard
and VGA standard modes can be selected on this monitor.
