Beruflich Dokumente
Kultur Dokumente
Syntax: WRITEt[<expre
J r <e
STATEMENT:
s
a
e,.
Explanation: WRITEi a sequenti file, number you opened file 0 mode.
to WR
The f
data to r is the
WRITEi is preferable to PRINTi when you plan to r the data
back with a series of INPUTi statements. The 0 from
WRITE' is in the form uired to read back the data
accurately.
The rules for form for PRINTi.
the expression are the same as those
See: PRINT, PRINT' Example:
Ok 10 KWH=34.275
Ok 20 K$="AVERAGE KILOWATT HOURS PER WEEK" OK 30 WRITE i2,K$,KWH
This writes to disk as:
"AVERAGE KILOWATT HOURS PER WEEKH,34.275
Close the file, reopen for input, then r
the file:
Ok 40 INPUT#2,K$,KWH
'IAVERAGE KILOWATT HOURS PER
H to K$ and 34.275 to B$
63
Number
APPENDIX D ERROR MESSAGES
Message
2 3 4 5 6 7 8
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
24-29 30 31 32 33
34-49 50 51 52 53 54 55 56 57 58
59-60 61 62 63
64 65
Something is wrong.
RETURN statement needs matching GOSUB. READ statement ran out of data. Function call not allowed.
Number too large.
Not enough memory.
A statement or a command refers to a nonexistent line.
Subscript refers to element outside the array_ You defined an array more than once.
You cannot divide by zero.
Statement is illegal in direct mode. Types of values do not match. Undefined error.
Strings cannot be over 255 characters long. Expression is too long or too complex.
CONT works only in BREAK mode.
Function needs prior definition with DEF FN. Undefined error.
RESUME statement found before error routine entered. Not used.
Expression has operator with no following operand. Program line too long.
Not used.
Window number invalid. Argument out of range.
Command cannot be executed from the editor. Line is too complex.
Not used.
FIELD statement caused overflow. Device number invalid.
File number or filename invalid.
File not found on disk drive specified. File mode is not valid.
You cannot OPEN or KILL a file already open. Undefined error.
Disk input/output error. File exists.
Not used.
Disk is full.
You have reached end-of-file.
The record number in PUT or GET is more than 32767 or zero.
Invalid filename.
Invalid character <character> in program file.
D-l
66
99 1 101 102 103 104 105 1 107 1 8
109 110 111
112-201 202 203 204
205 206 207
8 209 o 1 212 213 4
8
no line number.
from
first item.
ne subroutine cal too deep.
BLOAD f e.
Not used.
Command not owed here.
L number is required.
statement needs a NEXT or WHILE statement needs a WEND.
NEXT statement needs a FOR or WEND statement needs a WHILE.
A comma is expected.
A parenthesis is expected. Option Base must be 0 or 1. Statement end is expected.
Too many arguments your Ii
used.
Cannot redefine variable(s).
Func more than once.
You are trying to jump into a loop. used.
error #X, ease restart.
Program not run.
Too FOR
5 6 10 20 30
60 70 80 90
100 110 120 130 1
1
following tables 1 e on the acters f om
character sets these
I THIS PROGRAM PRINTS A L
OF ALL ST ASCII
2 GOTOXY 1,2:?"LIST P=O:l=O
ST ASCII CHARACTERS":GOTOXY 0,4
IF P 4:
IF 0 14: INPUT "pRESS [Return] TO
CONTINUE •• 0 ,AS
IF 1=10 THEN l=O:GOTOXY 0,4
IF 0 THEN? "10 ";:GOTO 1
IF THEN II "; 1
IF 51
? C,"= IIi P=P+l NEXT C
1
n TO EXIT .•. ",AS
first is set up for 8x16
terse different
differ screen
acter set s resolutions.
. e 0 16 ~2148 ~4 80 ~6 112 128 144 160 176 192 208 224 240'
101 234 5 678 gAB C 0 E F
e
o 0 1 1 2 2
3 3 4 4 5
E-l
6 611
7
9 D
10 A II
11 B
12 C •
13 D •
1 E iii
I
15 F E-2
7 7
8 8
9 9
10 A
11 B
121 C I
13 0
ASSEMBLY
MODULES
The CALL st in ST BAS use of assembly
language modules. To use a e, you must load it into
memo with a BLOAD statement, assign its starti address to
a variable, and CALL it from BASIC (pass any necessary
parameters to it).
Parameters are s from BASIC to Assembler ograms the
f owing manner. machine language module will find two
parameters on the user (A7). The first is a 2-byte integer specifying the number parameters being passed.
(In the example below, it is 3.) The second is a 4-byte pointer to an array that contains the parameters. Each parameter in the array will occupy 8-bytes, regardless of its type. In the case of a string variable, the 8-byte value is a pointer to the str
Before returning to BASIC, the Assembler program can put any parameters it wants to pass to BASIC into a given memory location. Later, the BASIC program can PEEK at these parameters.
Example:
500 DIM A$(8) :1% O:X 2
510 CHART=18566: ISTART ADDRESS OF THE ASSEMBLER
LANGUAGE CODE
530 CALL CHART(I%, A$, X)
F-l
Derived Functions
Secant
Cosecant
Inverse Sine
Inverse Cosine
Inverse Secant
Inverse Cosecant
Inverse Cotangent
Hyperbolic Sine
Hyperbolic Cosine
Hyperbolic Tangent
Hyperbolic Secant
Hyperbolic Cosecant
Hyperbolic Cotangent Inverse Hyperbolic
Sine
Inverse Hyperbolic
Cosine
Inverse Hyperbolic
Tangent
Inverse Hyperbolic
Secant
Inverse Hyperbolic
Cosecant APPENDIX G DERIVED FUNCTIONS
Derived Functions In Terms Of ATARI Functions
DEF FNSEC(X)=l/COS(X) DEF FNCSC{X)=l/SIN{X)
DEF FNARCSIN(X)=ATN(X/SQR(-X*X+l» DEF FNARCCOS(X)=-ATN(X/SQR(-X*X+l)+ CONSTANT
DEF FNARSEC(X)=ATN(SQR(X*X-l»+ (SGN(X-l)*CONSTANT
DEF FNARCCSC(X)=ATN(l/SQR(X*X-l»+ (SGN(X-l}*CONSTANT
DEF FNARCCOT(X)=ATN(X)+CONSTANT DEF FNSINH(X)=(EXP(X)-EXP(X»/2 DEF FNCOSH(X)=(EXP(X)+EXP(-X)/2 DEF FNTANH(X) =-EXP(-X)/(EXP(X) + EXP(-X»*2+1
DEF FNSECH(X)=2/(EXP(X)+EXP(-X»
DEF FNCSCH(X)=2/(EXP(X)-EXP(-X» DEF FNCOTH(X)=EXP(-X)/(EXP(X)EXP (-X» *2+1
DEF FNARCSINH(X)=LOG(X+SQR(X*X+l»
DEF FNARCCOSH(X)+LOG(X+SQR(X*X »
DEF FNARCTANH(X)=LOG«1+X)/(1-X»/2
DEF FNARCSECH(X)=LOG«SQR(-X*X+l)+l)/X)
DEF FNARCCSCH(X)=LOG «SGN(X)*SQR(X*X+l)+l)/X)
G-l
Inverse Hyperbolic Contangent
DEF FNARCCOTH
Note:In this chart, the variable X in
the value or expres on to be ua
function. Any vari e name is permissi represents the number or expresson to be
2
({X+I) I (X-I) )/2
rentheses resents the derived
e as I as it ua
APPENDIX H SAMPLE PROGRAMS
BOXES
An interesting example of the RND statement using color graphics. Run this program in low-resolution mode.
10 FILL BOXES SYMMETRICALLY
20 randomize O:c=O
30 color l,O,l,l,l:fullw 2:clearw 2
40 for x=18 to 284 step 19
50 linef x,O,x,166
60 next x
70 for y=13 to 153 step 14
80 linef 0,y,303,y
90 next y
100 c=c+l:if c=16 then c=l 110 color l,c,l
120 col=int(rnd*16)*19+9:row=int(rnd*12)*14+7 130 fill cOl,row,l
140 if col)151 then cenc=col-l5l:fill col-(cenc*2) ,row,l 150 if col<152 then colh=302-col:fill cOlh,row,l
160 if row)82 then rowh=row-«row-82)*2):fill col,rowh,l 170 if row<83 then rowh=164-row:fill col,rowh,l
180 if col)15l then fill col-(cenc*2) ,rowh,l else fill cOlh,rowh,l
190 goto 100
CIRCLE OF PATTERNS
This program divides a circle into segments and then fillS the segments with patterns. To vary the program, change line 120 to:
1 pellipse x,y,x,y,b,b+lOO
10 • CIRCLE WITH 36 PATTERNED SEGMENTS
20 color 1,O,l,1,1:ful1w 2:clearw 2
30 peek{systab)=l then 60
40 peek (systab) then 70
50 0 80
60 x 06:y=172:s=170:goto 90
70 x=304: 83:s=182:goto 90
80 x 51:y=83:s=
90 a=24: 2:b=0
100 for p=l to a
H-l
110 120 130 140 150 160
GRID
s then
10 20 30 40 50 60 70 80 90 100 110 120 130 140 150 160 170 180 190 200 210
LOW
l,l,p,i x,y,s b,
ion automatically,
ects f
screen r tterns.
PATTERNS 2
8:
4:b 4:b=154:
to step f
x,0,x,345
next x
for to step c
Ii 0,y,615,y
next
:d=51:e=561:f=102:goto 90 8: l:e=561:f=102:goto 90 8:d 5:e=2BO:f=51
b
next x,y
ors.
earw
of
10 O,I,I,l:f lw learw 2
20
30 to 3360 240
4 e,l
50 304, ,b,
60 c=L
70
90 . e=l
.
100 for b=O to 3360 240
110 or 1,e,1
1 lipse 04,83,304,83,b,
0 e=e e=4
140 next b
150 gosub DELAY
0 F . e=l: 4:
.
0 for p=l to a
180 earw 2
1 for x 03 to 609 203
200 color l,e,l, , i
210 linef x,O,x, 0
220 f x-2,2
230 e=e+l:if c=4 then c=l
240 next x,p
2 i=3 then 270
260 2:i :goto 0
0 gosub
280
290 DELAY: for z=l to 3000:next
300 earw 2
310 n MEDIUM
ION
rates
ium-
4
ut
or
ette
10 30 40 50 60 70
80 X=X
90 x>6
100 3 0
110 40
120 ai2:b 4:w=w-4
130 if w<O then
140 30
150 DELAY
160 LINES: x=O: 0 170 while x<61
180 linef 3 ,172,x,y 190 x=x+S
200 wend
210 e 344
220 linef 307,172,x
o 240
2 x>O
260 307,172,x,y
270 x=x-5 280 290
300 ,I ,x,y
310 3 330 3 3 0 360 o
i
l:w=
et r
5
r
i
i
GRAPH
I
epsilon, "E" i
40 IThe formulas cons
end of a ri
50 clearw 2:fullw 2:?
60 ? "'FINAL LUMP SUM PAYMENT::: "i:INPUT R
70 ? "MONTHLY PAYMENT:::: II;: INPUT A
80 ? YeaST IF BOUGHT NOW:::: ";:INPUT C
90 ? "NUMBER OF PAYMENTS:::: ";:INPUT N
100 2:1 .01: .01:K=0
110 ?:PR1NT" THE
120 PRINT II II
130 PRINT 1 PRINT 1 PRINT
Use
10 20
2
is
e f
am to ana
interest rate am uses a form roots.
lIn
am uses calculas with at line 100.
ea
to
RATE
II iN
THEN 0
II n
:::: *I:PRINT
IVE
II
d Lauck
"
1
250
10
50 60 70
100 110 120 130 1 1
on
f
s ? II You enter ? Return 1" n ?"zero.1f ? II Go INPUT II
r
r II
II
ANSWER ::
o r to q
S·?
. .
in$:::::"Y" or
lower II
1
3 • 4: $
t
e
6 0
)l\_ATARr~
©Atari Corp.
AI! Rights Reserved.
Printed in Taiwan C026166 Rev. A K.1. 11. 1985