PCjs Machines

Home of the original IBM PC emulator for browsers.

Logo

Graphics for the IBM PC

by Dan Illowsky and Michael Abrash (1984)

Check out the Live Demos we’ve created from this classic text.

Live Demos

From Page 46:

A KALEIDOSCOPE PROGRAM

Let’s run a program that will show you some of what BASIC can do on the IBM PC. This program produces a changing kaleidoscope display and is shown in Listing 2-3. Type it precisely as shown. If you make any mistakes, use the editing capabilities of BASIC discussed above to make corrections. Remember to type NEW to clear any previous programs out of memory before typing the new program. Enter RUN to execute the program, noting the wide range of colors available on the IBM PC. A typical display is shown in Fig. 4. in the color photograph section. Note that good effects can be produced with only a few program lines thanks to the power of Advanced BASIC.

[PCjs Machine "xt-cga-256k-1"]

Waiting for machine "xt-cga-256k-1" to load....

100 REM Kaleidoscope program
110 REM This program is inspired by material appearing in
120 REM   The Apple II Reference Manual, January 1978, p. 55
130 KEY OFF:WIDTH 40:SCREEN 0,1:COLOR 7,0,0:LOCATE ,,0:CLS
140 LOCATE 25,11:PRINT "PRESS ANY KEY TO EXIT";
150 FOR L=4 TO 40:FOR I=1 TO 12:FOR J=0 TO 11
160 K=I+J:COLOR (J*4/(I+2)+L) MOD 16,0
170 LOCATE K,I+9:PRINT CHR$(219)
180 LOCATE I,K+9:PRINT CHR$(219)
190 LOCATE 24-I,33-K:PRINT CHR$(219)
200 LOCATE 24-K,33-I:PRINT CHR$(219)
210 LOCATE I,33-K:PRINT CHR$(219)
220 LOCATE 24-K,I+9:PRINT CHR$(219)
230 LOCATE K,33-I:PRINT CHR$(219)
240 LOCATE 24-I,K+9:PRINT CHR$(219)
250 IF INKEY$<>"" THEN 280
260 NEXT J:NEXT I:NEXT L
270 GOTO 150
280 COLOR 7,0,0:CLS
290 END

From Page 58:

Medium-Resolution Color Selection

Every color available on the PC can be displayed in medium-resolution graphics mode, but, unfortunately, only in certain combinations. The background color (that is, the color to which the screen and border default and which graphics are typically set against) can be any of the 16 colors available on the PC, as shown in Table 4-1. The other three colors available at any one time consist of one of two sets. The sets are called palettes because, like painters’ palettes, each is a group of colors from which the PC artist may choose to work.

Palette number 0 contains green, red, and brown, which are colors 1,2, and 3, respectively (Table 4-2). (Many monitors will display yellow rather than brown.) These colors look excellent on an RGB monitor (see Fig. 5A in the color photograph section), but, unfortunately, often tend to look rather muddy on a television.

Palette number 1 contains cyan, magenta, and white, which are, respectively, colors 1, 2, and 3 (Table 4-2). Cyan is a light blue, and magenta is a light red. These colors aren’t as vivid on an RGB monitor as those in the other palette (See Fig. 5B). in the color photograph section), and can look somewhat washed out if screen brightness is high. However, the colors in palette 1 look just about as good on a television as on an RGB monitor, and because white appears much sharper on a television than any other color, this palette is the palette of choice for television work. (The same is true of any composite monitor.)

[PCjs Machine "xt-cga-256k-2"]

Waiting for machine "xt-cga-256k-2" to load....

100 REM Program to demonstrate palettes 0 and 1
110 REM   in medium-resolution graphics mode.
120 SCREEN 1,0:CLS:KEY OFF      'Set screen
130 COLOR 0             'Black background
140 REM Do palette 0 first
150 COLOR, 0            'Select palette 0
160 REM Draw circles in colors 1, 2, and 3
170 CIRCLE(80,100),30,1:PAINT STEP(0,0),1
180 CIRCLE(160,100),30,2:PAINT STEP(0,0),2
190 CIRCLE(240,100),30,3:PAINT STEP(0,0),3
200 REM Label screen
210 LOCATE 22,17:PRINT "PALETTE 0"
220 LOCATE 24,9:PRINT "PRESS ANY KEY TO CONTINUE";
230 A$=INKEY$:IF A$="" THEN 230
240 REM Palette 1
250 COLOR, 1            'Select palette 1
260 LOCATE 22,17:PRINT "PALETTE 1"
270 LOCATE 24,9:PRINT "PRESS ANY KEY TO CONTINUE";
280 A$=INKEY$:IF A$="" THEN 280
290 COLOR 0,1:CLS
300 END

Directory of Graphics for the IBM PC

 Volume in drive A is PROGRAMS
 Directory of A:\

02-03    BAS       733  12-07-15   1:09p
04-01    BAS       784  12-07-15   1:09p
README   TXT       112  12-07-15   1:09p
        3 file(s)       1629 bytes
                      359424 bytes free