EasyManua.ls Logo

Oki 80 Series - Page 61

Oki 80 Series
76 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Programming 3 – 31
Here is another sample program that uses a FOR-NEXT loop to print all
the possible combinations of dots and spaces in numeric order:
10 REM SAMPLE 2
20 WIDTH “LPT1:”,255
30 NDOTS = 256 ‘MAXIMUM POSSIBLE COMBINATIONS
40 LPRINT CHR$(27);CHR$(75);CHR$(NDOTS MOD 256);
CHR$(FIX(NDOTS/256));
50 REM START GRAPHICS 256 COLUMNS
60 FOR I=0 TO NDOTS-1
70 LPRINT CHR$(I);
80 NEXT I
90 PRlNT:REM LINE FEED
A word of explanation about line 20. The IBM Personal Computer is set
for a maximum line length of 80 characters, so it adds a Carriage Return
and Line Feed after the 80th character. Because the data for each column
is treated as a character, your computer will send CR and LF codes after
the data for the 80th column, and the printer will interpret these codes
as graphics information and print them. A WIDTH statement changes
the maximum length of a line, and placing the number 255 in a WIDTH
statement eliminates any length restriction. (See your IBM BASIC Manual
for details.)
The printout looks like this:

Related product manuals