Commodore PET User Manual page 388

Table of Contents

Advertisement

Program 6, SPEED UP.
5 REM PROGRAM 6
SPEErl L1P
10 REM
*******
B LAN K E T
~**~***
20 REM C:ONT
1
NLiOLlS-L
1
NE
Il 1
SPLA'T' OF
Ot'~E
30 REM
CHARACTER ENTERED FROM THE
40 REM
KEYBOARII
50 REM
***.*••••••••••*•••••••••••••••
90 PRItH"HIT A KE'r' OR <l'::> TO END".;
100 GET C:$: IF C$="" GOTO 100
105 IF C$=CHR$(13) GOTO 170
1€:16
FOF~
1
=1T07
107 C$=C$+C$
108 NEXT
:REM C$=128 C$/S
109 C$=C$+LEFT$(C$, 1(2)
:REM C$=230 C$/S
110 PF:
1
NT
"::1" .;
:
RHl CLEAR SCREEN
120 FOR 1=1T04
:REM 230.4=23 LINES
1:30 PRltH C$';
140
t'iE~<:T
15€:1 PI': 1
NT"
PHEloJ
! "
16~::1
GOTO
90
17€1 am
Changes
Add:
Change:
Delete:
Comments
Lines 5, 106-109
Line 120
None
Here vou have to realize that one long string prints more quickly than a num-
ber of shorter strings. Ideally we would print one 920-character string. However,
on the PET, strings are Iimited to a maximum of 255 characters. The program
breaks the 920 positions into four 230-character quadrants. At lines 106 to 109 it
concatenates the keyed-in character into a 230-character string. which is a
quarter of the screen area to be covered by the display character. The FOR. . .
NEXT loop at lines 106 to 108 uses a pyramided concatenation to quickly "grow"
the string to 128 characters. Then at line 109 the 128-character string is concate-
nated to the leftmost 102 characters of the string to give a 230-character string of
the display character. The FOR . . . NEXT print loop at lines 120 to 140 needs to
print this longer string only four times to fill the screen.
375

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents