Sets VI modes
#include <ultra64.h> /* os.h */ void osViSetMode(OSViMode *mode);
This function sets the display mode in the VI. The VI supports a total of 56 display modes. These break down into 14 NTSC modes, 14 PAL modes, 14 MPAL modes, and 14 full-screen display PAL (FPAL) modes. The attributes of each mode, such as interlace and non-interlace, 16-bit color pixels and 32-bit color pixels, low-resolution and high-resolution, etc., can be set. In addition, the resolution can be dropped or images can be rescaled in order to increase rendering speed.
The 56 modes are indicated by 5 switches, viz., high/low resolution, 16/32-bit color pixels, anti-aliasing/point sampling, filter/non-filter processing, and NTSC/PAL/MPAL/FPAL format. The defined symbol names for these modes are in <os.h>. For example, "OS_VI_NTSC_LPN1" indicates that low-resolution, point sampling, non-interlace, and 16-bit color pixels are supported, while "OS_VI_PAL_LPN1" indicates that the same content are supported in PAL format.
The last 4 characters of the symbol name (LPN1, etc.) comprise the following codes.
|1st Character||H = High resolution|
|L = Low resolution|
|2nd Character||A = Anti-aliasing|
|P = Point sampling|
|3rd Character||Low resolution||N = Non-interlaced|
|F = Interlaced|
|High resolution||N = Normal interlaced|
|F = Deflickered interlaced|
|4th Character||1 = 16-bit pixel size|
|2 = 32-bit pixel size|
At low resolution (320 pixels x 240 lines in PAL/MPAL/NTSC modes, 320 pixels x 288 lines in FPAL mode), non-interlaced mode and interlaced mode can be selected. Non-interlaced mode repeats the same frame in each field (scan). In contrast, interlaced mode interpolates between adjacent lines. First, in the first field, the upper line is weighted 75% and the lower line is weighted 25%. Then, interpolation is performed in the next in the next field, by weighting the upper line 25% and weighting the lower line 75%. In this case, there is no flicker because there is not high blanking frequency.
At high resolution (640 pixels x 480 lines in PAL/MPAL/NTSC modes, 640 pixels x 576 lines in FPAL mode), normal interlaced mode and de-flickered interlaced mode can be selected. In normal interlaced mode, only those data, which have been rendered for that field, are used in one field. While the current field is being displayed, the next field is being rendered, and since they have no effect on one another, there is no need to use a double-buffer. However, since it is high resolution, pixels, which are only displayed in one field, will flicker. On the other hand, in de-flickered interlaced mode, the lines are averaged and displayed to eliminate the high-frequency components. However, the data for both fields are required to display one field in this mode, double-buffer processing becomes necessary.
The register settings for these 56 modes are in the VI mode table osViModeTable, which is defined as an external variable. osViSetMode overwrites all VI registers with data referenced by mode (the pointer to osViModeTable) at the timing of the next vertical retrace. All previous settings (XY scale, gamma correction, etc.) will be reset. The VI mode table is an array of 56 OSViMode structures, but each mode is individually defined in <os.h> as an external variable in the OS source file. For instance, there are two ways, as shown below, to write it when registering NTSC, low-resolution, anti-aliasing, non-interlaced processing, and 16-bit mode in the VI.
Since the latter method is linked to data, which are not used, it uses a lot of memory. It is recommended that the former method be used.
osViSetMode will return all of the settings for functions that are set by X/Y scale processing or osViSetSpecialFeatures (e.g., gamma correction) to their default values as defined in the VI mode table.
References VI Mode Type List
// Start VI manager & blackout osCreateViManager(OS_PRIORITY_VIMGR); #if (SCREEN_WD==320)&&(SCREEN_HT==240) // Settings for low resolution osViSetMode(&osViModeNtscLan1); #elif (SCREEN_WD==640)&&(SCREEN_HT==480) // Settings for high resolution osViSetMode(&osViModeNtscHaf1); #else #error "Illegal Screen size" #endif osViBlack(TRUE);
02/01/99 Completely revised.