Classic Computer Magazine Archive COMPUTE! ISSUE 54 / NOVEMBER 1984 / PAGE 100

PC Monochrome Graphics

Michael A. Covington

Here are some graphics screens which don't require a color/graphics adapter—they'll work on any IBM PC (or PCjr), even those equipped only with the monochrome display board.

Owners of the IBM monochrome display often feel a bit left out because their systems do not support point-by-point graphics. The monochrome display adapter can produce a variety of special characters that could be used to construct drawings, but most programs never employ more than a few of them.

The brief program accompanying this article takes advantage of these special characters to create dramatic-looking patterns—actually contour maps of three-dimensional mathematical functions. Some of the displays look rather like Scottish tartans. The program runs on a PC or PCjr with any display, but the IBM monochrome display yields the best results.

Line 160 in the program defines the variable W as a function of ROW and COL. The function can be anything you wish. Here are some functions that result in attractive patterns:

W = ROW + COL
W = ROW*COL
W = LOG(ROW)-LOG(COL)
W = LOG(ROW2  +  COL2)
W = 5*SIN((ROW +COL/10)

An almost infinite variety of other functions are possible. Just substitute your function for line 160, save, and then run the program. Exit with Ctrl-Break.

PC Monochrome Graphics

Refer to "COMPUTEI's Guide For Typing In Programs" article before typing this program in.

BP 30 SCRNWIDTH = 80 
CE 50 DIM A$( 4 )
KH 60 A$ ( 0 ) = " "
NM 70 A$ ( 2 ) = CHR$(176)
NF 80 A$ ( 2 ) = CHR$(177)
PO 90 A$ ( 3 ) = CHR$(178)
HC 100 A$ ( 4 ) = CHR$(219)
HI 110 CLS:KEY OFF
CP 120 FOR R0W = 1 TO 22
JM 130 FOR COL = 1 TO SCRNWIDTH-1
NP 140 ' Change the following line
EK 150 ' to get different patterns
OH 160 W = SQRC ( (2*(R0W- 11))^2 + (COL-40)^2)
AF 170 PRINT A$ (ABS (W) MOD 5);
ON 180 NEXT
190 PRINT
200 NEXT
210 BEEP