Basic computer language commands

Basic computer programming language

SCREEN Statement

Purpose:

To set the specifications for the display screen.

Syntax:

SCREEN [mode] [,[colorswitch]][,[apage]][,[vpage]]

Comments:

The SCREEN statement is chiefly used to select a screen mode appropriate for a particular display-hardware configuration. Supported hardware configurations and screen modes are described below.

MDPA with Monochrome Display: Mode 0

The IBM Monochrome Display and Printer Adapter (MDPA) is used to connect only to a monochrome display. Programs written for this configuration must be text mode only.

CGA with Color Display: Modes 0, 1, and 2

The IBM Color Graphics Adapter (CGA) and Color Display are typically paired with each other. This hardware configuration permits the running of text mode programs, and both medium-resolution and high-resolution graphics programs.

EGA with Color Display: Modes 0, 1, 2, 7, and 8

The five screen modes 0, 1, 2, 7, and 8 allow you to interface to the IBM Color Display when it is connected to an IBM Enhanced Graphics Adapter (EGA). If EGA switches are set for CGA compatibility, programs written for modes 1 and 2 will run just as they would with the CGA. Modes 7 and 8 are similar to modes 1 and 2, except that a wider range of colors is available in modes 7 and 8.

EGA with Enhanced Color Display: Modes 0, 1, 2, 7, and 8

With the EGA/IBM Enhanced Display configuration, modes 0, 1, 2, 7, and 8 are virtually identical to their EGA/Color Display counterparts. Two possible differences are as follows:

  • In mode 0, the border color cannot be the same as for the EGA/Color Display because the border cannot be set on an Enhanced Color Display when it is in 640 350 text mode.
  • The quality of the text is better on the Enhanced Color Display (an 8 14 character box for Enhanced Color Display versus an 8 8 character box for color display).

EGA with Enhanced Color Display: Mode 9

The full capability of the Enhanced Color Display is taken advantage of in this mode. Mode 9 allows the highest resolution possible for the EGA/Enhanced Color Display configuration. Programs written for this mode will not work for any other hardware configuration.

EGA with Monochrome Display: Mode 10

The IBM Monochrome Display can be used to display monochrome graphics at a very high resolution in this mode. Programs written for this mode will not work for any other hardware configuration.

Arguments

The mode argument is an integer expression with legal values 0, 1, 2, 7, 8, 9, and 10. All other values are illegal. Selection of a mode argument depends primarily on your program's anticipated display hardware, as described above.

Each of the SCREEN modes is described individually in the following paragraphs.

SCREEN 0

  • Text mode only
  • Either 40 25 or 80 25 text format with character-box size of 8 8 (8 14 with EGA)
  • Assignment of 16 colors to any of 2 attributes
  • Assignment of 16 colors to any of 16 attributes (with EGA)

SCREEN 1

  • 320 200 pixel medium-resolution graphics
  • 80 25 text format with character-box size of 8 8
  • Assignment of 16 colors to any of 4 attributes
  • Supports both EGA and CGA
  • 2 bits per pixel

SCREEN 2

  • 640 200 pixel high-resolution graphics
  • 40 25 text format with character-box size of 8 8
  • Assignment of 16 colors to any of 2 attributes
  • Supports both EGA and CGA
  • 1 bit per pixel

SCREEN 7

  • 320 200 pixel medium-resolution graphics
  • 40 25 text format with character-box size of 8 8
  • 2, 4, or 8 memory pages with 64K, 128K, or 256K of memory, respectively, installed on the EGA
  • Assignment of any of 16 colors to 16 attributes
  • EGA required
  • 4 bit per pixel

SCREEN 8

  • 640 200 pixel high-resolution graphics
  • 80 25 text format with character-box size of 8 8
  • 1, 2, or 4 memory pages with 64K, 128K, or 256K of memory, respectively, installed on the EGA
  • Assignment of any of 16 colors to 16 attributes
  • EGA required
  • 4 bits per pixel

SCREEN 9

  • 640 350 pixel enhanced-resolution graphics
  • 80 25 text format with character-box size of 8 14
  • Assignment of either 64 colors to 16 attributes (more than 64K of EGA memory), or 16 colors to 4 attributes (64K of EGA memory)
  • Two display pages if 256K of EGA memory installed
  • EGA required
  • 2 bits per pixel (64K EGA memory) 4 bits per pixel (more than 64K EGA memory)

SCREEN 10

  • 640 350 enhanced-resolution graphics
  • 80 25 text format with character-box size of 8 14
  • Two display pages if 256K of EGA memory installed
  • Assignment of up to 9 pseudo-colors to 4 attributes
  • EGA required
  • 2 bits per pixel

The following are default attributes for SCREEN 10, monochrome display:

Attribute ValueDisplayed Pseudo-Color
0Off
1On, normal intensity
2Blink
3On, high intensity

The following are color values for SCREEN 10, monochrome display:

Color ValueDisplayed Pseudo-Color
0Off
1Blink, off to on
2Blink, off to high intensity
3Blink, on to off
4On
5Blink, on to high intensity
6Blink, high intensity to off
7Blink, high intensity to on
8High intensity

For both composite monitors and TVs, the colorswitch is a numeric expression that is either true (non-zero) or false (zero). A value of zero disables color and permits display of black and white images only. A nonzero value permits color. The meaning of the colorswitch argument is inverted in SCREEN mode 0.

For hardware configurations that include an EGA and enough memory to support multiple-screen pages, two arguments are available. These apage and vpage arguments determine the "active" and "visual" memory pages. The active page is the area in memory where graphics statements are written; the visual page is the area of memory that is displayed on the screen.

Animation can be achieved by alternating the display of graphics pages. The goal is to display the visual page with completed graphics output, while executing graphics statements in one or more active pages. A page is displayed only when graphics output to that page is complete. Thus, the following program fragment is typical:

SCREEN 7,, 1, 2  'work in page 1, show page 2
.
. Graphics output to page 1
. while viewing page 2
.

SCREEN 7,,2,1  'work in page 2, show page 1
.
. Graphics output to page 2
. while viewing page 1
.

The number of pages available depends on the SCREEN mode and the amount of available memory, as described in the following table:

Table 2

SCREEN Mode Specifications

ModeResolutionAttribute RangeColor RangeEGA MemoryPagesPage Size
040-column textNA0-15aNA12K
80-column textNA0-15aNA14K
13202000-3b0-3NA116K
26402000-1b0-1NA116K
73202000-150-1564K232K
128K4
256K8
86402000-150-1564K164K
128K2
256K4
96403500-30-1564K164K
0-150-63128K1128K
0-150-63256K2
106403500-30-8128K1128K
256K2

a Numbers in the range 16-31 are blinking versions of the colors 0-15.
b Attributes applicable only with EGA.

Attributes and Colors

For various screen modes and display hardware configurations, different attribute and color settings exist. (See the PALETTE statement for a discussion of attribute and color number.) The majority of these attribute and color configurations are summarized in the following table:

Table 3

Default Attributes and Colors for Most Screen Modes

Attributes for ModeColor DisplayMonochrome Display
1,920,7,8,9bNumbercColorNumbercColor
0000Black0Off
  11Blue (Underlined)a
  22Green1Ona
  33Cyan1Ona
  44Red1Ona
  55Magenta1Ona
  66Brown1Ona
  77White1Ona
  88Gray0Off
  99Light Blue High intensity (underlined)
  1010Light Green2High intensity
1 1111Light Cyan2High intensity
  1212Light Red2High intensity
2 1313Light Magenta2High intensity
  1414Yellow2High intensity
311515High-intensity White0Off

a Off when used for background.
b With EGA memory > 64K.
c Only for mode 0 monochrome.

The default foreground colors for the various modes are given in the following table:

Table 4

Default Foreground Colors

 Default foreground attributeDefault foreground color
Screen modeColor/Extended DisplayaMonochrome DisplayColor/Extended DisplayaMonochrome Display
07771
13NA15NA
21NA15NA
715NA15NA
815NA15NA
93bNA63NA
10NA3NA8

a IBM Enhanced Color Display
b 15 if greater than 64K of EGA memory
NA=Not Applicable

BASIC commands Main Menu

Index