Graphics

Type and run the following program; be especially careful to include all semicolons. The program produces the printout you see below.

10 WIDTH"LPT1:".255

20LPRINTCIiR$(27):"*":CHR$(O):CHR$(4O):CRR$(0);

30FOR Xtl TO 40

40LPRINTCHR$(170):

50NEXT X

:.-

--“..-

Line 20 specifies single-density graphics mode and also reserves 40 columns for graphics. Line 30 begins a loop to supply 40 bytes of data. Line 40 contains the number 170, which produces the first pin pattern shown in the section on pin labels, and line 50 finishes the loop.

Note: Some software programs (including most versions of BASIC) automatically insert carriage return and line feed codes after every 80 or 130 characters. This is usually no problem with text, but it can spoil your graphics. Two extra-cohnnns of graphics are printed in the middle of the ones you send, and two data numbers are left over and printed as text.

In some versions of BASIC, you can prevent unwanted ,co$rol codes in graphics by putting a WIDTH statement ‘at thebeginning of all graphics programs. The format in many BASK versions is either WIDTH ZPTl:“, 255 or WIDTH LPRINT 255. Check your software manual for the proper format.

Software and Graphics 4-15