SCREEN Statement ---------------------------------------------------------------------------- Action Sets the specifications for the graphics adapter and monitor. Syntax SCREEN mode% , colorswitch% , activepage% , visiblepage% Remarks The SCREEN statement sets a screen mode for a particular combination of display and adapter. Later sections in this entry describe the available modes for specific adapters. The SCREEN statement uses the following arguments. ----------------------------------------------------------------------------- Argument Description ---------------------------------------------------------------------------- mode% An integer constant or expression that selects a screen mode for a particular combination of display and adapter (see "Summary of Screen Modes" later in this entry for information on what the acronyms represent). There also are more details on mode% later in this entry. colorswitch% Integer expression that switches Argument Description ---------------------------------------------------------------------------- colorswitch% Integer expression that switches composite monitor display between color and monocolor (modes 0 and 1 only). See below for more details on colorswitch%. activepage% Integer expression that identifies the screen page that text or graphics output is written to. visiblepage% Integer expression that identifies the screen page that is displayed. The colorswitch% is effective only for screen modes 0 and 1 and for composite monitors. In screen mode 0, use a colorswitch% value of 0 to disable color, and a non-zero value to enable color. In screen mode 1, use a non-zero value to disable color and 0 to enable color. See "Adapters, Screen Modes, and Displays" later in this entry for the valid ranges for activepage% and visiblepage% for each graphics adapter. The "Attributes and Colors" section lists the default color attributes for different screen modes. If mode% is an expression, rather than a constant, and if you know your program will not use certain screen modes, you can achieve a smaller .EXE file by linking one or more stub files. ----------------------------------------------------------------------------- If not using screen modes. Link to file. ---------------------------------------------------------------------------- 1 or 2 NOCGA.OBJ 3 NOHERC.OBJ 4 NOOGA.OBJ 7, 8, 9, or 10 NOEGA.OBJ 11, 12, or 13 NOVGA.OBJ If you do not need graphics in your custom run-time module (because the programs use screen mode 0 only), you can save 15K by creating the run-time module with NOGRAPH.OBJ. Summary of Screen Modes The following lists summarize each of the screen modes. The color adapters referred to are the IBM Monochrome Display and Printer Adapter (MDPA), the IBM Color Graphics Adapter (CGA), the IBM Enhanced Graphics Adapter (EGA), the IBM Video Graphics Array (VGA), the IBM Multicolor Graphics Array (MCGA), and the Olivetti Color Adapter. The Hercules Graphics Card, Graphics Card Plus and InColor adapters are supported, but only with monochrome monitors. Note Many screen modes support more than one combination of rows and columns. See the WIDTH statement for more information about changing the number of rows and columns on the display. SCREEN 0 - MDPA, CGA, EGA, MCGA, Hercules, Olivetti, or VGA Adapter Boards - Text mode only - 40 x 25, 40 x 43, 40 x 50, 80 x 25, 80 x 43, or 80 x 50 text format with 8 x 8 character box size (8 x 14, 9 x 14, or 9 x 16 with EGA or VGA) - 16 colors assigned to two color attributes - 16 colors assigned to any of 16 color attributes with CGA or EGA - 64 colors assigned to any of 16 color attributes with EGA or VGA SCREEN 1 - CGA, EGA, VGA, or MCGA Adapter Boards - 320 x 200 graphics - 40 x 25 text format, 8 x 8 character box - 16 background colors and one of two sets of three foreground colors assigned using COLOR statement with CGA - 16 colors assigned to four color attributes with EGA, VGA or MCGA SCREEN 2 - CGA, EGA, VGA, or MCGA Adapter Boards - 640 x 200 graphics - 80 x 25 text format with character box size of 8 x 8 - 2 colors (black and white) with CGA - 16 colors assigned to two color attributes with EGA or VGA SCREEN 3 - Hercules, Olivetti, or AT&T Adapter Boards - Hercules adapter required, monochrome monitor only - 720 x 348 graphics - 80 x 25 text format, 9 x 14 character box - Two screen pages (one only if a second display adapter is installed) - PALETTE statement not supported SCREEN 4 - Hercules, Olivetti, or AT&T Adapter Boards - 640 x 400 graphics - 80 x 25 text format, 8 x 16 character box - One of 16 colors assigned as the foreground color (selected by the COLOR statement); background fixed at black - Supports Olivetti Personal Computers models M24, M240, M28, M280, M380, M380-C, and M380-T, and AT&T Personal Computers 6300 series Warning Olivetti personal computers running 3XBOX under OS-2 should avoid screen mode 4. SCREEN 7 - EGA or VGA Adapters - 320 x 200 graphics - 40 x 25 text format, character box size 8 x 8 - 32K page size, pages 0-1 (64K adapter memory), 0-3 (128K), or 0-7 (256K) - Assignment of 16 colors to any of 16 color attributes SCREEN 8 - EGA or VGA Adapters - 640 x 200 graphics - 80 x 25 text format, 8 x 8 character box - 64K page size, pages 0 (64K adapter memory), 0-1 (128K), or 0-3 (256K) - Assignment of 16 colors to any of 16 color attributes SCREEN 9 - EGA or VGA Adapters - 640 x 350 graphics - 80 x 25 or 80 x 43 text format, 8 x 14 or 8 x 8 character box size - 64K page size, page 0 (64K adapter memory); 128K page size, pages 0 (128K adapter memory) or 0 - 1 (256K) - 16 colors assigned to four color attributes (64K adapter memory), or 64 colors assigned to 16 color attributes (more than 64K adapter memory) SCREEN 10 - EGA or VGA adapters, monochrome monitor only - 640 x 350 graphics, monochrome monitor only - 80 x 25 or 80 x 43 text format, 8 x 14 or 8 x 8 character box size - 128K page size, pages 0 (128K adapter memory) or 0 - 1 (256K) - Up to nine shades of gray assigned to four color attributes SCREEN 11 - VGA or MCGA adapters - 640 x 480 graphics - 80 x 30 or 80 x 60 text format, character box size of 8 x 16 or 8 x 8 - Assignment of up to 256K colors to two color attributes SCREEN 12 - VGA adapter - 640 x 480 graphics - 80 x 30 or 80 x 60 text format, character box size of 8 x 16 or 8 x 8 - Assignment of up to 256K colors to 16 color attributes SCREEN 13 - VGA or MCGA adapters - 320 x 200 graphics - 40 x 25 text format, character box size of 8 x 8 - Assignment of up to 256K colors to up to 256 color attributes Screen Modes, Adapters, and Displays This section describes the screen modes available for each adapter. If the display device also is a factor in choosing a screen mode, it is listed. The IBM Monochrome Display and Printer Adapter (MDPA) must be used with a monochrome display. Only SCREEN 0, text mode, can be used with the MDPA. Table 1.10 describes the screen mode available with the MDPA. Table 1.11 summarizes the screen modes available with Hercules Adapters. The IBM Color Graphics Adapter (CGA) and Color Display typically are paired. This combination permits running text-mode programs, and both medium-resolution and high-resolution graphics programs. Table 1.12 summarizes the screen modes available with the CGA. The IBM Enhanced Graphics Adapter (EGA) can be used with either the IBM Color Display or the Enhanced Color Display. In modes 0, 1, 2, 7, and 8, these pairings produce similar results, except for the following differences. - Border color can't be set on an Enhanced Color Display when it is in 640 x 350 text mode. - The text quality is better on the Enhanced Color Display (an 8 x 14 character box for Enhanced Color Display versus an 8 x 8 character box for Color Display). Screen mode 9 takes full advantage of the capabilities of the Enhanced Color Display. Mode 9 provides for the highest resolution possible for the EGA-Enhanced Color Display configuration. Programs written for this mode will not work for any other hardware configuration except the VGA. Table 1.13 summarizes the screen modes that can be used with an EGA. Only the EGA and VGA can be paired with the IBM Monochrome display to run programs in screen mode 10. This mode can be used to display monochrome graphics at a very high resolution with the optional effects of blinking and high intensity. The following two tables summarize the color attributes, display colors, and effects for screen mode 10 used with a monochrome display. Tables 1.14 and 1.15 summarize EGA and VGA adapters used with monochrome display (SCREEN 10). The IBM Video Graphics Array (VGA) adapter offers significantly enhanced text and graphics in all modes. Table 1.16 summarizes the modes available with the VGA. The IBM Multicolor Graphics Array (MCGA) combines the modes of the CGA with the very high resolution and 256K color modes of the VGA to provide enhanced text and graphics in all modes. Table 1.17 summarizes the modes supported by the MCGA. The MCGA uses the same display color values as the VGA. For a description of how the MCGA calculates display color values, see the PALETTE statement. Attributes and Colors For various screen modes and display hardware configurations, different color-attribute and display-color settings exist. (See the PALETTE statement for a discussion of color attributes and display colors.) The majority of these color-attribute and display-color configurations are summarized in Tables 1.18-1.20. Note In OS-2 protected mode, BASIC supports only screen modes 0 - 2 and does not support the activepage% and visiblepage% arguments. See Also COLOR, PALETTE, SCREEN Function, WIDTH Example The following example sets up a multipage EGA or VGA mode 7 (320x200) display using the SCREEN statement. A help screen is displayed for several seconds then copied (using the PCOPY statement) to page 2 for later use. A cube is displayed and rotated on the screen. By pressing Shift+F1, the user can again see the help screen, after which the cube display is resumed. DEFINT A-Z ' Define a macro string to draw a cube and paint its sides. One$ = "BR30 BU25 C1 R54 U45 L54 D45 BE20 P1, 1G20 C2 G20" Two$ = "R54 E20 L54 BD5 P2, 2 U5 C4 G20 U45 E20 D45 BL5 P4, 4" Plot$ = One$ + Two$ ' Initialize values for active page, visual page, and help page. APage% = 0 . VPage% = 1 . HPage% = 2 Angle% = 0 ' Create a HELP screen on the visual page. SCREEN 7, 0, VPage%, VPage% LOCATE 1, 18 PRINT "HELP" LOCATE 5, 1 PRINT "Press 'Alt+F1' keys to see this HELP" PRINT "screen while the cube is rotating" PRINT "around the center of the screen." PRINT PRINT "After a brief delay, the cube will" PRINT "resume at the next point in its rotation." PRINT PRINT "Press any other key to exit the program." ' Put a copy of the help screen in page 2. PCOPY VPage%, HPage% SLEEP 5 DO SCREEN 7, 0, APage%, VPage% ' Clear the active page. CLS 1 ' Rotate the cube Angle% degrees. DRAW "TA" + STR$(Angle%) + Plot$ ' Angle% is some multiple of 15 degrees. Angle% = (Angle% + 15) MOD 360 ' Drawing is complete. Make the cube visible in its ' new position by swapping the active and visual pages. SWAP APage%, VPage% ' Check the keyboard input. Kbd$ = INKEY$ SELECT CASE Kbd$ ' If Shift+F1 is pressed, show the HELP page. CASE CHR$(0) + CHR$(104) PCOPY HPage%, APage% SLEEP 3 ' Do nothing if no key is pressed. CASE "" CASE ELSE EXIT DO END SELECT LOOP END