[Toc][Index]

[SetMode]


This section lists the required execution steps for a successful mode set. 
There could be one SetMode section per MonitorModeInfo, or one per 
ModeInfo, or one that services multiple modes. The Interpreter tags all 
ModeInfo and MonitorModeInfo sections found between two SetMode sections 
and, later on, associates the last SetMode with all of them. Thus, SetMode 
services for all of the modes could be provided by a number of different 
functions (if desired, a single function that serves as a router can be 
used). The SetMode section is also executed when Saving and Restoring the 
mode (see [SaveRestore] in this chapter). 
Any number of PMI functions can be called from within the mode section. 
The SetMode section has to ensure that the adapter is programmed to 
reflect the run-time settings of the ModeInfo/MonitorModeInfo structure. 
These settings are passed in the VIDEO_ADAPTER.VIDEOMODEINFO structure at 
the procedural level. The settings are also available as PMI keyvariables 
to the PMI language command sequences. On dynamic Legacy and PnP hardware, 
or when a coprocessor co-resides with a VGA chip, the SetMode has to 
ensure that the setup is configured appropriately for the mode to be set. 
This should be facilitated by an embedded EnableController call, which is 
sensitive to the current Hardware PMI keyvariable values. 
Vendors who provide the TuneDisplay section for sizing of the active 
display and the SetMonitorTimings section for manipulation of the timing 
PMI keyvariables should ensure that the SetMode section has the ability to 
set the run-time values for the timing PMI keyvariables. The easiest way 
to ensure this is by making the SetMode section use the SetMonitorTimings 
and TuneDisplay sections. 
See Supported Modes and [EnableController] in this chapter for more 
information. 
Here is a sample .PMI file for a Viper VLB card: 



[SetMode]
SetP9000AccelMode;

/*
** Set accelerated mode on P9000
*/
[SetP9000AccelMode]
EnableController;             //configure controller
r0   = 0x00000000;            //set DAC
r1   = 0x00000040;            //256 color 6:6:6
if (BitsPerPixel != 16) goto DAC
r1   = 0x00000030;            // 64K colors
DAC:
ProgramDAC;
InitializeP9000;              //initialize P9000 registers
                              //set sysconfig and clipping
if (Xresolution != 640) goto not640
r1  = 0x028001e0;             //640x480x8
r0  = 0x00563000;
if (BitsPerPixel == 8) goto domodeset
r0  = 0x00683000;             //640x480x16 bits
goto domodeset
not640:
if (Yresolution != 800) goto not800     //800x600x8
r0  =  0x00587000;
r1  =  0x03200258;
goto domodeset
not800:                       //must be 1024x760x8
r0  =  0x00603000;
r1  =  0x04000300;
domodeset:
writedw(sysconfig,r0);
writedw(w_min,0x00000000);
writedw(w_max,r1);            //program clipping
SetMonitorTimings;            //program clock and timings. Calls TuneDisplay.
writedw(srtctl,0x000001e5);   //enable



Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs