Microsoft KB Archive/59135

= Basic EGA/VGA Graphics in Protected Mode OS/2 by Calling VIO =

Article ID: 59135

Article Last Modified on 12/12/2003

-

APPLIES TO


 * Microsoft BASIC Compiler 6.0
 * Microsoft BASIC Compiler 6.0b
 * Microsoft BASIC Professional Development System 7.0
 * Microsoft BASIC Professional Development System 7.1

-



This article was previously published under Q59135



SUMMARY
It is possible to do EGA and VGA graphics in OS/2 protected mode using VIO calls for the graphics. This is done by getting the physical video buffer and modifying it (with POKE or BLOAD).

This information applies to Microsoft Basic Compiler versions 6.00 and 6.00b for MS OS/2 and to Microsoft Basic Professional Development System (PDS) version 7.00 and 7.10 for MS OS/2.



MORE INFORMATION
Basic's graphics statements (SCREEN, PSET, LINE, etc.) do not support EGA/VGA high-resolution graphics modes in OS/2 protected mode. This is because Basic writes directly to the hardware for EGA and VGA graphics. Basic directly supports CGA graphics (modes 1 and 2) in OS/2 protected mode.

For better graphics control than is provided by the BASVIO program, OS/2 Presentation Manager (PM) provides a wide range of graphics functions in the GPI (Graphics Programming Interface) calls. For information on how to program for PM using Basic, contact Microsoft Technical Support and ask for the application note &quot;Basic OS/2 Presentation Manager Toolkit Supplement.&quot;

More Information About BASVIO
The BASVIO code example provides several different graphics routines for EGA and VGA graphics under OS/2 protected mode. Color is supported only for mode 13 (256 colors). This is because EGA color requires modifying the hardware registers. To do this, a program must have an IOPL segment.

BASVIO contains routines that allow high-resolution (EGA/VGA) graphics to be used in OS/2 protected mode in the full screen groups. These routines manipulate the physical screen buffer. This requires that the screen group be in the foreground and locked during any drawing.

Color is supported in mode 13 (320 x 200, 256 colors), but EGA color requires manipulating hardware registers. To do this, an IOPL segment is required. With some versions of the OS/2 SDK, the example program, MANDEL.C, illustrates register-based programming for EGA modes. In modes other than 13, the color parameter is a simple Boolean for setting the pixel on or off.

NOTE: Text output is not supported with these routines. Input works but is not echoed.

The following is a brief summary of the important routines provided in BASVIO:   Routine     Description ---    ---

VioScreen  Set the screen mode (EGA &amp; VGA only) VioCLS     Clear graphics screen VioPSET    Set pixel VioLine    Draw line VioBox     Fill box VioBSAVE   BSAVE graphics screen VioBLOAD   BLOAD graphics screen DrawCircle Draw circle outline FillCircle Fill circle NOTE: These routines cannot be used in a text window.

Additional query words: BasicCom

Keywords: KB59135

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.