Atari ST BASIC Sourcebook Part4
Transcript of Atari ST BASIC Sourcebook Part4
-
8/6/2019 Atari ST BASIC Sourcebook Part4
1/24
WRITEi WRITE il,X,Y,A$
Syn ta x: WRITE t[
-
8/6/2019 Atari ST BASIC Sourcebook Part4
2/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
3/24
Number
APPENDIX DERROR MESSAGES
Message2345678
9
1011
121314151617181920212223
24-29
30313233
34-49505152535455565758
59-60616263
6465
Something is wrong.RETURN statement needs matching GOSUB.READ statement ran out of data.Function call not al lowed.Number too large.Not enough memory.A statement or a command refers to an onexis tent 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.Undefine d erro r.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.Undef in ed e rr or.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.Undef in ed e rr or.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 than32767 or zero.I nv al id f il en ame.Invalid character in program file.
D-l
-
8/6/2019 Atari ST BASIC Sourcebook Part4
4/24
66
991101102103
1041051
1071 8
109110111
112-201202203204
205
206207
8209
o1
212213
4
8no line number.
fromfirst 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 statementneeds 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
-
8/6/2019 Atari ST BASIC Sourcebook Part4
5/24
5
6102030
60
708090
10011012013011
following tables1 e on theacters f om
character setsthese
I THIS PROGRAM PRINTS A L OF ALL ST ASCII
2GOTOXY 1,2:?"LISTP=O:l=O
ST ASCII CHARACTERS":GOTOXY 0,4
IF P 4 :IF 0 14: INPUT "pRESS [Return] TOCONTINUE 0 ,ASIF 1=10 THEN l=O:GOTOXY 0,4IF 0 THEN? "10 ";:GOTO 1IF THEN II "; 1IF 51? C,"= IIiP=P+lNEXT C
1 n TO EXIT .. ",AS
first is set up for 8x16terse different
differ screencter set sresolutions.
. e 0 16 ~2148 ~4 80 ~6112 128 144 160 176 192 208 224 240'
101 234 5 678 gAB C 0 E Fe
o 0
1 1
2 2
3 3
4 4
5
E-l
-
8/6/2019 Atari ST BASIC Sourcebook Part4
6/24
6 6 1 1
7
9 D10 A II11 B
12 C 13 D 1 E iii
I15 F
E-2
-
8/6/2019 Atari ST BASIC Sourcebook Part4
7/24
7 7
8 8
9 9
10 A
11 B
121 C I
13 0
-
8/6/2019 Atari ST BASIC Sourcebook Part4
8/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
9/24
ASSEMBLY MODULES
The CALL st in ST BAS use of assemblylanguage modules. To use a e, you must load it intomemo with a BLOAD statement, assign its starti address toa variable, and CALL it from BASIC (pass any necessaryparameters to it).
Parameters are s from BASIC to Assembler ograms thef owing manner. machine language module will find twoparameters on the user (A7). The first is a 2-byteinteger specifying the number parameters being passed.(In the example below, it is 3.) The second is a 4-bytepointer to an array that contains the parameters. Eachparameter in the array will occupy 8-bytes, regardless of itstype. In the case of a string variable, the 8-byte value isa pointer to the str
Before returning to BASIC, the Assembler program can put anyparameters it wants to pass to BASIC into a given memorylocation. Later, the BASIC program can PEEK at theseparameters.
Example:
500 DIM A$(8) :1% O:X 2510 CHART=18566: ISTART ADDRESS OF THE ASSEMBLERLANGUAGE CODE530 CALL CHART(I%, A$, X)
F-l
-
8/6/2019 Atari ST BASIC Sourcebook Part4
10/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
11/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
12/24
Inverse HyperbolicContangent
DEF FNARCCOTH
Note:In this chart, the variable X inthe value or expres on to be uafunction. Any vari e name is permissirepresents the number or expresson to be
2
({X+I) I (X-I) )/2
rentheses resentsthe derived
e as I as itua
-
8/6/2019 Atari ST BASIC Sourcebook Part4
13/24
APPENDIX HSAMPLE PROGRAMS
BOXES
An interesting example of the RND statement using colorgraphics. Run this program in low-resolution mode.
10 FILL BOXES SYMMETRICALLY20 randomize O:c=O30 color l,O,l,l,l:fullw 2:clearw 240 for x=18 to 284 step 1950 linef x,O,x,16660 next x70 for y=13 to 153 step 1480 linef 0,y,303,y
90 next y100 c=c+l:if c=16 then c=l110 color l,c,l120 col=int(rnd*16)*19+9:row=int(rnd*12)*14+7130 fill cOl,row,l140 if col)151 then cenc=col-l5l:fill col-(cenc*2) ,row,l150 if col
-
8/6/2019 Atari ST BASIC Sourcebook Part4
14/24
110120130140150160
GRID
s
then
1020304050
60708090100110120130140150160170180
190200210
LOW
l,l,p,ix,y,s b,
ion automatically,ctsf
screen rtterns.
PATTERNS2
8:4:b4:b=154:
to step fx,0,x,345
next xfor to step cIi 0,y,615,ynext
:d=51:e=561:f=102:goto 908: l:e=561:f=102:goto 908:d 5:e=2BO:f=51
b
next x,y
ors.
earw
-
8/6/2019 Atari ST BASIC Sourcebook Part4
15/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
16/24
of
10 O,I,I,l:f lw learw 22030 to 3360 2404 e,l50 304, ,b,60 c=L70
90 . e=l100 for b=O to 3360 240110 or 1,e,11 lipse 04,83,304,83,b,
0 e=e e=4140 next b150 gosub DELAY
0 F . e=l: 4:0 for p=l to a
180 earw 21 for x 03 to 609 203200 color l , e , l , ,i210 linef x,O,x, 0220 f x-2,2230 e=e+l:if c=4 then c=l240 next x,p2 i=3 then 270
260 2:i :goto 00 gosub280290 DELAY: for z=l to 3000:next300 earw 2310 n
MEDIUM ION
rates ium-
4
ut or ette
-
8/6/2019 Atari ST BASIC Sourcebook Part4
17/24
10
304050607080 X=X90 x>6100 3 0110 40120 ai2:b 4:w=w-4130 if w
-
8/6/2019 Atari ST BASIC Sourcebook Part4
18/24
i
GRAPH
I
-
8/6/2019 Atari ST BASIC Sourcebook Part4
19/24
epsilon, "E" i40 IThe formulas consend of a ri50 clearw 2:ful lw 2:?60 ? " 'FINAL LUMP SUM PAYMENT::: "i:INPUT R70 ? "MONTHLY PAYMENT:: ::II;: INPUT A80 ? YeaST IF BOUGHT NOW:::: "; :INPUTC90 ? "NUMBER OF PAYMENTS::: : "; :INPUT N100 2:1 .01: .01:K=0110 ?:PR1NT" THE120 PRINT II II130 PRINT1 PRINT1 PRINT
Use
1020
2
is e fm to ana
interest ra team uses a form
roots.lIn am uses calculas with
at line 100.ea to
RATE
II iN
THEN 0II n
:: ::I: PRINT IVE
II
d Lauck
"
1
-
8/6/2019 Atari ST BASIC Sourcebook Part4
20/24
250
10
506070
10011012013011
o n f
s
? II Y o u e n t e r? R e t u r n1" n? " z e r o . 1 f? II GoINPUT II
r
r II
II
ANSWER : :
o
r t o qS ? . . i n $ : : : : : " Y "o r
l o w e r II1
-
8/6/2019 Atari ST BASIC Sourcebook Part4
21/24
3
4 : $
t e
6 0
-
8/6/2019 Atari ST BASIC Sourcebook Part4
22/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
23/24
-
8/6/2019 Atari ST BASIC Sourcebook Part4
24/24
) l \ _ATAR r~
Atari Corp.AI! Rights Reserved.
Printed in TaiwanC026166 Rev. AK.1. 11. 1985