First time posting here, I'm getting a few errors in an old 1977 BASIC program for the Sol 20 computer.
First error is a "DM error in line 4240":
4220 PRINT " TYPE IN -STOP- TO QUIT ANYTIME"
4230 PRINT
4240 DIM A$(30),B$(30),C$(45),D$(30),E$(30),L$(10),Z$(12)
4250 LET A$="NO SUCH ELEVATION IN MY TAPES, UNDER 360, PLEASE."
4260 PRINT " THE TANK IS ";E;" FEET AWAY."
If I remove the "B$(30)" from line 4240 then the program runs further but I get a "BS error in line 4590" below:
4560 IF I<=0 THEN 5250
4570 IF S=0 OR Z=3 THEN 4590
4580 LET S=-S
4590 LET D=(2*X**3*SIN(2*W)*COS(.5*W)/G*4)
4600 LET D=INT(D/15-(3*S-7))
4610 PRINT
4620 PRINT " ";D;" FEET"
If I remove one "*" after the "X" then the program runs but the range is far too low. Anyone that's familiar with BASIC might be able to see a fault or make a few suggestions.
First error is a "DM error in line 4240"
The manual states that this is an attempt to dimension an array more than once. Look for an earlier DIM
statement.
To find out which array triggers the error, write the line as:
4240 DIM A$(30)
4241 DIM B$(30)
4242 DIM C$(45)
4243 DIM D$(30)
4244 DIM E$(30)
4245 DIM L$(10)
4246 DIM Z$(12)
If I remove one "*" after the "X" then the program runs but the range is far too low
Two asterisks in a row mean exponentiation, so simply removing one asterisk in this expression (2*X**3*SIN(2*W)*COS(.5*W)/G*4)
is not equivalent. Use (2*X*X*X*SIN(2*W)*COS(.5*W)/G*4)
instead.
From your comment:
4050 DATA "DEGREE OF ANGLE",0,0,5,20000,15,5.7,100,50
4060 READ B$,R,Q,T,E,F,G,H,I
4065 LET N$="N"
This is where B$ is defined
and from this excerpt of another manual:
A string variable can contain one to ten characters unless its maximum size has been declared as a value larger than 10 in a
DIM
statement.
it is clear that your program is already using the B$ string variable with its default dimension of 10, before your DIM B$(30)
statement tries to declare the maximum size of the string variable. This is not permitted.
For a definitive answer one would need to see the whole program, but precausiously I'd say that simply moving the DIM B$(30)
statement to the very first lines (that get executed) of your program could solve this.
Look for these relevant parts in the manual:
DIM variable(dimensionl, dimension2, ...)
Defines a multi-dimensional numerical array with the number of dimensions specified. C5-17
DIM stringvariable(size)
Declares the number of characters that can be contained in the specified string variable. C5-11