Commodore PET User Manual page 421

Table of Contents

Advertisement

REM *START TAPE MOTOR*
·REM *IF BUFFER FULL CALL
SUB. TO ADVANCE TAPE
REM *WAIT 10 JIFFIES*
:REM *STOP TAPE MOTOR
REM *RESET ACCUMULATOR
Let's go back ta the original wait loop and combine it with the routine that
detects a full butter. Below is a sam pie program which writes 100 numbers ta a
data tape with a FOR... NEXT loop. Within the loop is a check for a full butter. If the
butter is full the data is written ta the tape. and the subroutine at 1000 is called ta
create an interrecord gap:
10 POKE 243. 122:POKE 244.2:0PENl.1.1
20 FOR X=l TO 100
::;;:1:3
PF.:ItH#l .. ;, . , ;
40 A=LEN(STR$(X»+l
50 IF (QT+A»=191 GOSUB 1000
6~1
G!T=QT+A
7~1
t·jD,;T ;, , , ;
::;:0 CLOSEI
9~1
Et·m
1000 POKE 59411.53
1~110
T=TI
1020 IF (TI-T)<10 GOTO 1020
1030 POKE 59411.61
1~140
G!T=0
1
~150
RETUf':t·j
where:
A
is the length of the printed string plus 1 for carriage return
OT
is the accumulator ta add lengths of printed strings.
If vou follow these suggestions and routines vou should have little or no
troubles writing and reading data files. But. if Vou find that Vou cannat get the files
ta work even with these routines. Vou should install the new ROMs in vour PET.
Chapter 5: GENERATING RANDOM NUMBERS
Do not trv ta use RND(-RND(O)) ta generate random seeds; it will not work.
Instead. use -TI as shawn in ail of the examples.
The RANDOM VERSION 2A sample program in Chapter 5 will not work on
the original ROMs because of the 256-element arrav limitation. A second version
of the program is shawn below. It shows the lengths you have to go ta in arder ta
program with the 256-element array limitation. In this program the 1000-element
table is divided into four quarters of 250 elements each.
5 REM RANDOM VERSION 2A
10 REM
*******
B LAN K E T
*~**.**
20 REM RANDOM DISPLAY OF ONE
30 REM
CHARACTER ENTERED FROM THE
40 REM
KEYBOARD
50 REM
*******************************
70 DIM Tl(249).T2(249).T3(249).T4(249)
75 T=4
:REM NUMBER OF TABLES
f b
N=250 :REM NO OF ELEMENTS
S0 GOSLtE: 2013
.
F~Et1
1NIT 1AL 1ZE TABLES
90 PF:nH"HIT A
fŒ'y'
OF: <R)· TO Et·m".;
95 Nl=N:N2=N:N3=N:N4=N
100 GET C$: IF C$="" GOTO
1~10
408

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cbm

Table of Contents