Jump to content

DDDR/2 - Physical Video Device Drivers: Difference between revisions

From EDM2
Created page with " === Physical Video Device Drivers === Video devices are accessed by using Base Video Handlers (BVHs). These BVHs consist of one or more Dynamic Link Libraries (DLLs). In th..."
 
Ak120 (talk | contribs)
 
(22 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
{{DisplDDRef}}{{IBM-Reprint}}
 
=== Physical Video Device Drivers ===


Video devices are accessed by using Base Video Handlers (BVHs). These BVHs consist of one or more Dynamic Link Libraries (DLLs). In the representative case of the VGA, BVHVGA.DLL manages the device for full-screen sessions, while DISPLAY.DLL (renamed from IBMVGA.DLL) manages the device for the Presentation Manager interface. Although these device handlers are initialized by different sections of the system at this time, they are architecturally compatible and can easily be combined at a later date.
Video devices are accessed by using Base Video Handlers (BVHs). These BVHs consist of one or more Dynamic Link Libraries (DLLs). In the representative case of the VGA, BVHVGA.DLL manages the device for full-screen sessions, while DISPLAY.DLL (renamed from IBMVGA.DLL) manages the device for the Presentation Manager interface. Although these device handlers are initialized by different sections of the system at this time, they are architecturally compatible and can easily be combined at a later date.


 
==Video Device Handler Identification==
 
=== Video Device Handler Identification ===
 
The list of the active video device handlers and their components resides in the CONFIG.SYS file as environment variables. To conserve environment space, these variables are removed from the environment during Shell Initialization. The VIDEO_DEVICES environment variable lists the names of the environment variables that describe each of the video device handlers. Commas are used to separate the names in this list. The following is an example of how to specify the environment variables ARTICHOKE and WATERMELON as those defining the active video device handlers, with ARTICHOKE used as configuration number one, and WATERMELON used as configuration number two.
The list of the active video device handlers and their components resides in the CONFIG.SYS file as environment variables. To conserve environment space, these variables are removed from the environment during Shell Initialization. The VIDEO_DEVICES environment variable lists the names of the environment variables that describe each of the video device handlers. Commas are used to separate the names in this list. The following is an example of how to specify the environment variables ARTICHOKE and WATERMELON as those defining the active video device handlers, with ARTICHOKE used as configuration number one, and WATERMELON used as configuration number two.
SET VIDEO_DEVICES=ARTICHOKE,WATERMELON


<br /><br />
<pre class="western">      SET VIDEO_DEVICES=ARTICHOKE,WATERMELON</pre>
The value of each environment variable that describes a video device handler is composed of three keywords and the values associated with them. These keywords are separated by blanks and can be specified in any order and in any combination of upper and lower case characters. The DEVICE() keyword defines the list of names of the dynamic link libraries and physical device drivers which are combined to create the video device handler. The names are separated by commas, and their order determines the order in which the components will be initialized. These names represent only those parts of the BVH that need to be called to initialize the Call Vector Table. That is, physical device drivers should not be included in the list if they are only called by the dynamic link libraries and do not directly modify the Call Vector Table.
The value of each environment variable that describes a video device handler is composed of three keywords and the values associated with them. These keywords are separated by blanks and can be specified in any order and in any combination of upper and lower case characters. The DEVICE() keyword defines the list of names of the dynamic link libraries and physical device drivers which are combined to create the video device handler. The names are separated by commas, and their order determines the order in which the components will be initialized. These names represent only those parts of the BVH that need to be called to initialize the Call Vector Table. That is, physical device drivers should not be included in the list if they are only called by the dynamic link libraries and do not directly modify the Call Vector Table.


The default initialization entry point name for the dynamic link libraries is DEVENABLE. An alternate entry point name can be specified by following any DLL name with +AltName, where AltName is the entry point name.
The default initialization entry point name for the dynamic link libraries is DEVENABLE. An alternate entry point name can be specified by following any DLL name with +AltName, where AltName is the entry point name.


The default initialization IOCtl for physical device drivers is Function 73h. An alternate function number and category can be specified by following the device name by +Func+Cat, where &quot;Func&quot; is the function number and &quot;Cat&quot; is the category. Both numbers must be specified in hexadecimal form. For details, see Function 73h under &quot;Physical Device Driver Initialization&quot; later in this chapter.
The default initialization IOCtl for physical device drivers is Function 73h. An alternate function number and category can be specified by following the device name by +Func+Cat, where "Func" is the function number and "Cat" is the category. Both numbers must be specified in hexadecimal form. For details, see Function 73h under "Physical Device Driver Initialization" later in this chapter.


The following is an example of a device handler that is composed of two physical device drivers, DEV1 and DEV2, and three dynamic link libraries, DYN1 through DYN3. The second physical device driver uses an alternate initialization IOCtl and the third dynamic link library uses an alternate initialization entry point. POINTER$ is the default physical pointer device driver.
The following is an example of a device handler that is composed of two physical device drivers, DEV1 and DEV2, and three dynamic link libraries, DYN1 through DYN3. The second physical device driver uses an alternate initialization IOCtl and the third dynamic link library uses an alternate initialization entry point. POINTER$ is the default physical pointer device driver.
SET ARTICHOKE=DEVICE(DEV1,DYN1,DEV2+74+05,DYN2,DYN3+OTHERENT)


<pre class="western">      SET ARTICHOKE=DEVICE(DEV1,DYN1,DEV2+74+05,DYN2,DYN3+OTHERENT)</pre>
''DosOpen'' is called for each name in the list to check if it is a device driver with an associated "DEVICE=" statement in the CONFIG.SYS file. If the call fails, ''DosLoadModule'' is called to check if it is a dynamic link library. If both of these calls fail for any name in the list, the entire device is ignored.
''DosOpen''is called for each name in the list to check if it is a device driver with an associated &quot;DEVICE=&quot; statement in the CONFIG.SYS file. If the call fails, ''DosLoadModule''is called to check if it is a dynamic link library. If both of these calls fail for any name in the list, the entire device is ignored.


If the optional PTRDEVP() keyword is specified, it defines the names of the physical pointer device drivers. If it is not specified, it defaults to PTRDEVP(POINTER$). The following is an example of a device with only one dynamic link library component and a unique physical pointer device driver for protect mode.
If the optional PTRDEVP() keyword is specified, it defines the names of the physical pointer device drivers. If it is not specified, it defaults to PTRDEVP(POINTER$). The following is an example of a device with only one dynamic link library component and a unique physical pointer device driver for protect mode.
 
SET WATERMELON=DEVICE(SEEDLESS) PTRDEVP(PPOINT)
<pre class="western">      SET WATERMELON=DEVICE(SEEDLESS) PTRDEVP(PPOINT)</pre>
'''Note:''' This design is not limited strictly to physical video devices. By writing a device handler, video data could be written to any device, such as a printer or a plotter. In addition, by using alternate initialization entry points, multiple devices can be handled by the same physical device handler.
'''Note:'''This design is not limited strictly to physical video devices. By writing a device handler, video data could be written to any device, such as a printer or a plotter. In addition, by using alternate initialization entry points, multiple devices can be handled by the same physical device handler.


All of the video device handlers shipped with OS/2 2.1 are dynamic link libraries. They can be defined by the following environment variables, which use the default keywords of PTRDEVP(POINTER$) and PTRDEVR(POINTER$).
All of the video device handlers shipped with OS/2 2.1 are dynamic link libraries. They can be defined by the following environment variables, which use the default keywords of PTRDEVP(POINTER$) and PTRDEVR(POINTER$).
 
SET VIO_IBMMPA=DEVICE(BVHMPA)
<pre class="western">      SET VIO_IBMMPA=DEVICE(BVHMPA)
SET VIO_IBMCGA=DEVICE(BVHCGA)
      SET VIO_IBMCGA=DEVICE(BVHCGA)
SET VIO_IBMEGA=DEVICE(BVHEGA)
      SET VIO_IBMEGA=DEVICE(BVHEGA)
SET VIO_IBMVGA=DEVICE(BVHVGA)
      SET VIO_IBMVGA=DEVICE(BVHVGA)
SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
      SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
SET VIO_IBM8514A=DEVICE(BVH8514A)
      SET VIO_IBM8514A=DEVICE(BVH8514A)
SET VIO_IBMXGA=DEVICE(BVHXGA)
      SET VIO_IBMXGA=DEVICE(BVHXGA)</pre>
The following statements define a system with an 8514 display attached to an 8514/A as the only active video device:
The following statements define a system with an 8514 display attached to an 8514/A as the only active video device:
 
SET VIDEO_DEVICES=VIO_IBM8514A
<pre class="western">      SET VIDEO_DEVICES=VIO_IBM8514A
SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
      SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)</pre>
However, the statement below defines a system with an 8514 display attached to an 8514/A, and another PS/2* display attached to the VGA connector, as independent video devices.
However, the statement below defines a system with an 8514 display attached to an 8514/A, and another PS/2* display attached to the VGA connector, as independent video devices.
 
SET VIDEO_DEVICES=VIO_IBMVGA,VIO_IBM8514A
<pre class="western">      SET VIDEO_DEVICES=VIO_IBMVGA,VIO_IBM8514A
SET VIO_IBMVGA=DEVICE(BVHVGA)
      SET VIO_IBMVGA=DEVICE(BVHVGA)
SET VIO_IBM8514A=DEVICE(BVH8514A)
      SET VIO_IBM8514A=DEVICE(BVH8514A)</pre>
Two other device handlers are provided with OS/2. The names of these device drivers are fixed. The Base Video Subsystem loads them automatically as they are needed.
Two other device handlers are provided with OS/2. The names of these device drivers are fixed. The Base Video Subsystem loads them automatically as they are needed.


Line 54: Line 43:
BVHWNDW.DLL is the device handler that can support VIO window sessions and that provides the interface to the Presentation Manager interface by treating the PM interface as a virtual video device driver. BVHWNDW.DLL is loaded only for VIO window sessions.
BVHWNDW.DLL is the device handler that can support VIO window sessions and that provides the interface to the Presentation Manager interface by treating the PM interface as a virtual video device driver. BVHWNDW.DLL is loaded only for VIO window sessions.


=== Video Device Chaining ===
===Video Device Chaining===
 
Video device handlers (BVHs) can be chained together when multiple BVHs share the responsibility of supporting a specific video adapter. This is accomplished by allowing previously loaded BVHs to attempt the handling of BVH functions. BVH8514A and BVHXGA are chained BVHs shipped with the product that provides this support.
Video device handlers (BVHs) can be chained together when multiple BVHs share the responsibility of supporting a specific video adapter. This is accomplished by allowing previously loaded BVHs to attempt the handling of BVH functions. BVH8514A and BVHXGA are chained BVHs shipped with the product that provides this support.


 
===A VGA and 8514A Scenario===
 
=== A VGA and 8514A Scenario ===
 
During system initialization, BVHVGA is first called to initialize the Call Vector Table, that is, the table used by BVS to give control to the BVH routines. BVHVGA functions as though no other BVH will be handling the device. Next, BVH8514A is called to initialize the same Call Vector Table. However, BVH8514A saves a copy of the Call Vector Table before changing it.
During system initialization, BVHVGA is first called to initialize the Call Vector Table, that is, the table used by BVS to give control to the BVH routines. BVHVGA functions as though no other BVH will be handling the device. Next, BVH8514A is called to initialize the same Call Vector Table. However, BVH8514A saves a copy of the Call Vector Table before changing it.


When calls are made to this chained BVH, BVH8514A receives the call and passes it to the BVHVGA routine through the saved Call Vector Table. If an error occurs or if the results of the routine need to be modified, BVH8514A handles the call. Thus, BVH8514A uses the BVHVGA routines to perform all common functions. ''Device chaining''can be viewed as a mechanism to allow one BVH to filter function calls to another BVH.
When calls are made to this chained BVH, BVH8514A receives the call and passes it to the BVHVGA routine through the saved Call Vector Table. If an error occurs or if the results of the routine need to be modified, BVH8514A handles the call. Thus, BVH8514A uses the BVHVGA routines to perform all common functions. ''Device chaining'' can be viewed as a mechanism to allow one BVH to filter function calls to another BVH.
 
 


=== Primary Display Identification ===
=== Primary Display Identification ===
The primary display is the default display chosen by VIO for full-screen sessions. It is also the display on which VIO and hard error pop-ups are shown. Notice that the primary display used by VIO is not necessarily the display on which the Presentation Manager environment runs. The Presentation Manager interface normally runs on the highest resolution display. In a dual-display configuration, the highest resolution display is not necessarily a display that can be used in text mode.
The primary display is the default display chosen by VIO for full-screen sessions. It is also the display on which VIO and hard error pop-ups are shown. Notice that the primary display used by VIO is not necessarily the display on which the Presentation Manager environment runs. The Presentation Manager interface normally runs on the highest resolution display. In a dual-display configuration, the highest resolution display is not necessarily a display that can be used in text mode.


The primary display is the pop-up display. A physical video device driver must determine if it represents the pop-up display. If so, the video device driver must specify that it represents the pop-up display configuration in Query Config Info.
The primary display is the pop-up display. A physical video device driver must determine if it represents the pop-up display. If so, the video device driver must specify that it represents the pop-up display configuration in Query Config Info.


 
===WrtToScrn/Panic Write Support===
 
Before the video subsystem is loaded, and when the system is about to abnormally terminate, messages are sent to the screen by the ''WrtToScrn'' function, also known as Panic Write. This function switches to real mode and executes the INT 10h function to set the video mode to a text mode (BIOS mode 3). It then uses BIOS INT 10h, "Write TTY", to display the message.
=== WrtToScrn/Panic Write Support ===
 
Before the video subsystem is loaded, and when the system is about to abnormally terminate, messages are sent to the screen by the ''WrtToScrn''function, also known as Panic Write. This function switches to real mode and executes the INT 10h function to set the video mode to a text mode ( BIOS mode 3). It then uses BIOS INT 10h, &quot;Write TTY&quot;, to display the message.


However, adapters such as the 8514/A have native modes that cannot be changed by INT 10h. In such cases, the BVH must include a Level 0 device driver that hooks INT 10h to provide extended set mode support. This hook must force the adapter out of its native mode, and then pass control to the previous INT 10h support. If these conditions are not satisfied, the adapter should not drive the power up display.
However, adapters such as the 8514/A have native modes that cannot be changed by INT 10h. In such cases, the BVH must include a Level 0 device driver that hooks INT 10h to provide extended set mode support. This hook must force the adapter out of its native mode, and then pass control to the previous INT 10h support. If these conditions are not satisfied, the adapter should not drive the power up display.


 
===System Installation===
 
=== System Installation ===
 
The generic device handler, BVHINIT.DLL, is used primarily by system installation. It is also used for those situations when video devices have not been identified in the CONFIG.SYS file. It provides only the functions required for system installation and is otherwise device-independent.
The generic device handler, BVHINIT.DLL, is used primarily by system installation. It is also used for those situations when video devices have not been identified in the CONFIG.SYS file. It provides only the functions required for system installation and is otherwise device-independent.


Through ''VioGetConfig''BVHINIT.DLL reports the highest function video adapter and display it can identify. It can identify only the MPA, CGA, EGA, VGA, 8514A, and XGA, along with their respective displays. Although it does not support mode and font setting, it attempts to load the 850 code page for the current EGA or VGA mode during system initialization.
Through ''VioGetConfig'' BVHINIT.DLL reports the highest function video adapter and display it can identify. It can identify only the MPA, CGA, EGA, VGA, 8514A, and XGA, along with their respective displays. Although it does not support mode and font setting, it attempts to load the 850 code page for the current EGA or VGA mode during system initialization.


If video devices have not been identified in the CONFIG.SYS file, the generic device handler attempts to load each of the following devices, until one is successfully loaded:
If video devices have not been identified in the CONFIG.SYS file, the generic device handler attempts to load each of the following devices, until one is successfully loaded:
GENERIC=DEVICE(BVHVGA,BVH8514A)
GENERIC=DEVICE(BVHVGA)
GENERIC=DEVICE(BVHEGA)
GENERIC=DEVICE(BVHCGA)
GENERIC=DEVICE(BVHINIT)


<pre class="western">        GENERIC=DEVICE(BVHVGA,BVH8514A)
===Loadable Device Drivers===
        GENERIC=DEVICE(BVHVGA)
        GENERIC=DEVICE(BVHEGA)
        GENERIC=DEVICE(BVHCGA)
        GENERIC=DEVICE(BVHINIT)</pre>
 
 
=== Loadable Device Drivers ===
 
Loadable device drivers present a unique problem when used to support video devices because some video support can be required before the DEVICE= statements have been processed by system initialization. To handle this problem, two different initialization calls are made.
Loadable device drivers present a unique problem when used to support video devices because some video support can be required before the DEVICE= statements have been processed by system initialization. To handle this problem, two different initialization calls are made.


The Enable subfunction determines which type of initialization is to be done. If the subfunction is 1 (Fill Logical Device Block), the ''DevEnable''function is requested to add all of the functions supported by the device handler to the Call Vector Table. If the subfunction is 3 (Fill Initialization Device Block), the ''InitEnable''function is requested to add only those functions, that can be supported without the use of a loadable device driver to the Call Vector Table.
The Enable subfunction determines which type of initialization is to be done. If the subfunction is 1 (Fill Logical Device Block), the ''DevEnable'' function is requested to add all of the functions supported by the device handler to the Call Vector Table. If the subfunction is 3 (Fill Initialization Device Block), the ''InitEnable'' function is requested to add only those functions, that can be supported without the use of a loadable device driver to the Call Vector Table.
 
Regardless of the success of the ''InitEnable''function, the ''DevEnable''function is called at Shell Initialization time. See [[00053.htm|DevEnable]], and [[00054.htm|InitEnable]]for more information.
 
 


=== Video Device Handler Interfaces ===
Regardless of the success of the ''InitEnable'' function, the ''DevEnable'' function is called at Shell Initialization time. See [[#DevEnable|DevEnable]], and [[#InitEnable|InitEnable]] for more information.


==Video Device Handler Interfaces==
The functions that follow are video primitives reserved for use by OS/2 system components. Unexpected results can occur if these functions are started by applications. All of the video device handler functions described below (except for the DLL Initialization function) use the same calling sequence. Parameters are passed to the routines on the stack. The entry point is found in the BVH Call Vector Table at the index of the function number. The calling sequence used to invoke all the routines is as follows:
The functions that follow are video primitives reserved for use by OS/2 system components. Unexpected results can occur if these functions are started by applications. All of the video device handler functions described below (except for the DLL Initialization function) use the same calling sequence. Parameters are passed to the routines on the stack. The entry point is found in the BVH Call Vector Table at the index of the function number. The calling sequence used to invoke all the routines is as follows:
 
<pre>
<pre class="western">     PUSH@    OTHER    Environment        ; Environment buffer
    PUSH@    OTHER    Environment        ; Environment buffer
     PUSH@    OTHER    ParmBlock          ; Parameter block
     PUSH@    OTHER    ParmBlock          ; Parameter block
     PUSH    DWORD    Function          ; Function number
     PUSH    DWORD    Function          ; Function number


     CALL    FAR      BVH Routine Entry Point</pre>
     CALL    FAR      BVH Routine Entry Point
</pre>
'''Environment:'''
'''Environment:'''


Line 125: Line 96:


A data structure containing all of the parameters of the operation to be performed. The general format of this structure is:
A data structure containing all of the parameters of the operation to be performed. The general format of this structure is:
 
<pre>
<pre class="western">   Length of parameter block in bytes (=NN)  WORD
    Length of parameter block in bytes (=NN)  WORD
     Flags                                    WORD
     Flags                                    WORD


Line 134: Line 105:
         ON  = Initialize the environment buffer and the hardware state
         ON  = Initialize the environment buffer and the hardware state


     Bits 1 through 15 are reserved and must be OFF.</pre>
     Bits 1 through 15 are reserved and must be OFF.
The length of the parameter block is the total length, including the length field itself. The number in parentheses ( =NN ) represents the value of this field, if it is a constant.
</pre>
 
The length of the parameter block is the total length, including the length field itself. The number in parentheses (=NN) represents the value of this field, if it is a constant.
The first flag bit always indicates a background versus foreground state for this function. If the bit is ON, the adapter is actually updated, as it is when an application is in the foreground. If the bit is OFF, only the buffer that is used to shadow the adapter when an application is in the background is actually updated. All bits that are not currently defined as reserved must be OFF.
The first flag bit always indicates a background versus foreground state for this function. If the bit is ON, the adapter is actually updated, as it is when an application is in the foreground. If the bit is OFF, only the buffer that is used to shadow the adapter when an application is in the background is actually updated. All bits that are not currently defined as reserved must be OFF.


Line 142: Line 113:


The function identifier for this routine. This corresponds to the offset into the Call Vector Table, and can be used to determine the number of parameters on the stack. This is consistent with the existing DDI used by the Presentation Manager interface. All routines are expected to return with AX = 0 if no error was detected. Otherwise, an error code is returned in AX. The following errors are common to all commands:
The function identifier for this routine. This corresponds to the offset into the Call Vector Table, and can be used to determine the number of parameters on the stack. This is consistent with the existing DDI used by the Presentation Manager interface. All routines are expected to return with AX = 0 if no error was detected. Otherwise, an error code is returned in AX. The following errors are common to all commands:
 
    ERROR_VIO_INVALID_LENGTH, if the parameter block length is incorrect.
<pre class="western">    ERROR_VIO_INVALID_LENGTH, if the parameter block length is incorrect.
     ERROR_VIO_INVALID_PARMS,  if a reserved flag bit is non-zero, or if
     ERROR_VIO_INVALID_PARMS,  if a reserved flag bit is non-zero, or if
                               the function number does not match the routine.</pre>
                               the function number does not match the routine.
 
 
=== DevEnable ===


==DevEnable==
This function fills the entries in the Call Vector Table for all of the functions supported by this BVH. It is called as a subfunction of the Presentation Manager enable function entry point. To initialize the Call Vector Table for dynamic link libraries:
This function fills the entries in the Call Vector Table for all of the functions supported by this BVH. It is called as a subfunction of the Presentation Manager enable function entry point. To initialize the Call Vector Table for dynamic link libraries:
 
<pre>
<pre class="western">   PUSH  DWORD  Parameter2    ; Variable parameter 2
    PUSH  DWORD  Parameter2    ; Variable parameter 2
     PUSH  DWORD  Parameter1    ; Variable parameter 1
     PUSH  DWORD  Parameter1    ; Variable parameter 1
     PUSH  DWORD  Subfunction  ; Enable subfunction
     PUSH  DWORD  Subfunction  ; Enable subfunction


     CALL  FAR    DevEnable</pre>
     CALL  FAR    DevEnable
'''Parameters'''
</pre>


===Parameters===
'''''Parameter2 for Subfunction=1'''''
'''''Parameter2 for Subfunction=1'''''


A far pointer to this structure:
A far pointer to this structure:
 
    DWORD  Flags Pointer
<pre class="western">    DWORD  Flags Pointer
     DWORD  Call Vector Table
     DWORD  Call Vector Table</pre>
   
'''''Flags Pointer'''''
'''''Flags Pointer'''''


Line 174: Line 143:


The functions listed below are defined as follows:
The functions listed below are defined as follows:
 
<code>
000h-0FFh (000-255) Reserved for Presentation Manager interface
:000h-0FFh (000-255) Reserved for Presentation Manager interface
 
:100h-11Fh (256-287) Reserved for BVS
100h-11Fh (256-287) Reserved for BVS
:120h-12Fh (288-303) Reserved for IBM JAPAN
 
:130h-13Fh (304-319) Reserved for MSKK
120h-12Fh (288-303) Reserved for IBM JAPAN
:100h (256) [[#Function 100h|Function 100h]] Text Buffer Update
 
:101h (257) [[#Function 101h|Function 101h]] Initialize Environment
130h-13Fh (304-319) Reserved for MSKK
:102h (258) [[#Function 102h|Function 102h]] Save Environment
 
:103h (259) [[#Function 103h|Function 103h]] Restore Environment
100h (256) [[00055.htm|Function 100h]]Text Buffer Update
:104h (260) [[#Function 104h|Function 104h]] Query Config Info
 
:105h (261) [[#Function 105h|Function 105h]] DBCS Display Info
101h (257) [[00082.htm|Function 101h]]Initialize Environment
:106H (262) [[#Function 106h|Function 106h]] Query Color Lookup Table
 
:107H (263) [[#Function 107h|Function 107h]] Set Color Lookup Table
102h (258) [[00091.htm|Function 102h]]Save Environment
:108H (264) [[#Function 108h|Function 108h]] Query Cursor Info
 
:109H (265) [[#Function 109h|Function 109h]] Set Cursor Info
103h (259) [[00100.htm|Function 103h]]Restore Environment
:10AH (266) [[#Function 10Ah|Function 10Ah]] Query Font
 
:10BH (267) [[#Function 10Bh|Function 10Bh]] Set Font
104h (260) [[00109.htm|Function 104h]]Query Config Info
:10CH (268) [[#Function 10Ch|Function 10Ch]] Query Mode
 
:10DH (269) [[#Function 10Dh|Function 10Dh]] Set Mode
105h (261) [[00117.htm|Function 105h]]DBCS Display Info
:10EH (270) [[#Function 10Eh|Function 10Eh]] Query Palette Registers
 
:10Fh (271) [[#Function 10Fh|Function 10Fh]] Set Palette Registers
106H (262) [[00127.htm|Function 106h]]Query Color Lookup Table
:110H (272) [[#Function 110h|Function 110h]] Query Physical Buffer
 
:111H (273) [[#Function 111h|Function 111h]] Free Physical Buffer
107H (263) [[00138.htm|Function 107h]]Set Color Lookup Table
:112H (274) [[#Function 112h|Function 112h]] Query Variable Info
 
:113H (275) [[#Function 113h|Function 113h]] Set Variable Info
108H (264) [[00149.htm|Function 108h]]Query Cursor Info
:114H (276) [[#Function 114h|Function 114h]] Terminate Environment
 
:115H (277) [[#Function 115h|Function 115h]] Print Screen
109H (265) [[00163.htm|Function 109h]]Set Cursor Info
:116H (278) [[#Function 116h|Function 116h]] Write TTY
 
:117H (279) [[#Function 117h|Function 117h]] Query LVB Info
10AH (266) [[00177.htm|Function 10Ah]]Query Font
</code>
 
'''''Parameter1 for Subfunction=1'''''
10BH (267) [[00189.htm|Function 10Bh]]Set Font
 
10CH (268) [[00201.htm|Function 10Ch]]Query Mode
 
10DH (269) [[00210.htm|Function 10Dh]]Set Mode
 
10EH (270) [[00219.htm|Function 10Eh]]Query Palette Registers
 
10Fh (271) [[00230.htm|Function 10Fh]]Set Palette Registers
 
110H (272) [[00241.htm|Function 110h]]Query Physical Buffer
 
111H (273) [[00250.htm|Function 111h]]Free Physical Buffer
 
112H (274) [[00259.htm|Function 112h]]Query Variable Info
 
113H (275) [[00279.htm|Function 113h]]Set Variable Info
 
114H (276) [[00299.htm|Function 114h]]Terminate Environment
 
115H (277) [[00308.htm|Function 115h]]Print Screen
 
116H (278) [[00318.htm|Function 116h]]Write TTY
 
117H (279) [[00330.htm|Function 117h]]Query LVB Info <br />'''''Parameter1 for Subfunction=1'''''


Far pointer to this structure:
Far pointer to this structure:
 
DWORD  Engine Version
<pre class="western">    DWORD  Engine Version
DWORD  Count of Table Functions
    DWORD  Count of Table Functions</pre>
'''''Engine Version'''''
'''''Engine Version'''''


Line 249: Line 192:
'''Remarks'''
'''Remarks'''


This function is supported by the video dynamic link functions and is called only once for each adapter supported by the physical device driver. A video device handler determines if the display adapter and that which the adapter supports is present. If not present, this function returns an error . Every part of a BVH must successfully initialize the Call Vector Table for that device to be usable by the OS/2 operating system.
This function is supported by the video dynamic link functions and is called only once for each adapter supported by the physical device driver. A video device handler determines if the display adapter and that which the adapter supports is present. If not present, this function returns an error. Every part of a BVH must successfully initialize the Call Vector Table for that device to be usable by the OS/2 operating system.


 
==InitEnable==
 
This function fills the entries in the Call Vector Table for all of the functions supported by this BVH using only SCREEN$ device driver. It is called with parameters similar to the ''DevEnable'' entry point specified in [[#DevEnable|DevEnable]], except for the Subfunction parameter.
=== InitEnable ===
 
This function fills the entries in the Call Vector Table for all of the functions supported by this BVH using only SCREEN$ device driver. It is called with parameters similar to the ''DevEnable''entry point specified in [[00053.htm|DevEnable]], except for the Subfunction parameter.


To initialize the Call Vector Table for dynamic link libraries:
To initialize the Call Vector Table for dynamic link libraries:
PUSH  DWORD  Parameter2    ; Variable parameter 2
PUSH  DWORD  Parameter1    ; Variable parameter 1
PUSH  DWORD  Subfunction  ; Enable subfunction
CALL  FAR    InitEnable


<pre class="western">    PUSH  DWORD  Parameter2    ; Variable parameter 2
===Parameters===
    PUSH  DWORD  Parameter1    ; Variable parameter 1
    PUSH  DWORD  Subfunction  ; Enable subfunction
 
    CALL  FAR    InitEnable</pre>
'''Parameters'''
 
'''''Parameter2 for Subfunction=3'''''
'''''Parameter2 for Subfunction=3'''''


See [[00053.htm|DevEnable]].
See [[#DevEnable|DevEnable]].


'''''Parameter1 for Subfunction='''''
'''''Parameter1 for Subfunction='''''


See [[00053.htm|DevEnable]]. Subfunction is the Presentation Manager enable subfunction number. Its value must be 3 to start the Presentation Manager Fill Initialization Device Block subfunction. The default entry point of ''DevEnable''can be overridden by specifying an alternate name in the DEVICE() parameter describing this BVH in the CONFIG.SYS file.
See [[#DevEnable|DevEnable]]. Subfunction is the Presentation Manager enable subfunction number. Its value must be 3 to start the Presentation Manager Fill Initialization Device Block subfunction. The default entry point of ''DevEnable'' can be overridden by specifying an alternate name in the DEVICE() parameter describing this BVH in the CONFIG.SYS file.


'''Remarks'''
'''Remarks'''
Line 279: Line 218:


The BVH must be able to support the following subfunctions:
The BVH must be able to support the following subfunctions:
<code>
:100h (256) [[#Function 100h|Function 100h]] Text Buffer Update
:101h (257) [[#Function 101h|Function 101h]] Initialize Environment
:102h (258) [[#Function 102h|Function 102h]] Save Environment (settable environment only)
:103h (259) [[#Function 103h|Function 103h]] Restore Environment (settable environment only)
:104h (260) [[#Function 104h|Function 104h]] Query Config Info
:105h (261) [[#Function 105h|Function 105h]] DBCS Display Info
:108H (264) [[#Function 108h|Function 108h]] Query Cursor Info
:109H (265) [[#Function 109h|Function 109h]] Set Cursor Info
:10CH (268) [[#Function 10Ch|Function 10Ch]] Query Mode (80x25 text or equivalent only)
:10DH (269) [[#Function 10Dh|Function 10Dh]] Set Mode (80x25 text or equivalent only)
:112H (274) [[#Function 112h|Function 112h]] Query Variable Info (code page only)
:113H (275) [[#Function 113h|Function 113h]] Set Variable Info (code page only)
</code>
See [[#DevEnable|DevEnable]].


100h (256) [[00055.htm|Function 100h]]Text Buffer Update
===Function 100h===
 
;Text Buffer Update - Function 100h:This function performs text updates to the logical and physical video buffers. All references to the buffer are made through the text row and column of each cell affected by the called function.
101h (257) [[00082.htm|Function 101h]]Initialize Environment
;Parmlength:Length of the data structure in bytes (greater than, or equal to, 26), including the ''Length''field itself. The maximum length is 44 bytes. Values not passed are assumed to be the default values for the environment.
 
;Flags :Defined as follows:
102h (258) [[00091.htm|Function 102h]]Save Environment (settable environment only)
:Bit 0 indicates whether the physical video buffer needs to be updated.
 
::OFF = The physical video buffer must not be updated.
103h (259) [[00100.htm|Function 103h]]Restore Environment (settable environment only)
::ON  = The physical video buffer must be updated.
 
:Bit 1 indicates whether the logical video buffer needs to be updated.
104h (260) [[00109.htm|Function 104h]]Query Config Info
::OFF = The logical video buffer may optionally be updated.
 
::ON  = The logical video buffer must be updated.
105h (261) [[00117.htm|Function 105h]]DBCS Display Info
:Bit 2 indicates that attribute information in the user buffer is in CGA format and might need to be translated into the format used by the device. This bit is set for VioWrtTTY calls any time that ANSI is active, because
 
108H (264) [[00149.htm|Function 108h]]Query Cursor Info
 
109H (265) [[00163.htm|Function 109h]]Set Cursor Info
 
10CH (268) [[00201.htm|Function 10Ch]]Query Mode (80x25 text or equivalent only)
 
10DH (269) [[00210.htm|Function 10Dh]]Set Mode (80x25 text or equivalent only)
 
112H (274) [[00259.htm|Function 112h]]Query Variable Info (code page only)
 
113H (275) [[00279.htm|Function 113h]]Set Variable Info (code page only)
 
See [[00053.htm|DevEnable]].
 
 
 
=== Text Buffer Update - Function 100h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />100h <br />'''Description:'''<br />Text Buffer Update
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function performs text updates to the logical and physical video buffers. All references to the buffer are made through the text row and column of each cell affected by the called function.
 
 
 
=== Function 100h - Description ===
 
This function performs text updates to the logical and physical video buffers. All references to the buffer are made through the text row and column of each cell affected by the called function.
 
 
 
=== Function 100h - Parmlength ===
 
'''Parmlength'''
 
Length of the data structure in bytes (greater than, or equal to, 26), including the ''Length''field itself. The maximum length is 44 bytes. Values not passed are assumed to be the default values for the environment.
 
 
 
=== Function 100h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical video buffer needs to be updated.
 
      OFF = The physical video buffer must not be updated.
      ON  = The physical video buffer must be updated.
 
Bit 1 indicates whether the logical video buffer needs to be updated.
 
      OFF = The logical video buffer may optionally be updated.
      ON  = The logical video buffer must be updated.
 
Bit 2 indicates that attribute information in the user buffer is in CGA
format and might need to be translated into the format used by the device.
This bit is set for VioWrtTTY calls any time that ANSI is active, because
ANSI recognizes only CGA format attributes.
ANSI recognizes only CGA format attributes.
::OFF = Use attributes in existing format.
::ON  = Translation to or from CGA format required.
:Bits 3-15 are reserved and must be OFF.
;Selector/Offset of the Application Data Area :Pointer to the application's data area, which provides either the source or the destination for the buffer operation.
;Selector/Offset of the Secondary Data Area: Pointer to the additional parameter required by this type of update operation. It is used to define, at most, one cell of information that is used repetitively as filler. This is used only with Index = 3, 4, 5, 6, or 9.
;Index :Defined as follows:
:0 = Read Cell Types from (Row,Col) as word of flags:
::Bit 0 indicates whether the cell is part of a single or double cell character.
:::OFF = The cell represents a single cell character.
:::ON  = The cell represents part of a double cell character.  Bit 1 is examined for more information.
::Bit 1 indicates whether the cell is a trailing cell of a double cell character.
:::OFF = The cell represents the leading or only cell of a character.
:::ON  = The cell represents the trailing cell of a double cell character.
::Bits 2 thru 15 are reserved and must be OFF.
::1 = Read Characters from (Row,Col)
::2 = Read Cells from (Row,Col)
::3 = Scroll (Row,Col) through (Row2,Col2) Up
::4 = Scroll (Row,Col) through (Row2,Col2) Down
::5 = Scroll (Row,Col) through (Row2,Col2) Left
::6 = Scroll (Row,Col) through (Row2,Col2) Right
::7 = Write Cells to (Row,Col)
::8 = Write Characters to (Row,Col)
::9 = Write Characters with Constant Attr to (Row,Col)
::10 = Write Repeated Character to (Row,Col)
::11 = Write Repeated Attribute to (Row,Col)
::12 = Write Repeated Cell to (Row,Col)
::13 = Copy LVB Rect to PVB


      OFF = Use attributes in existing format.
;Starting Row:Defines the text location (row) in the Video Buffer at which the update is to be started. For Function 13, this is the upper-left corner of the rectangle to be written.
      ON  = Translation to or from CGA format required.
;Starting Column :Defines the text location (column) in the Video Buffer at which the update is to be started. For Function 13, this is the upper-left corner of the rectangle to be written.
 
;Secondary Row :Defines the text location (row) in the Video Buffer to which cells will be moved. This is used only when moving cells from one location to another (Index=3-6). For Function 13, this is the lower-right corner of the rectangle to be written.
Bits 3-15 are reserved and must be OFF.</pre>
;Secondary Column :Defines the text location (column) in the Video Buffer to which cells will be moved. This is used only when moving cells from one location to another (Index=3-6). For Function 13, this is the lower-right corner of the rectangle to be written.
<br /><br />
;Repeat Factor:Repeat factor used when updating the buffer. It represents the number of character cells to be updated, or the number of rows or columns to be scrolled. This is used for both input and output.
 
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
;TouchXLeft :The X-coordinate of the upper-left corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched (as in a Read), -1 is returned. Collectively, this field and the next three fields form an area of influence for the call. This field is returned by the BVH.
 
;TouchYTop :The Y-coordinate of the upper-left corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
=== Function 100h - Selector/Offset of the Application Data Area ===
;TouchXRight :The X-coordinate of the lower-right corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
 
;TouchYBottom :The Y-coordinate of the lower-right corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
'''Selector/Offset of the Application Data Area'''
;LVBRowOff :The row offset of the upper-left corner of the LVB in PVB coordinates. All reads, writes, and scrolls are done in PVB coordinates.
 
;LVBColOff :The column offset of the upper-left corner of the LVB in PVB coordinates. All reads, writes, and scrolls are done in PVB coordinates.
Pointer to the application's data area, which provides either the source or the destination for the buffer operation.
;LVBWidth :The width of the LVB in cells. Must be greater than 0.
 
;LVBHeight :The height of the LVB in cells. Must be greater than 0.
 
;LVBFormatID :The format ID of the LVB. If this value and attribute count are both 0, the Format ID and attribute count for the current mode are used.
 
;LVBAttrCount :The attribute count for the LVB.
=== Function 100h - Selector/Offset of the Secondary Data Area ===
 
'''Selector/Offset of the Secondary Data Area'''Pointer to the additional parameter required by this type of update operation. It is used to define, at most, one cell of information that is used repetitively as filler. This is used only with Index = 3, 4, 5, 6, or 9.
 
 
 
=== Function 100h - Index ===
 
'''Index'''
 
Defined as follows:
 
<br /><br />
 
<pre class="western">    0 = Read Cell Types from (Row,Col) as word of flags:
 
        Bit 0 indicates whether the cell is part of a single or
              double cell character.
 
              OFF = The cell represents a single cell character.
              ON  = The cell represents part of a double cell
                      character.  Bit 1 is examined for more
                      information.
 
        Bit 1 indicates whether the cell is a trailing cell of
              a double cell character.
 
              OFF = The cell represents the leading or only cell of a
                      character.
              ON  = The cell represents the trailing cell of a double
                      cell character.
 
        Bits 2 thru 15 are reserved and must be OFF.
 
    1 = Read Characters from (Row,Col)
    2 = Read Cells from (Row,Col)
    3 = Scroll (Row,Col) through (Row2,Col2) Up
    4 = Scroll (Row,Col) through (Row2,Col2) Down
    5 = Scroll (Row,Col) through (Row2,Col2) Left
    6 = Scroll (Row,Col) through (Row2,Col2) Right
    7 = Write Cells to (Row,Col)
    8 = Write Characters to (Row,Col)
    9 = Write Characters with Constant Attr to (Row,Col)
    10 = Write Repeated Character to (Row,Col)
    11 = Write Repeated Attribute to (Row,Col)
    12 = Write Repeated Cell to (Row,Col)
    13 = Copy LVB Rect to PVB</pre>
<br /><br />
 
 
 
=== Function 100h - Starting Row ===
 
'''Starting Row'''
 
Defines the text location (row) in the Video Buffer at which the update is to be started. For Function 13, this is the upper-left corner of the rectangle to be written.
 
 
 
=== Function 100h - Starting Column ===
 
'''Starting Column'''
 
Defines the text location (column) in the Video Buffer at which the update is to be started. For Function 13, this is the upper-left corner of the rectangle to be written.
 
 
 
=== Function 100h - Secondary Row ===
 
'''Secondary Row'''
 
Defines the text location (row) in the Video Buffer to which cells will be moved. This is used only when moving cells from one location to another ( Index=3-6). For Function 13, this is the lower-right corner of the rectangle to be written.
 
 
 
=== Function 100h - Secondary Column ===
 
'''Secondary Column'''
 
Defines the text location (column) in the Video Buffer to which cells will be moved. This is used only when moving cells from one location to another (Index=3-6). For Function 13, this is the lower-right corner of the rectangle to be written.
 
 
 
=== Function 100h - Repeat Factor ===
 
'''Repeat Factor'''
 
Repeat factor used when updating the buffer. It represents the number of character cells to be updated, or the number of rows or columns to be scrolled. This is used for both input and output.
 
 
 
=== Function 100h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 100h - TouchXLeft ===
 
'''TouchXLeft'''
 
The X-coordinate of the upper-left corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched (as in a Read), -1 is returned. Collectively, this field and the next three fields form an area of influence for the call. This field is returned by the BVH.
 
 
 
=== Function 100h - TouchYTop ===
 
'''TouchYTop'''
 
The Y-coordinate of the upper-left corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
 
 
 
=== Function 100h - TouchXRight ===
 
'''TouchXRight'''
 
The X-coordinate of the lower-right corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
 
 
 
=== Function 100h - TouchYBottom ===
 
'''TouchYBottom'''
 
The Y-coordinate of the lower-right corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
 
 
 
=== Function 100h - LVBRowOff ===
 
'''LVBRowOff'''
 
The row offset of the upper-left corner of the LVB in PVB coordinates. All reads, writes, and scrolls are done in PVB coordinates.
 
 
 
=== Function 100h - LVBColOff ===
 
'''LVBColOff'''
 
The column offset of the upper-left corner of the LVB in PVB coordinates. All reads, writes, and scrolls are done in PVB coordinates.
 
 
 
=== Function 100h - LVBWidth ===
 
'''LVBWidth'''
 
The width of the LVB in cells. Must be greater than 0.
 
 
 
=== Function 100h - LVBHeight ===
 
'''LVBHeight'''
 
The height of the LVB in cells. Must be greater than 0.
 
 
 
=== Function 100h - LVBFormatID ===
 
'''LVBFormatID'''
 
The format ID of the LVB. If this value and attribute count are both 0, the Format ID and attribute count for the current mode are used.
 
 
 
=== Function 100h - LVBAttrCount ===
 
'''LVBAttrCount'''
 
The attribute count for the LVB.
 
 
 
=== Function 100h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Parmlength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Selector/Offset of the        DWORD    |
|Application Data Area                    |
|-----------------------------------------|
|Selector/Offset of the        DWORD    |
|Secondary Data Area                      |
|-----------------------------------------|
|Index                          WORD      |
|-----------------------------------------|
|Starting Row                  WORD      |
|-----------------------------------------|
|Starting Column                WORD      |
|-----------------------------------------|
|Secondary Row                  WORD      |
|-----------------------------------------|
|Secondary Column              WORD      |
|-----------------------------------------|
|Repeat Factor                  WORD      |
|-----------------------------------------|
|Logical Buffer Selector        WORD      |
|-----------------------------------------|
|TouchXLeft                    WORD      |
|-----------------------------------------|
|TouchYTop                      WORD      |
|-----------------------------------------|
|TouchXRight                    WORD      |
|-----------------------------------------|
|TouchYBottom                  WORD      |
|-----------------------------------------|
|LVBRowOff                      WORD      |
|-----------------------------------------|
|LVBColOff                      WORD      |
|-----------------------------------------|
|LVBWidth                      WORD      |
|-----------------------------------------|
|LVBHeight                      WORD      |
|-----------------------------------------|
|LVBFormatID                    BYTE      |
|-----------------------------------------|
|LVBAttrCount                  BYTE      |
\-----------------------------------------/</pre>
 
 
=== Function 100h - Returns ===


{|class="wikitable"
!Field||Length
|+Function 100h - Parameter Packet Format
|Parmlength||WORD
|-
|Flags||WORD
|-
|Selector/Offset of the Application Data Area||DWORD
|-
|Selector/Offset of the Secondary Data Area||DWORD
|-
|Index||WORD
|-
|Starting Row||WORD
|-
|Starting Column||WORD
|-
|Secondary Row||WORD
|-
|Secondary Column||WORD
|-
|Repeat Factor||WORD
|-
|Logical Buffer Selector||WORD
|-
|TouchXLeft||WORD
|-
|TouchYTop||WORD
|-
|TouchXRight||WORD
|-
|TouchYBottom||WORD
|-
|LVBRowOff||WORD
|-
|LVBColOff||WORD
|-
|LVBWidth||WORD
|-
|LVBHeight||WORD
|-
|LVBFormatID||BYTE
|-
|LVBAttrCount||BYTE
|}
;Returns
The Text Buffer Update routine returns with AX = 0, if no error was detected. Otherwise, the following error codes are returned in AX:
The Text Buffer Update routine returns with AX = 0, if no error was detected. Otherwise, the following error codes are returned in AX:
{|
|ERROR_VIO_COL,||if an invalid column number was specified
|-
|ERROR_VIO_INVALID_LENGTH,||if the ParmLength was incorrect
|-
|ERROR_VIO_INVALID_PARMS,||if the Index was incorrect
|-
|ERROR_VIO_MODE,||if updates are not supported in the current video mode
|-
|ERROR_VIO_ROW,||if an invalid row number was specified.
|}
;Remarks
The Touch''xxxx'' fields circumscribe the area of the LVB, or PVB, for a rectangle that was potentially changed by the given operation. For example, a Write that included the cells (10,12) to (79,12), (0,13) to (79,13), and (0,14) to (8,14) returns TouchXLeft=0, TouchYTop=12, TouchXRight=79, and TouchYBottom=14. Any new functions added to the BVH interface that can affect the data in the PVB or LVB must include a return area for the rectangle of the video buffer that was affected by the given call.


<br /><br />
The LVB''xxxx'' fields indicate that an LVB can differ from the normal LVB format. The information about the LVB is taken from these fields, if they are included. Notice that these fields allow an LVB to begin at a location other than (0,0) and allow LVBs of different row and column dimensions.
 
<pre class="western">    ERROR_VIO_COL,              if an invalid column number was specified
    ERROR_VIO_INVALID_LENGTH,  if the ParmLength was incorrect
    ERROR_VIO_INVALID_PARMS,    if the Index was incorrect
    ERROR_VIO_MODE,            if updates are not supported in the
                                  current video mode
    ERROR_VIO_ROW,              if an invalid row number was specified.</pre>
 
 
=== Function 100h - Remarks ===
 
The Touch''xxxx''fields circumscribe the area of the LVB, or PVB, for a rectangle that was potentially changed by the given operation. For example, a Write that included the cells (10,12) to (79,12), (0,13) to (79,13), and (0,14) to (8,14) returns TouchXLeft=0, TouchYTop=12, TouchXRight=79, and TouchYBottom=14. Any new functions added to the BVH interface that can affect the data in the PVB or LVB must include a return area for the rectangle of the video buffer that was affected by the given call.
 
The LVB''xxxx''fields indicate that an LVB can differ from the normal LVB format. The information about the LVB is taken from these fields, if they are included. Notice that these fields allow an LVB to begin at a location other than (0,0) and allow LVBs of different row and column dimensions.
 
 
 
=== Function 100h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />100h <br />'''Description:'''<br />Text Buffer Update
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Initialize Environment - Function 101h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />101h <br />'''Description:'''<br />Initialize Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function causes the Environment Buffer and the video adapter (optional ) to be initialized.
 
 
 
=== Function 101h - Description ===
 
This function causes the Environment Buffer and the video adapter (optional ) to be initialized.
 
 
 
=== Function 101h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=6) passed on input.
 
 
 
=== Function 101h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware is
      updated.
 
      OFF = Initialize only the environment buffer.
      ON  = Initialize the environment buffer and the
            hardware state.
 
Bit 1 indicates whether the 3xBox is being
      initialized.
 
      OFF = The 3xBox is not being initialized.
      ON  = The 3xBox is being initialized.
 
Bits 2 thru 15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 101h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 101h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Logical Buffer Selector    WORD      |
\--------------------------------------/</pre>


===Function 101h===
;Initialize Environment - Function 101h
This function causes the Environment Buffer and the video adapter (optional) to be initialized.


=== Function 101h - Returns ===
;Parmlength :Length of parameter block in bytes (=6) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is updated.
::OFF = Initialize only the environment buffer.
::ON  = Initialize the environment buffer and the hardware state.
:Bit 1 indicates whether the 3xBox is being initialized.
::OFF = The 3xBox is not being initialized.
::ON  = The 3xBox is being initialized.
:Bits 2 thru 15 are reserved and must be OFF.
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Logical Buffer Selector||WORD
|}
;Returns
This routine always returns with AX = 0.
This routine always returns with AX = 0.
 
;Remarks
 
 
=== Function 101h - Remarks ===
 
It must be possible to call Restore Environment before Save Environment.
It must be possible to call Restore Environment before Save Environment.


 
===Function 102h===
 
;Save Environment - Function 102h
=== Function 101h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />101h <br />'''Description:'''<br />Initialize Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Save Environment - Function 102h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />102h <br />'''Description:'''<br />Save Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function is used to save all aspects of the video adapter, including the hardware state and the video buffers.
This function is used to save all aspects of the video adapter, including the hardware state and the video buffers.


;Parmlength :Length of parameter block in bytes (=6) passed on input.
;Flags :Defined as follows:
:Bit 0 is reserved and must be Off.
:Bit 1 indicates whether hardware state (mode, CLUT, everything except the buffer) is saved.
::OFF = The hardware state is not saved.
::ON  = The hardware state is saved.
:Bit 2 indicates whether the physical display is fully saved for session switching.
::OFF = The physical display is not fully saved.
::ON  = The physical display is fully saved.
:Bit 3 indicates whether the physical display is partially saved for pop-ups.
::OFF = The physical display is not partially saved.
::ON  = The physical display is partially saved.
:Bits 4 thru 15 are reserved and must be OFF.</pre>
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Logical Buffer Selector||WORD
|}
;Returns
The Save Environment routine returns with AX=0 if it can successfully save the environment to the Environment Block and the Logical Video Buffer. Otherwise, it returns with AX=ERROR_VIO_MODE.


=== Function 102h - Description ===
;Remarks
 
This function is used to save all aspects of the video adapter, including the hardware state and the video buffers.
 
 
 
=== Function 102h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=6) passed on input.
 
 
 
=== Function 102h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 is reserved and must be Off.
 
Bit 1 indicates whether hardware state (mode,
      CLUT, everything except the buffer) is saved.
 
      OFF = The hardware state is not saved.
      ON  = The hardware state is saved.
 
Bit 2 indicates whether the physical display
      is fully saved for session switching.
 
      OFF = The physical display is not fully saved.
      ON  = The physical display is fully saved.
 
Bit 3 indicates whether the physical display
      is partially saved for pop-ups.
 
      OFF = The physical display is not partially saved.
      ON  = The physical display is partially saved.
 
Bits 4 thru 15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 102h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 102h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Logical Buffer Selector    WORD      |
\--------------------------------------/</pre>
 
 
=== Function 102h - Returns ===
 
The Save Environment routine returns with AX = 0 if it can successfully save the environment to the Environment Block and the Logical Video Buffer. Otherwise, it returns with AX = ERROR_VIO_MODE.
 
 
 
=== Function 102h - Remarks ===
 
Bits 2 and 3 are mutually exclusive. If both are specified, bit 3 will be ignored. Bit 4 is used in combination with bits 2 and 3. The code and data segments referenced or accessed to perform the functions selected by bits 1 and 3 must be locked during device driver initialization. The format of the data saved in the segments passed as input is determined by the device handler.
Bits 2 and 3 are mutually exclusive. If both are specified, bit 3 will be ignored. Bit 4 is used in combination with bits 2 and 3. The code and data segments referenced or accessed to perform the functions selected by bits 1 and 3 must be locked during device driver initialization. The format of the data saved in the segments passed as input is determined by the device handler.


Partial saves are started on VIO and ''hard error pop-ups''. Pop-ups appear on the primary display configuration. The device driver must save whatever portion of the physical display buffer that is overlaid by the pop-up. To display a pop-up, OS/2 2.1 switches to the highest resolution 80 x 25 text mode supported by the primary display configuration (mode 3 or 7, whichever is listed first in the list of modes supported by the display configuration ). Alternatively, if a device driver's physical display buffer is not overlaid by a pop-up, the physical device driver returns zero for partial save size.
Partial saves are started on VIO and ''hard error pop-ups''. Pop-ups appear on the primary display configuration. The device driver must save whatever portion of the physical display buffer that is overlaid by the pop-up. To display a pop-up, OS/2 2.1 switches to the highest resolution 80 x 25 text mode supported by the primary display configuration (mode 3 or 7, whichever is listed first in the list of modes supported by the display configuration). Alternatively, if a device driver's physical display buffer is not overlaid by a pop-up, the physical device driver returns zero for partial save size.


When a hard error pop-up occurs before a VIO pop-up has cleared, the Save Environment function is called twice before the Restore Environment is called. Therefore, the device handler must be prepared to handle both a partial save of a graphics mode and a full save of the text mode of the user pop-up.
When a hard error pop-up occurs before a VIO pop-up has cleared, the Save Environment function is called twice before the Restore Environment is called. Therefore, the device handler must be prepared to handle both a partial save of a graphics mode and a full save of the text mode of the user pop-up.


OS/2 allocates the buffer in which the physical display buffer is saved by using ''DosAllocHuge''. The selector to the Data Packet addresses the first of ''n''segments in which the physical display buffer is saved. (The offset to the Data Packet should be ignored.) The selector to the second segment can be calculated by adding the ''DosAllocHuge''increment to the first selector value. The third selector can similarly be calculated by adding the ''DosAllocHuge''increment to the second selector value, and so forth. Enough selectors are allocated to meet the full/partial buffer requirement specified by the physical device driver. The selectors each address 64KB except the last selector, which addresses the remainder.
OS/2 allocates the buffer in which the physical display buffer is saved by using ''DosAllocHuge''. The selector to the Data Packet addresses the first of ''n'' segments in which the physical display buffer is saved. (The offset to the Data Packet should be ignored.) The selector to the second segment can be calculated by adding the ''DosAllocHuge'' increment to the first selector value. The third selector can similarly be calculated by adding the ''DosAllocHuge'' increment to the second selector value, and so forth. Enough selectors are allocated to meet the full/partial buffer requirement specified by the physical device driver. The selectors each address 64KB except the last selector, which addresses the remainder.
 
=== Function 102h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />102h <br />'''Description:'''<br />Save Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Restore Environment - Function 103h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />103h <br />'''Description:'''<br />Restore Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----


===Function 103h ===
;Restore Environment - Function 103h
This function is used to restore all aspects of the video adapter, including the hardware state and the video buffers.
This function is used to restore all aspects of the video adapter, including the hardware state and the video buffers.
;Parmlength :Length of parameter block in bytes (=6) passed on input.
;Flags :Defined as follows:
:Bit 0 is reserved and must be Off.
:Bit 1 indicates whether hardware state (mode, CLUT, everything except the buffer) is saved.
::OFF = The hardware state is not restored.
::ON  = The hardware state is restored.
:Bit 2 indicates whether the physical display is fully restored for session switching.
::OFF = The physical display is not fully restored.
::ON  = The physical display is fully restored.
:Bit 3 indicates whether the physical display is partially restored for pop-ups.
::OFF = The physical display is not partially restored.
::ON  = The physical display is partially restored.
:Bits 4 thru 15 are reserved and must be OFF.
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
{|class="wikitable"
|+Function 103h - Parameter Packet Format
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Logical Buffer Selector||WORD
|}
;Returns
The Restore Environment routine returns with AX = 0 if it can successfully restore the environment to the Environment Block and the Logical Video Buffer. Otherwise, it returns with AX = ERROR_VIO_MODE. See [[#Function 102h|Function 102h]] for more information.


 
===Function 104h===
 
;Query Config Info - Function 104h
=== Function 103h - Description ===
 
This function is used to restore all aspects of the video adapter, including the hardware state and the video buffers.
 
 
 
=== Function 103h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=6) passed on input.
 
 
 
=== Function 103h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 is reserved and must be Off.
 
Bit 1 indicates whether hardware state (mode,
      CLUT, everything except the buffer) is saved.
 
      OFF = The hardware state is not restored.
      ON  = The hardware state is restored.
 
Bit 2 indicates whether the physical display
      is fully restored for session switching.
 
      OFF = The physical display is not fully restored.
      ON  = The physical display is fully restored.
 
Bit 3 indicates whether the physical display
      is partially restored for pop-ups.
 
      OFF = The physical display is not partially restored.
      ON  = The physical display is partially restored.
 
Bits 4 thru 15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 103h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 103h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Logical Buffer Selector    WORD      |
\--------------------------------------/</pre>
 
 
=== Function 103h - Returns ===
 
The Restore Environment routine returns with AX = 0 if it can successfully restore the environment to the Environment Block and the Logical Video Buffer. Otherwise, it returns with AX = ERROR_VIO_MODE. See [[00091.htm|Function 102h]]for more information.
 
 
 
=== Function 103h - Remarks ===
 
None.
 
 
 
=== Function 103h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />103h <br />'''Description:'''<br />Restore Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Query Config Info - Function 104h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />104h <br />'''Description:'''<br />Query Config Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function returns all of the information necessary to identify the current video adapter and display.
This function returns all of the information necessary to identify the current video adapter and display.
 
;Parmlength :Length of parameter block in bytes (=8) passed on input.
 
;Flags :Must be zero.
 
;Parameter Packet Format
=== Function 104h - Description ===
{| class="wikitable"
 
!Field||Length
This function returns all of the information necessary to identify the current video adapter and display.
|-
 
|Parmlength||WORD
 
|-
 
|Flags||WORD
=== Function 104h - Parmlength ===
|}
 
;Returns
'''Parmlength'''
 
Length of parameter block in bytes (=8) passed on input.
 
 
 
=== Function 104h - Flags ===
 
'''Flags'''
 
Must be zero.
 
 
 
=== Function 104h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-------------------------\
|Field          Length   |
|-------------------------|
|Parmlength     WORD     |
|-------------------------|
|Flags         WORD     |
\-------------------------/</pre>
 
 
=== Function 104h - Returns ===
 
This function returns with AX = ERROR_VIO_INVALID_LENGTH only if the Length specified is less than 2.
This function returns with AX = ERROR_VIO_INVALID_LENGTH only if the Length specified is less than 2.


 
;Remarks
 
=== Function 104h - Remarks ===
 
The Environment Buffer is not used by this function. The Environment Buffer address is passed as a DWORD of zero. If the Length specified in the Config Data is larger than the maximum possible length, or if the Length is specified as 2 (the length of Length field itself), it is replaced by the largest valid length.
The Environment Buffer is not used by this function. The Environment Buffer address is passed as a DWORD of zero. If the Length specified in the Config Data is larger than the maximum possible length, or if the Length is specified as 2 (the length of Length field itself), it is replaced by the largest valid length.


 
===Function 105h===
 
;DBCS Display Info - Function 105h
=== Function 104h - ===
This function returns various forms of DBCS information used by the display.
 
;Parmlength :Length of parameter block in bytes. If Length is specified as 2, only the maximum length of the parameter block is returned in the length field. If the length is not 2, it defines the maximum amount of data returned.
'''Category:'''<br /><br />'''Function:'''<br />104h <br />'''Description:'''<br />Query Config Info
;Flags: Must be zero.
 
;DBCS Table Length: Length of double cell character table.
Select an item:
;DBCS Table Offset: Offset of double-cell character table, which consists of WORD pairs that define the low and high limits (inclusive) of ranges of double-cell characters.
 
;Parameter Packet Format
<pre class="western">Description
{| class="wikitable"
Parameter Packet Format
!Field||Length
Returns
|-
Remarks </pre>
|Parmlength||WORD
 
|-
 
|Flags||WORD
=== DBCS Display Info - Function 105h ===
|-
 
|DBCS Table Length||WORD
 
|-
-----
|DBCS Table Offset||WORD
 
|}
'''Category:'''<br /><br />'''Function:'''<br />105h <br />'''Description:'''<br />DBCS Display Info
;Returns
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function returns various forms of DBCS information used by the display .
 
 
 
=== Function 105h - Description ===
 
This function returns various forms of DBCS information used by the display .
 
 
 
=== Function 105h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes. If Length is specified as 2, only the maximum length of the parameter block is returned in the length field. If the length is not 2, it defines the maximum amount of data returned.
 
 
 
=== Function 105h - Flags ===
 
'''Flags'''
 
Must be zero.
 
 
 
=== Function 105h - DBCS Table Length ===
 
'''DBCS Table Length'''
 
Length of double cell character table.
 
 
 
=== Function 105h - DBCS Table Offset ===
 
'''DBCS Table Offset'''
 
Offset of double-cell character table, which consists of WORD pairs that define the low and high limits (inclusive) of ranges of double-cell characters.
 
 
 
=== Function 105h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------\
|Field                Length   |
|--------------------------------|
|Parmlength           WORD     |
|--------------------------------|
|Flags                 WORD     |
|--------------------------------|
|DBCS Table Length     WORD     |
|--------------------------------|
|DBCS Table Offset     WORD     |
\--------------------------------/</pre>
 
 
=== Function 105h - Returns ===
 
This function is used to get the DBCS display information associated with the given environment buffer, and returns with AX = ERROR_VIO_INVALID_ LENGTH if the Length specified is less than 2 or the buffer was too short to return all of the DBCS display information. Otherwise, Query DBCS Display Info returns with AX = 0.
This function is used to get the DBCS display information associated with the given environment buffer, and returns with AX = ERROR_VIO_INVALID_ LENGTH if the Length specified is less than 2 or the buffer was too short to return all of the DBCS display information. Otherwise, Query DBCS Display Info returns with AX = 0.


 
===Function 106h===
 
;Query Color Lookup Table - Function 106h
=== Function 105h - Remarks ===
 
None.
 
 
 
=== Function 105h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />105h <br />'''Description:'''<br />DBCS Display Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Query Color Lookup Table - Function 106h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />106h <br />'''Description:'''<br />Query Color Lookup Table
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function reads the definitions of the colors from the Color Lookup Table.
 
 
 
=== Function 106h - Description ===
 
This function reads the definitions of the colors from the Color Lookup Table.
This function reads the definitions of the colors from the Color Lookup Table.
 
;Parmlength :Length of parameter block in bytes (=12) passed on input.
 
;Flags: Defined as follows:
 
:Bit 0 indicates whether the physical hardware is to be read.
=== Function 106h - Parmlength ===
::OFF = Return data from the environment buffer only.
 
::ON  = Read the hardware to update the environment buffer before returning the requested data.
'''Parmlength'''
:Bits 1-15 are reserved and must be OFF.
 
;Color Lookup Table Far Address :Far address of Color Lookup Table. The Table format is device-dependent. Three-byte table entries are returned for the VGA. Each table entry contains a red, green, and blue color index, respectively.
Length of parameter block in bytes (=12) passed on input.
;Index :Index of the first table entry to get.
 
;Table Entry Quantity :Number of table entries to get. Three-byte table entries are returned for the VGA. Each table entry contains a red, green, and blue color index, respectively.
 
;Parameter Packet Format
 
{| class="wikitable"
=== Function 106h - Flags ===
!Field||Length
 
|-
'''Flags'''
|Parmlength||WORD
 
|-
Defined as follows:
|Flags||WORD
 
|-
<pre class="western">Bit 0 indicates whether the physical hardware
|Color Lookup Table Far Address||DWORD
      is to be read.
|-
 
|Index||WORD
      OFF = Return data from the environment buffer only.
|-
      ON  = Read the hardware to update the environment
|Table Entry Quantity||WORD
            buffer before returning the requested data.
|}
 
;Returns
Bits 1-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 106h - Color Lookup Table Far Address ===
 
'''Color Lookup Table Far Address'''
 
Far address of Color Lookup Table. The Table format is device-dependent. Three-byte table entries are returned for the VGA. Each table entry contains a red, green, and blue color index, respectively.
 
 
 
=== Function 106h - Index ===
 
'''Index'''
 
Index of the first table entry to get.
 
 
 
=== Function 106h - Table Entry Quantity ===
 
'''Table Entry Quantity'''
 
Number of table entries to get. Three-byte table entries are returned for the VGA. Each table entry contains a red, green, and blue color index, respectively.
 
 
 
=== Function 106h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-----------------------------------------\
|Field                          Length   |
|-----------------------------------------|
|Parmlength                     WORD     |
|-----------------------------------------|
|Flags                         WORD     |
|-----------------------------------------|
|Color Lookup Table Far Address DWORD     |
|-----------------------------------------|
|Index                         WORD     |
|-----------------------------------------|
|Table Entry Quantity           WORD     |
\-----------------------------------------/</pre>
 
 
=== Function 106h - Returns ===
 
This function returns with AX = 0 if it can successfully get all of the requested registers from the Color Lookup Table. Otherwise, this routine returns with AX = ERROR_VIO_INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO_INVALID_LENGTH if too many registers were requested.
This function returns with AX = 0 if it can successfully get all of the requested registers from the Color Lookup Table. Otherwise, this routine returns with AX = ERROR_VIO_INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO_INVALID_LENGTH if too many registers were requested.


=== Function 106h - Remarks ===
===Function 107h===
 
;Set Color Lookup Table - Function 107h
None.
 
=== Function 106h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />106h <br />'''Description:'''<br />Query Color Lookup Table
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Set Color Lookup Table - Function 107h ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />107h <br />'''Description:'''<br />Set Color Lookup Table
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function loads the definitions of the colors from the Color Lookup Table.
 
=== Function 107h - Description ===
 
This function loads the definitions of the colors from the Color Lookup Table.
This function loads the definitions of the colors from the Color Lookup Table.
;Parmlength :Length of parameter block in bytes (=12) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is updated.
::OFF = Update only the environment buffer.
::ON  = Update the environment buffer and the hardware state.
:Bits 1-15 are reserved and must be OFF.
;Color Lookup Table Far Address :Far address of Color Lookup Table. The Table format is device-dependent. The VGA format has three bytes containing the red, green and blue indices, respectively, for each color being set.
;Index :Index of the first table entry to set.
;Table Entry Quantity :Number of table entries to set.


=== Function 107h - Parmlength ===
;Parameter Packet Format
 
{| class="wikitable"
'''Parmlength'''
!Field||Length
 
|-
Length of parameter block in bytes (=12) passed on input.
|Parmlength||WORD
 
|-
=== Function 107h - Flags ===
|Flags||WORD
 
|-
'''Flags'''
|Color Lookup Table Far Address||DWORD
 
|-
Defined as follows:
|Index||WORD
 
|-
<pre class="western">Bit 0 indicates whether the physical hardware is
|Table Entry Quantity||WORD
      updated.
|}
 
      OFF = Update only the environment buffer.
      ON  = Update the environment buffer and the
            hardware state.
 
Bits 1-15 are reserved and must be OFF.</pre>
 
=== Function 107h - Color Lookup Table Far Address ===
 
'''Color Lookup Table Far Address'''
 
Far address of Color Lookup Table. The Table format is device-dependent. The VGA format has three bytes containing the red, green and blue indices, respectively, for each color being set.
 
=== Function 107h - Index ===
 
'''Index'''
 
Index of the first table entry to set.
 
=== Function 107h - Table Entry Quantity ===
 
'''Table Entry Quantity'''
 
Number of table entries to set.
 
=== Function 107h - Parameter Packet Format ===
 
<pre class="western">/-----------------------------------------\
|Field                          Length   |
|-----------------------------------------|
|Parmlength                     WORD     |
|-----------------------------------------|
|Flags                         WORD     |
|-----------------------------------------|
|Color Lookup Table Far Address DWORD     |
|-----------------------------------------|
|Index                         WORD     |
|-----------------------------------------|
|Table Entry Quantity           WORD     |
\-----------------------------------------/</pre>
 
 
=== Function 107h - Returns ===
 
This function returns with AX = 0 if it can successfully set all of the registers in the Color Lookup Table. Otherwise, it returns with AX = ERROR_ VIO_INVALID_PARMS if an invalid color register was requested, or AX = ERROR _VIO_INVALID_LENGTH if too many registers were requested.
 
 
 
=== Function 107h - Remarks ===
 
None.
 
 
 
=== Function 107h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />107h <br />'''Description:'''<br />Set Color Lookup Table
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Query Cursor Info - Function 108h ===
 
 
-----


'''Category:'''<br /><br />'''Function:'''<br />108h <br />'''Description:'''<br />Query Cursor Info
;Returns
 
This function returns with AX = 0 if it can successfully set all of the registers in the Color Lookup Table. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO_INVALID_LENGTH if too many registers were requested.
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----


===Function 108h===
;Query Cursor Info - Function 108h
This function returns all of the information related to the cursor.
This function returns all of the information related to the cursor.
;Parmlength :Length of parameter block in bytes (=16) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is to be read.
::OFF = Return data from the environment buffer only.
::ON  = Read the hardware to update the environment buffer before returning the requested data.
:The remaining flags select the information to be returned:
::Bit 1 selects cursor position.
::Bit 2 selects cursor type.
::Bits 3-15 are reserved and must be Off.
;Row :0 is the top row.
;Column :0 is the left column.
;Top Cursor Scan Line :If n scan lines, 0 is top scan line and n-1 is bottom scan line.
;Bottom Cursor Scan Line :If n scan lines, 0 is top scan line and n-1 is bottom scan line.
;Cursor Width :Cursor width in columns, if text mode; in pels, if graphics mode.
;Cursor Attribute :Cursor attribute: -1 = hidden, if text mode; other values = color attribute, if graphics mode.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Row||WORD
|-
|Column||WORD
|-
|Top Cursor Scan Line||WORD
|-
|Bottom Cursor Scan Line||WORD
|-
|Cursor Width||WORD
|-
|Cursor Attribute||WORD
|}


;Returns
This function returns with AX = 0 if it can successfully get all of the cursor information requested. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.


=== Function 108h - Description ===
===Function 109h ===
 
;Set Cursor Info - Function 109h
This function returns all of the information related to the cursor.
 
 
 
=== Function 108h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=16) passed on input.
 
 
 
=== Function 108h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware
      is to be read.
 
      OFF = Return data from the environment buffer only.
      ON  = Read the hardware to update the environment
            buffer before returning the requested data.
 
The remaining flags select the information to be
returned:
 
Bit 1 selects cursor position.
Bit 2 selects cursor type.
Bits 3-15 are reserved and must be Off.</pre>
<br /><br />
 
 
 
=== Function 108h - Row ===
 
'''Row'''
 
0 is the top row.
 
 
 
=== Function 108h - Column ===
 
'''Column'''
 
0 is the left column.
 
 
 
=== Function 108h - Top Cursor Scan Line ===
 
'''Top Cursor Scan Line'''
 
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
 
 
 
=== Function 108h - Bottom Cursor Scan Line ===
 
'''Bottom Cursor Scan Line'''
 
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
 
 
 
=== Function 108h - Cursor Width ===
 
'''Cursor Width'''
 
Cursor width in columns, if text mode; in pels, if graphics mode.
 
 
 
=== Function 108h - Cursor Attribute ===
 
'''Cursor Attribute'''
 
Cursor attribute: -1 = hidden, if text mode; other values = color attribute, if graphics mode.
 
 
 
=== Function 108h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Row                        WORD      |
|--------------------------------------|
|Column                      WORD      |
|--------------------------------------|
|Top Cursor Scan Line        WORD      |
|--------------------------------------|
|Bottom Cursor Scan Line    WORD      |
|--------------------------------------|
|Cursor Width                WORD      |
|--------------------------------------|
|Cursor Attribute            WORD      |
\--------------------------------------/</pre>
 
 
=== Function 108h - Returns ===
 
This function returns with AX = 0 if it can successfully get all of the cursor information requested. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS.
 
 
 
=== Function 108h - Remarks ===
 
None.
 
 
 
=== Function 108h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />108h <br />'''Description:'''<br />Query Cursor Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Set Cursor Info - Function 109h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />109h <br />'''Description:'''<br />Set Cursor Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function sets all of the information related to the cursor.
 
 
 
=== Function 109h - Description ===
 
This function sets all of the information related to the cursor.
This function sets all of the information related to the cursor.
;Parmlength: Length of parameter block in bytes (=16) passed on input.
;Flags: Defined as follows:
:Bit 0 indicates whether the physical hardware is updated.
::OFF = Update only the environment buffer.
::ON  = Update the environment buffer and the hardware state.
:The remaining flags select the options to be set:
::Bit 1 selects cursor position.
::Bit 2 selects cursor type.
:Bits 3-15 are reserved and must be OFF.
;Row :0 is the top row.
;Column :0 is the left column.
;Top Cursor Scan Line: If n scan lines, 0 is top scan line and n-1 is bottom scan line.
;Bottom Cursor Scan Line: If n scan lines, 0 is top scan line and n-1 is bottom scan line.
;Cursor Width: Cursor width in columns, if text mode; in pels, if graphics mode.
;Cursor Attribute :Cursor attribute: -1 = hidden, if text mode; other values = color attribute, if graphics mode.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Row||WORD
|-
|Column||WORD
|-
|Top Cursor Scan Line||WORD
|-
|Bottom Cursor Scan Line||WORD
|-
|Cursor Width||WORD
|-
|Cursor Attribute||WORD
|}


 
;Returns
=== Function 109h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=16) passed on input.
 
 
 
=== Function 109h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware is
      updated.
 
      OFF = Update only the environment buffer.
      ON  = Update the environment buffer and the
            hardware state.
 
The remaining flags select the options to be set:
 
Bit 1 selects cursor position.
Bit 2 selects cursor type.
Bits 3-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 109h - Row ===
 
'''Row'''
 
0 is the top row.
 
 
 
=== Function 109h - Column ===
 
'''Column'''
 
0 is the left column.
 
 
 
=== Function 109h - Top Cursor Scan Line ===
 
'''Top Cursor Scan Line'''
 
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
 
 
 
=== Function 109h - Bottom Cursor Scan Line ===
 
'''Bottom Cursor Scan Line'''
 
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
 
 
 
=== Function 109h - Cursor Width ===
 
'''Cursor Width'''
 
Cursor width in columns, if text mode; in pels, if graphics mode.
 
 
 
=== Function 109h - Cursor Attribute ===
 
'''Cursor Attribute'''
 
Cursor attribute: -1 = hidden, if text mode; other values = color attribute, if graphics mode.
 
 
 
=== Function 109h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Row                        WORD      |
|--------------------------------------|
|Column                      WORD      |
|--------------------------------------|
|Top Cursor Scan Line        WORD      |
|--------------------------------------|
|Bottom Cursor Scan Line    WORD      |
|--------------------------------------|
|Cursor Width                WORD      |
|--------------------------------------|
|Cursor Attribute            WORD      |
\--------------------------------------/</pre>
 
 
=== Function 109h - Returns ===
 
This function returns with AX = 0 if it can successfully set all of the cursor information requested. Otherwise, it returns with AX equal to:
This function returns with AX = 0 if it can successfully set all of the cursor information requested. Otherwise, it returns with AX equal to:
*ERROR_VIO_MODE if it cannot support the function in the current mode
*ERROR_VIO_ROW if the row number is out of range
*ERROR_VIO_COL if the column number is out of range


<pre class="western">    ERROR_VIO_MODE if it cannot support the function
===Function 10Ah===
      in the current mode
;Query Font - Function 10Ah
    ERROR_VIO_ROW if the row number is out of range
    ERROR_VIO_COL if the column number is out of range</pre>
 
 
=== Function 109h - Remarks ===
 
None.
 
=== Function 109h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />109h <br />'''Description:'''<br />Set Cursor Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Query Font - Function 10Ah ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />10Ah <br />'''Description:'''<br />Query Font
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function returns the current active font or a selected font for the current code page. The format of the font definition is determined by the type of adapter.
 
 
 
=== Function 10Ah - Description ===
 
This function returns the current active font or a selected font for the current code page. The format of the font definition is determined by the type of adapter.
This function returns the current active font or a selected font for the current code page. The format of the font definition is determined by the type of adapter.
;Parmlength :Length of parameter block in bytes (=14) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is to be read.
::OFF = Return data from the environment buffer only.
::ON  = Read the hardware to update the environment buffer before returning the requested data.
:Bit 1 indicates whether a specific font is to be returned instead of the current font.
::OFF = Return the current font.
::ON  = Return the selected font for the current code page.  Setting this flag indicates that the pel columns and rows are used as input to select the font.
:Bits 2-15 are reserved and must be OFF.
;Font Buffer Far Address: Data area in which the font definition is returned.
;Data Area Length :Length of data area in which font table is returned.
;Pel Columns :Pel columns.
;Pel Rows: Pel rows.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Font Buffer Far Address||DWORD
|-
|Data Area Length||WORD
|-
|Pel Columns||WORD
|-
|Pel Rows||WORD
|}


 
;Returns
=== Function 10Ah - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=14) passed on input.
 
 
 
=== Function 10Ah - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware
      is to be read.
 
      OFF = Return data from the environment buffer
            only.
      ON  = Read the hardware to update the environment
            buffer before returning the requested data.
 
Bit 1 indicates whether a specific font is to be
      returned instead of the current font.
 
      OFF = Return the current font.
      ON  = Return the selected font for the current code
            page.  Setting this flag indicates that the pel
            columns and rows are used as input to select
            the font.
 
Bits 2-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 10Ah - Font Buffer Far Address ===
 
'''Font Buffer Far Address'''
 
Data area in which the font definition is returned.
 
 
 
=== Function 10Ah - Data Area Length ===
 
'''Data Area Length'''
 
Length of data area in which font table is returned.
 
 
 
=== Function 10Ah - Pel Columns ===
 
'''Pel Columns'''
 
Pel columns.
 
 
 
=== Function 10Ah - Pel Rows ===
 
'''Pel Rows'''
 
Pel rows.
 
 
 
=== Function 10Ah - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Font Buffer Far Address    DWORD    |
|--------------------------------------|
|Data Area Length            WORD      |
|--------------------------------------|
|Pel Columns                WORD      |
|--------------------------------------|
|Pel Rows                    WORD      |
\--------------------------------------/</pre>
 
 
=== Function 10Ah - Returns ===
 
If the Length is specified as 0, no font is returned. Instead, the Length field returns the size needed to hold the font. Query Font returns with AX = 0 if it can successfully read the font. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.
If the Length is specified as 0, no font is returned. Instead, the Length field returns the size needed to hold the font. Query Font returns with AX = 0 if it can successfully read the font. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.


 
===Function 10Bh===
 
;Set Font - Function 10Bh
=== Function 10Ah - Remarks ===
 
None.
 
 
 
=== Function 10Ah - ===
 
'''Category:'''<br /><br />'''Function:'''<br />10Ah <br />'''Description:'''<br />Query Font
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Set Font - Function 10Bh ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />10Bh <br />'''Description:'''<br />Set Font
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function sends a user font definition to the device handler. If the font is appropriate for the current mode, it is loaded into the adapter. If not, it is saved for possible use on subsequent calls to ''SetMode''. The format of the font definition is determined by the type of adapter.
 
 
 
=== Function 10Bh - Description ===
 
This function sends a user font definition to the device handler. If the font is appropriate for the current mode, it is loaded into the adapter. If not, it is saved for possible use on subsequent calls to ''SetMode''. The format of the font definition is determined by the type of adapter.
This function sends a user font definition to the device handler. If the font is appropriate for the current mode, it is loaded into the adapter. If not, it is saved for possible use on subsequent calls to ''SetMode''. The format of the font definition is determined by the type of adapter.
;Parmlength
:Length of parameter block in bytes (=14) passed on input.
;Flags
:Defined as follows:
:Bit 0 indicates whether the physical hardware is updated.
::OFF = Update only the environment buffer.
::ON  = Update the environment buffer and the hardware state.
:Bits 1-15 are reserved and must be OFF.
;Font Buffer Far Address :Far address of the font buffer containing the font set in compact form.
;Data Area Length
:Length of data area containing the font table to be set.
;Pel Columns
:Pel columns.
;Pel Rows
:Pel rows.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Font Buffer Far Address||DWORD
|-
|Data Area Length||WORD
|-
|Pel Columns||WORD
|-
|Pel Rows||WORD
|}


 
;Returns
=== Function 10Bh - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=14) passed on input.
 
 
 
=== Function 10Bh - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware
      is updated.
 
      OFF = Update only the environment buffer.
      ON  = Update the environment buffer and the
            hardware state.
 
Bits 1-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 10Bh - Font Buffer Far Address ===
 
'''Font Buffer Far Address'''
 
Far address of the font buffer containing the font set in compact form.
 
 
 
=== Function 10Bh - Data Area Length ===
 
'''Data Area Length'''
 
Length of data area containing the font table to be set.
 
 
 
=== Function 10Bh - Pel Columns ===
 
'''Pel Columns'''
 
Pel columns.
 
 
 
=== Function 10Bh - Pel Rows ===
 
'''Pel Rows'''
 
Pel rows.
 
 
 
=== Function 10Bh - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Font Buffer Far Address    DWORD    |
|--------------------------------------|
|Data Area Length            WORD      |
|--------------------------------------|
|Pel Columns                WORD      |
|--------------------------------------|
|Pel Rows                    WORD      |
\--------------------------------------/</pre>
 
 
=== Function 10Bh - Returns ===
 
This function returns with AX = 0 if it can successfully load the font. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.
This function returns with AX = 0 if it can successfully load the font. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.


 
===Function 10Ch===
 
;Query Mode - Function 10Ch
=== Function 10Bh - Remarks ===
 
None.
 
 
 
=== Function 10Bh - ===
 
'''Category:'''<br /><br />'''Function:'''<br />10Bh <br />'''Description:'''<br />Set Font
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Query Mode - Function 10Ch ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />10Ch <br />'''Description:'''<br />Query Mode
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function returns all of the information pertaining to the current video mode.
This function returns all of the information pertaining to the current video mode.
;Parmlength: Length of parameter block in bytes (=8) passed on input.
;Flags: Defined as follows:
:Bit 0 indicates whether the physical hardware is to be read.
::OFF = Return data from the environment buffer only.
::ON  = Read the hardware to update the environment buffer before returning the requested data.
:Bits 1-15 are reserved and must be OFF.
;Mode Data Structure Far Address: Far Address of the Mode data structure defined by VioGetMode.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Mode Data Structure Far Address||DWORD
|}


;Returns
If the Length specified in the Config Data is larger than the maximum possible length or if the Length is specified as 2, it is replaced by the largest valid length. This function returns with AX = ERROR_VIO_INVALID_LENGTH only if the Length specified is less than 2.


=== Function 10Ch - Description ===
===Function 10Dh===
 
;Set Mode - Function 10Dh
This function returns all of the information pertaining to the current video mode.
 
 
 
=== Function 10Ch - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=8) passed on input.
 
 
 
=== Function 10Ch - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware is to
      be read.
 
      OFF = Return data from the environment buffer only.
      ON  = Read the hardware to update the environment
            buffer before returning the requested data.
 
Bits 1-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 10Ch - Mode Data Structure Far Address ===
 
'''Mode Data Structure Far Address'''
 
Far Address of the Mode data structure defined by VioGetMode.
 
 
 
=== Function 10Ch - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Parmlength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Mode Data Structure Far        DWORD    |
|Address                                  |
\-----------------------------------------/</pre>
 
 
=== Function 10Ch - Returns ===
 
If the Length specified in the Config Data is larger than the maximum possible length or if the Length is specified as 2, it is replaced by the largest valid length. This function returns with AX = ERROR_VIO_INVALID_ LENGTH only if the Length specified is less than 2.
 
 
 
=== Function 10Ch - Remarks ===
 
None.
 
 
 
=== Function 10Ch - ===
 
'''Category:'''<br /><br />'''Function:'''<br />10Ch <br />'''Description:'''<br />Query Mode
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Set Mode - Function 10Dh ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />10Dh <br />'''Description:'''<br />Set Mode
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function sets the video mode of the video adapter. For text modes, it considers not only what display characteristics it can support but also what ROM, code page, and user-defined fonts it has available.
This function sets the video mode of the video adapter. For text modes, it considers not only what display characteristics it can support but also what ROM, code page, and user-defined fonts it has available.
;Datalength :Length of the data structure in bytes, including Length itself (=8).
;Flags: Defined as follows:
:Bit 0 indicates whether the physical hardware is updated.
::OFF = Update only the environment buffer.
::ON  = Update the environment buffer and the hardware state.
:Bit 1 indicates whether the mode is changed or only validated.
::OFF = Perform normal mode setting.
::ON  = Perform only mode validation.
:Bits 2-15 are reserved and must be OFF.
;Mode Data Structure Far Address :Far Address of the Mode data structure defined by VioSetMode.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Datalength||WORD
|-
|Flags||WORD
|-
|Mode Data Structure Far Address||DWORD
|}


 
;Returns
=== Function 10Dh - Description ===
 
This function sets the video mode of the video adapter. For text modes, it considers not only what display characteristics it can support but also what ROM, code page, and user-defined fonts it has available.
 
=== Function 10Dh - Datalength ===
 
'''Datalength'''
 
Length of the data structure in bytes, including Length itself (=8).
 
=== Function 10Dh - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware
      is updated.
 
      OFF = Update only the environment buffer.
      ON  = Update the environment buffer and the
            hardware state.
 
Bit 1 indicates whether the mode is changed
      or only validated.
 
      OFF = Perform normal mode setting.
      ON  = Perform only mode validation.
 
Bits 2-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 10Dh - Mode Data Structure Far Address ===
 
'''Mode Data Structure Far Address'''
 
Far Address of the Mode data structure defined by VioSetMode.
 
 
 
=== Function 10Dh - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Datalength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Mode Data Structure Far        DWORD    |
|Address                                  |
\-----------------------------------------/</pre>
 
 
=== Function 10Dh - Returns ===
 
Set Mode returns with AX = 0 if it can set the requested mode. Otherwise, it returns with AX = ERROR_VIO_MODE.
Set Mode returns with AX = 0 if it can set the requested mode. Otherwise, it returns with AX = ERROR_VIO_MODE.


 
;Remarks
 
=== Function 10Dh - Remarks ===
 
This function must validate the mode data without using the environment buffer, because it might not have been initialized or might not be valid for this device. This function implicitly initializes the environment buffer if it has not already been done.
This function must validate the mode data without using the environment buffer, because it might not have been initialized or might not be valid for this device. This function implicitly initializes the environment buffer if it has not already been done.


 
===Function 10Eh===
 
;Query Palette Registers - Function 10Eh
=== Function 10Dh - ===
 
'''Category:'''<br /><br />'''Function:'''<br />10Dh <br />'''Description:'''<br />Set Mode
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Query Palette Registers - Function 10Eh ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />10Eh <br />'''Description:'''<br />Query Palette Registers
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function queries the relationship between the text attributes and the color registers.
 
=== Function 10Eh - Description ===
 
This function queries the relationship between the text attributes and the color registers.
This function queries the relationship between the text attributes and the color registers.
;Datalength :Length of parameter block in bytes (=12) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is to be read.
::OFF = Return data from the environment buffer only.
::ON  = Read the hardware to update the environment buffer before returning the requested data.
:Bits 1-15 are reserved and must be OFF.
;Palette Buffer Far Address :Data area where a 1-WORD entry for each register containing its color value is returned.
;Palette Register Index: Index of first palette register to get.
;Register Quantity: Number of registers to return.


=== Function 10Eh - Datalength ===
;Parameter Packet Format
 
{| class="wikitable"
'''Datalength'''
!Field||Length
 
|-
Length of parameter block in bytes (=12) passed on input.
|Datalength||WORD
 
|-
=== Function 10Eh - Flags ===
|Flags||WORD
 
|-
'''Flags'''
|Palette Buffer Far Address||DWORD
 
|-
Defined as follows:
|Palette Register Index||WORD
 
|-
<pre class="western">Bit 0 indicates whether the physical hardware
|Register Quantity||WORD
      is to be read.
|}
 
      OFF = Return data from the environment buffer
            only.
      ON  = Read the hardware to update the environment
            buffer before returning the requested data.
 
Bits 1-15 are reserved and must be OFF.</pre>
 
=== Function 10Eh - Palette Buffer Far Address ===
 
'''Palette Buffer Far Address'''
 
Data area where a 1-WORD entry for each register containing its color value is returned.
 
=== Function 10Eh - Palette Register Index ===


'''Palette Register Index'''
;Returns
 
Index of first palette register to get.
 
=== Function 10Eh - Register Quantity ===
 
'''Register Quantity'''
 
Number of registers to return.
 
=== Function 10Eh - Parameter Packet Format ===
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Datalength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Palette Buffer Far Address    DWORD    |
|-----------------------------------------|
|Palette Register Index        WORD      |
|-----------------------------------------|
|Register Quantity              WORD      |
\-----------------------------------------/</pre>
 
=== Function 10Eh - Returns ===
This function returns with AX = 0 if it can successfully get all of the requested palette registers. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO _INVALID_LENGTH if too many registers were requested.
This function returns with AX = 0 if it can successfully get all of the requested palette registers. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO _INVALID_LENGTH if too many registers were requested.


=== Function 10Eh - Remarks ===
===Function 10Fh===
 
;Set Palette Registers - Function 10Fh
None.
 
=== Function 10Eh - ===
 
'''Category:'''<br /><br />'''Function:'''<br />10Eh <br />'''Description:'''<br />Query Palette Registers
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Set Palette Registers - Function 10Fh ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />10Fh <br />'''Description:'''<br />Set Palette Registers
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function defines the relationship between the text attributes and the color registers.
This function defines the relationship between the text attributes and the color registers.
;Parmlength :Length of parameter block in bytes (=12) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is updated.
::OFF = Update only the environment buffer.
::ON  = Update the environment buffer and the hardware state.
:Bits 1-15 are reserved and must be OFF.
;Palette Buffer Far Address : Far address of palette register buffer. Data area with 1 WORD, containing the color value for each register set.
;Palette Register Index :Index of first palette register to set. Data area with 1 WORD, containing the color value for each register set.
;Register Quantity :Number of registers to set.


=== Function 10Fh - Description ===
;Parameter Packet Format
 
{| class="wikitable"
This function defines the relationship between the text attributes and the color registers.
!Field||Length
 
|-
=== Function 10Fh - Parmlength ===
|Parmlength||WORD
 
|-
'''Parmlength'''
|Flags||WORD
 
|-
Length of parameter block in bytes (=12) passed on input.
|Palette Buffer Far Address||DWORD
 
|-
=== Function 10Fh - Flags ===
|Palette Register Index||WORD
 
|-
'''Flags'''
|Register Quantity||WORD
 
|}
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical hardware
      is updated.
 
      OFF = Update only the environment buffer.
      ON  = Update the environment buffer and the
            hardware state.
 
Bits 1-15 are reserved and must be OFF.</pre>
 
=== Function 10Fh - Palette Buffer Far Address ===
 
'''Palette Buffer Far Address'''
 
Far address of palette register buffer. Data area with 1 WORD, containing the color value for each register set.
 
=== Function 10Fh - Palette Register Index ===
 
'''Palette Register Index'''
 
Index of first palette register to set. Data area with 1 WORD, containing the color value for each register set.
 
=== Function 10Fh - Register Quantity ===
 
'''Register Quantity'''
 
Number of registers to set.
 
=== Function 10Fh - Parameter Packet Format ===
 
<pre class="western">/-----------------------------------------\
|Field                          Length   |
|-----------------------------------------|
|Parmlength                     WORD     |
|-----------------------------------------|
|Flags                         WORD     |
|-----------------------------------------|
|Palette Buffer Far Address     DWORD     |
|-----------------------------------------|
|Palette Register Index         WORD     |
|-----------------------------------------|
|Register Quantity             WORD     |
\-----------------------------------------/</pre>
 
 
=== Function 10Fh - Returns ===


;Returns
This function returns with AX = 0 if it can successfully set all of the requested palette registers. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO _INVALID_LENGTH if too many registers were requested.
This function returns with AX = 0 if it can successfully set all of the requested palette registers. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO _INVALID_LENGTH if too many registers were requested.


=== Function 10Fh - Remarks ===
===Function 110h ===
 
;Query Physical Buffer - Function 110h
None.
 
=== Function 10Fh - ===
 
'''Category:'''<br /><br />'''Function:'''<br />10Fh <br />'''Description:'''<br />Set Palette Registers
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Query Physical Buffer - Function 110h ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />110h <br />'''Description:'''<br />Query Physical Buffer
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function returns an LDT selector that can be used to access the physical video buffer. The current physical video buffer is returned unless a specific address range is requested.
This function returns an LDT selector that can be used to access the physical video buffer. The current physical video buffer is returned unless a specific address range is requested.
;Parmlength :Length of parameter block in bytes (=12) passed on input.
;Flags :Must be zero.
;Query Physical Buffer Far Address :Far Address of the Query Physical Buffer data structure defined by VioGetPhysBuf.


=== Function 110h - Description ===
;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Query Physical Buffer Far Address||DWORD
|}


This function returns an LDT selector that can be used to access the physical video buffer. The current physical video buffer is returned unless a specific address range is requested.
;Returns
 
=== Function 110h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=12) passed on input.
 
=== Function 110h - Flags ===
 
'''Flags'''
 
Must be zero.
 
=== Function 110h - Query Physical Buffer Far Address ===
 
'''Query Physical Buffer Far Address'''
 
Far Address of the Query Physical Buffer data structure defined by VioGetPhysBuf.
 
=== Function 110h - Parameter Packet Format ===
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Parmlength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Query Physical Buffer Far      DWORD    |
|Address                                  |
\-----------------------------------------/</pre>
 
=== Function 110h - Returns ===
Query Physical Buffer returns with AX = 0 if it can successfully allocate the LDT selector. Otherwise, it returns with AX set by the ''PhysToUVirt''device helper function or with AX = ERROR_VIO_INVALID_PARMS if the requested buffer resides outside the valid range for the device.
Query Physical Buffer returns with AX = 0 if it can successfully allocate the LDT selector. Otherwise, it returns with AX set by the ''PhysToUVirt''device helper function or with AX = ERROR_VIO_INVALID_PARMS if the requested buffer resides outside the valid range for the device.


=== Function 110h - Remarks ===
;Remarks
If the physical display buffer address and length passed on input are 0, this subfunction returns an LDT selector, that corresponds to the current mode.
If the physical display buffer address and length passed on input are 0, this subfunction returns an LDT selector, that corresponds to the current mode.


A physical video device driver must provide Read/Write access to the physical address range where the physical display buffer is located. The physical device driver must provide Read-only access to the physical address range where the ROM fonts are located. If the physical address passed on input is not within the physical display buffer or ROM font ranges, an error is returned.
A physical video device driver must provide Read/Write access to the physical address range where the physical display buffer is located. The physical device driver must provide Read-only access to the physical address range where the ROM fonts are located. If the physical address passed on input is not within the physical display buffer or ROM font ranges, an error is returned.


=== Function 110h - ===
===Function 111h===
 
;Free Physical Buffer - Function 111h
'''Category:'''<br /><br />'''Function:'''<br />110h <br />'''Description:'''<br />Query Physical Buffer
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Free Physical Buffer - Function 111h ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />111h <br />'''Description:'''<br />Free Physical Buffer
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function deallocates an LDT selector that was acquired by a call to the Query Physical Buffer routine.
 
=== Function 111h - Description ===
 
This function deallocates an LDT selector that was acquired by a call to the Query Physical Buffer routine.
This function deallocates an LDT selector that was acquired by a call to the Query Physical Buffer routine.
;Parmlength :Length of parameter block in bytes (=6) passed on input.
;Flags :Must be zero.
;LDT Selector :LDT Selector.


=== Function 111h - Parmlength ===
;Parameter Packet Format
 
{| class="wikitable"
'''Parmlength'''
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|LDT Selector||DWORD
|}


Length of parameter block in bytes (=6) passed on input.
;Returns
 
=== Function 111h - Flags ===
 
'''Flags'''
Must be zero.
 
=== Function 111h - LDT Selector ===
'''LDT Selector'''
 
LDT Selector.
 
=== Function 111h - Parameter Packet Format ===
 
<pre class="western">/---------------------------\
|Field            Length    |
|---------------------------|
|Parmlength      WORD      |
|---------------------------|
|Flags            WORD      |
|---------------------------|
|LDT Selector    DWORD    |
\---------------------------/</pre>
 
 
=== Function 111h - Returns ===
This function always returns with AX = 0.
This function always returns with AX = 0.


=== Function 111h - Remarks ===
===Function 112h===
 
;Query Variable Info - Function 112h
None.
 
=== Function 111h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />111h <br />'''Description:'''<br />Free Physical Buffer
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Query Variable Info - Function 112h ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />112h <br />'''Description:'''<br />Query Variable Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function reads various minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.
This function reads various minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.
 
;Parmlength :Length of parameter block in bytes (=26) passed on input.
=== Function 112h - Description ===
;Flags :Defined as follows:
 
:Bit 0 indicates whether the physical hardware is to be read.
This function reads various minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.
::OFF = Return data from the environment buffer only.
 
::ON  = Read the hardware to update the environment buffer before returning the requested data.
 
:The remaining flags select the information to be returned:
 
::Bit 1 selects blink versus background color.
=== Function 112h - Parmlength ===
::Bit 2 selects overscan (border) color.
 
::Bit 3 selects scan line for underscore.
'''Parmlength'''
::Bit 4 selects video enable.
 
::Bit 5 selects the display mask.
Length of parameter block in bytes (=26) passed on input.
::Bit 6 selects code page.
 
::Bit 7 forces a code page set (used with 6).
 
::Bit 8 gets the scrollable rectangle.
 
:Bits 9-15 are reserved and must be OFF.
=== Function 112h - Flags ===
;Blink/Background Intensity :Blink versus background intensity:
 
::0 = blink.
'''Flags'''
::1 = background intensity.
 
;Overscan (border) Color :Overscan (border) Color.
Defined as follows:
;Scan Line: Scan line for underscore (0-31); 32 = no underscore.
 
;Video Enable :Video enable: 0 = OFF and 1 = ON. OFF means off until the physical device driver is told to turn it back on. If the video signal is turned off and then the mode is set, the signal must remain off.
<pre class="western">Bit 0 indicates whether the physical hardware
;Display Mask :Display mask:
      is to be read.
<pre>
 
  bit 0  = plane 0
      OFF = Return data from the environment buffer
     ?         ?
            only.
     ?         ?
      ON  = Read the hardware to update the environment
     ?         ?
            buffer before returning the requested data.
 
The remaining flags select the information to be
returned:
 
Bit 1 selects blink versus background color.
Bit 2 selects overscan (border) color.
Bit 3 selects scan line for underscore.
Bit 4 selects video enable.
Bit 5 selects the display mask.
Bit 6 selects code page.
Bit 7 forces a code page set (used with 6).
Bit 8 gets the scrollable rectangle.
Bits 9-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 112h - Blink/Background Intensity ===
 
'''Blink/Background Intensity'''
 
Blink versus background intensity:
 
<pre class="western">        0 = blink.
        1 = background intensity.</pre>
<br /><br />
 
 
 
=== Function 112h - Overscan (border) Color ===
 
'''Overscan (border) Color'''Overscan (border) Color.
 
 
 
=== Function 112h - Scan Line ===
 
'''Scan Line'''
 
Scan line for underscore (0-31); 32 = no underscore.
 
 
 
=== Function 112h - Video Enable ===
 
'''Video Enable'''
 
Video enable: 0 = OFF and 1 = ON. OFF means off until the physical device driver is told to turn it back on. If the video signal is turned off and then the mode is set, the signal must remain off.
 
 
 
=== Function 112h - Display Mask ===
 
'''Display Mask'''
 
Display mask:
 
<pre class="western">   bit 0  = plane 0
            
            
            
   bit 31 = plane 31
   bit 31 = plane 31


Line 2,588: Line 921:
   bit state = 1, plane enabled for display.
   bit state = 1, plane enabled for display.


   (Planes disabled for display result in 0 to palette.)</pre>
   (Planes disabled for display result in 0 to palette.)
<br /><br />
</pre>
 
;Code Page: Code Page.
 
;Scrollable Rectangle - Left: The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
;Scrollable Rectangle - Top :The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
=== Function 112h - Code Page ===
;Scrollable Rectangle - Right :The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
;Scrollable Rectangle - Bottom :The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
'''Code Page'''
;Screen Rows :The number of text rows in the current mode.
 
;Screen Columns :The number of text columns in the current mode.
Code Page.
 
 
 
=== Function 112h - Scrollable Rectangle - Left ===
 
'''Scrollable Rectangle - Left'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 112h - Scrollable Rectangle - Top ===
 
'''Scrollable Rectangle - Top'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 112h - Scrollable Rectangle - Right ===
 
'''Scrollable Rectangle - Right'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 112h - Scrollable Rectangle - Bottom ===
 
'''Scrollable Rectangle - Bottom'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 112h - Screen Rows ===
 
'''Screen Rows'''
 
The number of text rows in the current mode.
 
 
 
=== Function 112h - Screen Columns ===
 
'''Screen Columns'''
 
The number of text columns in the current mode.
 
 
 
=== Function 112h - Parameter Packet Format ===


<br /><br />
;Parameter Packet Format
 
{| class="wikitable"
<pre class="western">/-----------------------------------------\
!Field||Length
|Field                          Length   |
|-
|-----------------------------------------|
|Parmlength||WORD
|Parmlength                     WORD     |
|-
|-----------------------------------------|
|Flags||WORD
|Flags                         WORD     |
|-
|-----------------------------------------|
|Blink/Background Intensity||WORD
|Blink/Background Intensity     WORD     |
|-
|-----------------------------------------|
|Overscan (border) Color||WORD
|Overscan (border) Color       WORD     |
|-
|-----------------------------------------|
|Scan Line||WORD
|Scan Line                     WORD     |
|-
|-----------------------------------------|
|Video Enable||WORD
|Video Enable                   WORD     |
|-
|-----------------------------------------|
|Display Mask||DWORD
|Display Mask                   DWORD     |
|-
|-----------------------------------------|
|Code Page||WORD
|Code Page                     WORD     |
|-
|-----------------------------------------|
|Scrollable Rectangle - Left||WORD
|Scrollable Rectangle - Left   WORD     |
|-
|-----------------------------------------|
|Scrollable Rectangle - Top||WORD
|Scrollable Rectangle - Top     WORD     |
|-
|-----------------------------------------|
|Scrollable Rectangle - Right||WORD
|Scrollable Rectangle - Right   WORD     |
|-
|-----------------------------------------|
|Scrollable Rectangle - Bottom||WORD
|Scrollable Rectangle - Bottom WORD     |
|-
|-----------------------------------------|
|Screen Rows||WORD
|Screen Rows                   WORD     |
|-
|-----------------------------------------|
|Screen Columns||WORD
|Screen Columns                 WORD     |
|}
\-----------------------------------------/</pre>
 
 
=== Function 112h - Returns ===


;Returns
Query Variable Info returns with AX = 0 if it can successfully get the selected variable information. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS.
Query Variable Info returns with AX = 0 if it can successfully get the selected variable information. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS.


 
===Function 113h ===
 
;Set Variable Info - Function 113h
=== Function 112h - Remarks ===
 
None.
 
 
 
=== Function 112h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />112h <br />'''Description:'''<br />Query Variable Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Set Variable Info - Function 113h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />113h <br />'''Description:'''<br />Set Variable Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function sets the minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.
 
 
 
=== Function 113h - Description ===
 
This function sets the minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.
This function sets the minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.
 
;Parmlength
 
:Length of parameter block in bytes (=26) passed on input.
 
;Flags
=== Function 113h - Parmlength ===
:Defined as follows:
 
:Bit 0 indicates whether the physical hardware is updated.
'''Parmlength'''
::OFF = Update only the environment buffer.
 
::ON  = Update the environment buffer and the hardware state.
Length of parameter block in bytes (=26) passed on input.
:The remaining flags select the information to be set:
 
::Bit 1 selects blink versus background color.
 
::Bit 2 selects overscan (border) color.
 
::Bit 3 selects scan line for underscore.
=== Function 113h - Flags ===
::Bit 4 selects video enable.
 
::Bit 5 selects the display mask.
'''Flags'''
::Bit 6 selects code page.
 
::Bit 7 forces a code page set (used with 6).
Defined as follows:
::Bit 8 gets the scrollable rectangle.
 
:Bits 9-15 are reserved and must be OFF.
<pre class="western">Bit 0 indicates whether the physical hardware
;Blink/Background Intensity :Blink versus background intensity:
      is updated.
::0 = blink.
 
::1 = background intensity.
      OFF = Update only the environment buffer.
;;Overscan (border) Color : Overscan (border) Color.
      ON  = Update the environment buffer and the
;Scan Line :Scan line for underscore (0-31); 32 = no underscore.
            hardware state.
;Video Enable :Video enable: 0 = OFF and 1 = ON. OFF means off until the physical device driver is told to turn it back on. If the video signal is turned off and then the mode is set, the signal must remain off.
 
;Display Mask :Display mask:
The remaining flags select the information to be set:
<pre>
 
  bit 0  = plane 0
Bit 1 selects blink versus background color.
     ?         ?
Bit 2 selects overscan (border) color.
     ?         ?
Bit 3 selects scan line for underscore.
     ?         ?
Bit 4 selects video enable.
Bit 5 selects the display mask.
Bit 6 selects code page.
Bit 7 forces a code page set (used with 6).
Bit 8 gets the scrollable rectangle.
Bits 9-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 113h - Blink/Background Intensity ===
 
'''Blink/Background Intensity'''
 
Blink versus background intensity:
 
<pre class="western">        0 = blink.
        1 = background intensity.</pre>
<br /><br />
 
 
 
=== Function 113h - Overscan (border) Color ===
 
'''Overscan (border) Color'''
 
Overscan (border) Color.
 
 
 
=== Function 113h - Scan Line ===
 
'''Scan Line'''
 
Scan line for underscore (0-31); 32 = no underscore.
 
 
 
=== Function 113h - Video Enable ===
 
'''Video Enable'''
 
Video enable: 0 = OFF and 1 = ON. OFF means off until the physical device driver is told to turn it back on. If the video signal is turned off and then the mode is set, the signal must remain off.
 
 
 
=== Function 113h - Display Mask ===
 
'''Display Mask'''
 
Display mask:
 
<pre class="western">   bit 0  = plane 0
            
            
            
   bit 31 = plane 31
   bit 31 = plane 31


Line 2,823: Line 1,004:
   bit state = 1, plane enabled for display.
   bit state = 1, plane enabled for display.


   (Planes disabled for display result in 0 to palette.)</pre>
   (Planes disabled for display result in 0 to palette.)
<br /><br />
</pre>
 
;Code Page :Code Page.
 
;Scrollable Rectangle - Left:The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
;Scrollable Rectangle - Top:The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
=== Function 113h - Code Page ===
;Scrollable Rectangle - Right:The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
;Scrollable Rectangle - Bottom:The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
'''Code Page'''
;Screen Rows:The number of text rows in the current mode. Reserved (0).
 
;Screen Columns:The number of text columns in the current mode. Reserved (0).
Code Page.
 
 
 
=== Function 113h - Scrollable Rectangle - Left ===
 
'''Scrollable Rectangle - Left'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 113h - Scrollable Rectangle - Top ===
 
'''Scrollable Rectangle - Top'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 113h - Scrollable Rectangle - Right ===
 
'''Scrollable Rectangle - Right'''
 
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 


;Parameter Packet Format
{|class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Blink/Background Intensity||WORD
|-
|Overscan (border) Color||WORD
|-
|Scan Line||WORD
|-
|Video Enable||WORD
|-
|Display Mask||DWORD
|-
|Code Page||WORD
|-
|Scrollable Rectangle - Left||WORD
|-
|Scrollable Rectangle - Top||WORD
|-
|Scrollable Rectangle - Right||WORD
|-
|Scrollable Rectangle - Bottom||WORD
|-
|Screen Rows||WORD
|-
|Screen Columns||WORD
|}


=== Function 113h - Scrollable Rectangle - Bottom ===
;Returns
Set Variable Info returns with AX = 0 if it can successfully set the selected variable information. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.


'''Scrollable Rectangle - Bottom'''
;Remarks
 
There are two types of code page sets. The first code page set allows a code page to be set while the mode of the display (as used by [[#Function 10Dh|Function 10Dh]]) remains the same. The other type of code page set causes a change in the display mode. This occurs when switching between DBCS and non-DBCS code pages.
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
 
 
 
=== Function 113h - Screen Rows ===
 
'''Screen Rows'''
 
The number of text rows in the current mode. Reserved (0).
 
 
 
=== Function 113h - Screen Columns ===
 
'''Screen Columns'''
 
The number of text columns in the current mode. Reserved (0).
 
 
 
=== Function 113h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Parmlength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Blink/Background Intensity    WORD      |
|-----------------------------------------|
|Overscan (border) Color        WORD      |
|-----------------------------------------|
|Scan Line                      WORD      |
|-----------------------------------------|
|Video Enable                  WORD      |
|-----------------------------------------|
|Display Mask                  DWORD    |
|-----------------------------------------|
|Code Page                      WORD      |
|-----------------------------------------|
|Scrollable Rectangle - Left    WORD      |
|-----------------------------------------|
|Scrollable Rectangle - Top    WORD      |
|-----------------------------------------|
|Scrollable Rectangle - Right  WORD      |
|-----------------------------------------|
|Scrollable Rectangle - Bottom  WORD      |
|-----------------------------------------|
|Screen Rows                    WORD      |
|-----------------------------------------|
|Screen Columns                WORD      |
\-----------------------------------------/</pre>
 
 
=== Function 113h - Returns ===
 
Set Variable Info returns with AX = 0 if it can successfully set the selected variable information. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS.
 
 
 
=== Function 113h - Remarks ===
 
There are two types of code page sets. The first code page set allows a code page to be set while the mode of the display (as used by [[00210.htm|Function 10Dh]] ) remains the same. The other type of code page set causes a change in the display mode. This occurs when switching between DBCS and non-DBCS code pages.


If bit 6 of the flags WORD is set and bit 7 is clear, the code page is set when the adapter can use the code page without changing from DBCS mode to SBCS mode, or vice versa. The mode should be changed if both bits 6 and 7 of the flags WORD are set, and the code page is used when the mode is changed from SBCS mode to DBCS mode. Bit 7 is ignored if bit 6 is not set. This applies only to text modes. Graphics modes are not set to text modes by forcing a code page.
If bit 6 of the flags WORD is set and bit 7 is clear, the code page is set when the adapter can use the code page without changing from DBCS mode to SBCS mode, or vice versa. The mode should be changed if both bits 6 and 7 of the flags WORD are set, and the code page is used when the mode is changed from SBCS mode to DBCS mode. Bit 7 is ignored if bit 6 is not set. This applies only to text modes. Graphics modes are not set to text modes by forcing a code page.
Line 2,935: Line 1,057:
The BVH need not support any scrollable region other than the entire display area. The adapter may support any scrollable rectangle up to the size of the entire screen. All coordinates are in text display cells. This scrollable rectangle data is undefined for graphics modes.
The BVH need not support any scrollable region other than the entire display area. The adapter may support any scrollable rectangle up to the size of the entire screen. All coordinates are in text display cells. This scrollable rectangle data is undefined for graphics modes.


 
===Function 114h===
 
;Terminate Environment - Function 114h
=== Function 113h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />113h <br />'''Description:'''<br />Set Variable Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Terminate Environment - Function 114h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />114h <br />'''Description:'''<br />Terminate Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function is used to notify the BVH that the environment is about to be freed so that any required cleanup can be performed by the BVH. If no Terminate Environment processing is required, this function can be omitted. PMERR_DEV_FUNC_NOT_INSTALLED is then returned in AX, but it is ignored by the video subsystem.
This function is used to notify the BVH that the environment is about to be freed so that any required cleanup can be performed by the BVH. If no Terminate Environment processing is required, this function can be omitted. PMERR_DEV_FUNC_NOT_INSTALLED is then returned in AX, but it is ignored by the video subsystem.
;Parmlength :Length of parameter block in bytes (=6) passed on input.
;Flags :Reserved, must be off.
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Logical Buffer Selector||WORD
|}


;Returns:None.


=== Function 114h - Description ===
===Function 115h===
 
;Print Screen - Function 115h
This function is used to notify the BVH that the environment is about to be freed so that any required cleanup can be performed by the BVH. If no Terminate Environment processing is required, this function can be omitted. PMERR_DEV_FUNC_NOT_INSTALLED is then returned in AX, but it is ignored by the video subsystem.
 
 
 
=== Function 114h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=6) passed on input.
 
 
 
=== Function 114h - Flags ===
 
'''Flags'''
 
Reserved, must be off.
 
 
 
=== Function 114h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 114h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Logical Buffer Selector    WORD      |
\--------------------------------------/</pre>
 
 
=== Function 114h - Returns ===
 
None.
 
 
 
=== Function 114h - Remarks ===
 
None.
 
 
 
=== Function 114h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />114h <br />'''Description:'''<br />Terminate Environment
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
=== Print Screen - Function 115h ===
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />115h <br />'''Description:'''<br />Print Screen
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function causes the contents of the current screen to be written to the printer handle provided. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.
This function causes the contents of the current screen to be written to the printer handle provided. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.
;Parmlength :Length of parameter block in bytes (=8) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical video buffer should be printed.
::OFF = Print only the contents of the logical video buffer.
::ON  = Print the contents of the physical video buffer, if appropriate.
:Bits 1-15 are reserved and must be OFF.</pre>
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
;Print Device Handle :Print Device Handle. File handle of the print device to be used.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Logical Buffer Selector||WORD
|-
|Print Device Handle||WORD
|}


;Returns:None.


=== Function 115h - Description ===
===Function 116h===
 
;Write TTY - Function 116h
This function causes the contents of the current screen to be written to the printer handle provided. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.
 
 
 
=== Function 115h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=8) passed on input.
 
 
 
=== Function 115h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical video
      buffer should be printed.
 
      OFF = Print only the contents of the logical
            video buffer.
      ON  = Print the contents of the physical
            video buffer, if appropriate.
 
Bits 1-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 115h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 115h - Print Device Handle ===
 
'''Print Device Handle'''
 
Print Device Handle. File handle of the print device to be used.
 
 
 
=== Function 115h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/--------------------------------------\
|Field                      Length    |
|--------------------------------------|
|Parmlength                  WORD      |
|--------------------------------------|
|Flags                      WORD      |
|--------------------------------------|
|Logical Buffer Selector    WORD      |
|--------------------------------------|
|Print Device Handle        WORD      |
\--------------------------------------/</pre>
 
 
=== Function 115h - Returns ===
 
None.
 
 
 
=== Function 115h - Remarks ===
 
None.
 
 
 
=== Function 115h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />115h <br />'''Description:'''<br />Print Screen
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Write TTY - Function 116h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />116h <br />'''Description:'''<br />Write TTY
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function performs the functions of the call to ''VioWrtTTY''. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.
This function performs the functions of the call to ''VioWrtTTY''. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.
;Parmlength :Length of parameter block in bytes (=14) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical video buffer needs to be updated.
::OFF = The physical video buffer must not be updated.
::ON  = The physical video buffer must be updated.
:Bit 1 indicates whether the logical video buffer needs to be updated.
::OFF = The logical video buffer can optionally be updated.
::ON  = The logical video buffer must be updated.
:Bit 2 indicates whether ANSI is active.
::OFF = ANSI is not active.  Escape sequences should be considered as text data.
::ON  = ANSI is active.  Escape sequences must be handled locally or passed to the default routine in BVS through device chaining.
:Bit 3 indicates whether Ctrl_PrtSc is active.
::OFF = Ctrl_PrtSc is not active.
::ON  = Ctrl_PrtSc is active.  Characters need to be echoed to the printer locally or by the default routine in BVS through device chaining.
:Bits 4-15 are reserved and must be OFF.
;Logical Buffer Selector :Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
;Character String Far Address :Far Address of character string to be written.
;Character String Length :Length of character string to be written.
;Print Device Handle :Print Device Handle. The file handle of the print device used for Ctrl_ PrtSc.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|Logical Buffer Selector||WORD
|-
|Character String Far Address||DWORD
|-
|Character String Length||DWORD
|-
|Print Device Handle||WORD
|}


;Returns:None.


=== Function 116h - Description ===
===Function 117h===
 
;Query LVB Info - Function 117h
This function performs the functions of the call to ''VioWrtTTY''. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.
 
 
 
=== Function 116h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=14) passed on input.
 
 
 
=== Function 116h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical video
      buffer needs to be updated.
 
      OFF = The physical video buffer must not be
            updated.
      ON  = The physical video buffer must be updated.
 
Bit 1 indicates whether the logical video buffer
      needs to be updated.
 
      OFF = The logical video buffer can optionally be
            updated.
      ON  = The logical video buffer must be updated.
 
Bit 2 indicates whether ANSI is active.
 
      OFF = ANSI is not active.  Escape sequences should
            be considered as text data.
      ON  = ANSI is active.  Escape sequences must be
            handled locally or passed to the default
            routine in BVS through device chaining.
 
Bit 3 indicates whether Ctrl_PrtSc is active.
 
      OFF = Ctrl_PrtSc is not active.
      ON  = Ctrl_PrtSc is active.  Characters need to
            be echoed to the printer locally or by the
            default routine in BVS through device chaining.
 
Bits 4-15 are reserved and must be OFF.</pre>
<br /><br />
 
 
 
=== Function 116h - Logical Buffer Selector ===
 
'''Logical Buffer Selector'''
 
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
 
 
 
=== Function 116h - Character String Far Address ===
 
'''Character String Far Address'''
 
Far Address of character string to be written.
 
 
 
=== Function 116h - Character String Length ===
 
'''Character String Length'''
 
Length of character string to be written.
 
 
 
=== Function 116h - Print Device Handle ===
 
'''Print Device Handle'''
 
Print Device Handle. The file handle of the print device used for Ctrl_ PrtSc.
 
=== Function 116h - Parameter Packet Format ===
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Parmlength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|Logical Buffer Selector        WORD      |
|-----------------------------------------|
|Character String Far Address  DWORD    |
|-----------------------------------------|
|Character String Length        DWORD    |
|-----------------------------------------|
|Print Device Handle            WORD      |
\-----------------------------------------/</pre>
 
 
=== Function 116h - Returns ===
 
None.
 
 
 
=== Function 116h - Remarks ===
 
None.
 
 
 
=== Function 116h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />116h <br />'''Description:'''<br />Write TTY
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Query LVB Info - Function 117h ===
 
 
-----
 
'''Category:'''<br /><br />'''Function:'''<br />117h <br />'''Description:'''<br />Query LVB Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
-----
 
This function returns information associated with the LVB, such as the allocation size and default attribute for a specified LVB.
This function returns information associated with the LVB, such as the allocation size and default attribute for a specified LVB.
;Parmlength :Length of parameter block in bytes (=20) passed on input.
;Flags :Defined as follows:
:Bit 0 indicates whether the physical hardware is to be read.
::OFF = Read from the environment buffer.
::ON  = Read from the current state of the hardware state.
:Bits 1-15 are reserved and must be OFF.
;LVB Format ID :Format ID for LVB. If this and the attribute count are both 0, the current mode values are used.
;LVB Attribute Count :Attribute Count for the LVB. If this and the format ID are both 0, the current mode values are used.
;LVB Width :LVB Width in cells.
;LVB Height :LVB Height in cells.
;LVB Allocation Size :Allocation size of the LVB is returned here.
;Attribute Return Buffer Size :Size of the default attribute return buffer.
;Attribute Return Buffer Pointer :Pointer to the default attribute return buffer (passed). The default attribute is returned if the buffer is large enough. If this value is 0, the attribute is not returned.


;Parameter Packet Format
{| class="wikitable"
!Field||Length
|-
|Parmlength||WORD
|-
|Flags||WORD
|-
|LVB Format ID||BYTE
|-
|LVB Attribute Count||BYTE
|-
|LVB Width||WORD
|-
|LVB Height||WORD
|-
|LVB Allocation Size||DWORD
|-
|Attribute Return Buffer Size||WORD
|-
|Attribute Return Buffer Pointer||DWORD
|}


 
;Returns
=== Function 117h - Description ===
 
This function returns information associated with the LVB, such as the allocation size and default attribute for a specified LVB.
 
 
 
=== Function 117h - Parmlength ===
 
'''Parmlength'''
 
Length of parameter block in bytes (=20) passed on input.
 
=== Function 117h - Flags ===
 
'''Flags'''
 
Defined as follows:
 
<pre class="western">Bit 0 indicates whether the physical
      hardware is to be read.
 
      OFF = Read from the environment buffer.
      ON  = Read from the current state of the
            hardware state.
 
Bits 1-15 are reserved and must be OFF.</pre>
 
=== Function 117h - LVB Format ID ===
 
'''LVB Format ID'''
 
Format ID for LVB. If this and the attribute count are both 0, the current mode values are used.
 
=== Function 117h - LVB Attribute Count ===
 
'''LVB Attribute Count'''
 
Attribute Count for the LVB. If this and the format ID are both 0, the current mode values are used.
 
=== Function 117h - LVB Width ===
'''LVB Width'''
 
LVB Width in cells.
 
 
 
=== Function 117h - LVB Height ===
 
'''LVB Height'''
 
LVB Height in cells.
 
 
 
=== Function 117h - LVB Allocation Size ===
 
'''LVB Allocation Size'''
 
Allocation size of the LVB is returned here.
 
 
 
=== Function 117h - Attribute Return Buffer Size ===
 
'''Attribute Return Buffer Size'''
 
Size of the default attribute return buffer.
 
 
 
=== Function 117h - Attribute Return Buffer Pointer ===
 
'''Attribute Return Buffer Pointer'''
 
Pointer to the default attribute return buffer (passed). The default attribute is returned if the buffer is large enough. If this value is 0, the attribute is not returned.
 
 
 
=== Function 117h - Parameter Packet Format ===
 
<br /><br />
 
<pre class="western">/-----------------------------------------\
|Field                          Length    |
|-----------------------------------------|
|Parmlength                    WORD      |
|-----------------------------------------|
|Flags                          WORD      |
|-----------------------------------------|
|LVB Format ID                  BYTE      |
|-----------------------------------------|
|LVB Attribute Count            BYTE      |
|-----------------------------------------|
|LVB Width                      WORD      |
|-----------------------------------------|
|LVB Height                    WORD      |
|-----------------------------------------|
|LVB Allocation Size            DWORD    |
|-----------------------------------------|
|Attribute Return Buffer Size  WORD      |
|-----------------------------------------|
|Attribute Return Buffer        DWORD    |
|Pointer                                  |
\-----------------------------------------/</pre>
 
 
=== Function 117h - Returns ===
 
This function returns with AX = 0 if it can successfully calculate the LVB size and return the attribute information. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.
This function returns with AX = 0 if it can successfully calculate the LVB size and return the attribute information. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.


 
==Level 0 Physical Device Driver Interfaces==
 
The strategy portion of the Level 0 physical device drivers that can be a component of any video device handler is called to handle I/O requests through a request packet interface with the OS/2 kernel. The strategy routine executes at task-time as a result of an application VIO request. The strategy routine is called with ES:BX pointing to the request packet (the pointer is valid in both a DOS session and an OS/2 session). Only three command codes (passed in the request packet) are required to be supported by a video device driver. For any other command code the physical device driver does not support, the physical video device driver must return Unsupported Command and Done in the request packet status field.
=== Function 117h - Remarks ===
 
None.
 
 
 
=== Function 117h - ===
 
'''Category:'''<br /><br />'''Function:'''<br />117h <br />'''Description:'''<br />Query LVB Info
 
Select an item:
 
<pre class="western">Description
Parameter Packet Format
Returns
Remarks </pre>
 
 
=== Level 0 Physical Device Driver Interfaces ===
 
The strategy portion of the Level 0 physical device drivers that can be a component of any video device handler is called to handle I/O requests through a request packet interface with the OS/2 kernel. The strategy routine executes at task-time as a result of an application VIO request. The strategy routine is called with ES:BX pointing to the request packet ( the pointer is valid in both a DOS session and an OS/2 session). Only three command codes (passed in the request packet) are required to be supported by a video device driver. For any other command code the physical device driver does not support, the physical video device driver must return Unsupported Command and Done in the request packet status field.


The following are the physical device driver commands that are supported by the physical video device driver (the command codes are in parentheses):
The following are the physical device driver commands that are supported by the physical video device driver (the command codes are in parentheses):


=== INIT (00h) - Initialize the Device ===
===INIT (00h) - Initialize the Device===
 
On entry, the request block contains the following fields as inputs to the physical video device driver:
On entry, the request block contains the following fields as inputs to the physical video device driver:
:Pointer to the DevHlp entry point
:Pointer to the INIT arguments


*Pointer to the DevHlp entry point
On exit, the physical video device driver sets the first pointer to the offsets of the code and data segments to release code and data needed only by the initialization routine. The second pointer is set to 0. If initialization is successful, the request packet status field is set to indicate No Error and Done; otherwise, the status is set to General Failure.
*Pointer to the INIT arguments
 
On exit, the physical video device driver sets the first pointer to the offsets of the code and data segments to release code and data needed only by the initialization routine. The second pointer is set to 0. If initialization is successful, the request packet status field is set to indicate No Error and Done; otherwise, the status is set to General Failure .


The physical video device driver can perform the following initialization:
The physical video device driver can perform the following initialization:
:Obtain the DevHlp address from the request packet.
:Verify that the display adapter and the display that it supports are present. If not, it can fail initialization.


�Obtain the DevHlp address from the request packet. <br />�Verify that the display adapter and the display that it supports are present. If not, it can fail initialization.
===OPEN (0Dh) - Open the Device===
 
 
 
=== OPEN (0Dh) - Open the Device ===
 
This service routine does nothing but return with No Error status.
This service routine does nothing but return with No Error status.


 
===GENERIC IOCtl (10h) - Send I/O Requests to the Device===
 
=== GENERIC IOCtl (10h) - Send I/O Requests to the Device ===
On entry, the request packet has the IOCtl category code and function code set. The parameter buffer and the data buffer addresses are set as virtual addresses. The physical video device driver performs the physical device driver initialization, when requested.
On entry, the request packet has the IOCtl category code and function code set. The parameter buffer and the data buffer addresses are set as virtual addresses. The physical video device driver performs the physical device driver initialization, when requested.


=== Physical Device Driver Initialization ===
==Physical Device Driver Initialization==
The IOCtl described below supports the same class of functions as the Presentation Manager dynamic link enable entry point. It is called to fill in the Call Vector Table for the BVH. The call returns an error if the physical device driver detects that the adapter is not present.
The IOCtl described below supports the same class of functions as the Presentation Manager dynamic link enable entry point. It is called to fill in the Call Vector Table for the BVH. The call returns an error if the physical device driver detects that the adapter is not present.
 
;Category 3 :Function 73h
'''Category 3'''
;Purpose :To initialize the Call Vector Table.
 
;Parameter Block Format :None.
Function 73h
;Data Packet Format :
 
:{|
'''Purpose'''
|DWORD||Subfunction
 
|-
To initialize the Call Vector Table.
|DWORD||Parameter1
 
|-
'''Parameter Block Format'''
|DWORD||Parameter2
 
|-
None.
|WORD||ReturnCode
 
|}
'''Data Packet Format'''
 
<br /><br />
 
<pre class="western">    DWORD   Subfunction
    DWORD   Parameter1
    DWORD   Parameter2
    WORD   ReturnCode</pre>
'''''Subfunction'''''
'''''Subfunction'''''


The Presentation Manager enables the subfunction number. Its value must be 1 to start the Presentation Manager Fill Logical Device Block subfunction. All pieces of the BVH must support this function. Pieces of the BVH that do not support the Presentation Manager interface do not need to support the other functions. Any function not supported should return PMERR_DEV_FUNC_ NOT_INSTALLED.
The Presentation Manager enables the subfunction number. Its value must be 1 to start the Presentation Manager Fill Logical Device Block subfunction. All pieces of the BVH must support this function. Pieces of the BVH that do not support the Presentation Manager interface do not need to support the other functions. Any function not supported should return PMERR_DEV_FUNC_NOT_INSTALLED.


'''''Parameter1 for Subfunction = 1'''''
'''''Parameter1 for Subfunction = 1'''''


Far pointer to this structure:
Far pointer to this structure:
 
:{|
<pre class="western">    DWORD   Engine Version
|DWORD||Engine Version
    DWORD   Count of Table Functions</pre>
|-
|DWORD||Count of Table Functions
|}
Engine Version Version of the Presentation Manager Graphics Engine
Engine Version Version of the Presentation Manager Graphics Engine


Line 3,513: Line 1,245:


Far pointer to this structure:
Far pointer to this structure:
 
:{|
<pre class="western">    DWORD   Flags Pointer
|DWORD||Flags Pointer
    DWORD   Call Vector Table</pre>
|-
|DWORD||Call Vector Table
|}
Flags Pointer Pointer to where the flags controlling calls to the Fill Physical Device Block function go.
Flags Pointer Pointer to where the flags controlling calls to the Fill Physical Device Block function go.


Call Vector Table Pointer to the default dispatch table containing the addresses of the default handler functions and the functions supported by this component. Each entry in the Call Vector Table is the far address of a Video Device Handler function, which must be callable from Ring 3. The address of the ''n''th BVH function is the ''n''th DWORD in the table, beginning with Function 0. Refer to the DLL Initialization function for a description of the function numbers.
Call Vector Table Pointer to the default dispatch table containing the addresses of the default handler functions and the functions supported by this component. Each entry in the Call Vector Table is the far address of a Video Device Handler function, which must be callable from Ring 3. The address of the ''n''th BVH function is the ''n''th DWORD in the table, beginning with Function 0. Refer to the DLL Initialization function for a description of the function numbers.


'''Remarks'''
====Remarks====
 
This function is supported by the video device drivers and is called only once for each adapter to be supported by the BVH. A video device handler should determine if the display adapter and that which it supports is present. If not present, this function must return an error. Every part of a BVH must successfully initialize the Call Vector Table for that device to be used by OS/2.
This function is supported by the video device drivers and is called only once for each adapter to be supported by the BVH. A video device handler should determine if the display adapter and that which it supports is present. If not present, this function must return an error. Every part of a BVH must successfully initialize the Call Vector Table for that device to be used by OS/2.


=== EGA.SYS and INT 2Fh Screen Switch Notification ===
==EGA.SYS and INT 2Fh Screen Switch Notification==
For some DOS EGA applications, OS/2 is not able to switch from a DOS session to an OS/2 session and then back again. Upon return to the DOS application, the screen will be incorrect. The DOS EGA applications that do not run successfully are:
For some DOS EGA applications, OS/2 is not able to switch from a DOS session to an OS/2 session and then back again. Upon return to the DOS application, the screen will be incorrect. The DOS EGA applications that do not run successfully are:
* Applications that download fonts into a character generator block other than Block 0. Character Generator Block 0 is supported.
* Applications that download fonts into a character generator block other than Block 0. Character Generator Block 0 is supported.
* Graphic mode applications that use more than one display page.
* Graphic mode applications that use more than one display page.
Line 3,533: Line 1,265:
To supplement OS/2 screen switching support, a DOS application can be written to use the EGA register interface. Alternatively, a DOS application can be notified on a screen switch through multiplex interrupt 2Fh, AH = 40h. These two mechanisms are described in the following sections.
To supplement OS/2 screen switching support, a DOS application can be written to use the EGA register interface. Alternatively, a DOS application can be notified on a screen switch through multiplex interrupt 2Fh, AH = 40h. These two mechanisms are described in the following sections.


'''Note:'''On an IBM PS/2 personal computer the registers on the adapter are both readable and writable. For these configurations, OS/2 reads and saves the registers on a screen switch away from a DOS session, and restores the registers upon return to a DOS session.
'''Note:''' On an IBM PS/2 personal computer the registers on the adapter are both readable and writable. For these configurations, OS/2 reads and saves the registers on a screen switch away from a DOS session, and restores the registers upon return to a DOS session.


For configurations including the IBM PS/2 Display Adapter 8514/A when the 8514/A display adapter is in an advanced function mode, the OS/2 operating system does not save the physical display buffer when switching away from a DOS session. Therefore, end users are cautioned to complete any 8514/A advanced function mode application before switching to OS/2 mode.
For configurations including the IBM PS/2 Display Adapter 8514/A when the 8514/A display adapter is in an advanced function mode, the OS/2 operating system does not save the physical display buffer when switching away from a DOS session. Therefore, end users are cautioned to complete any 8514/A advanced function mode application before switching to OS/2 mode.


=== EGA.SYS Device Driver ===
==EGA.SYS Device Driver==
EGA.SYS is a physical device driver that provides support for the EGA register interface in a DOS session. To support advanced graphics modes D, E, F, and 10 in a DOS session, the Mouse Pointer Draw device driver must save or restore the EGA registers. Because the EGA registers are not readable, this can be done only if the application assists in setting the registers initially. Rather than performing I/O directly to the registers on the adapter, the application sets the registers through the EGA register interface.
EGA.SYS is a physical device driver that provides support for the EGA register interface in a DOS session. To support advanced graphics modes D, E, F, and 10 in a DOS session, the Mouse Pointer Draw device driver must save or restore the EGA registers. Because the EGA registers are not readable, this can be done only if the application assists in setting the registers initially. Rather than performing I/O directly to the registers on the adapter, the application sets the registers through the EGA register interface.


=== EGA Register Interface ===
===EGA Register Interface===
The EGA register interface is a library of ten functions supported for a DOS session, advanced graphics applications (modes D, E, F, and 10). These functions do the following:
The EGA register interface is a library of ten functions supported for a DOS session, advanced graphics applications (modes D, E, F, and 10). These functions do the following:
* Read from, or write to, one or more of the EGA write-only registers
* Read from, or write to, one or more of the EGA write-only registers
* Define default values for the EGA write-only registers, reset the EGA registers to these default values, or return the default values
* Define default values for the EGA write-only registers, reset the EGA registers to these default values, or return the default values
* Check whether the EGA register interface is present and, if so, return its version number.
* Check whether the EGA register interface is present and, if so, return its version number.


When the application uses the EGA register interface, OS/2 2.1 maintains a backup copy or ''shadows''how the EGA registers are set. Then, if the operator switches away from (and later returns to) the application, the registers are restored properly. It is not necessary to use the EGA register interface to set the mode, color palette, or palette registers. Instead, use ROM BIOS function INT 10h with AH = 00h, 0Bh, or 10h, respectively.
When the application uses the EGA register interface, OS/2 2.1 maintains a backup copy or ''shadows'' how the EGA registers are set. Then, if the operator switches away from (and later returns to) the application, the registers are restored properly. It is not necessary to use the EGA register interface to set the mode, color palette, or palette registers. Instead, use ROM BIOS function INT 10h with AH = 00h, 0Bh, or 10h, respectively.
 
=== Calling The EGA Register Interface ===


====Calling The EGA Register Interface====
To call EGA register interface functions from an assembly language program, the following actions must be performed:
To call EGA register interface functions from an assembly language program, the following actions must be performed:
 
#Load the registers with the required parameter values
1.Load the registers with the required parameter values <br />2.Execute software interrupt 10h.
#Execute software interrupt 10h.
 
Values returned by the EGA register interface functions are placed in registers.
Values returned by the EGA register interface functions are placed in registers.


 
====EGA Register Interface Restrictions====
 
=== EGA Register Interface Restrictions ===
 
A list of areas where restrictions apply for the EGA Register Interface are shown below:
A list of areas where restrictions apply for the EGA Register Interface are shown below:
 
:Functions not supported <br />?Attribute Controller registers
�Functions not supported <br />�Attribute Controller registers <br />�Sequencer Memory Mode register <br />�Input Status registers <br />�Graphics Controller Miscellaneous register
:Sequencer Memory Mode register
:Input Status registers
:Graphics Controller Miscellaneous register


'''Functions Not Supported'''
'''Functions Not Supported'''
Line 3,571: Line 1,299:
'''Attribute Controller Registers'''
'''Attribute Controller Registers'''


Before your application program uses the Attribute Controller registers (I/ O address 3C0h) in an extended interrupt 10h call, it must set the ''flip- flop''that selects the address or data register so that it selects the address register (by doing an input from I/O port 3BAh or 3DAh). The flip- flop is always reset to this state upon return from the extended INT 10h call. Interrupt routines that access the attribute chip must also leave the flip-flop set to the address register upon return from the interrupt.
Before your application program uses the Attribute Controller registers (I/ O address 3C0h) in an extended interrupt 10h call, it must set the ''flip-flop'' that selects the address or data register so that it selects the address register (by doing an input from I/O port 3BAh or 3DAh). The flip-flop is always reset to this state upon return from the extended INT 10h call. Interrupt routines that access the attribute chip must also leave the flip-flop set to the address register upon return from the interrupt.


'''Note:'''If the application program sets the flip-flop so that it selects the Data register, and expects the flip-flop to remain in this state, the application must disable interrupts between the time it sets the flip-flop to the Data register state and the last time the flip-flop is assumed to be in this state.
'''Note:''' If the application program sets the flip-flop so that it selects the Data register, and expects the flip-flop to remain in this state, the application must disable interrupts between the time it sets the flip-flop to the Data register state and the last time the flip-flop is assumed to be in this state.


'''Sequencer Memory Mode Register'''
'''Sequencer Memory Mode Register'''


When the Sequencer Memory Mode register (I/O address 3C5H, data register 4) is accessed, the sequencer produces a ''fault''on the CAS lines that can cause problems with video random access memory. As a result, the application cannot use the EGA Register Interface to read from, or write to, this register. Instead, use the following procedure to safely alter this register:
When the Sequencer Memory Mode register (I/O address 3C5H, data register 4) is accessed, the sequencer produces a ''fault''on the CAS lines that can cause problems with video random access memory. As a result, the application cannot use the EGA Register Interface to read from, or write to, this register. Instead, use the following procedure to safely alter this register:
 
#Disable interrupts
1.Disable interrupts <br />2.Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0 <br />3.Read/modify/write the Sequencer Memory Mode register <br />4.Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1 <br />5.Enable interrupts
#Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0
#3.Read/modify/write the Sequencer Memory Mode register
#4.Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1
#5.Enable interrupts


'''Input Status Registers'''
'''Input Status Registers'''
Line 3,587: Line 1,318:
'''Graphics Controller Miscellaneous Register'''
'''Graphics Controller Miscellaneous Register'''


When the Graphics Controller Miscellaneous register (I/O address 3CFh, data register 6) is accessed, a ''glitch''on the CAS lines occurs that can cause problems with video random access memory. As a result, the application should not use the EGA Register Interface to read from or write to this register.
When the Graphics Controller Miscellaneous register (I/O address 3CFh, data register 6) is accessed, a ''glitch'' on the CAS lines occurs that can cause problems with video random access memory. As a result, the application should not use the EGA Register Interface to read from or write to this register.


EGA Register Interface Function F6h does not alter the state of the Graphics Controller Miscellaneous register. Instead, use the following procedure to safely alter this register:
EGA Register Interface Function F6h does not alter the state of the Graphics Controller Miscellaneous register. Instead, use the following procedure to safely alter this register:
#Disable interrupts
#Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0
#Read/modify/write the Graphics Controller Miscellaneous register
#Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1
#Enable interrupts


1.Disable interrupts <br />2.Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0 <br />3.Read/modify/write the Graphics Controller Miscellaneous register <br />4.Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1 <br />5.Enable interrupts
====EGA Register Interface Functions====
 
 
 
=== EGA Register Interface Functions ===
 
This section describes each EGA Register Interface function in detail. The following list shows these functions by function number (hex):
This section describes each EGA Register Interface function in detail. The following list shows these functions by function number (hex):
:F0 Read One Register
:F1 Write One Register
:F2 Read Register Range
:F3 Write Register Range
:F4 Read Register Set
:F5 Write Register Set
:F6 Revert to Default Registers
:F7 Define Default Register Table
:F8 Read Default Register Table
:FA Interrogate Driver


F0 Read One Register <br />F1 Write One Register <br />F2 Read Register Range <br />F3 Write Register Range <br />F4 Read Register Set <br />F5 Write Register Set <br />F6 Revert to Default Registers <br />F7 Define Default Register Table <br />F8 Read Default Register Table <br />FA Interrogate Driver
'''Note:''' Function F9h, and Functions FBh through FFh are reserved.
 
'''Note:'''Function F9h, and Functions FBh through FFh are reserved.


Each function description includes:
Each function description includes:
 
:The parameters required to make the call (input) and the expected return values (output)
�The parameters required to make the call (input) and the expected return values (output) <br />�Any special considerations regarding the function
:Any special considerations regarding the function


If the function description does not specify an input for a parameter, it is not necessary to supply a value for that parameter before making the call. If the function description does not specify an output value for a parameter, the parameter's value is the same before and after the call.
If the function description does not specify an input for a parameter, it is not necessary to supply a value for that parameter before making the call. If the function description does not specify an output value for a parameter, the parameter's value is the same before and after the call.


'''Note:'''The EGA Register Interface does not check input values, so be sure that the values loaded into the registers before making a call are correct.
'''Note:''' The EGA Register Interface does not check input values, so be sure that the values loaded into the registers before making a call are correct.
 
 
 
=== Function F0H - Read One Register ===


==Function F0H - Read One Register==
This function reads data from a specified register on the EGA.
This function reads data from a specified register on the EGA.


'''Input'''
;Input
 
AH = F0h
AH = F0h


BX = Pointer for:
BX = Pointer for:
 
:'''Pointer/data chips'''
'''Pointer/data chips'''
:{|BH =||0
 
|-
BH = 0
|BL =||Pointer
 
|}
BL = Pointer
:'''Single registers'''
 
:BX ignored.
'''Single registers'''
 
BX ignored.
 
DX = Port number:
DX = Port number:
:'''Pointer/data chips'''
:{|
|0h:||CRT Controller (3?4H)
|-
|8h:||Sequencer (3C4H)
|-
|10h:||Graphics Controller (3CEH)
|-
|18h:||Attribute Controller (3C0H)
|}
:'''Single registers'''
:{|
|20h:||Miscellaneous Output register (3C2H)
|-
|28h:||Feature Control register (3?AH)
|-
|30h:||Graphics 1 Position register (3CCH)
|-
|38h:||Graphics 2 Position register (3CAH)
|}
? = B for monochrome modes, or D for color modes
;Output
AX: Restored


'''Pointer/data chips'''
BH: Restored


0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
BL: Data


'''Single registers'''
DX: Restored
 
20h: Miscellaneous Output register (3C2H) <br />28h: Feature Control register (3?AH) <br />30h: Graphics 1 Position register (3CCH) <br />38h: Graphics 2 Position register (3CAH)
 
? = B for monochrome modes, or D for color modes
 
'''Output'''
 
AX: Restored <br />BH: Restored <br />BL: Data <br />DX: Restored


All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example saves the contents of the Sequencer Map Mask register in ''myvalue'':
The following example saves the contents of the Sequencer Map Mask register in ''myvalue'':
 
<pre>
<br /><br />
myvalue db  ?
 
<pre class="western">myvalue db  ?
         mov  ah, 0f0h        ; f0 = read one register
         mov  ah, 0f0h        ; f0 = read one register
         mov  bx, 0002h      ; bh = 0 / bl = map mask index
         mov  bx, 0002h      ; bh = 0 / bl = map mask index
         mov  dx, 0008h      ; dx = sequencer
         mov  dx, 0008h      ; dx = sequencer
         int  10h            ; get it!
         int  10h            ; get it!
         mov  myvalue, bl    ; save it!</pre>
         mov  myvalue, bl    ; save it!
</pre>
The example below saves the contents of the Miscellaneous Output register in ''myvalue'':
The example below saves the contents of the Miscellaneous Output register in ''myvalue'':
 
<pre>
<br /><br />
myvalue db  ?
 
<pre class="western">myvalue db  ?
         mov  ah, 0f0h        ; f0 = read one register
         mov  ah, 0f0h        ; f0 = read one register
         mov  dx, 0020h      ; dx = miscellaneous output register
         mov  dx, 0020h      ; dx = miscellaneous output register
         int  10h            ; get it!
         int  10h            ; get it!
         mov  myvalue, bl    ; save it!</pre>
         mov  myvalue, bl    ; save it!
 
</pre>
 
==Function F1H - Write One Register==
=== Function F1H - Write One Register ===
 
This function writes data to a specified register on the EGA. When an application program returns from a call to Function F1, the contents of registers BH and DX are not restored. The program must save and restore these registers.
This function writes data to a specified register on the EGA. When an application program returns from a call to Function F1, the contents of registers BH and DX are not restored. The program must save and restore these registers.
 
;Input
'''Input'''


AH = F1h
AH = F1h
Line 3,687: Line 1,426:


DX = Port number:
DX = Port number:
:'''Pointer/data chips'''
:{|
|0h:||CRT Controller (3?4H)
|-
|8h:||Sequencer (3C4H)
|-
|10h:||Graphics Controller (3CEH)
|-
|18h:||Attribute Controller (3C0H)
|}
:'''Single registers'''
|{|
|20h:||Miscellaneous Output register (3C2H)
|-
|28h:||Feature Control register (3?AH)
|-
|30h: Graphics 1 Position register (3CCH)
|-
|38h:||Graphics 2 Position register (3CAH)
|}
? = B for monochrome modes or D for color modes
;Output
AX: Restored


'''Pointer/data chips'''
BL: Restored
 
0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
 
'''Single registers'''


20h: Miscellaneous Output register (3C2H) <br />28h: Feature Control register (3?AH) <br />30h: Graphics 1 Position register (3CCH) <br />38h: Graphics 2 Position register (3CAH)
BH: Not restored


? = B for monochrome modes or D for color modes
DX: Not restored
 
'''Output'''
 
AX: Restored <br />BL: Restored <br />BH: Not restored <br />DX: Not restored


All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example writes the contents of ''myvalue'' into the CRT Controller Cursor Start register:
The following example writes the contents of ''myvalue''into the CRT Controller Cursor Start register:
<pre>
 
myvalue db  3h
<br /><br />
 
<pre class="western">myvalue db  3h
         mov  ah, 0f1h        ; f1 = write one register
         mov  ah, 0f1h        ; f1 = write one register
         mov  bh, myvalue    ; bh = data from myvalue
         mov  bh, myvalue    ; bh = data from myvalue
         mov  bl, 000ah      ; bl = cursor start index
         mov  bl, 000ah      ; bl = cursor start index
         mov  dx, 0000h      ; dx = crt controller
         mov  dx, 0000h      ; dx = crt controller
         int  10h            ; write it!</pre>
         int  10h            ; write it!
The example below writes the contents of ''myvalue''into the Feature Control register:
</pre>
 
The example below writes the contents of ''myvalue'' into the Feature Control register:
<br /><br />
<pre>
 
myvalue db  2h
<pre class="western">myvalue db  2h
         mov  ah, 0f1h        ; f1 = write one register
         mov  ah, 0f1h        ; f1 = write one register
         mov  bl, myvalue    ; bl = data from myvalue
         mov  bl, myvalue    ; bl = data from myvalue
         mov  dx, 0028h      ; dx = feature control register
         mov  dx, 0028h      ; dx = feature control register
         int  10h            ; write it!</pre>
         int  10h            ; write it!
 
</pre>
 
==Function F2H - Read Register Range==
=== Function F2H - Read Register Range ===
 
This function reads data from a specified range of registers on the EGA. A range of registers is defined to be several registers that have consecutive indexes, on a single chip. This function is applicable for pointer/data chips.
This function reads data from a specified range of registers on the EGA. A range of registers is defined to be several registers that have consecutive indexes, on a single chip. This function is applicable for pointer/data chips.
 
;Input
'''Input'''
 
AH = F2h
AH = F2h


CH = Starting pointer value
CH = Starting pointer value


CL = Number of registers (must be &gt;1)
CL = Number of registers (must be >1)


DX = Port number:
DX = Port number:
:'''Pointer/data chips'''
:{|
|0h:||CRT Controller (3?4H)
|-
|8h:||Sequencer (3C4H)
|-
|10h:||Graphics Controller (3CEH)
|-
|18h:||Attribute Controller (3C0H)
|}
? = B for monochrome modes, or D for color modes


'''Pointer/data chips'''
ES:BX = Points to table of one-byte entries (length = value in CL). On return, each entry is set to the contents of the corresponding register.
;Output
AX: Restored


0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
BX: Restored
 
? = B for monochrome modes, or D for color modes


ES:BX = Points to table of one-byte entries (length = value in CL). On return, each entry is set to the contents of the corresponding register.
CX: Not restored


'''Output'''
DX: Restored


AX: Restored <br />BX: Restored <br />CX: Not restored <br />DX: Restored <br />ES: Restored
ES: Restored


All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example saves the contents of the Attribute Controller Palette registers in ''paltable'':
The following example saves the contents of the Attribute Controller Palette registers in ''paltable'':
 
<pre>
<pre class="western">paltable db  16 dup (?)
paltable db  16 dup (?)
         mov  ax, ds              ; assume paltable in data segment
         mov  ax, ds              ; assume paltable in data segment
         mov  es, ax              ; es = data segment
         mov  es, ax              ; es = data segment
Line 3,767: Line 1,523:
                                   ; cl = 16 registers to read
                                   ; cl = 16 registers to read
         mov  dx, 0018h            ; dx = attribute controller
         mov  dx, 0018h            ; dx = attribute controller
         int  10h                  ; read them!</pre>
         int  10h                  ; read them!
 
</pre>
 
==Function F3H - Write Register Range==
=== Function F3H - Write Register Range ===
 
This function writes data to a specified range of registers on the EGA. A range of registers is defined to be several registers that have consecutive indexes, on a single chip. This function is applicable for the pointer/data chips.
This function writes data to a specified range of registers on the EGA. A range of registers is defined to be several registers that have consecutive indexes, on a single chip. This function is applicable for the pointer/data chips.
 
;Input
'''Input'''
 
AH = F3h
AH = F3h


CH = Starting pointer value
CH = Starting pointer value


CL = Number of registers (must be &gt;1)
CL = Number of registers (must be >1)


DX = Port number:
DX = Port number:
 
:'''Pointer/data chips'''
'''Pointer/data chips'''
:{|0h:||CRT Controller (3?4H)
 
|-
0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
|8h:||Sequencer (3C4H)
 
|-
|10h:||Graphics Controller (3CEH)
|-
|18h:||Attribute Controller (3C0H)
|}
? = B for monochrome modes, or D for color modes
? = B for monochrome modes, or D for color modes


ES:BX = Points to table of one-byte entries (length = value in CL). Each entry contains the value to be written to the corresponding register.
ES:BX = Points to table of one-byte entries (length = value in CL). Each entry contains the value to be written to the corresponding register.
;Output
AX: Restored


'''Output'''
BX: Not restored


AX: Restored <br />BX: Not restored <br />CX: Not restored <br />DX: Not restored <br />ES: Restored.
CX: Not restored


All other registers are restored.
DX: Not restored


'''Example'''
ES: Restored.


The following example writes the contents of ''cursloc''into the CRT Controller Cursor Location High and Cursor Location Low registers.
All other registers are restored.


<br /><br />
;Example
 
The following example writes the contents of ''cursloc'' into the CRT Controller Cursor Location High and Cursor Location Low registers.
<pre class="western">cursloc db  01h, 00h            ; cursor at page offset 0100h
<pre>
cursloc db  01h, 00h            ; cursor at page offset 0100h
         mov  ax, ds              ; assume cursloc in data segment
         mov  ax, ds              ; assume cursloc in data segment
         mov  es, ax              ; es = data segment
         mov  es, ax              ; es = data segment
Line 3,812: Line 1,571:
                                 ; cl = 2 registers to write
                                 ; cl = 2 registers to write
         mov  dx, 0000h          ; dx = crt controller
         mov  dx, 0000h          ; dx = crt controller
         int  10h                ; write them!</pre>
         int  10h                ; write them!
 
</pre>
 
==Function F4H - Read Register Set==
=== Function F4H - Read Register Set ===
 
This function reads data from a set of registers on the EGA. A set of registers is defined to be several registers that might have consecutive indexes and that might not be on the same chip.
This function reads data from a set of registers on the EGA. A set of registers is defined to be several registers that might have consecutive indexes and that might not be on the same chip.
 
;Input
'''Input'''
 
AH = F4h
AH = F4h


CX = Number of registers (must be &gt;1)
CX = Number of registers (must be >1)


ES:BX = Points to table of records with each entry in this format:
ES:BX = Points to table of records with each entry in this format:


Bytes 1-2: Port number:
Bytes 1-2: Port number:
 
:'''Pointer/data chips'''
'''Pointer/data chips'''
:{|
 
|0h:||CRT Controller (3?4H)
0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
|-
 
|8h:||Sequencer (3C4H)
'''Single registers'''
|-
 
|10h:||Graphics Controller (3CEH)
20h: Miscellaneous Output register (3C2H) <br />28h: Feature Control register (3?AH) <br />30h: Graphics 1 Position register (3CCH) <br />38h: Graphics 2 Position register (3CAH)
|-
 
18h:||Attribute Controller (3C0H)
|}
:'''Single registers'''
:{|
|20h:||Miscellaneous Output register (3C2H)
|-
|28h:||Feature Control register (3?AH)
|-
|30h:||Graphics 1 Position register (3CCH)
|-
|38h: Graphics 2 Position register (3CAH)
|}
? = B for monochrome modes, or D for color modes
? = B for monochrome modes, or D for color modes


Line 3,842: Line 1,608:


Byte 4: EGA Register Interface fills in data read from register specified in bytes 1-3.
Byte 4: EGA Register Interface fills in data read from register specified in bytes 1-3.
;Output
AX: Restored
BX: Restored


'''Output'''
CX: Not restored


AX: Restored <br />BX: Restored <br />CX: Not restored <br />ES: Restored.
ES: Restored.


All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example saves the contents of the Miscellaneous Output register, Sequencer Memory Mode register, and CRT Controller Mode Control register in ''results'':
The following example saves the contents of the Miscellaneous Output register, Sequencer Memory Mode register, and CRT Controller Mode Control register in ''results'':
 
<pre>
<br /><br />
outvals dw  0020h              ; miscellaneous output register
 
<pre class="western">outvals dw  0020h              ; miscellaneous output register
         db  0                  ; 0 for single registers
         db  0                  ; 0 for single registers
         db  ?                  ; returned value
         db  ?                  ; returned value
Line 3,881: Line 1,648:
         add  si, 4              ; skip to next source byte
         add  si, 4              ; skip to next source byte
         inc  di                  ; point to next destination byte
         inc  di                  ; point to next destination byte
         loop loop</pre>
         loop loop
 
</pre>
 
==Function F5H - Write Register Set==
=== Function F5H - Write Register Set ===
 
This function writes data to a set of registers on the EGA. A set of registers is defined to be several registers that might have consecutive indexes, and that might be on the same chip.
This function writes data to a set of registers on the EGA. A set of registers is defined to be several registers that might have consecutive indexes, and that might be on the same chip.
 
;Input
'''Input'''
 
AH = F5h
AH = F5h


CX = Number of registers (must be &gt;1)
CX = Number of registers (must be >1)


ES:BX = Points to table of values with each entry in this format:
ES:BX = Points to table of values with each entry in this format:


Bytes 1-2: Port number:
Bytes 1-2: Port number:
 
:'''Pointer/data chips'''
'''Pointer/data chips'''
:{|
 
|0h:||CRT Controller (3?4H)
0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
|-
 
|8h:||Sequencer (3C4H)
'''Single registers'''
|-
 
|10h:||Graphics Controller (3CEH)
20h: Miscellaneous Output register (3C2H) <br />28h: Feature Control register (3?AH) <br />30h: Graphics 1 Position register (3CCH) <br />38h: Graphics 2 Position register (3CAH)
|-
 
|18h:||Attribute Controller (3C0H)
|}
:'''Single registers'''
:{|
|20h:||Miscellaneous Output register (3C2H)
|-
|28h:||Feature Control register (3?AH)
|-
|30h:||Graphics 1 Position register (3CCH)
|-
|38h: Graphics 2 Position register (3CAH)
|}
? = B for monochrome modes, or D for color modes
? = B for monochrome modes, or D for color modes


Line 3,911: Line 1,685:


Byte 4: Data to be written to register specified in bytes 1-3.
Byte 4: Data to be written to register specified in bytes 1-3.
 
;Output
'''Output'''
:AX: Restored
 
:BX: Restored
AX: Restored <br />BX: Restored <br />CX: Not restored <br />ES: Restored.
:CX: Not restored
:ES: Restored.


All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example writes the contents of ''outvals'' to the Miscellaneous Output register, Sequencer Memory Mode register, and CRT Controller Mode Control register:
The following example writes the contents of ''outvals''to the Miscellaneous Output register, Sequencer Memory Mode register, and CRT Controller Mode Control register:
<pre>
 
outvals dw  0020h              ; miscellaneous output register
<br /><br />
 
<pre class="western">outvals dw  0020h              ; miscellaneous output register
         db  0                  ; 0 for single registers
         db  0                  ; 0 for single registers
         db  0a7h                ; output value
         db  0a7h                ; output value
Line 3,938: Line 1,710:
         mov  ah, 0f5h            ; f5 = write register set
         mov  ah, 0f5h            ; f5 = write register set
         mov  cx, 3              ; number of entries in outvals
         mov  cx, 3              ; number of entries in outvals
         int  10h                ; write the registers!</pre>
         int  10h                ; write the registers!
 
</pre>
 
==Function F6H - Revert to Default Registers==
=== Function F6H - Revert to Default Registers ===
This function restores the default settings of any registers that the application program has changed through the EGA Register Interface. The default settings are defined in a call to Function F7 (described in the next section).
This function restores the default settings of any registers that the application program has changed through the EGA Register Interface. The default settings are defined in a call to Function F7 (described in the next section).
 
;Input
'''Input'''
 
AH = F6h
AH = F6h
 
;Output
'''Output'''
 
All registers are restored.
All registers are restored.
 
;Example
'''Example'''
 
The following example restores the default settings of the EGA registers:
The following example restores the default settings of the EGA registers:
mov  ah, 0f6h    ; f6 = revert to default registers
int  10h        ; do it now!


<br /><br />
==Function F7H - Define Default Register Table==
 
This function defines a table containing default values for any pointer/data chip or single register. If default values are defined for a pointer/data chip, they must be defined for all registers within that chip.
<pre class="western">        mov  ah, 0f6h    ; f6 = revert to default registers
;Input
        int  10h        ; do it now!</pre>
 
 
=== Function F7H - Define Default Register Table ===
 
This function defines a table containing default values for any pointer/ data chip or single register. If default values are defined for a pointer/ data chip, they must be defined for all registers within that chip.
 
'''Input'''
 
AH = F7h
AH = F7h


DX = Port number:
DX = Port number:
 
:'''Pointer/data chips'''
'''Pointer/data chips'''
:{|
 
|0h:||CRT Controller (3?4H)
0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
|-
 
|8h:||Sequencer (3C4H)
'''Single registers'''
|-
 
|10h:||Graphics Controller (3CEH)
20h: Miscellaneous Output register (3C2H) <br />28h: Feature Control register (3?AH) <br />30h: Graphics 1 Position register (3CCH) <br />38h: Graphics 2 Position register (3CAH)
|-
 
|18h:||Attribute Controller (3C0H)
|}
|'''Single registers'''
|{|
|20h:||Miscellaneous Output register (3C2H)
|-
|28h: Feature Control register (3?AH)
|-
|30h:||Graphics 1 Position register (3CCH)
|-
|38h:||Graphics 2 Position register (3CAH)
|}
? = B for monochrome modes, or D for color modes
? = B for monochrome modes, or D for color modes


ES:BX = Points to table of one-byte entries. Each entry contains the default value for the corresponding register. The table must contain entries for all registers.
ES:BX = Points to table of one-byte entries. Each entry contains the default value for the corresponding register. The table must contain entries for all registers.


'''Output'''
;Output
 
:AX: Restored
AX: Restored <br />BX: Not restored <br />DX: Not restored <br />ES: Restored
:BX: Not restored
 
:DX: Not restored
:ES: Restored
All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example defines default values for the Attribute Controller:
The following example defines default values for the Attribute Controller:
 
<pre>
<br /><br />
attrdflt db  00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h
 
<pre class="western">attrdflt db  00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h
         db  10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h
         db  10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h
         db  08h, 00h, 0fh, 00h
         db  08h, 00h, 0fh, 00h
Line 4,004: Line 1,771:
         mov  ah, 0f7h            ; f7 = define default register table
         mov  ah, 0f7h            ; f7 = define default register table
         mov  dx, 0018h          ; dx = attribute controller
         mov  dx, 0018h          ; dx = attribute controller
         int  10h                ; do it!</pre>
         int  10h                ; do it!
</pre>
The example below defines a default value for the Feature Control register:
The example below defines a default value for the Feature Control register:
 
<pre>
<br /><br />
featdflt db  00h
 
<pre class="western">featdflt db  00h
         mov  ax, ds              ; assume featdflt in data segment
         mov  ax, ds              ; assume featdflt in data segment
         mov  es, ax              ; es = data segment
         mov  es, ax              ; es = data segment
Line 4,015: Line 1,781:
         mov  ah, 0f7h            ; f7 = define default register table
         mov  ah, 0f7h            ; f7 = define default register table
         mov  dx, 0028h          ; dx = feature control register
         mov  dx, 0028h          ; dx = feature control register
         int  10h                ; do it!</pre>
         int  10h                ; do it!
 
</pre>
 
=== Function F8H - Read Default Register Table ===


==Function F8H - Read Default Register Table==
This function reads the table containing default register values for any pointer/data chip or single register.
This function reads the table containing default register values for any pointer/data chip or single register.


'''Input'''
;Input
 
AH = 0F8H
AH = 0F8H


DX = Port number:
DX = Port number:
 
:'''Pointer/data chips'''
'''Pointer/data chips'''
:{|
 
|0h:||CRT Controller (3?4H)
0h: CRT Controller (3?4H) <br />8h: Sequencer (3C4H) <br />10h: Graphics Controller (3CEH) <br />18h: Attribute Controller (3C0H)
|-
 
|8h:||Sequencer (3C4H)
'''Single registers'''
|-
 
|10h||Graphics Controller (3CEH)
20h: Miscellaneous Output register (3C2H) <br />28h: Feature Control register (3?AH) <br />30h: Graphics 1 Position register (3CCH) <br />38h: Graphics 2 Position register (3CAH)
|-
 
|18h||Attribute Controller (3C0H)
|}
:'''Single registers'''
:{|
|20h:||Miscellaneous Output register (3C2H)
|-
|28h:||Feature Control register (3?AH)
|-
|30h:||Graphics 1 Position register (3CCH)
|-
|38h:||Graphics 2 Position register (3CAH)
|}
? = B for monochrome modes, or D for color modes
? = B for monochrome modes, or D for color modes


ES:BX = Points to a table into which the default values are returned. The table must have room for the full set of values for the pointer/data chip or single register specified.
ES:BX = Points to a table into which the default values are returned. The table must have room for the full set of values for the pointer/data chip or single register specified.


'''Output'''
;Output:
 
:AX: Restored
AX: Restored <br />BX: Not restored <br />DX: Not restored <br />ES: Restored
:BX: Not restored
 
:DX: Not restored
:ES: Restored
All other registers are restored.
All other registers are restored.


'''Example'''
;Example
 
The following example reads the default values for the Miscellaneous Output register:
The following example reads the default values for the Miscellaneous Output register:
 
<pre>
<br /><br />
regdflt  db
 
<pre class="western">regdflt  db
         mov  ax, ds
         mov  ax, ds
         mov  es, ax              ; es = data segment
         mov  es, ax              ; es = data segment
Line 4,058: Line 1,831:
         mov  ah, 0f8h            ; f8 = read default register table
         mov  ah, 0f8h            ; f8 = read default register table
         mov  dx, 0020h            ; dx = miscellaneous output register
         mov  dx, 0020h            ; dx = miscellaneous output register
         int  10h                  ; do it!</pre>
         int  10h                  ; do it!
</pre>
The following example reads the default values for the CRT Controller register:
The following example reads the default values for the CRT Controller register:
 
<pre>
<br /><br />
regdflt  db  25 dup (?)
 
<pre class="western">regdflt  db  25 dup (?)
         mov  ax, ds
         mov  ax, ds
         mov  es, ax              ; es = data segment
         mov  es, ax              ; es = data segment
Line 4,069: Line 1,841:
         mov  ah, 0f8h            ; f8 = read default register table
         mov  ah, 0f8h            ; f8 = read default register table
         mov  dx, 0000h            ; dx = crt controller register
         mov  dx, 0000h            ; dx = crt controller register
         int  10h                  ; do it!</pre>
         int  10h                  ; do it!
 
</pre>
 
==Function FAH - Interrogate Driver==
=== Function FAH - Interrogate Driver ===
 
This function returns a value specifying whether the EGA.SYS device driver is present.
This function returns a value specifying whether the EGA.SYS device driver is present.
;Input
:AH = FAh
:BX = 0


'''Input'''
;Output
 
:AX: Restored
AH = FAh
:BX: 0, if EGA.SYS driver is not present
 
:ES:BX: Pointer to EGA Register Interface version number, if present
BX = 0
:Byte 1: Major release number
 
:Byte 2: Minor release number (in 1/100ths)
'''Output'''
 
AX: Restored <br />BX: 0, if EGA.SYS driver is not present <br />ES:BX: Pointer to EGA Register Interface version number, if present <br />Byte 1: Major release number <br />Byte 2: Minor release number (in 1/100ths)
 
'''Example'''


;Example
The following example interrogates the driver and displays the results:
The following example interrogates the driver and displays the results:
 
<pre>
<br /><br />
gotmsg  db  "EGA.SYS driver found", 0dh, 0ah, 24h
 
nopmsg  db  "EGA.SYS driver not found", 0dh, 0ah, 24h
<pre class="western">gotmsg  db  &quot;EGA.SYS driver found&quot;, 0dh, 0ah, 24h
revmsg  db  "revision $"
nopmsg  db  &quot;EGA.SYS driver not found&quot;, 0dh, 0ah, 24h
revmsg  db  &quot;revision $&quot;
crlf    db  0dh, 0ah, 24h
crlf    db  0dh, 0ah, 24h
ten    db  10
ten    db  10
Line 4,111: Line 1,878:
         mov  dx, offset revmsg  ; assume revmsg in data segment
         mov  dx, offset revmsg  ; assume revmsg in data segment
         mov  ah, 09h            ; 9 = print string
         mov  ah, 09h            ; 9 = print string
         int  21h                ; output &quot;revision &quot;
         int  21h                ; output "revision "
         mov  dl, es:[bx]        ; dl = major release number
         mov  dl, es:[bx]        ; dl = major release number
         add  dl, &quot;0&quot;           ; convert to ASCII
         add  dl, "0"           ; convert to ASCII
         mov  ah, 2              ; 2 = display character
         mov  ah, 2              ; 2 = display character
         int  21h                ; output major release number
         int  21h                ; output major release number
         mov  dl, &quot;.&quot;           ; dl = &quot;.&quot;
         mov  dl, "."           ; dl = "."
         mov  ah, 2              ; 2 = display character
         mov  ah, 2              ; 2 = display character
         int  21h                ; output a period
         int  21h                ; output a period
Line 4,125: Line 1,892:
         mov  bx, ax            ; save ax in bx
         mov  bx, ax            ; save ax in bx
         mov  dl, al            ; dl = 10ths
         mov  dl, al            ; dl = 10ths
         add  dl, &quot;0&quot;           ; convert to ASCII
         add  dl, "0"           ; convert to ASCII
         mov  ah, 2              ; 2 = display character
         mov  ah, 2              ; 2 = display character
         int  21h                ; output minor release 10ths
         int  21h                ; output minor release 10ths
         mov  dl, bh            ; dl = 100ths
         mov  dl, bh            ; dl = 100ths
         add  dl, &quot;0&quot;           ; convert to ASCII
         add  dl, "0"           ; convert to ASCII
         mov  ah, 2              ; 2 = display character
         mov  ah, 2              ; 2 = display character
         int  21h                ; output minor release 100ths
         int  21h                ; output minor release 100ths
Line 4,135: Line 1,902:
         mov  ah, 09h            ; 9 = print string
         mov  ah, 09h            ; 9 = print string
         int  21h                ; output end of line
         int  21h                ; output end of line
continue:                      ; the end</pre>
continue:                      ; the end
 
</pre>
 
==INT 2Fh Screen Switch Notification==
=== INT 2Fh Screen Switch Notification ===
 
A new Multiplex Interrupt (INT 2Fh) is issued by OS/2 to signal either of the following two events:
A new Multiplex Interrupt (INT 2Fh) is issued by OS/2 to signal either of the following two events:
:Switching the DOS application to the background (AX = 4001H)
:Switching the DOS application to the foreground (AX = 4002H)


�Switching the DOS application to the background (AX = 4001H) <br />�Switching the DOS application to the foreground (AX = 4002H)
A DOS application that receives this signal must ''hook'' the Multiplex Interrupt vector. That is, when the application is started, it must save the current INT 2Fh vector and set this vector to point to the application's interrupt handler.
 
A DOS application that receives this signal must ''hook''the Multiplex Interrupt vector. That is, when the application is started, it must save the current INT 2Fh vector and set this vector to point to the application' s interrupt handler.


When the notification is received, the application must save all registers, perform whatever processing is required, restore all registers, and issue the IRET instruction to return to the operating system. Only the following forms of processing are supported:
When the notification is received, the application must save all registers, perform whatever processing is required, restore all registers, and issue the IRET instruction to return to the operating system. Only the following forms of processing are supported:
 
:Modifying application or video memory (or both)
�Modifying application or video memory (or both) <br />�Issuing ROM BIOS video service calls (INT 10h) <br />�Issuing EGA Register Interface calls (INT 10h) <br />�Programming the EGA video card directly
:Issuing ROM BIOS video service calls (INT 10h)
 
:Issuing EGA Register Interface calls (INT 10h)
'''Note:'''When an application is being switched to the background, and the application's INT 2Fh handler uses the EGA Register Interface to save the EGA registers, these registers are restored automatically when the application is returned to the foreground.
:Programming the EGA video card directly
'''Note:''' When an application is being switched to the background, and the application's INT 2Fh handler uses the EGA Register Interface to save the EGA registers, these registers are restored automatically when the application is returned to the foreground.


An application can receive notification that it is being switched to the background at any time. Code sequences that are sensitive to interruption can be protected with CLI/STI instructions. When the switch notification occurs, the application (other than its INT 2Fh handler) is frozen until it is returned to the foreground.
An application can receive notification that it is being switched to the background at any time. Code sequences that are sensitive to interruption can be protected with CLI/STI instructions. When the switch notification occurs, the application (other than its INT 2Fh handler) is frozen until it is returned to the foreground.
Line 4,156: Line 1,922:
When an application's INT 2Fh handler receives notification with a value in AH other than 40H, the application must issue the JMP FAR instruction to branch to the previous INT 2Fh vector.
When an application's INT 2Fh handler receives notification with a value in AH other than 40H, the application must issue the JMP FAR instruction to branch to the previous INT 2Fh vector.


 
==Using Extended Screen and Keyboard Control (ANSI.SYS, ANSICALL)==
 
=== Using Extended Screen and Keyboard Control (ANSI.SYS, ANSICALL) ===
 
This section explains how to issue special control character sequences to:
This section explains how to issue special control character sequences to:
:Control the position of the cursor
:Erase text from the screen
:Set the display mode
:Redefine the meaning of keyboard keys


�Control the position of the cursor <br />�Erase text from the screen <br />�Set the display mode <br />�Redefine the meaning of keyboard keys
ANSI extended screen and keyboard control sequences are supported in DOS sessions by ANSI.SYS, an installable device driver. In OS/2 sessions, these control sequences are supported by the ANSICALL component within OS/2 CHAR.DLL.
 
ANSI extended screen and keyboard control sequences are supported in DOS sessions by ANSI.SYS, an installable device driver. In OS/2 sessions, these control sequences are supported by the ANSICALL component within OS/2 CHAR. DLL.
 
'''Note:'''In this section, unless otherwise specified, ANSI refers to both ANSI.SYS and ANSICALL.
 


'''Note:''' In this section, unless otherwise specified, ANSI refers to both ANSI.SYS and ANSICALL.


=== Limitations and Restrictions ===
===Limitations and Restrictions===
 
ANSI operates on a per-session basis. OS/2-mode ANSI is affected when keys are reassigned in a code page environment. ANSI does not provide code page support for key reassignment in a DOS session.
ANSI operates on a per-session basis. OS/2-mode ANSI is affected when keys are reassigned in a code page environment. ANSI does not provide code page support for key reassignment in a DOS session.


 
===Control Sequence Syntax===
 
=== Control Sequence Syntax ===
 
Each of the cursor control sequences is in the format:
Each of the cursor control sequences is in the format:
 
:ESC [ ''parameters'' COMMAND
<pre class="western">    ESC [ parameters COMMAND </pre>
A cursor control sequence is defined as follows:
A cursor control sequence is defined as follows:
 
{| class="wikitable"
<pre class="western">/-------------------------------------------------------------\
!Sequence||Description
|Sequence            |Description                             |
|-
|--------------------+----------------------------------------|
|ESC||The 1-byte ASCII code for ESC (1BH). It is not the three characters ESC.
|ESC                 |The 1-byte ASCII code for ESC (1BH). It |
|-
|                    |is not the three characters ESC.       |
|[||The character [.
|--------------------+----------------------------------------|
|-
|[                   |The character [.                       |
|parameters||The numeric values specified for #. The # represents a numeric parameter that is an integer value specified with ASCII characters. If a parameter value is not specified, or if a value of 0 (zero) is specified, the default value for the parameter is used.
|--------------------+----------------------------------------|
|-
|parameters         |The numeric values specified for #. The |
|COMMAND||An alphabetic string that represents the command. It is case-specific.
|                    |# represents a numeric parameter that is|
|}
|                    |an integer value specified with ASCII   |
For example, ''ESC [2;10H'' could be created using BASIC as shown below. Notice that "CHR$(27)" is ESC.
|                    |characters. If a parameter value is not |
<pre>
|                    |specified, or if a value of 0 (zero) is |
The IBM Personal Computer Basic Version 3.00 Copyright IBM Corp. 1981, 1982, 1983, 1984
|                    |specified, the default value for the   |
|                    |parameter is used.                     |
|--------------------+----------------------------------------|
|COMMAND             |An alphabetic string that represents the|
|                    |command. It is case-specific.           |
\-------------------------------------------------------------/</pre>
For example, ''ESC [2;10H''could be created using BASIC as shown below. Notice that &quot;CHR$(27)&quot; is ESC.
 
<pre class="western">The IBM Personal Computer Basic Version 3.00 Copyright IBM Corp. 1981, 1982, 1983, 1984
xxxxx Bytes free
xxxxx Bytes free


OK
OK
open &quot;sample&quot; for output as 1
open "sample" for output as 1
OK
OK
print #1, CHR$(27);&quot;[2;10H&quot;;&quot;x row 2 col 10&quot;
print #1, CHR$(27);"[2;10H";"x row 2 col 10"
OK
OK
close #1
close #1
OK</pre>
OK
 
</pre>
=== Cursor Control Sequences ===
===Cursor Control Sequences===
The following tables contain the cursor control sequences used to control cursor positioning:
The following tables contain the cursor control sequences used to control cursor positioning:


<pre class="western">/-------------------------------------------------------------\
{| class="wikitable"
|Cursor Position     |Function                               |
!Cursor Position||Function
|--------------------+----------------------------------------|
|-
|ESC [#;#H           |Moves the cursor to the position       |
|ESC [#;#H|||Moves the cursor to the position specified by the parameters. The first parameter specifies the row number and the second parameter specifies the column number. The default value is 1. If no parameter is given, the cursor is moved to the home position.
|                    |specified by the parameters. The first |
|}
|                    |parameter specifies the row number and |
|                    |the second parameter specifies the     |
|                    |column number. The default value is 1. |
|                    |If no parameter is given, the cursor is |
|                    |moved to the home position.             |
\-------------------------------------------------------------/</pre>
This example copies the file SAMPLE from the previous example to CON, that places the cursor on row 2, column 10 of the screen:
This example copies the file SAMPLE from the previous example to CON, that places the cursor on row 2, column 10 of the screen:
 
:type sample
<br /><br />
{| class="wikitable"
 
!Cursor Up||Function
<pre class="western">type sample</pre>
|-
<br /><br />
|ESC [#A||Moves the cursor up one or more rows without changing the column position. The value of # determines the number of lines moved. The default value for # is 1. This sequence is ignored if the cursor is already on the top line.
 
|-
<pre class="western">/-------------------------------------------------------------\
!Cursor Down||
|Cursor Up           |Function                               |
|-
|--------------------+----------------------------------------|
|ESC [#B||Moves the cursor down one or more rows without changing the column position. The value of # determines the number of lines moved. The default value for # is 1. The sequence is ignored if the cursor is already on the bottom line.
|ESC [#A             |Moves the cursor up one or more rows   |
|-
|                    |without changing the column position.   |
!Cursor Forward||
|                    |The value of # determines the number of |
|-
|                    |lines moved. The default value for # is |
|ESC [#C||Moves the cursor forward one or more columns without changing the row position. The value of # determines the number of columns moved. The default value for # is 1. This sequence is ignored if the cursor is already in the rightmost column.
|                    |1. This sequence is ignored if the     |
|-
|                    |cursor is already on the top line.     |
!Cursor Backward||
\-------------------------------------------------------------/</pre>
|-
<br /><br />
|ESC [#D||Moves the cursor back one or more columns without changing the row position. The value of # determines the number of columns moved. The default value for # is 1. This sequence is ignored if the cursor is already in the leftmost column.
 
|-
<pre class="western">/-------------------------------------------------------------\
!Horizontal and Vertical Position||
|Cursor Down         |Function                                |
|-
|--------------------+----------------------------------------|
|ESC [#;#f||Moves the cursor to the position specified by the parameters. The first parameter specifies the line number and the second parameter specifies the column number. The default value is 1. If no parameter is given, the cursor is moved to the home position.
|ESC [#B             |Moves the cursor down one or more rows |
|-
|                    |without changing the column position.   |
!Cursor Position Report||
|                    |The value of # determines the number of |
|-
|                    |lines moved. The default value for # is |
|ESC [#;#R||The cursor sequence report reports the current cursor position through the standard input device. The first parameter specifies the current line and the second parameter specifies the current column.
|                    |1. The sequence is ignored if the cursor|
|-
|                    |is already on the bottom line.         |
!Device Status Report||
\-------------------------------------------------------------/</pre>
|-
<br /><br />
|ESC [6n||The console driver gives a cursor position report sequence on receipt of device status report.
 
|}
<pre class="western">/-------------------------------------------------------------\
'''Note:''' Do not use the Device Status Report as part of a prompt.
|Cursor Forward     |Function                                |
|--------------------+----------------------------------------|
|ESC [#C             |Moves the cursor forward one or more   |
|                    |columns without changing the row       |
|                    |position. The value of # determines the |
|                    |number of columns moved. The default   |
|                    |value for # is 1. This sequence is     |
|                    |ignored if the cursor is already in the |
|                    |rightmost column.                       |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Cursor Backward     |Function                                |
|--------------------+----------------------------------------|
|ESC [#D             |Moves the cursor back one or more       |
|                    |columns without changing the row       |
|                    |position. The value of # determines the |
|                    |number of columns moved. The default   |
|                    |value for # is 1. This sequence is     |
|                    |ignored if the cursor is already in the |
|                    |leftmost column.                       |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Horizontal and     |Function                                |
|Vertical Position   |                                       |
|--------------------+----------------------------------------|
|ESC [#;#f           |Moves the cursor to the position       |
|                    |specified by the parameters. The first |
|                    |parameter specifies the line number and |
|                    |the second parameter specifies the     |
|                    |column number. The default value is 1. |
|                    |If no parameter is given, the cursor is |
|                    |moved to the home position.             |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Cursor Position     |Function                                |
|Report             |                                       |
|--------------------+----------------------------------------|
|ESC [#;#R           |The cursor sequence report reports the |
|                    |current cursor position through the     |
|                    |standard input device. The first       |
|                    |parameter specifies the current line and|
|                    |the second parameter specifies the     |
|                    |current column.                         |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Device Status Report|Function                                |
|--------------------+----------------------------------------|
|ESC [6n             |The console driver gives a cursor       |
|                    |position report sequence on receipt of |
|                    |device status report.                   |
\-------------------------------------------------------------/</pre>
'''Note:'''Do not use the Device Status Report as part of a prompt.


This example tells ANSI to put the current cursor position (row and column) in STDIN. Then the program reads it from STDIN and outputs it to STDOUT.
This example tells ANSI to put the current cursor position (row and column) in STDIN. Then the program reads it from STDIN and outputs it to STDOUT.
 
<pre>
<br /><br />
PROGRAM dsr(INPUT,OUTPUT);
 
<pre class="western">PROGRAM dsr(INPUT,OUTPUT);


   VAR
   VAR
Line 4,351: Line 2,032:
         WRITE(inkey,inkey)                { write column  }
         WRITE(inkey,inkey)                { write column  }
   END.</pre>
   END.</pre>
<br /><br />
{| class="wikitable"
 
!Save Cursor Position||Function
<pre class="western">/-------------------------------------------------------------\
|-
|Save Cursor Position|Function                               |
|ESC [s||The current cursor position is saved. This cursor position can be restored with the restore cursor position sequence (see below).
|--------------------+----------------------------------------|
|-
|ESC [s             |The current cursor position is saved.   |
!Restore Cursor Position||
|                    |This cursor position can be restored   |
|-
|                    |with the restore cursor position       |
|ESC [u||Restores the cursor to the value it had when the console driver received the save cursor position sequence.
|                    |sequence (see below).                   |
|}
\-------------------------------------------------------------/</pre>
===Erasing===
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Restore Cursor     |Function                                |
|Position           |                                       |
|--------------------+----------------------------------------|
|ESC [u             |Restores the cursor to the value it had |
|                    |when the console driver received the   |
|                    |save cursor position sequence.         |
\-------------------------------------------------------------/</pre>
 
 
=== Erasing ===
 
The following tables contain the control sequences used to erase text from the screen:
The following tables contain the control sequences used to erase text from the screen:
{| class="wikitable"
!Erase in Display||Function
|-
|ESC [2J||Erases all of the screen, and the cursor goes to the home position.
|-
!Erase in Line||
|-
|ESC [K||Erases from the cursor to the end of the line and includes the cursor position.
|}


<pre class="western">/-------------------------------------------------------------\
===Controlling the Display Mode===
|Erase in Display    |Function                                |
|--------------------+----------------------------------------|
|ESC [2J            |Erases all of the screen, and the cursor|
|                    |goes to the home position.              |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Erase in Line      |Function                                |
|--------------------+----------------------------------------|
|ESC [K              |Erases from the cursor to the end of the|
|                    |line and includes the cursor position.  |
\-------------------------------------------------------------/</pre>
 
 
=== Controlling the Display Mode ===
 
The following tables contain the control sequences used to set the mode of operation:
The following tables contain the control sequences used to set the mode of operation:
:Set Graphics Rendition (SGR)
:Set Mode (SM)
:Reset Mode (RM)
{|class="wikitable"
!Set Graphics Rendition (SGR)||Function
|-
|ESC [#;...;#m||Sets the character attribute specified by the parameters. All of the following characters have the attribute according to the parameters until the next occurrence of SGR.
{|
!Parameter||Meaning
|-
|0||All attributes off (normal white on black
|-
|1||Bold on (high intensity)
|-
|4||Underscore on (monochrome compatible modes)
|-
|5||Blink on
|-
|7||Reverse video on
|-
|8||Canceled on (invisible)
|-
|30||Black foreground
|-
|31||Red foreground
|-
|32||Green foreground
|-
|33||Yellow foreground
|-
|34 ||Blue foreground
|-
|35||Magenta foreground
|-
|36||Cyan foreground
|-
|37||White foreground
|-
|38||Reserved
|-
|39||Reserved
|-
|40||Black background
|-
|41||Red background
|-
|42||Green background
|-
|43||Yellow background
|-
|44||Blue background
|-
|45||Magenta background
|-
|46||Cyan background
|-
|47||White background
|}
|}


�Set Graphics Rendition (SGR) <br />�Set Mode (SM) <br />�Reset Mode (RM)
{| class="wikitable"
!Set Mode (SM)||Function
|-
|ESC [=#h<br>or ESC [=h<br>or ESC [=0h<br>or ESC [?7h||Invokes the screen width or type specifiedby the parameter.
{|
!Parameter||Meaning
|-
|0||40 x 25 black and white
|-
|1||40 x 25 color
|-
|2||80 x 25 black and white
|-
|3||80 x 25 color
|-
|4||320 x 200 color
|-
|5||320 x 200 black and white
|-
|6||640 x 200 black and white
|-
|7||Wrap at end of line. Typing past end-of-line results in new line.
|}
|}


<br /><br />
{| class="wikitable"
 
!Reset Mode (RM)||Function
<pre class="western">/-------------------------------------------------------------\
|-
|Set Graphics    |Function                                    |
|ESC [=#l<br>or ESC [=l<br>or ESC [=0l<br>or ESC [?7l||Parameters are the same as Set Mode (SM) except that parameter 7 resets wrap at end-of-line mode (characters past end-of-line are discarded).
|Rendition (SGR) |                                           |
|}
|----------------+--------------------------------------------|
|ESC [#;...;#m  |Sets the character attribute specified by  |
|                |the parameters.  All of the following char- |
|                |acters have the attribute according to the  |
|                |parameters until the next occurrence of SGR.|
|                |                                            |
|                |Parameter  Meaning                          |
|                |                                            |
|                |    0      All attributes off (normal white |
|                |          on black                        |
|                |    1      Bold on (high intensity)        |
|                |    4      Underscore on (monochrome-      |
|                |          compatible modes)                |
|                |    5      Blink on                        |
|                |    7      Reverse video on                |
|                |    8      Canceled on (invisible)          |
|                |  30      Black foreground                |
|                |  31      Red foreground                  |
|                |  32      Green foreground                |
|                |  33      Yellow foreground                |
|                |  34      Blue foreground                  |
|                |  35      Magenta foreground              |
|                |  36      Cyan foreground                  |
|                |  37      White foreground                |
|                |  38      Reserved                        |
|                |  39      Reserved                        |
|                |  40      Black background                |
|                |  41      Red background                  |
|                |  42      Green background                |
|                |  43      Yellow background                |
|                |  44      Blue background                  |
|                |  45      Magenta background              |
|                |  46      Cyan background                  |
|                |  47      White background                |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Set Mode (SM)  |      Function                              |
|----------------+--------------------------------------------|
|  ESC [=#h    |Invokes the screen width or type specified  |
|or ESC [=h      |by the parameter.                          |
|or ESC [=0h    |                                            |
|or ESC [?7h    |                                            |
|                |Parameter  Meaning                          |
|                |                                            |
|                |    0      40 x 25 black and white        |
|                |    1      40 x 25 color                  |
|                |    2      80 x 25 black and white        |
|                |    3      80 x 25 color                  |
|                |    4      320 x 200 color                  |
|                |    5      320 x 200 black and white        |
|                |    6      640 x 200 black and white        |
|                |    7      Wrap at end of line. Typing past |
|                |          end-of-line results in new line. |
\-------------------------------------------------------------/</pre>
<br /><br />
 
<pre class="western">/-------------------------------------------------------------\
|Reset Mode (RM) |      Function                              |
|----------------+--------------------------------------------|
|   ESC [=#l    |      Parameters are the same as Set Mode   |
|or ESC [=l      |      (SM) except that parameter 7 resets   |
|or ESC [=0l    |      wrap at end-of-line mode (characters |
|or ESC [?7l    |      past end-of-line are discarded).     |
\-------------------------------------------------------------/</pre>
 
 
=== Keyboard Key Reassignment ===


===Keyboard Key Reassignment===
The ANSI system can be used to reassign keys on the keyboard. When an application calls ''KbdStringIn'', the reassigned key's ASCII code is converted to the specified string and is passed back to the calling application. For example, replace a with q so that whenever the a key is pressed, a q is passed to the application that is reading input.
The ANSI system can be used to reassign keys on the keyboard. When an application calls ''KbdStringIn'', the reassigned key's ASCII code is converted to the specified string and is passed back to the calling application. For example, replace a with q so that whenever the a key is pressed, a q is passed to the application that is reading input.


In OS/2 2.1, keyboard remapping can be done only from an application calling ''KbdStringIn''. In DOS, keyboard remapping must be done from the command line.
In OS/2 2.1, keyboard remapping can be done only from an application calling ''KbdStringIn''. In DOS, keyboard remapping must be done from the command line.


'''Note:'''Keyboard reassignment works only with OS/2 applications that use the ''KbdStringIn''call to get input.
'''Note:''' Keyboard reassignment works only with OS/2 applications that use the ''KbdStringIn'' call to get input.


OS/2 mode ANSI is affected when keys are reassigned in a code-page environment. ANSI &quot;remembers&quot; the code page under which a key is reassigned . The keyboard subsystem checks for reassigned keys when the application calls the ''KbdStringIn''function. When a reassigned key is detected, the ANSI support:
OS/2 mode ANSI is affected when keys are reassigned in a code-page environment. ANSI "remembers" the code page under which a key is reassigned. The keyboard subsystem checks for reassigned keys when the application calls the ''KbdStringIn'' function. When a reassigned key is detected, the ANSI support:
 
#Checks to see what code page the requestor is running under
1.Checks to see what code page the requestor is running under <br />2.Looks internally to see if the key has been reassigned under that code page <br />3.If there is a key reassignment for that code page, gives the reassignment string <br />4.Otherwise, gives the original ASCII codes.
#Looks internally to see if the key has been reassigned under that code page
#If there is a key reassignment for that code page, gives the reassignment string
#Otherwise, gives the original ASCII codes.


A maximum storage of 64KB can be allocated to OS/2 mode ANSI-reassigned key definitions. The table shown below contains the control sequences used to redefine the meaning of keyboard keys:
A maximum storage of 64KB can be allocated to OS/2 mode ANSI-reassigned key definitions. The table shown below contains the control sequences used to redefine the meaning of keyboard keys:
 
{|
<pre class="western">/--------------------------------------------------------------\
!The control sequence is:||Function
| The control sequence is:     |Function                       |
|-
|------------------------------+-------------------------------|
|ESC [#;#;...#p<br>or ESC ["string"p<br>or ESC [#;"string";#;#; "string";#p<br>or any other combination of strings and decimal numbers||The first ASCII code in the control sequence defines which code is being mapped. The remaining numbers define the sequence of ASCII codes generated when this key is intercepted. However, if the first code in the sequence is 0 (NULL), the first and second code make up an extended ASCII redefinition.
|   ESC [#;#;...#p           |The first ASCII code in the    |
|}
|or ESC [&quot;string&quot;p           |control sequence defines which |
|or ESC [#;&quot;string&quot;;#;#;      |code is being mapped. The     |
|    &quot;string&quot;;#p              |remaining numbers define the   |
|or  any other combination    |sequence of ASCII codes       |
|    of strings and decimal    |generated when this key is     |
|    numbers                  |intercepted. However, if the |
|                              |first code in the sequence is |
|                              |0 (NULL), the first and second |
|                              |code make up an extended ASCII |
|                              |redefinition.                 |
\--------------------------------------------------------------/</pre>
To execute the examples below, either create a file that contains the following statements and then use the TYPE command to display the file that contains the statement, or execute the command at the OS/2 prompt:
To execute the examples below, either create a file that contains the following statements and then use the TYPE command to display the file that contains the statement, or execute the command at the OS/2 prompt:
 
:Assign the '''A'''and '''a'''key to the '''Q'''and '''q'''key, respectively.
�Assign the '''A'''and '''a'''key to the '''Q'''and '''q'''key, respectively.
:Assign the '''Q'''and '''q'''key to the '''A'''and '''a'''key, respectively:
 
�Assign the '''Q'''and '''q'''key to the '''A'''and '''a'''key, respectively:
 
'''Using a File:'''
'''Using a File:'''
 
<pre>
<br /><br />
ESC [65;8lp          A becomes Q
 
<pre class="western">ESC [65;8lp          A becomes Q
ESC [97;113p        a becomes q
ESC [97;113p        a becomes q
ESC [81;65p          Q becomes A
ESC [81;65p          Q becomes A
ESC [113;97p        q becomes a</pre>
ESC [113;97p        q becomes a
</pre>
'''At the OS/2 Prompt:'''
'''At the OS/2 Prompt:'''
 
<pre>
<br /><br />
prompt $e[65;8lp    A becomes Q
 
<pre class="western">prompt $e[65;8lp    A becomes Q
prompt $e[97;113p    a becomes q
prompt $e[97;113p    a becomes q
prompt $e[81;65p    Q becomes A
prompt $e[81;65p    Q becomes A
prompt $e[113;97p    q becomes a</pre>
prompt $e[113;97p    q becomes a
�Reassign the F10 key to a DIR command followed by a carriage return:
</pre>
 
:Reassign the F10 key to a DIR command followed by a carriage return:
'''Using a File:'''
'''Using a File:'''


<br /><br />
ESC [0;68;"dir";13p


<pre class="western">ESC [0;68;&quot;dir&quot;;13p</pre>
'''At the OS/2 Prompt:'''
'''At the OS/2 Prompt:'''


<br /><br />
  prompt $e[0;68;"dir";13p


<pre class="western">  prompt $e[0;68;&quot;dir&quot;;13p</pre>
The $e is the prompt command characters for ESC. The 0;68 is the extended ASCII code for the F10 key; 13 decimal is a carriage return.
The $e is the prompt command characters for ESC. The 0;68 is the extended ASCII code for the F10 key; 13 decimal is a carriage return.
:The following example sets the prompt to display the current directory on the top of the screen and the current drive on the current line:
    prompt $e[s$e[1;30f$e[K$p$e[u$n$g


�The following example sets the prompt to display the current directory on the top of the screen and the current drive on the current line:
<pre class="western">    prompt $e[s$e[1;30f$e[K$p$e[u$n$g</pre>
If the current directory is C:\FILES, and the current drive is C, this example would display:
If the current directory is C:\FILES, and the current drive is C, this example would display:
            C:\FILES
C>
:The following DOS-compatible assembly language program reassigns the F10 key to a DIR B: command followed by a carriage return:
<pre>
        TITLE SET ANSI.ASM - SET F10 TO STRING FOR ANSI.SYS


<br /><br />
CSEG    SEGMENT PARA PUBLIC 'CODE'
        ASSUME  CS:CSEG,DS:CSEG
        ORG    100H
ENTPT:  JMP    SHORT START
STRING  DB      27,'[0;68;"DIR B:";13P' ;Redefine F10 key
STRSIZ  EQU    $-STRING                ;Length of above message
HANDLE  EQU    1                      ;Pre-defined file.
                                        ;Handle for standard output


<pre class="western">            C:\FILES
START  PROC    NEAR
C&gt;</pre>
        MOV    BX,HANDLE              ;Standard output device
�The following DOS-compatible assembly language program reassigns the F10 key to a DIR B: command followed by a carriage return:
        MOV    CX,STRSIZ              ;Get size of text to be sent
        MOV    DX,OFFSET STRING        ;Pass offset of string
                                        ;To be sent
        MOV    AH,40H                  ;Function="write to device"
        INT    21h                    ;Call DOS
        RET                            ;Return to DOS
START  ENDP


<br /><br />
CSEG    ENDS
 
        END     ENTPT
<pre class="western">        TITLE SET ANSI.ASM - SET F10 TO STRING FOR ANSI.SYS
</pre>
 
CSEG     SEGMENT  PARA  PUBLIC  ' CODE '
        ASSUME  CS : CSEG , DS : CSEG
        ORG      100H
ENTPT :   JMP      SHORT  START
STRING    DB        27 , ' [ 0 ; 68 ; &quot; DIR  B : &quot; ; 13P '  ; Redefine  F10  key
STRSIZ    EQU      $ - STRING                  ; Length  of  above  message
HANDLE    EQU      1                          ; Pre - defined  file .
                                            ; Handle  for  standard  output
 
START    PROC      NEAR
        MOV      BX , HANDLE                  ; Standard  output  device
        MOV      CX , STRSIZ                  ; Get  size  of  text  to  be  sent
        MOV      DX , OFFSET  STRING          ; Pass  offset  of  string
                                            ; To  be  sent
        MOV      AH , 40H                    ; Function = &quot; write  to  device &quot;
        INT      21h                        ; Call  DOS
        RET                                ; Return  to  DOS
START    ENDP
 
CSEG      ENDS  
        END       ENTPT </pre>
<br /><br />
 
 
 
=== DPRINTF Print Formatting Package ===


==DPRINTF Print Formatting Package==
DPRINTF is a kernel-debugging print-formatting package. You can include this function in the code to test your display driver.
DPRINTF is a kernel-debugging print-formatting package. You can include this function in the code to test your display driver.


Line 4,587: Line 2,234:
The string to be output is ASCIIZ. It may contain literal characters.
The string to be output is ASCIIZ. It may contain literal characters.


A literal character is defined as any character that is not part of a format specification. Special non-printing characters are listed as follows :
A literal character is defined as any character that is not part of a format specification. Special non-printing characters are listed as follows:
 
:\n for CRLF (carriage return/linefeed)
\n for CRLF (carriage return/linefeed)
:\t for tab
 
:\b for bell
\t for tab
:\\ for \.
 
\b for bell


\\ for \.
[[Category:Display Device Driver Reference]]

Latest revision as of 23:20, 5 July 2023

Display Device Driver Reference
Chapters
  1. 16-Bit VGA Display Driver
  2. 8514/A Display Driver
  3. 32-Bit VGA Display Driver
  4. 32-Bit Super VGA Display Driver
  5. SVGA Base Video Subsystem
  6. Physical Video Device Drivers
  7. Virtual Video Device Drivers
  8. Seamless Windows Support
  9. PM Palette Management Support
  10. Distributed Console Access Facility (DCAF)
  11. DBCS Video Driver Support
  12. Installing and Configuring Display Device Drivers
  13. Graphics Test Suites
  14. Display Test Tool
  15. VIDEOCFG.DLL Exported Functions
  16. VIDEOPMI.DLL Exported Functions
  17. VIDEO Protect-Mode Interface
Appendixes
  1. Data Types
  2. S3 Display Driver

Reprint Courtesy of International Business Machines Corporation, © International Business Machines Corporation

Video devices are accessed by using Base Video Handlers (BVHs). These BVHs consist of one or more Dynamic Link Libraries (DLLs). In the representative case of the VGA, BVHVGA.DLL manages the device for full-screen sessions, while DISPLAY.DLL (renamed from IBMVGA.DLL) manages the device for the Presentation Manager interface. Although these device handlers are initialized by different sections of the system at this time, they are architecturally compatible and can easily be combined at a later date.

Video Device Handler Identification

The list of the active video device handlers and their components resides in the CONFIG.SYS file as environment variables. To conserve environment space, these variables are removed from the environment during Shell Initialization. The VIDEO_DEVICES environment variable lists the names of the environment variables that describe each of the video device handlers. Commas are used to separate the names in this list. The following is an example of how to specify the environment variables ARTICHOKE and WATERMELON as those defining the active video device handlers, with ARTICHOKE used as configuration number one, and WATERMELON used as configuration number two.

SET VIDEO_DEVICES=ARTICHOKE,WATERMELON

The value of each environment variable that describes a video device handler is composed of three keywords and the values associated with them. These keywords are separated by blanks and can be specified in any order and in any combination of upper and lower case characters. The DEVICE() keyword defines the list of names of the dynamic link libraries and physical device drivers which are combined to create the video device handler. The names are separated by commas, and their order determines the order in which the components will be initialized. These names represent only those parts of the BVH that need to be called to initialize the Call Vector Table. That is, physical device drivers should not be included in the list if they are only called by the dynamic link libraries and do not directly modify the Call Vector Table.

The default initialization entry point name for the dynamic link libraries is DEVENABLE. An alternate entry point name can be specified by following any DLL name with +AltName, where AltName is the entry point name.

The default initialization IOCtl for physical device drivers is Function 73h. An alternate function number and category can be specified by following the device name by +Func+Cat, where "Func" is the function number and "Cat" is the category. Both numbers must be specified in hexadecimal form. For details, see Function 73h under "Physical Device Driver Initialization" later in this chapter.

The following is an example of a device handler that is composed of two physical device drivers, DEV1 and DEV2, and three dynamic link libraries, DYN1 through DYN3. The second physical device driver uses an alternate initialization IOCtl and the third dynamic link library uses an alternate initialization entry point. POINTER$ is the default physical pointer device driver.

SET ARTICHOKE=DEVICE(DEV1,DYN1,DEV2+74+05,DYN2,DYN3+OTHERENT)

DosOpen is called for each name in the list to check if it is a device driver with an associated "DEVICE=" statement in the CONFIG.SYS file. If the call fails, DosLoadModule is called to check if it is a dynamic link library. If both of these calls fail for any name in the list, the entire device is ignored.

If the optional PTRDEVP() keyword is specified, it defines the names of the physical pointer device drivers. If it is not specified, it defaults to PTRDEVP(POINTER$). The following is an example of a device with only one dynamic link library component and a unique physical pointer device driver for protect mode.

SET WATERMELON=DEVICE(SEEDLESS) PTRDEVP(PPOINT)

Note: This design is not limited strictly to physical video devices. By writing a device handler, video data could be written to any device, such as a printer or a plotter. In addition, by using alternate initialization entry points, multiple devices can be handled by the same physical device handler.

All of the video device handlers shipped with OS/2 2.1 are dynamic link libraries. They can be defined by the following environment variables, which use the default keywords of PTRDEVP(POINTER$) and PTRDEVR(POINTER$).

SET VIO_IBMMPA=DEVICE(BVHMPA)
SET VIO_IBMCGA=DEVICE(BVHCGA)
SET VIO_IBMEGA=DEVICE(BVHEGA)
SET VIO_IBMVGA=DEVICE(BVHVGA)
SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)
SET VIO_IBM8514A=DEVICE(BVH8514A)
SET VIO_IBMXGA=DEVICE(BVHXGA)

The following statements define a system with an 8514 display attached to an 8514/A as the only active video device:

SET VIDEO_DEVICES=VIO_IBM8514A
SET VIO_IBM8514A=DEVICE(BVHVGA,BVH8514A)

However, the statement below defines a system with an 8514 display attached to an 8514/A, and another PS/2* display attached to the VGA connector, as independent video devices.

SET VIDEO_DEVICES=VIO_IBMVGA,VIO_IBM8514A
SET VIO_IBMVGA=DEVICE(BVHVGA)
SET VIO_IBM8514A=DEVICE(BVH8514A)

Two other device handlers are provided with OS/2. The names of these device drivers are fixed. The Base Video Subsystem loads them automatically as they are needed.

BVHINIT.DLL is the generic device handler used by system installation and system initialization. It provides the minimum function necessary to support installation of the system and reporting of system errors during startup. It is loaded only if no other BVHs are successfully loaded.

BVHWNDW.DLL is the device handler that can support VIO window sessions and that provides the interface to the Presentation Manager interface by treating the PM interface as a virtual video device driver. BVHWNDW.DLL is loaded only for VIO window sessions.

Video Device Chaining

Video device handlers (BVHs) can be chained together when multiple BVHs share the responsibility of supporting a specific video adapter. This is accomplished by allowing previously loaded BVHs to attempt the handling of BVH functions. BVH8514A and BVHXGA are chained BVHs shipped with the product that provides this support.

A VGA and 8514A Scenario

During system initialization, BVHVGA is first called to initialize the Call Vector Table, that is, the table used by BVS to give control to the BVH routines. BVHVGA functions as though no other BVH will be handling the device. Next, BVH8514A is called to initialize the same Call Vector Table. However, BVH8514A saves a copy of the Call Vector Table before changing it.

When calls are made to this chained BVH, BVH8514A receives the call and passes it to the BVHVGA routine through the saved Call Vector Table. If an error occurs or if the results of the routine need to be modified, BVH8514A handles the call. Thus, BVH8514A uses the BVHVGA routines to perform all common functions. Device chaining can be viewed as a mechanism to allow one BVH to filter function calls to another BVH.

Primary Display Identification

The primary display is the default display chosen by VIO for full-screen sessions. It is also the display on which VIO and hard error pop-ups are shown. Notice that the primary display used by VIO is not necessarily the display on which the Presentation Manager environment runs. The Presentation Manager interface normally runs on the highest resolution display. In a dual-display configuration, the highest resolution display is not necessarily a display that can be used in text mode.

The primary display is the pop-up display. A physical video device driver must determine if it represents the pop-up display. If so, the video device driver must specify that it represents the pop-up display configuration in Query Config Info.

WrtToScrn/Panic Write Support

Before the video subsystem is loaded, and when the system is about to abnormally terminate, messages are sent to the screen by the WrtToScrn function, also known as Panic Write. This function switches to real mode and executes the INT 10h function to set the video mode to a text mode (BIOS mode 3). It then uses BIOS INT 10h, "Write TTY", to display the message.

However, adapters such as the 8514/A have native modes that cannot be changed by INT 10h. In such cases, the BVH must include a Level 0 device driver that hooks INT 10h to provide extended set mode support. This hook must force the adapter out of its native mode, and then pass control to the previous INT 10h support. If these conditions are not satisfied, the adapter should not drive the power up display.

System Installation

The generic device handler, BVHINIT.DLL, is used primarily by system installation. It is also used for those situations when video devices have not been identified in the CONFIG.SYS file. It provides only the functions required for system installation and is otherwise device-independent.

Through VioGetConfig BVHINIT.DLL reports the highest function video adapter and display it can identify. It can identify only the MPA, CGA, EGA, VGA, 8514A, and XGA, along with their respective displays. Although it does not support mode and font setting, it attempts to load the 850 code page for the current EGA or VGA mode during system initialization.

If video devices have not been identified in the CONFIG.SYS file, the generic device handler attempts to load each of the following devices, until one is successfully loaded:

GENERIC=DEVICE(BVHVGA,BVH8514A)
GENERIC=DEVICE(BVHVGA)
GENERIC=DEVICE(BVHEGA)
GENERIC=DEVICE(BVHCGA)
GENERIC=DEVICE(BVHINIT)

Loadable Device Drivers

Loadable device drivers present a unique problem when used to support video devices because some video support can be required before the DEVICE= statements have been processed by system initialization. To handle this problem, two different initialization calls are made.

The Enable subfunction determines which type of initialization is to be done. If the subfunction is 1 (Fill Logical Device Block), the DevEnable function is requested to add all of the functions supported by the device handler to the Call Vector Table. If the subfunction is 3 (Fill Initialization Device Block), the InitEnable function is requested to add only those functions, that can be supported without the use of a loadable device driver to the Call Vector Table.

Regardless of the success of the InitEnable function, the DevEnable function is called at Shell Initialization time. See DevEnable, and InitEnable for more information.

Video Device Handler Interfaces

The functions that follow are video primitives reserved for use by OS/2 system components. Unexpected results can occur if these functions are started by applications. All of the video device handler functions described below (except for the DLL Initialization function) use the same calling sequence. Parameters are passed to the routines on the stack. The entry point is found in the BVH Call Vector Table at the index of the function number. The calling sequence used to invoke all the routines is as follows:

     PUSH@    OTHER    Environment        ; Environment buffer
     PUSH@    OTHER    ParmBlock          ; Parameter block
     PUSH     DWORD    Function           ; Function number

     CALL     FAR      BVH Routine Entry Point

Environment:

The environment buffer. The format of this buffer is defined by the BVH developer. The selector is a huge selector.

ParmBlock:

A data structure containing all of the parameters of the operation to be performed. The general format of this structure is:

    Length of parameter block in bytes (=NN)  WORD
    Flags                                     WORD

    Bit 0 indicates whether the physical hardware is updated.

        OFF = Initialize only the environment buffer
        ON  = Initialize the environment buffer and the hardware state

    Bits 1 through 15 are reserved and must be OFF.

The length of the parameter block is the total length, including the length field itself. The number in parentheses (=NN) represents the value of this field, if it is a constant. The first flag bit always indicates a background versus foreground state for this function. If the bit is ON, the adapter is actually updated, as it is when an application is in the foreground. If the bit is OFF, only the buffer that is used to shadow the adapter when an application is in the background is actually updated. All bits that are not currently defined as reserved must be OFF.

Function:

The function identifier for this routine. This corresponds to the offset into the Call Vector Table, and can be used to determine the number of parameters on the stack. This is consistent with the existing DDI used by the Presentation Manager interface. All routines are expected to return with AX = 0 if no error was detected. Otherwise, an error code is returned in AX. The following errors are common to all commands:

   ERROR_VIO_INVALID_LENGTH, if the parameter block length is incorrect.
   ERROR_VIO_INVALID_PARMS,  if a reserved flag bit is non-zero, or if
                             the function number does not match the routine.

DevEnable

This function fills the entries in the Call Vector Table for all of the functions supported by this BVH. It is called as a subfunction of the Presentation Manager enable function entry point. To initialize the Call Vector Table for dynamic link libraries:

    PUSH  DWORD   Parameter2    ; Variable parameter 2
    PUSH  DWORD   Parameter1    ; Variable parameter 1
    PUSH  DWORD   Subfunction   ; Enable subfunction

    CALL  FAR     DevEnable

Parameters

Parameter2 for Subfunction=1

A far pointer to this structure:

   DWORD   Flags Pointer
   DWORD   Call Vector Table
   

Flags Pointer

Pointer to where the flags that control calls to the Fill Physical Device Block function go.

Call Vector Table

Pointer to the default dispatch table containing the addresses of the default handler functions and the functions supported by this component. Each entry in the Call Vector Table is the far address of a Video Device Handler function, which must be callable from both Ring 2 and Ring 3. The far address of the nth BVH function is the nth DWORD in the table, beginning with Function 0.

The functions listed below are defined as follows:

000h-0FFh (000-255) Reserved for Presentation Manager interface
100h-11Fh (256-287) Reserved for BVS
120h-12Fh (288-303) Reserved for IBM JAPAN
130h-13Fh (304-319) Reserved for MSKK
100h (256) Function 100h Text Buffer Update
101h (257) Function 101h Initialize Environment
102h (258) Function 102h Save Environment
103h (259) Function 103h Restore Environment
104h (260) Function 104h Query Config Info
105h (261) Function 105h DBCS Display Info
106H (262) Function 106h Query Color Lookup Table
107H (263) Function 107h Set Color Lookup Table
108H (264) Function 108h Query Cursor Info
109H (265) Function 109h Set Cursor Info
10AH (266) Function 10Ah Query Font
10BH (267) Function 10Bh Set Font
10CH (268) Function 10Ch Query Mode
10DH (269) Function 10Dh Set Mode
10EH (270) Function 10Eh Query Palette Registers
10Fh (271) Function 10Fh Set Palette Registers
110H (272) Function 110h Query Physical Buffer
111H (273) Function 111h Free Physical Buffer
112H (274) Function 112h Query Variable Info
113H (275) Function 113h Set Variable Info
114H (276) Function 114h Terminate Environment
115H (277) Function 115h Print Screen
116H (278) Function 116h Write TTY
117H (279) Function 117h Query LVB Info

Parameter1 for Subfunction=1

Far pointer to this structure:

DWORD   Engine Version
DWORD   Count of Table Functions

Engine Version

Version of the Presentation Manager Graphics Engine.

Count of Table Functions

The number of entries in the passed dispatch table. The driver can write only this many entries into the table.

Subfunction

The Presentation Manager enable subfunction number. Its value must be 1 to start the Presentation Manager Fill Logical Device Block subfunction. All pieces of the BVH must support this function. Pieces of the BVH that do not support the Presentation Manager interface do not need to support the other functions. Any function not supported will return PMERR_DEV_FUNC_NOT_INSTALLED.

Remarks

This function is supported by the video dynamic link functions and is called only once for each adapter supported by the physical device driver. A video device handler determines if the display adapter and that which the adapter supports is present. If not present, this function returns an error. Every part of a BVH must successfully initialize the Call Vector Table for that device to be usable by the OS/2 operating system.

InitEnable

This function fills the entries in the Call Vector Table for all of the functions supported by this BVH using only SCREEN$ device driver. It is called with parameters similar to the DevEnable entry point specified in DevEnable, except for the Subfunction parameter.

To initialize the Call Vector Table for dynamic link libraries:

PUSH  DWORD   Parameter2    ; Variable parameter 2
PUSH  DWORD   Parameter1    ; Variable parameter 1
PUSH  DWORD   Subfunction   ; Enable subfunction

CALL  FAR     InitEnable

Parameters

Parameter2 for Subfunction=3

See DevEnable.

Parameter1 for Subfunction=

See DevEnable. Subfunction is the Presentation Manager enable subfunction number. Its value must be 3 to start the Presentation Manager Fill Initialization Device Block subfunction. The default entry point of DevEnable can be overridden by specifying an alternate name in the DEVICE() parameter describing this BVH in the CONFIG.SYS file.

Remarks

This function is called only if video functions are required before Shell Initialization.

The BVH must be able to support the following subfunctions:

100h (256) Function 100h Text Buffer Update
101h (257) Function 101h Initialize Environment
102h (258) Function 102h Save Environment (settable environment only)
103h (259) Function 103h Restore Environment (settable environment only)
104h (260) Function 104h Query Config Info
105h (261) Function 105h DBCS Display Info
108H (264) Function 108h Query Cursor Info
109H (265) Function 109h Set Cursor Info
10CH (268) Function 10Ch Query Mode (80x25 text or equivalent only)
10DH (269) Function 10Dh Set Mode (80x25 text or equivalent only)
112H (274) Function 112h Query Variable Info (code page only)
113H (275) Function 113h Set Variable Info (code page only)

See DevEnable.

Function 100h

Text Buffer Update - Function 100h
This function performs text updates to the logical and physical video buffers. All references to the buffer are made through the text row and column of each cell affected by the called function.
Parmlength
Length of the data structure in bytes (greater than, or equal to, 26), including the Lengthfield itself. The maximum length is 44 bytes. Values not passed are assumed to be the default values for the environment.
Flags
Defined as follows:
Bit 0 indicates whether the physical video buffer needs to be updated.
OFF = The physical video buffer must not be updated.
ON = The physical video buffer must be updated.
Bit 1 indicates whether the logical video buffer needs to be updated.
OFF = The logical video buffer may optionally be updated.
ON = The logical video buffer must be updated.
Bit 2 indicates that attribute information in the user buffer is in CGA format and might need to be translated into the format used by the device. This bit is set for VioWrtTTY calls any time that ANSI is active, because

ANSI recognizes only CGA format attributes.

OFF = Use attributes in existing format.
ON = Translation to or from CGA format required.
Bits 3-15 are reserved and must be OFF.
Selector/Offset of the Application Data Area
Pointer to the application's data area, which provides either the source or the destination for the buffer operation.
Selector/Offset of the Secondary Data Area
Pointer to the additional parameter required by this type of update operation. It is used to define, at most, one cell of information that is used repetitively as filler. This is used only with Index = 3, 4, 5, 6, or 9.
Index
Defined as follows:
0 = Read Cell Types from (Row,Col) as word of flags:
Bit 0 indicates whether the cell is part of a single or double cell character.
OFF = The cell represents a single cell character.
ON = The cell represents part of a double cell character. Bit 1 is examined for more information.
Bit 1 indicates whether the cell is a trailing cell of a double cell character.
OFF = The cell represents the leading or only cell of a character.
ON = The cell represents the trailing cell of a double cell character.
Bits 2 thru 15 are reserved and must be OFF.
1 = Read Characters from (Row,Col)
2 = Read Cells from (Row,Col)
3 = Scroll (Row,Col) through (Row2,Col2) Up
4 = Scroll (Row,Col) through (Row2,Col2) Down
5 = Scroll (Row,Col) through (Row2,Col2) Left
6 = Scroll (Row,Col) through (Row2,Col2) Right
7 = Write Cells to (Row,Col)
8 = Write Characters to (Row,Col)
9 = Write Characters with Constant Attr to (Row,Col)
10 = Write Repeated Character to (Row,Col)
11 = Write Repeated Attribute to (Row,Col)
12 = Write Repeated Cell to (Row,Col)
13 = Copy LVB Rect to PVB
Starting Row
Defines the text location (row) in the Video Buffer at which the update is to be started. For Function 13, this is the upper-left corner of the rectangle to be written.
Starting Column
Defines the text location (column) in the Video Buffer at which the update is to be started. For Function 13, this is the upper-left corner of the rectangle to be written.
Secondary Row
Defines the text location (row) in the Video Buffer to which cells will be moved. This is used only when moving cells from one location to another (Index=3-6). For Function 13, this is the lower-right corner of the rectangle to be written.
Secondary Column
Defines the text location (column) in the Video Buffer to which cells will be moved. This is used only when moving cells from one location to another (Index=3-6). For Function 13, this is the lower-right corner of the rectangle to be written.
Repeat Factor
Repeat factor used when updating the buffer. It represents the number of character cells to be updated, or the number of rows or columns to be scrolled. This is used for both input and output.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
TouchXLeft
The X-coordinate of the upper-left corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched (as in a Read), -1 is returned. Collectively, this field and the next three fields form an area of influence for the call. This field is returned by the BVH.
TouchYTop
The Y-coordinate of the upper-left corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
TouchXRight
The X-coordinate of the lower-right corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
TouchYBottom
The Y-coordinate of the lower-right corner of the tightest rectangle that circumscribes the cells touched by the current function. If no cells were touched, -1 is returned. This field is returned by the BVH.
LVBRowOff
The row offset of the upper-left corner of the LVB in PVB coordinates. All reads, writes, and scrolls are done in PVB coordinates.
LVBColOff
The column offset of the upper-left corner of the LVB in PVB coordinates. All reads, writes, and scrolls are done in PVB coordinates.
LVBWidth
The width of the LVB in cells. Must be greater than 0.
LVBHeight
The height of the LVB in cells. Must be greater than 0.
LVBFormatID
The format ID of the LVB. If this value and attribute count are both 0, the Format ID and attribute count for the current mode are used.
LVBAttrCount
The attribute count for the LVB.
Field Length
Function 100h - Parameter Packet Format
Parmlength WORD
Flags WORD
Selector/Offset of the Application Data Area DWORD
Selector/Offset of the Secondary Data Area DWORD
Index WORD
Starting Row WORD
Starting Column WORD
Secondary Row WORD
Secondary Column WORD
Repeat Factor WORD
Logical Buffer Selector WORD
TouchXLeft WORD
TouchYTop WORD
TouchXRight WORD
TouchYBottom WORD
LVBRowOff WORD
LVBColOff WORD
LVBWidth WORD
LVBHeight WORD
LVBFormatID BYTE
LVBAttrCount BYTE
Returns

The Text Buffer Update routine returns with AX = 0, if no error was detected. Otherwise, the following error codes are returned in AX:

ERROR_VIO_COL, if an invalid column number was specified
ERROR_VIO_INVALID_LENGTH, if the ParmLength was incorrect
ERROR_VIO_INVALID_PARMS, if the Index was incorrect
ERROR_VIO_MODE, if updates are not supported in the current video mode
ERROR_VIO_ROW, if an invalid row number was specified.
Remarks

The Touchxxxx fields circumscribe the area of the LVB, or PVB, for a rectangle that was potentially changed by the given operation. For example, a Write that included the cells (10,12) to (79,12), (0,13) to (79,13), and (0,14) to (8,14) returns TouchXLeft=0, TouchYTop=12, TouchXRight=79, and TouchYBottom=14. Any new functions added to the BVH interface that can affect the data in the PVB or LVB must include a return area for the rectangle of the video buffer that was affected by the given call.

The LVBxxxx fields indicate that an LVB can differ from the normal LVB format. The information about the LVB is taken from these fields, if they are included. Notice that these fields allow an LVB to begin at a location other than (0,0) and allow LVBs of different row and column dimensions.

Function 101h

Initialize Environment - Function 101h

This function causes the Environment Buffer and the video adapter (optional) to be initialized.

Parmlength
Length of parameter block in bytes (=6) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Initialize only the environment buffer.
ON = Initialize the environment buffer and the hardware state.
Bit 1 indicates whether the 3xBox is being initialized.
OFF = The 3xBox is not being initialized.
ON = The 3xBox is being initialized.
Bits 2 thru 15 are reserved and must be OFF.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Logical Buffer Selector WORD
Returns

This routine always returns with AX = 0.

Remarks

It must be possible to call Restore Environment before Save Environment.

Function 102h

Save Environment - Function 102h

This function is used to save all aspects of the video adapter, including the hardware state and the video buffers.

Parmlength
Length of parameter block in bytes (=6) passed on input.
Flags
Defined as follows:
Bit 0 is reserved and must be Off.
Bit 1 indicates whether hardware state (mode, CLUT, everything except the buffer) is saved.
OFF = The hardware state is not saved.
ON = The hardware state is saved.
Bit 2 indicates whether the physical display is fully saved for session switching.
OFF = The physical display is not fully saved.
ON = The physical display is fully saved.
Bit 3 indicates whether the physical display is partially saved for pop-ups.
OFF = The physical display is not partially saved.
ON = The physical display is partially saved.
Bits 4 thru 15 are reserved and must be OFF.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Logical Buffer Selector WORD
Returns

The Save Environment routine returns with AX=0 if it can successfully save the environment to the Environment Block and the Logical Video Buffer. Otherwise, it returns with AX=ERROR_VIO_MODE.

Remarks

Bits 2 and 3 are mutually exclusive. If both are specified, bit 3 will be ignored. Bit 4 is used in combination with bits 2 and 3. The code and data segments referenced or accessed to perform the functions selected by bits 1 and 3 must be locked during device driver initialization. The format of the data saved in the segments passed as input is determined by the device handler.

Partial saves are started on VIO and hard error pop-ups. Pop-ups appear on the primary display configuration. The device driver must save whatever portion of the physical display buffer that is overlaid by the pop-up. To display a pop-up, OS/2 2.1 switches to the highest resolution 80 x 25 text mode supported by the primary display configuration (mode 3 or 7, whichever is listed first in the list of modes supported by the display configuration). Alternatively, if a device driver's physical display buffer is not overlaid by a pop-up, the physical device driver returns zero for partial save size.

When a hard error pop-up occurs before a VIO pop-up has cleared, the Save Environment function is called twice before the Restore Environment is called. Therefore, the device handler must be prepared to handle both a partial save of a graphics mode and a full save of the text mode of the user pop-up.

OS/2 allocates the buffer in which the physical display buffer is saved by using DosAllocHuge. The selector to the Data Packet addresses the first of n segments in which the physical display buffer is saved. (The offset to the Data Packet should be ignored.) The selector to the second segment can be calculated by adding the DosAllocHuge increment to the first selector value. The third selector can similarly be calculated by adding the DosAllocHuge increment to the second selector value, and so forth. Enough selectors are allocated to meet the full/partial buffer requirement specified by the physical device driver. The selectors each address 64KB except the last selector, which addresses the remainder.

Function 103h

Restore Environment - Function 103h

This function is used to restore all aspects of the video adapter, including the hardware state and the video buffers.

Parmlength
Length of parameter block in bytes (=6) passed on input.
Flags
Defined as follows:
Bit 0 is reserved and must be Off.
Bit 1 indicates whether hardware state (mode, CLUT, everything except the buffer) is saved.
OFF = The hardware state is not restored.
ON = The hardware state is restored.
Bit 2 indicates whether the physical display is fully restored for session switching.
OFF = The physical display is not fully restored.
ON = The physical display is fully restored.
Bit 3 indicates whether the physical display is partially restored for pop-ups.
OFF = The physical display is not partially restored.
ON = The physical display is partially restored.
Bits 4 thru 15 are reserved and must be OFF.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
Function 103h - Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Logical Buffer Selector WORD
Returns

The Restore Environment routine returns with AX = 0 if it can successfully restore the environment to the Environment Block and the Logical Video Buffer. Otherwise, it returns with AX = ERROR_VIO_MODE. See Function 102h for more information.

Function 104h

Query Config Info - Function 104h

This function returns all of the information necessary to identify the current video adapter and display.

Parmlength
Length of parameter block in bytes (=8) passed on input.
Flags
Must be zero.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Returns

This function returns with AX = ERROR_VIO_INVALID_LENGTH only if the Length specified is less than 2.

Remarks

The Environment Buffer is not used by this function. The Environment Buffer address is passed as a DWORD of zero. If the Length specified in the Config Data is larger than the maximum possible length, or if the Length is specified as 2 (the length of Length field itself), it is replaced by the largest valid length.

Function 105h

DBCS Display Info - Function 105h

This function returns various forms of DBCS information used by the display.

Parmlength
Length of parameter block in bytes. If Length is specified as 2, only the maximum length of the parameter block is returned in the length field. If the length is not 2, it defines the maximum amount of data returned.
Flags
Must be zero.
DBCS Table Length
Length of double cell character table.
DBCS Table Offset
Offset of double-cell character table, which consists of WORD pairs that define the low and high limits (inclusive) of ranges of double-cell characters.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
DBCS Table Length WORD
DBCS Table Offset WORD
Returns

This function is used to get the DBCS display information associated with the given environment buffer, and returns with AX = ERROR_VIO_INVALID_ LENGTH if the Length specified is less than 2 or the buffer was too short to return all of the DBCS display information. Otherwise, Query DBCS Display Info returns with AX = 0.

Function 106h

Query Color Lookup Table - Function 106h

This function reads the definitions of the colors from the Color Lookup Table.

Parmlength
Length of parameter block in bytes (=12) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Return data from the environment buffer only.
ON = Read the hardware to update the environment buffer before returning the requested data.
Bits 1-15 are reserved and must be OFF.
Color Lookup Table Far Address
Far address of Color Lookup Table. The Table format is device-dependent. Three-byte table entries are returned for the VGA. Each table entry contains a red, green, and blue color index, respectively.
Index
Index of the first table entry to get.
Table Entry Quantity
Number of table entries to get. Three-byte table entries are returned for the VGA. Each table entry contains a red, green, and blue color index, respectively.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Color Lookup Table Far Address DWORD
Index WORD
Table Entry Quantity WORD
Returns

This function returns with AX = 0 if it can successfully get all of the requested registers from the Color Lookup Table. Otherwise, this routine returns with AX = ERROR_VIO_INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO_INVALID_LENGTH if too many registers were requested.

Function 107h

Set Color Lookup Table - Function 107h

This function loads the definitions of the colors from the Color Lookup Table.

Parmlength
Length of parameter block in bytes (=12) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Update only the environment buffer.
ON = Update the environment buffer and the hardware state.
Bits 1-15 are reserved and must be OFF.
Color Lookup Table Far Address
Far address of Color Lookup Table. The Table format is device-dependent. The VGA format has three bytes containing the red, green and blue indices, respectively, for each color being set.
Index
Index of the first table entry to set.
Table Entry Quantity
Number of table entries to set.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Color Lookup Table Far Address DWORD
Index WORD
Table Entry Quantity WORD
Returns

This function returns with AX = 0 if it can successfully set all of the registers in the Color Lookup Table. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO_INVALID_LENGTH if too many registers were requested.

Function 108h

Query Cursor Info - Function 108h

This function returns all of the information related to the cursor.

Parmlength
Length of parameter block in bytes (=16) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Return data from the environment buffer only.
ON = Read the hardware to update the environment buffer before returning the requested data.
The remaining flags select the information to be returned:
Bit 1 selects cursor position.
Bit 2 selects cursor type.
Bits 3-15 are reserved and must be Off.
Row
0 is the top row.
Column
0 is the left column.
Top Cursor Scan Line
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
Bottom Cursor Scan Line
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
Cursor Width
Cursor width in columns, if text mode; in pels, if graphics mode.
Cursor Attribute
Cursor attribute: -1 = hidden, if text mode; other values = color attribute, if graphics mode.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Row WORD
Column WORD
Top Cursor Scan Line WORD
Bottom Cursor Scan Line WORD
Cursor Width WORD
Cursor Attribute WORD
Returns

This function returns with AX = 0 if it can successfully get all of the cursor information requested. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.

Function 109h

Set Cursor Info - Function 109h

This function sets all of the information related to the cursor.

Parmlength
Length of parameter block in bytes (=16) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Update only the environment buffer.
ON = Update the environment buffer and the hardware state.
The remaining flags select the options to be set:
Bit 1 selects cursor position.
Bit 2 selects cursor type.
Bits 3-15 are reserved and must be OFF.
Row
0 is the top row.
Column
0 is the left column.
Top Cursor Scan Line
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
Bottom Cursor Scan Line
If n scan lines, 0 is top scan line and n-1 is bottom scan line.
Cursor Width
Cursor width in columns, if text mode; in pels, if graphics mode.
Cursor Attribute
Cursor attribute: -1 = hidden, if text mode; other values = color attribute, if graphics mode.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Row WORD
Column WORD
Top Cursor Scan Line WORD
Bottom Cursor Scan Line WORD
Cursor Width WORD
Cursor Attribute WORD
Returns

This function returns with AX = 0 if it can successfully set all of the cursor information requested. Otherwise, it returns with AX equal to:

  • ERROR_VIO_MODE if it cannot support the function in the current mode
  • ERROR_VIO_ROW if the row number is out of range
  • ERROR_VIO_COL if the column number is out of range

Function 10Ah

Query Font - Function 10Ah

This function returns the current active font or a selected font for the current code page. The format of the font definition is determined by the type of adapter.

Parmlength
Length of parameter block in bytes (=14) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Return data from the environment buffer only.
ON = Read the hardware to update the environment buffer before returning the requested data.
Bit 1 indicates whether a specific font is to be returned instead of the current font.
OFF = Return the current font.
ON = Return the selected font for the current code page. Setting this flag indicates that the pel columns and rows are used as input to select the font.
Bits 2-15 are reserved and must be OFF.
Font Buffer Far Address
Data area in which the font definition is returned.
Data Area Length
Length of data area in which font table is returned.
Pel Columns
Pel columns.
Pel Rows
Pel rows.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Font Buffer Far Address DWORD
Data Area Length WORD
Pel Columns WORD
Pel Rows WORD
Returns

If the Length is specified as 0, no font is returned. Instead, the Length field returns the size needed to hold the font. Query Font returns with AX = 0 if it can successfully read the font. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.

Function 10Bh

Set Font - Function 10Bh

This function sends a user font definition to the device handler. If the font is appropriate for the current mode, it is loaded into the adapter. If not, it is saved for possible use on subsequent calls to SetMode. The format of the font definition is determined by the type of adapter.

Parmlength
Length of parameter block in bytes (=14) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Update only the environment buffer.
ON = Update the environment buffer and the hardware state.
Bits 1-15 are reserved and must be OFF.
Font Buffer Far Address
Far address of the font buffer containing the font set in compact form.
Data Area Length
Length of data area containing the font table to be set.
Pel Columns
Pel columns.
Pel Rows
Pel rows.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Font Buffer Far Address DWORD
Data Area Length WORD
Pel Columns WORD
Pel Rows WORD
Returns

This function returns with AX = 0 if it can successfully load the font. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.

Function 10Ch

Query Mode - Function 10Ch

This function returns all of the information pertaining to the current video mode.

Parmlength
Length of parameter block in bytes (=8) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Return data from the environment buffer only.
ON = Read the hardware to update the environment buffer before returning the requested data.
Bits 1-15 are reserved and must be OFF.
Mode Data Structure Far Address
Far Address of the Mode data structure defined by VioGetMode.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Mode Data Structure Far Address DWORD
Returns

If the Length specified in the Config Data is larger than the maximum possible length or if the Length is specified as 2, it is replaced by the largest valid length. This function returns with AX = ERROR_VIO_INVALID_LENGTH only if the Length specified is less than 2.

Function 10Dh

Set Mode - Function 10Dh

This function sets the video mode of the video adapter. For text modes, it considers not only what display characteristics it can support but also what ROM, code page, and user-defined fonts it has available.

Datalength
Length of the data structure in bytes, including Length itself (=8).
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Update only the environment buffer.
ON = Update the environment buffer and the hardware state.
Bit 1 indicates whether the mode is changed or only validated.
OFF = Perform normal mode setting.
ON = Perform only mode validation.
Bits 2-15 are reserved and must be OFF.
Mode Data Structure Far Address
Far Address of the Mode data structure defined by VioSetMode.
Parameter Packet Format
Field Length
Datalength WORD
Flags WORD
Mode Data Structure Far Address DWORD
Returns

Set Mode returns with AX = 0 if it can set the requested mode. Otherwise, it returns with AX = ERROR_VIO_MODE.

Remarks

This function must validate the mode data without using the environment buffer, because it might not have been initialized or might not be valid for this device. This function implicitly initializes the environment buffer if it has not already been done.

Function 10Eh

Query Palette Registers - Function 10Eh

This function queries the relationship between the text attributes and the color registers.

Datalength
Length of parameter block in bytes (=12) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Return data from the environment buffer only.
ON = Read the hardware to update the environment buffer before returning the requested data.
Bits 1-15 are reserved and must be OFF.
Palette Buffer Far Address
Data area where a 1-WORD entry for each register containing its color value is returned.
Palette Register Index
Index of first palette register to get.
Register Quantity
Number of registers to return.
Parameter Packet Format
Field Length
Datalength WORD
Flags WORD
Palette Buffer Far Address DWORD
Palette Register Index WORD
Register Quantity WORD
Returns

This function returns with AX = 0 if it can successfully get all of the requested palette registers. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO _INVALID_LENGTH if too many registers were requested.

Function 10Fh

Set Palette Registers - Function 10Fh

This function defines the relationship between the text attributes and the color registers.

Parmlength
Length of parameter block in bytes (=12) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Update only the environment buffer.
ON = Update the environment buffer and the hardware state.
Bits 1-15 are reserved and must be OFF.
Palette Buffer Far Address
Far address of palette register buffer. Data area with 1 WORD, containing the color value for each register set.
Palette Register Index
Index of first palette register to set. Data area with 1 WORD, containing the color value for each register set.
Register Quantity
Number of registers to set.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Palette Buffer Far Address DWORD
Palette Register Index WORD
Register Quantity WORD
Returns

This function returns with AX = 0 if it can successfully set all of the requested palette registers. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS if an invalid color register was requested, or AX = ERROR_VIO _INVALID_LENGTH if too many registers were requested.

Function 110h

Query Physical Buffer - Function 110h

This function returns an LDT selector that can be used to access the physical video buffer. The current physical video buffer is returned unless a specific address range is requested.

Parmlength
Length of parameter block in bytes (=12) passed on input.
Flags
Must be zero.
Query Physical Buffer Far Address
Far Address of the Query Physical Buffer data structure defined by VioGetPhysBuf.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Query Physical Buffer Far Address DWORD
Returns

Query Physical Buffer returns with AX = 0 if it can successfully allocate the LDT selector. Otherwise, it returns with AX set by the PhysToUVirtdevice helper function or with AX = ERROR_VIO_INVALID_PARMS if the requested buffer resides outside the valid range for the device.

Remarks

If the physical display buffer address and length passed on input are 0, this subfunction returns an LDT selector, that corresponds to the current mode.

A physical video device driver must provide Read/Write access to the physical address range where the physical display buffer is located. The physical device driver must provide Read-only access to the physical address range where the ROM fonts are located. If the physical address passed on input is not within the physical display buffer or ROM font ranges, an error is returned.

Function 111h

Free Physical Buffer - Function 111h

This function deallocates an LDT selector that was acquired by a call to the Query Physical Buffer routine.

Parmlength
Length of parameter block in bytes (=6) passed on input.
Flags
Must be zero.
LDT Selector
LDT Selector.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
LDT Selector DWORD
Returns

This function always returns with AX = 0.

Function 112h

Query Variable Info - Function 112h

This function reads various minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.

Parmlength
Length of parameter block in bytes (=26) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Return data from the environment buffer only.
ON = Read the hardware to update the environment buffer before returning the requested data.
The remaining flags select the information to be returned:
Bit 1 selects blink versus background color.
Bit 2 selects overscan (border) color.
Bit 3 selects scan line for underscore.
Bit 4 selects video enable.
Bit 5 selects the display mask.
Bit 6 selects code page.
Bit 7 forces a code page set (used with 6).
Bit 8 gets the scrollable rectangle.
Bits 9-15 are reserved and must be OFF.
Blink/Background Intensity
Blink versus background intensity:
0 = blink.
1 = background intensity.
Overscan (border) Color
Overscan (border) Color.
Scan Line
Scan line for underscore (0-31); 32 = no underscore.
Video Enable
Video enable: 0 = OFF and 1 = ON. OFF means off until the physical device driver is told to turn it back on. If the video signal is turned off and then the mode is set, the signal must remain off.
Display Mask
Display mask:
   bit 0  = plane 0
     ?         ?
     ?         ?
     ?         ?
   bit 31 = plane 31

   bit state = 0, plane disabled for display.
   bit state = 1, plane enabled for display.

   (Planes disabled for display result in 0 to palette.)
Code Page
Code Page.
Scrollable Rectangle - Left
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Scrollable Rectangle - Top
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Scrollable Rectangle - Right
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Scrollable Rectangle - Bottom
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Screen Rows
The number of text rows in the current mode.
Screen Columns
The number of text columns in the current mode.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Blink/Background Intensity WORD
Overscan (border) Color WORD
Scan Line WORD
Video Enable WORD
Display Mask DWORD
Code Page WORD
Scrollable Rectangle - Left WORD
Scrollable Rectangle - Top WORD
Scrollable Rectangle - Right WORD
Scrollable Rectangle - Bottom WORD
Screen Rows WORD
Screen Columns WORD
Returns

Query Variable Info returns with AX = 0 if it can successfully get the selected variable information. Otherwise, it returns with AX = ERROR_VIO_ INVALID_PARMS.

Function 113h

Set Variable Info - Function 113h

This function sets the minor features of the video adapter, including the blink state, border color, underscore line, and scrollable rectangle of the screen.

Parmlength
Length of parameter block in bytes (=26) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is updated.
OFF = Update only the environment buffer.
ON = Update the environment buffer and the hardware state.
The remaining flags select the information to be set:
Bit 1 selects blink versus background color.
Bit 2 selects overscan (border) color.
Bit 3 selects scan line for underscore.
Bit 4 selects video enable.
Bit 5 selects the display mask.
Bit 6 selects code page.
Bit 7 forces a code page set (used with 6).
Bit 8 gets the scrollable rectangle.
Bits 9-15 are reserved and must be OFF.
Blink/Background Intensity
Blink versus background intensity:
0 = blink.
1 = background intensity.
Overscan (border) Color
Overscan (border) Color.
Scan Line
Scan line for underscore (0-31); 32 = no underscore.
Video Enable
Video enable: 0 = OFF and 1 = ON. OFF means off until the physical device driver is told to turn it back on. If the video signal is turned off and then the mode is set, the signal must remain off.
Display Mask
Display mask:
   bit 0  = plane 0
     ?         ?
     ?         ?
     ?         ?
   bit 31 = plane 31

   bit state = 0, plane disabled for display.
   bit state = 1, plane enabled for display.

   (Planes disabled for display result in 0 to palette.)
Code Page
Code Page.
Scrollable Rectangle - Left
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Scrollable Rectangle - Top
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Scrollable Rectangle - Right
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Scrollable Rectangle - Bottom
The scrollable rectangle fields indicate the area of the screen that can scroll during scroll and write TTY operations.
Screen Rows
The number of text rows in the current mode. Reserved (0).
Screen Columns
The number of text columns in the current mode. Reserved (0).
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Blink/Background Intensity WORD
Overscan (border) Color WORD
Scan Line WORD
Video Enable WORD
Display Mask DWORD
Code Page WORD
Scrollable Rectangle - Left WORD
Scrollable Rectangle - Top WORD
Scrollable Rectangle - Right WORD
Scrollable Rectangle - Bottom WORD
Screen Rows WORD
Screen Columns WORD
Returns

Set Variable Info returns with AX = 0 if it can successfully set the selected variable information. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.

Remarks

There are two types of code page sets. The first code page set allows a code page to be set while the mode of the display (as used by Function 10Dh) remains the same. The other type of code page set causes a change in the display mode. This occurs when switching between DBCS and non-DBCS code pages.

If bit 6 of the flags WORD is set and bit 7 is clear, the code page is set when the adapter can use the code page without changing from DBCS mode to SBCS mode, or vice versa. The mode should be changed if both bits 6 and 7 of the flags WORD are set, and the code page is used when the mode is changed from SBCS mode to DBCS mode. Bit 7 is ignored if bit 6 is not set. This applies only to text modes. Graphics modes are not set to text modes by forcing a code page.

The BVH need not support any scrollable region other than the entire display area. The adapter may support any scrollable rectangle up to the size of the entire screen. All coordinates are in text display cells. This scrollable rectangle data is undefined for graphics modes.

Function 114h

Terminate Environment - Function 114h

This function is used to notify the BVH that the environment is about to be freed so that any required cleanup can be performed by the BVH. If no Terminate Environment processing is required, this function can be omitted. PMERR_DEV_FUNC_NOT_INSTALLED is then returned in AX, but it is ignored by the video subsystem.

Parmlength
Length of parameter block in bytes (=6) passed on input.
Flags
Reserved, must be off.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Logical Buffer Selector WORD
Returns
None.

Function 115h

Print Screen - Function 115h

This function causes the contents of the current screen to be written to the printer handle provided. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.

Parmlength
Length of parameter block in bytes (=8) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical video buffer should be printed.
OFF = Print only the contents of the logical video buffer.
ON = Print the contents of the physical video buffer, if appropriate.
Bits 1-15 are reserved and must be OFF.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
Print Device Handle
Print Device Handle. File handle of the print device to be used.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Logical Buffer Selector WORD
Print Device Handle WORD
Returns
None.

Function 116h

Write TTY - Function 116h

This function performs the functions of the call to VioWrtTTY. BVS provides a default routine that provides the same level of support as previous versions if the vector is not replaced.

Parmlength
Length of parameter block in bytes (=14) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical video buffer needs to be updated.
OFF = The physical video buffer must not be updated.
ON = The physical video buffer must be updated.
Bit 1 indicates whether the logical video buffer needs to be updated.
OFF = The logical video buffer can optionally be updated.
ON = The logical video buffer must be updated.
Bit 2 indicates whether ANSI is active.
OFF = ANSI is not active. Escape sequences should be considered as text data.
ON = ANSI is active. Escape sequences must be handled locally or passed to the default routine in BVS through device chaining.
Bit 3 indicates whether Ctrl_PrtSc is active.
OFF = Ctrl_PrtSc is not active.
ON = Ctrl_PrtSc is active. Characters need to be echoed to the printer locally or by the default routine in BVS through device chaining.
Bits 4-15 are reserved and must be OFF.
Logical Buffer Selector
Selector used for the beginning of the logical video buffer. This selector is a huge selector with a maximum size of 1MB.
Character String Far Address
Far Address of character string to be written.
Character String Length
Length of character string to be written.
Print Device Handle
Print Device Handle. The file handle of the print device used for Ctrl_ PrtSc.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
Logical Buffer Selector WORD
Character String Far Address DWORD
Character String Length DWORD
Print Device Handle WORD
Returns
None.

Function 117h

Query LVB Info - Function 117h

This function returns information associated with the LVB, such as the allocation size and default attribute for a specified LVB.

Parmlength
Length of parameter block in bytes (=20) passed on input.
Flags
Defined as follows:
Bit 0 indicates whether the physical hardware is to be read.
OFF = Read from the environment buffer.
ON = Read from the current state of the hardware state.
Bits 1-15 are reserved and must be OFF.
LVB Format ID
Format ID for LVB. If this and the attribute count are both 0, the current mode values are used.
LVB Attribute Count
Attribute Count for the LVB. If this and the format ID are both 0, the current mode values are used.
LVB Width
LVB Width in cells.
LVB Height
LVB Height in cells.
LVB Allocation Size
Allocation size of the LVB is returned here.
Attribute Return Buffer Size
Size of the default attribute return buffer.
Attribute Return Buffer Pointer
Pointer to the default attribute return buffer (passed). The default attribute is returned if the buffer is large enough. If this value is 0, the attribute is not returned.
Parameter Packet Format
Field Length
Parmlength WORD
Flags WORD
LVB Format ID BYTE
LVB Attribute Count BYTE
LVB Width WORD
LVB Height WORD
LVB Allocation Size DWORD
Attribute Return Buffer Size WORD
Attribute Return Buffer Pointer DWORD
Returns

This function returns with AX = 0 if it can successfully calculate the LVB size and return the attribute information. Otherwise, it returns with AX = ERROR_VIO_INVALID_PARMS.

Level 0 Physical Device Driver Interfaces

The strategy portion of the Level 0 physical device drivers that can be a component of any video device handler is called to handle I/O requests through a request packet interface with the OS/2 kernel. The strategy routine executes at task-time as a result of an application VIO request. The strategy routine is called with ES:BX pointing to the request packet (the pointer is valid in both a DOS session and an OS/2 session). Only three command codes (passed in the request packet) are required to be supported by a video device driver. For any other command code the physical device driver does not support, the physical video device driver must return Unsupported Command and Done in the request packet status field.

The following are the physical device driver commands that are supported by the physical video device driver (the command codes are in parentheses):

INIT (00h) - Initialize the Device

On entry, the request block contains the following fields as inputs to the physical video device driver:

Pointer to the DevHlp entry point
Pointer to the INIT arguments

On exit, the physical video device driver sets the first pointer to the offsets of the code and data segments to release code and data needed only by the initialization routine. The second pointer is set to 0. If initialization is successful, the request packet status field is set to indicate No Error and Done; otherwise, the status is set to General Failure.

The physical video device driver can perform the following initialization:

Obtain the DevHlp address from the request packet.
Verify that the display adapter and the display that it supports are present. If not, it can fail initialization.

OPEN (0Dh) - Open the Device

This service routine does nothing but return with No Error status.

GENERIC IOCtl (10h) - Send I/O Requests to the Device

On entry, the request packet has the IOCtl category code and function code set. The parameter buffer and the data buffer addresses are set as virtual addresses. The physical video device driver performs the physical device driver initialization, when requested.

Physical Device Driver Initialization

The IOCtl described below supports the same class of functions as the Presentation Manager dynamic link enable entry point. It is called to fill in the Call Vector Table for the BVH. The call returns an error if the physical device driver detects that the adapter is not present.

Category 3
Function 73h
Purpose
To initialize the Call Vector Table.
Parameter Block Format
None.
Data Packet Format
DWORD Subfunction
DWORD Parameter1
DWORD Parameter2
WORD ReturnCode

Subfunction

The Presentation Manager enables the subfunction number. Its value must be 1 to start the Presentation Manager Fill Logical Device Block subfunction. All pieces of the BVH must support this function. Pieces of the BVH that do not support the Presentation Manager interface do not need to support the other functions. Any function not supported should return PMERR_DEV_FUNC_NOT_INSTALLED.

Parameter1 for Subfunction = 1

Far pointer to this structure:

DWORD Engine Version
DWORD Count of Table Functions

Engine Version Version of the Presentation Manager Graphics Engine

Count of Table Functions Number of entries in the passed dispatch table. The physical device driver can only write this many entries into the table.

Parameter2 for Subfunction=1

Far pointer to this structure:

DWORD Flags Pointer
DWORD Call Vector Table

Flags Pointer Pointer to where the flags controlling calls to the Fill Physical Device Block function go.

Call Vector Table Pointer to the default dispatch table containing the addresses of the default handler functions and the functions supported by this component. Each entry in the Call Vector Table is the far address of a Video Device Handler function, which must be callable from Ring 3. The address of the nth BVH function is the nth DWORD in the table, beginning with Function 0. Refer to the DLL Initialization function for a description of the function numbers.

Remarks

This function is supported by the video device drivers and is called only once for each adapter to be supported by the BVH. A video device handler should determine if the display adapter and that which it supports is present. If not present, this function must return an error. Every part of a BVH must successfully initialize the Call Vector Table for that device to be used by OS/2.

EGA.SYS and INT 2Fh Screen Switch Notification

For some DOS EGA applications, OS/2 is not able to switch from a DOS session to an OS/2 session and then back again. Upon return to the DOS application, the screen will be incorrect. The DOS EGA applications that do not run successfully are:

  • Applications that download fonts into a character generator block other than Block 0. Character Generator Block 0 is supported.
  • Graphic mode applications that use more than one display page.
  • Advanced graphics mode applications that write directly to the registers on the EGA adapter.

To supplement OS/2 screen switching support, a DOS application can be written to use the EGA register interface. Alternatively, a DOS application can be notified on a screen switch through multiplex interrupt 2Fh, AH = 40h. These two mechanisms are described in the following sections.

Note: On an IBM PS/2 personal computer the registers on the adapter are both readable and writable. For these configurations, OS/2 reads and saves the registers on a screen switch away from a DOS session, and restores the registers upon return to a DOS session.

For configurations including the IBM PS/2 Display Adapter 8514/A when the 8514/A display adapter is in an advanced function mode, the OS/2 operating system does not save the physical display buffer when switching away from a DOS session. Therefore, end users are cautioned to complete any 8514/A advanced function mode application before switching to OS/2 mode.

EGA.SYS Device Driver

EGA.SYS is a physical device driver that provides support for the EGA register interface in a DOS session. To support advanced graphics modes D, E, F, and 10 in a DOS session, the Mouse Pointer Draw device driver must save or restore the EGA registers. Because the EGA registers are not readable, this can be done only if the application assists in setting the registers initially. Rather than performing I/O directly to the registers on the adapter, the application sets the registers through the EGA register interface.

EGA Register Interface

The EGA register interface is a library of ten functions supported for a DOS session, advanced graphics applications (modes D, E, F, and 10). These functions do the following:

  • Read from, or write to, one or more of the EGA write-only registers
  • Define default values for the EGA write-only registers, reset the EGA registers to these default values, or return the default values
  • Check whether the EGA register interface is present and, if so, return its version number.

When the application uses the EGA register interface, OS/2 2.1 maintains a backup copy or shadows how the EGA registers are set. Then, if the operator switches away from (and later returns to) the application, the registers are restored properly. It is not necessary to use the EGA register interface to set the mode, color palette, or palette registers. Instead, use ROM BIOS function INT 10h with AH = 00h, 0Bh, or 10h, respectively.

Calling The EGA Register Interface

To call EGA register interface functions from an assembly language program, the following actions must be performed:

  1. Load the registers with the required parameter values
  2. Execute software interrupt 10h.

Values returned by the EGA register interface functions are placed in registers.

EGA Register Interface Restrictions

A list of areas where restrictions apply for the EGA Register Interface are shown below:

Functions not supported
?Attribute Controller registers
Sequencer Memory Mode register
Input Status registers
Graphics Controller Miscellaneous register

Functions Not Supported

Multiple display pages in graphics modes are not supported. Fonts can be loaded (by using ROM BIOS INT 10h with AH = 11h) only into Character Generator Block 0.

Attribute Controller Registers

Before your application program uses the Attribute Controller registers (I/ O address 3C0h) in an extended interrupt 10h call, it must set the flip-flop that selects the address or data register so that it selects the address register (by doing an input from I/O port 3BAh or 3DAh). The flip-flop is always reset to this state upon return from the extended INT 10h call. Interrupt routines that access the attribute chip must also leave the flip-flop set to the address register upon return from the interrupt.

Note: If the application program sets the flip-flop so that it selects the Data register, and expects the flip-flop to remain in this state, the application must disable interrupts between the time it sets the flip-flop to the Data register state and the last time the flip-flop is assumed to be in this state.

Sequencer Memory Mode Register

When the Sequencer Memory Mode register (I/O address 3C5H, data register 4) is accessed, the sequencer produces a faulton the CAS lines that can cause problems with video random access memory. As a result, the application cannot use the EGA Register Interface to read from, or write to, this register. Instead, use the following procedure to safely alter this register:

  1. Disable interrupts
  2. Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0
  3. 3.Read/modify/write the Sequencer Memory Mode register
  4. 4.Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1
  5. 5.Enable interrupts

Input Status Registers

The application cannot use the EGA Register Interface to read Input Status registers 0 (I/O address 3C2h) and 1 (I/O address 3BAh or 3DAh). If the program must read these registers, it must do so directly.

Graphics Controller Miscellaneous Register

When the Graphics Controller Miscellaneous register (I/O address 3CFh, data register 6) is accessed, a glitch on the CAS lines occurs that can cause problems with video random access memory. As a result, the application should not use the EGA Register Interface to read from or write to this register.

EGA Register Interface Function F6h does not alter the state of the Graphics Controller Miscellaneous register. Instead, use the following procedure to safely alter this register:

  1. Disable interrupts
  2. Set Synchronous Reset (bit 1) in the Sequencer Reset register to 0
  3. Read/modify/write the Graphics Controller Miscellaneous register
  4. Set Synchronous Reset (bit 1) in the Sequencer Reset register to 1
  5. Enable interrupts

EGA Register Interface Functions

This section describes each EGA Register Interface function in detail. The following list shows these functions by function number (hex):

F0 Read One Register
F1 Write One Register
F2 Read Register Range
F3 Write Register Range
F4 Read Register Set
F5 Write Register Set
F6 Revert to Default Registers
F7 Define Default Register Table
F8 Read Default Register Table
FA Interrogate Driver

Note: Function F9h, and Functions FBh through FFh are reserved.

Each function description includes:

The parameters required to make the call (input) and the expected return values (output)
Any special considerations regarding the function

If the function description does not specify an input for a parameter, it is not necessary to supply a value for that parameter before making the call. If the function description does not specify an output value for a parameter, the parameter's value is the same before and after the call.

Note: The EGA Register Interface does not check input values, so be sure that the values loaded into the registers before making a call are correct.

Function F0H - Read One Register

This function reads data from a specified register on the EGA.

Input

AH = F0h

BX = Pointer for:

Pointer/data chips
BL = Pointer
Single registers
BX ignored.

DX = Port number:

Pointer/data chips
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
18h: Attribute Controller (3C0H)
Single registers
20h: Miscellaneous Output register (3C2H)
28h: Feature Control register (3?AH)
30h: Graphics 1 Position register (3CCH)
38h: Graphics 2 Position register (3CAH)

? = B for monochrome modes, or D for color modes

Output

AX: Restored

BH: Restored

BL: Data

DX: Restored

All other registers are restored.

Example

The following example saves the contents of the Sequencer Map Mask register in myvalue:

myvalue db   ?
        mov  ah, 0f0h        ; f0 = read one register
        mov  bx, 0002h       ; bh = 0 / bl = map mask index
        mov  dx, 0008h       ; dx = sequencer
        int  10h             ; get it!
        mov  myvalue, bl     ; save it!

The example below saves the contents of the Miscellaneous Output register in myvalue:

myvalue db   ?
        mov  ah, 0f0h        ; f0 = read one register
        mov  dx, 0020h       ; dx = miscellaneous output register
        int  10h             ; get it!
        mov  myvalue, bl     ; save it!

Function F1H - Write One Register

This function writes data to a specified register on the EGA. When an application program returns from a call to Function F1, the contents of registers BH and DX are not restored. The program must save and restore these registers.

Input

AH = F1h

BL = Pointer for pointer/data chips. Data for single registers.

BH = Data for pointer/data chips. Ignored for single registers.

DX = Port number:

Pointer/data chips
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
18h: Attribute Controller (3C0H)
Single registers

|{| |20h:||Miscellaneous Output register (3C2H) |- |28h:||Feature Control register (3?AH) |- |30h: Graphics 1 Position register (3CCH) |- |38h:||Graphics 2 Position register (3CAH) |} ? = B for monochrome modes or D for color modes

Output

AX: Restored

BL: Restored

BH: Not restored

DX: Not restored

All other registers are restored.

Example

The following example writes the contents of myvalue into the CRT Controller Cursor Start register:

myvalue db   3h
        mov  ah, 0f1h        ; f1 = write one register
        mov  bh, myvalue     ; bh = data from myvalue
        mov  bl, 000ah       ; bl = cursor start index
        mov  dx, 0000h       ; dx = crt controller
        int  10h             ; write it!

The example below writes the contents of myvalue into the Feature Control register:

myvalue db   2h
        mov  ah, 0f1h        ; f1 = write one register
        mov  bl, myvalue     ; bl = data from myvalue
        mov  dx, 0028h       ; dx = feature control register
        int  10h             ; write it!

Function F2H - Read Register Range

This function reads data from a specified range of registers on the EGA. A range of registers is defined to be several registers that have consecutive indexes, on a single chip. This function is applicable for pointer/data chips.

Input

AH = F2h

CH = Starting pointer value

CL = Number of registers (must be >1)

DX = Port number:

Pointer/data chips
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
18h: Attribute Controller (3C0H)

? = B for monochrome modes, or D for color modes

ES:BX = Points to table of one-byte entries (length = value in CL). On return, each entry is set to the contents of the corresponding register.

Output

AX: Restored

BX: Restored

CX: Not restored

DX: Restored

ES: Restored

All other registers are restored.

Example

The following example saves the contents of the Attribute Controller Palette registers in paltable:

paltable db  16 dup (?)
         mov  ax, ds               ; assume paltable in data segment
         mov  es, ax               ; es = data segment
         mov  bx, offset paltable  ; es:bx = paltable address
         mov  ah, 0f2h             ; f2 = read register range
         mov  cx, 0010h            ; ch = start index of 0
                                   ; cl = 16 registers to read
         mov  dx, 0018h            ; dx = attribute controller
         int  10h                  ; read them!

Function F3H - Write Register Range

This function writes data to a specified range of registers on the EGA. A range of registers is defined to be several registers that have consecutive indexes, on a single chip. This function is applicable for the pointer/data chips.

Input

AH = F3h

CH = Starting pointer value

CL = Number of registers (must be >1)

DX = Port number:

Pointer/data chips
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
18h: Attribute Controller (3C0H)

? = B for monochrome modes, or D for color modes

ES:BX = Points to table of one-byte entries (length = value in CL). Each entry contains the value to be written to the corresponding register.

Output

AX: Restored

BX: Not restored

CX: Not restored

DX: Not restored

ES: Restored.

All other registers are restored.

Example

The following example writes the contents of cursloc into the CRT Controller Cursor Location High and Cursor Location Low registers.

cursloc db   01h, 00h            ; cursor at page offset 0100h
        mov  ax, ds              ; assume cursloc in data segment
        mov  es, ax              ; es = data segment
        mov  bx, offset cursloc  ; es:bx = cursloc address
        mov  ah, 0f3h            ; f3 = write register range
        mov  cx, 0e02h           ; ch = start index of 14
                                 ; cl = 2 registers to write
        mov  dx, 0000h           ; dx = crt controller
        int  10h                 ; write them!

Function F4H - Read Register Set

This function reads data from a set of registers on the EGA. A set of registers is defined to be several registers that might have consecutive indexes and that might not be on the same chip.

Input

AH = F4h

CX = Number of registers (must be >1)

ES:BX = Points to table of records with each entry in this format:

Bytes 1-2: Port number:

Pointer/data chips
18h:||Attribute Controller (3C0H)
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
Single registers
20h: Miscellaneous Output register (3C2H)
28h: Feature Control register (3?AH)
30h: Graphics 1 Position register (3CCH)
38h: Graphics 2 Position register (3CAH)

? = B for monochrome modes, or D for color modes

Byte 3: Pointer value (0 for single registers)

Byte 4: EGA Register Interface fills in data read from register specified in bytes 1-3.

Output

AX: Restored

BX: Restored

CX: Not restored

ES: Restored.

All other registers are restored.

Example

The following example saves the contents of the Miscellaneous Output register, Sequencer Memory Mode register, and CRT Controller Mode Control register in results:

outvals dw   0020h               ; miscellaneous output register
        db   0                   ; 0 for single registers
        db   ?                   ; returned value
        dw   0008h               ; sequencer
        db   04h                 ; memory mode register index
        db   ?                   ; returned value
        dw   0000h               ; crt controller
        db   17h                 ; mode control register index
        db   ?                   ; returned value

results db   3 dup (?)
        mov  ax, ds              ; assume outvals in data segment
        mov  es, ax              ; es = data segment
        mov  bx, offset outvals  ; es:bx = outvals address
        mov  ah, 0f4h            ; f4 = read register set
        mov  cx, 3               ; number of entries in outvals
        int  10h                 ; get values into outvals
        mov  si, 3               ; move the returned values from
        add  si, offset outvals  ;  outvals
        mov  di, offset results  ;  to results
        mov  cx, 3               ; 3 values to move

loop:   mov  al, [si]            ; move one value from
        mov  [di], al            ;  outvals to results
        add  si, 4               ; skip to next source byte
        inc  di                  ; point to next destination byte
        loop loop

Function F5H - Write Register Set

This function writes data to a set of registers on the EGA. A set of registers is defined to be several registers that might have consecutive indexes, and that might be on the same chip.

Input

AH = F5h

CX = Number of registers (must be >1)

ES:BX = Points to table of values with each entry in this format:

Bytes 1-2: Port number:

Pointer/data chips
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
18h: Attribute Controller (3C0H)
Single registers
20h: Miscellaneous Output register (3C2H)
28h: Feature Control register (3?AH)
30h: Graphics 1 Position register (3CCH)
38h: Graphics 2 Position register (3CAH)

? = B for monochrome modes, or D for color modes

Byte 3: Pointer value (0 for single registers)

Byte 4: Data to be written to register specified in bytes 1-3.

Output
AX: Restored
BX: Restored
CX: Not restored
ES: Restored.

All other registers are restored.

Example

The following example writes the contents of outvals to the Miscellaneous Output register, Sequencer Memory Mode register, and CRT Controller Mode Control register:

outvals dw   0020h               ; miscellaneous output register
        db   0                   ; 0 for single registers
        db   0a7h                ; output value
        dw   0008h               ; sequencer
        db   04h                 ; memory mode register index
        db   03h                 ; output value
        dw   0000h               ; crt controller
        db   17h                 ; mode control register index
        db   0a3h                ; output value
        mov  ax, ds              ; assume outvals in data segment
        mov  es, ax              ; es = data segment
        mov  bx, offset outvals  ; es:bx = outvals address
        mov  ah, 0f5h            ; f5 = write register set
        mov  cx, 3               ; number of entries in outvals
        int  10h                 ; write the registers!

Function F6H - Revert to Default Registers

This function restores the default settings of any registers that the application program has changed through the EGA Register Interface. The default settings are defined in a call to Function F7 (described in the next section).

Input

AH = F6h

Output

All registers are restored.

Example

The following example restores the default settings of the EGA registers:

mov  ah, 0f6h    ; f6 = revert to default registers
int  10h         ; do it now!

Function F7H - Define Default Register Table

This function defines a table containing default values for any pointer/data chip or single register. If default values are defined for a pointer/data chip, they must be defined for all registers within that chip.

Input

AH = F7h

DX = Port number:

Pointer/data chips
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h: Graphics Controller (3CEH)
18h: Attribute Controller (3C0H)

|Single registers |{| |20h:||Miscellaneous Output register (3C2H) |- |28h: Feature Control register (3?AH) |- |30h:||Graphics 1 Position register (3CCH) |- |38h:||Graphics 2 Position register (3CAH) |} ? = B for monochrome modes, or D for color modes

ES:BX = Points to table of one-byte entries. Each entry contains the default value for the corresponding register. The table must contain entries for all registers.

Output
AX: Restored
BX: Not restored
DX: Not restored
ES: Restored

All other registers are restored.

Example

The following example defines default values for the Attribute Controller:

attrdflt db  00h, 01h, 02h, 03h, 04h, 05h, 06h, 07h
         db  10h, 11h, 12h, 13h, 14h, 15h, 16h, 17h
         db  08h, 00h, 0fh, 00h
         mov  ax, ds              ; assume attrdflt in data segment
         mov  es, ax              ; es = data segment
         mov  bx, offset attrdflt ; es:bx = attrdflt address
         mov  ah, 0f7h            ; f7 = define default register table
         mov  dx, 0018h           ; dx = attribute controller
         int  10h                 ; do it!

The example below defines a default value for the Feature Control register:

featdflt db  00h
         mov  ax, ds              ; assume featdflt in data segment
         mov  es, ax              ; es = data segment
         mov  bx, offset featdflt ; es:bx = featdflt address
         mov  ah, 0f7h            ; f7 = define default register table
         mov  dx, 0028h           ; dx = feature control register
         int  10h                 ; do it!

Function F8H - Read Default Register Table

This function reads the table containing default register values for any pointer/data chip or single register.

Input

AH = 0F8H

DX = Port number:

Pointer/data chips
0h: CRT Controller (3?4H)
8h: Sequencer (3C4H)
10h Graphics Controller (3CEH)
18h Attribute Controller (3C0H)
Single registers
20h: Miscellaneous Output register (3C2H)
28h: Feature Control register (3?AH)
30h: Graphics 1 Position register (3CCH)
38h: Graphics 2 Position register (3CAH)

? = B for monochrome modes, or D for color modes

ES:BX = Points to a table into which the default values are returned. The table must have room for the full set of values for the pointer/data chip or single register specified.

Output
AX: Restored
BX: Not restored
DX: Not restored
ES: Restored

All other registers are restored.

Example

The following example reads the default values for the Miscellaneous Output register:

regdflt  db
         mov  ax, ds
         mov  es, ax               ; es = data segment
         mov  bx, offset regdflt   ; es:bx = regdflt address
         mov  ah, 0f8h             ; f8 = read default register table
         mov  dx, 0020h            ; dx = miscellaneous output register
         int  10h                  ; do it!

The following example reads the default values for the CRT Controller register:

regdflt  db   25 dup (?)
         mov  ax, ds
         mov  es, ax               ; es = data segment
         mov  bx, offset regdflt   ; es:bx = regdflt address
         mov  ah, 0f8h             ; f8 = read default register table
         mov  dx, 0000h            ; dx = crt controller register
         int  10h                  ; do it!

Function FAH - Interrogate Driver

This function returns a value specifying whether the EGA.SYS device driver is present.

Input
AH = FAh
BX = 0
Output
AX: Restored
BX: 0, if EGA.SYS driver is not present
ES:BX: Pointer to EGA Register Interface version number, if present
Byte 1: Major release number
Byte 2: Minor release number (in 1/100ths)
Example

The following example interrogates the driver and displays the results:

gotmsg  db   "EGA.SYS driver found", 0dh, 0ah, 24h
nopmsg  db   "EGA.SYS driver not found", 0dh, 0ah, 24h
revmsg  db   "revision $"
crlf    db   0dh, 0ah, 24h
ten     db   10
        mov  bx, 0              ; must be 0 for this call
        mov  ah, 0fah           ; fa = interrogate driver
        int  10h                ; interrogate!
        or   bx, bx             ; bx = 0 ?
        jnz  found              ; branch if driver present
        mov  dx, offset nopmsg  ; assume nopmsg in data segment
        mov  ah, 09h            ; 9 = print string
        int  21h                ; output not found message
        jmp  continue           ; that's all for now
found:  mov  dx, offset gotmsg  ; assume gotmsg in data segment
        mov  ah, 09h            ; 9 = print string
        int  21h                ; output found message
        mov  dx, offset revmsg  ; assume revmsg in data segment
        mov  ah, 09h            ; 9 = print string
        int  21h                ; output "revision "
        mov  dl, es:[bx]        ; dl = major release number
        add  dl, "0"            ; convert to ASCII
        mov  ah, 2              ; 2 = display character
        int  21h                ; output major release number
        mov  dl, "."            ; dl = "."
        mov  ah, 2              ; 2 = display character
        int  21h                ; output a period
        mov  al, es:[bx+1]      ; al = minor release number

        xor  ah, ah             ; ah = 0
        idiv ten                ; al = 10ths, ah = 100ths
        mov  bx, ax             ; save ax in bx
        mov  dl, al             ; dl = 10ths
        add  dl, "0"            ; convert to ASCII
        mov  ah, 2              ; 2 = display character
        int  21h                ; output minor release 10ths
        mov  dl, bh             ; dl = 100ths
        add  dl, "0"            ; convert to ASCII
        mov  ah, 2              ; 2 = display character
        int  21h                ; output minor release 100ths
        mov  dx, offset crlf    ; assume crlf in data segment
        mov  ah, 09h            ; 9 = print string
        int  21h                ; output end of line
continue:                       ; the end

INT 2Fh Screen Switch Notification

A new Multiplex Interrupt (INT 2Fh) is issued by OS/2 to signal either of the following two events:

Switching the DOS application to the background (AX = 4001H)
Switching the DOS application to the foreground (AX = 4002H)

A DOS application that receives this signal must hook the Multiplex Interrupt vector. That is, when the application is started, it must save the current INT 2Fh vector and set this vector to point to the application's interrupt handler.

When the notification is received, the application must save all registers, perform whatever processing is required, restore all registers, and issue the IRET instruction to return to the operating system. Only the following forms of processing are supported:

Modifying application or video memory (or both)
Issuing ROM BIOS video service calls (INT 10h)
Issuing EGA Register Interface calls (INT 10h)
Programming the EGA video card directly

Note: When an application is being switched to the background, and the application's INT 2Fh handler uses the EGA Register Interface to save the EGA registers, these registers are restored automatically when the application is returned to the foreground.

An application can receive notification that it is being switched to the background at any time. Code sequences that are sensitive to interruption can be protected with CLI/STI instructions. When the switch notification occurs, the application (other than its INT 2Fh handler) is frozen until it is returned to the foreground.

When an application's INT 2Fh handler receives notification with a value in AH other than 40H, the application must issue the JMP FAR instruction to branch to the previous INT 2Fh vector.

Using Extended Screen and Keyboard Control (ANSI.SYS, ANSICALL)

This section explains how to issue special control character sequences to:

Control the position of the cursor
Erase text from the screen
Set the display mode
Redefine the meaning of keyboard keys

ANSI extended screen and keyboard control sequences are supported in DOS sessions by ANSI.SYS, an installable device driver. In OS/2 sessions, these control sequences are supported by the ANSICALL component within OS/2 CHAR.DLL.

Note: In this section, unless otherwise specified, ANSI refers to both ANSI.SYS and ANSICALL.

Limitations and Restrictions

ANSI operates on a per-session basis. OS/2-mode ANSI is affected when keys are reassigned in a code page environment. ANSI does not provide code page support for key reassignment in a DOS session.

Control Sequence Syntax

Each of the cursor control sequences is in the format:

ESC [ parameters COMMAND

A cursor control sequence is defined as follows:

Sequence Description
ESC The 1-byte ASCII code for ESC (1BH). It is not the three characters ESC.
[ The character [.
parameters The numeric values specified for #. The # represents a numeric parameter that is an integer value specified with ASCII characters. If a parameter value is not specified, or if a value of 0 (zero) is specified, the default value for the parameter is used.
COMMAND An alphabetic string that represents the command. It is case-specific.

For example, ESC [2;10H could be created using BASIC as shown below. Notice that "CHR$(27)" is ESC.

The IBM Personal Computer Basic Version 3.00 Copyright IBM Corp. 1981, 1982, 1983, 1984
xxxxx Bytes free

OK
open "sample" for output as 1
OK
print #1, CHR$(27);"[2;10H";"x row 2 col 10"
OK
close #1
OK

Cursor Control Sequences

The following tables contain the cursor control sequences used to control cursor positioning:

Cursor Position Function
ESC [#;#H Moves the cursor to the position specified by the parameters. The first parameter specifies the row number and the second parameter specifies the column number. The default value is 1. If no parameter is given, the cursor is moved to the home position.

This example copies the file SAMPLE from the previous example to CON, that places the cursor on row 2, column 10 of the screen:

type sample
Cursor Up Function
ESC [#A Moves the cursor up one or more rows without changing the column position. The value of # determines the number of lines moved. The default value for # is 1. This sequence is ignored if the cursor is already on the top line.
Cursor Down
ESC [#B Moves the cursor down one or more rows without changing the column position. The value of # determines the number of lines moved. The default value for # is 1. The sequence is ignored if the cursor is already on the bottom line.
Cursor Forward
ESC [#C Moves the cursor forward one or more columns without changing the row position. The value of # determines the number of columns moved. The default value for # is 1. This sequence is ignored if the cursor is already in the rightmost column.
Cursor Backward
ESC [#D Moves the cursor back one or more columns without changing the row position. The value of # determines the number of columns moved. The default value for # is 1. This sequence is ignored if the cursor is already in the leftmost column.
Horizontal and Vertical Position
ESC [#;#f Moves the cursor to the position specified by the parameters. The first parameter specifies the line number and the second parameter specifies the column number. The default value is 1. If no parameter is given, the cursor is moved to the home position.
Cursor Position Report
ESC [#;#R The cursor sequence report reports the current cursor position through the standard input device. The first parameter specifies the current line and the second parameter specifies the current column.
Device Status Report
ESC [6n The console driver gives a cursor position report sequence on receipt of device status report.

Note: Do not use the Device Status Report as part of a prompt.

This example tells ANSI to put the current cursor position (row and column) in STDIN. Then the program reads it from STDIN and outputs it to STDOUT.

PROGRAM dsr(INPUT,OUTPUT);

  VAR
    f:FILE OF CHAR;
    key:CHAR;

  FUNCTION inkey:CHAR;                    { read character  }
    VAR                                   { from the  /Using a File
      ch:CHAR;                            { keyboard buffer }
    BEGIN
      READ(f,ch);
      inkey:=ch
    END;

  BEGIN
    ASSIGN(f,'user');
    RESET(f);
        WRITE(CHR(27),'[6n');             { issue a DSR,  }
        key:=inkey;                       { read up to    }
        key:=inkey;                       { first digit   }
        key:=inkey;                       { of the row    }
        WRITE('row ',inkey,inkey,'  column ');
        key:=inkey;                       { skip to column}
        WRITE(inkey,inkey)                { write column  }
  END.
Save Cursor Position Function
ESC [s The current cursor position is saved. This cursor position can be restored with the restore cursor position sequence (see below).
Restore Cursor Position
ESC [u Restores the cursor to the value it had when the console driver received the save cursor position sequence.

Erasing

The following tables contain the control sequences used to erase text from the screen:

Erase in Display Function
ESC [2J Erases all of the screen, and the cursor goes to the home position.
Erase in Line
ESC [K Erases from the cursor to the end of the line and includes the cursor position.

Controlling the Display Mode

The following tables contain the control sequences used to set the mode of operation:

Set Graphics Rendition (SGR)
Set Mode (SM)
Reset Mode (RM)
Set Graphics Rendition (SGR) Function
ESC [#;...;#m Sets the character attribute specified by the parameters. All of the following characters have the attribute according to the parameters until the next occurrence of SGR.
Parameter Meaning
0 All attributes off (normal white on black
1 Bold on (high intensity)
4 Underscore on (monochrome compatible modes)
5 Blink on
7 Reverse video on
8 Canceled on (invisible)
30 Black foreground
31 Red foreground
32 Green foreground
33 Yellow foreground
34 Blue foreground
35 Magenta foreground
36 Cyan foreground
37 White foreground
38 Reserved
39 Reserved
40 Black background
41 Red background
42 Green background
43 Yellow background
44 Blue background
45 Magenta background
46 Cyan background
47 White background
Set Mode (SM) Function
ESC [=#h
or ESC [=h
or ESC [=0h
or ESC [?7h
Invokes the screen width or type specifiedby the parameter.
Parameter Meaning
0 40 x 25 black and white
1 40 x 25 color
2 80 x 25 black and white
3 80 x 25 color
4 320 x 200 color
5 320 x 200 black and white
6 640 x 200 black and white
7 Wrap at end of line. Typing past end-of-line results in new line.
Reset Mode (RM) Function
ESC [=#l
or ESC [=l
or ESC [=0l
or ESC [?7l
Parameters are the same as Set Mode (SM) except that parameter 7 resets wrap at end-of-line mode (characters past end-of-line are discarded).

Keyboard Key Reassignment

The ANSI system can be used to reassign keys on the keyboard. When an application calls KbdStringIn, the reassigned key's ASCII code is converted to the specified string and is passed back to the calling application. For example, replace a with q so that whenever the a key is pressed, a q is passed to the application that is reading input.

In OS/2 2.1, keyboard remapping can be done only from an application calling KbdStringIn. In DOS, keyboard remapping must be done from the command line.

Note: Keyboard reassignment works only with OS/2 applications that use the KbdStringIn call to get input.

OS/2 mode ANSI is affected when keys are reassigned in a code-page environment. ANSI "remembers" the code page under which a key is reassigned. The keyboard subsystem checks for reassigned keys when the application calls the KbdStringIn function. When a reassigned key is detected, the ANSI support:

  1. Checks to see what code page the requestor is running under
  2. Looks internally to see if the key has been reassigned under that code page
  3. If there is a key reassignment for that code page, gives the reassignment string
  4. Otherwise, gives the original ASCII codes.

A maximum storage of 64KB can be allocated to OS/2 mode ANSI-reassigned key definitions. The table shown below contains the control sequences used to redefine the meaning of keyboard keys:

The control sequence is: Function
ESC [#;#;...#p
or ESC ["string"p
or ESC [#;"string";#;#; "string";#p
or any other combination of strings and decimal numbers
The first ASCII code in the control sequence defines which code is being mapped. The remaining numbers define the sequence of ASCII codes generated when this key is intercepted. However, if the first code in the sequence is 0 (NULL), the first and second code make up an extended ASCII redefinition.

To execute the examples below, either create a file that contains the following statements and then use the TYPE command to display the file that contains the statement, or execute the command at the OS/2 prompt:

Assign the Aand akey to the Qand qkey, respectively.
Assign the Qand qkey to the Aand akey, respectively:

Using a File:

ESC [65;8lp          A becomes Q
ESC [97;113p         a becomes q
ESC [81;65p          Q becomes A
ESC [113;97p         q becomes a

At the OS/2 Prompt:

prompt $e[65;8lp     A becomes Q
prompt $e[97;113p    a becomes q
prompt $e[81;65p     Q becomes A
prompt $e[113;97p    q becomes a
Reassign the F10 key to a DIR command followed by a carriage return:

Using a File:

ESC [0;68;"dir";13p

At the OS/2 Prompt:

 prompt $e[0;68;"dir";13p

The $e is the prompt command characters for ESC. The 0;68 is the extended ASCII code for the F10 key; 13 decimal is a carriage return.

The following example sets the prompt to display the current directory on the top of the screen and the current drive on the current line:
   prompt $e[s$e[1;30f$e[K$p$e[u$n$g

If the current directory is C:\FILES, and the current drive is C, this example would display:

            C:\FILES
C>
The following DOS-compatible assembly language program reassigns the F10 key to a DIR B: command followed by a carriage return:
        TITLE SET ANSI.ASM - SET F10 TO STRING FOR ANSI.SYS

CSEG    SEGMENT PARA PUBLIC 'CODE'
        ASSUME  CS:CSEG,DS:CSEG
        ORG     100H
ENTPT:  JMP     SHORT START
STRING  DB      27,'[0;68;"DIR B:";13P' ;Redefine F10 key
STRSIZ  EQU     $-STRING                ;Length of above message
HANDLE  EQU     1                       ;Pre-defined file.
                                        ;Handle for standard output

START   PROC    NEAR
        MOV     BX,HANDLE               ;Standard output device
        MOV     CX,STRSIZ               ;Get size of text to be sent
        MOV     DX,OFFSET STRING        ;Pass offset of string
                                        ;To be sent
        MOV     AH,40H                  ;Function="write to device"
        INT     21h                     ;Call DOS
        RET                             ;Return to DOS
START   ENDP

CSEG    ENDS
        END     ENTPT

DPRINTF Print Formatting Package

DPRINTF is a kernel-debugging print-formatting package. You can include this function in the code to test your display driver.

To use the DPRINTF function, you must have a second device attached to COM1 or COM2. Due to difficulties passing variable-length argument lists through a call-gate transition, only one argument, a 0-terminated string, is passed to this routine. The string is sent to either COM1 or COM2 depending on how the variable, UR_DAT, is defined.

The only checking that this routine performs is to process XON/XOFF characters from the equipment attached to the debug port. This guarantees that the output does not overrun the receiving device. However, after receiving XOFF, this routine spins in a loop, waiting for XON.

The string to be output is ASCIIZ. It may contain literal characters.

A literal character is defined as any character that is not part of a format specification. Special non-printing characters are listed as follows:

\n for CRLF (carriage return/linefeed)
\t for tab
\b for bell
\\ for \.