VioSetMode (FAPI)

This call sets the mode of the display.

Syntax
VioSetMode (ModeData, VioHandle)

Parameters

 * ModeData (PVIOMODEINFO) - input: Address of the mode characteristics structure
 * VioHandle (HVIO) - input : Reserved word of 0s.

Return Code

 * rc (USHORT) - return:Return code descriptions are:
 * 0  NO_ERROR
 * 355 ERROR_VIO_MODE
 * 430 ERROR_VIO_ILLEGAL_DURING_POPUP
 * 436 ERROR_VIO_INVALID_HANDLE
 * 438 ERROR_VIO_INVALID_LENGTH
 * 465 ERROR_VIO_DETACHED
 * 467 ERROR_VIO_FONT
 * 468 ERROR_VIO_USER_FONT
 * 494 ERROR_VIO_EXTENDED_SG

Remarks
VioSetMode initializes the cursor position and type.

VioSetMode does not clear the screen. To clear the screen, use one of the VioScrollxx calls.

The disable color burst bit in the Type field in the VioSetMode data structure is functional only for the CGA and VGA. This bit causes the color portion of the video signal to be suppressed, producing a black and white mode on composite monitors attached to the CGA. On VGA, the bit causes the color lookup table to be loaded with values that produce shades of gray instead of colors, again producing a black and white mode. For all other combinations of adapters and displays, the setting of this bit is recorded and returned on any subsequent VioGetMode call, but otherwise is ignored.

For text modes in full-screen sessions, the number of rows on the screen is determined by the availability of fonts of the correct size. For any specified mode, the size of the character defined by the font must be (Horizontal Resolution)/(Text Columns) dots wide and (Vertical Resolution)/(Text Rows) dots high. For example, an 8x8 font would support 39 through 43 text rows if the screen resolution were 640x350.

If VioSetState request type 6 has been issued previously to select the target display configuration for VioSetMode, the mode is set on the display configuration selected. If that display configuration does not support the mode specified, an error is returned.

Assuming no target display configuration for VioSetMode is selected, the mode is set on the primary configuration. If the primary configuration does not support the mode specified, the mode is set on the secondary configuration.

The table below shows the VioSetMode parameters required to set all the modes supported by the CGA, EGA, VGA, and PS/2 Display Adapters. The modes native to the 8514/A and other advanced video adapters are set with the Adapter (programming) Interface to these adapters, not VioSetMode.


 * Note: Although graphics mode support is provided in VioSetMode, this support is not provided by the Base Video Handlers provided with OS/2.
 * Note: For text modes in full-screen, the number of rows may differ from the mode table due to the availability of fonts of the correct size as described above.

PM Considerations
Windowable VIO sessions support only 80-column, color text modes. When VioSetMode is called from a Windowable VIO session, it only verifies that an 80-column text mode was requested, with Text Rows between 1 and 255. The resulting mode, which can be queried using VioGetMode, always has Type = 1, Color = 4, Text Columns = 80, Text Rows = requested Text Rows, Horizontal Resolution = 640, and Vertical Resolution = 16 * (Text Rows).

Family API Considerations
Some options operate differently in the DOS mode than in the OS/2 mode. Therefore, the following consideration applies to VioSetMode when coding for the DOS mode:
 * VioSetMode clears the screen.

C
 typedef struct _VIOMODEINFO { USHORT cb;                   /* Length of the entire data structure  */ UCHAR fbType;                /* Bit mask of mode being set           */ UCHAR color;                 /* Number of colors (power of 2)        */ USHORT col;                  /* Number of text columns               */ USHORT row;                  /* Number of text rows                  */ USHORT hres;                 /* Horizontal resolution                */ USHORT vres;                 /* Vertical resolution                  */ UCHAR fmt_ID;                /* Attribute format                     */ UCHAR attrib;                /* Number of attributes                 */ ULONG buf_addr; ULONG buf_length; ULONG full_length; ULONG partial_length; PCH   ext_data_addr; } VIOMODEINFO; typedef VIOMODEINFO far *PVIOMODEINFO;


 * 1) define INCL_VIO

USHORT rc = VioSetMode(ModeData, VioHandle);

PVIOMODEINFO    ModeData;      /* Mode characteristics */ HVIO            VioHandle;     /* Video handle */

USHORT          rc;            /* return code */ 

MASM
 VIOMODEINFO struc viomi_cb            dw ? ;Length of the entire data structure viomi_fbType        db ? ;Bit mask of mode being set viomi_color         db ? ;Number of colors (power of 2) viomi_col           dw ? ;Number of text columns viomi_row           dw ? ;Number of text rows viomi_hres          dw ? ;Horizontal resolution viomi_vres          dw ? ;Vertical resolution viomi_fmt_ID        db ? ;Attribute format viomi_attrib        db ? ;Number of attributes viomi_buf_addr      dd ? ; viomi_buf_length     dd ? ; viomi_full_length    dd ? ; viomi_partial_length dd ? ; viomi_ext_data_addr  dd ? ; VIOMODEINFO ends

EXTRN VioSetMode:FAR INCL_VIO           EQU 1

PUSH@ OTHER   ModeData      ;Mode characteristics PUSH  WORD    VioHandle     ;Video handle CALL  VioSetMode

Returns WORD 