BASIC Programs
David R. Lane (77) 766 posts |
My Son is trying to get a BASIC program that I have written, and runs fine on my ARMX6, to run on his Apple computer or Linux computer. But it fails to run with the error “Bad subscript Error in line 74”. However, as he says, there is no line 74 anyway. Also, there are no arrays in the program. He is using the Chipmunk Basic interpreter which, according to its home page, “runs on multiple OS platforms”. For the home page click on ChipmunkBasic . The program is around 50 lines long. Could the “line 74” be due to differing line feed conventions? |
Stuart Swales (8827) 1357 posts |
Looks like they use |
Paul Sprangers (346) 525 posts |
I always have to multiply the error line by 10 to get to the culprit. You might therefore try line 740. |
David J. Ruck (33) 1636 posts |
You may remember from the 1980’s that different computer’s BASIC are not compatible for anything other than the most trivial program, nothing has changed. |
David R. Lane (77) 766 posts |
My post said:
So, should I be looking at line 7.4?! Thanks for replies. |
André Timmermans (100) 655 posts |
Line 74 of a 50 lines program? Does the program use libraries because then the error line number might refer to a line number from one of those libraries. |
Steve Fryatt (216) 2105 posts |
I assume David is confusing logical and physical line numbers. The program is 50 lines long, but that doesn’t mean that BASIC numbers the lines 1 to 50. They could be 10 to 500, or anything else: there’s no requirement for the numbers to be evenly spaced. So it could even be something like 10, 20, 30, 40, 50, 55, 60, 65, 70, 71, 73, 74, 75, 80, … I’ve no idea about Chipmunk Basic, but BBC BASIC will report logical line numbers in errors, so you would get “74” reported above even though it’s the 12th line in the listing. |
Dave Higton (1515) 3534 posts |
Are you trying to get the tokenised BASIC file (filetype &FFB) straight in there? That isn’t going to work. Pretty much the only way to get it in to the other machine is to type it in from reading the RISC OS machine’s screen. |
David R. Lane (77) 766 posts |
No. It uses the tangent, square root and arcsine functions which, in our BBC BASIC, are TAN, SQR and ASN. Steve, I am not the one getting any errors, it is my Son on his Apple, or possibly a Linux computer, who is seeing the error around 400 miles away. I have no idea whether line 74 is a logical line number, or a physical line number. Perhaps a good error checker should give the line number that corresponds to what the programmer can see on the screen? |
David R. Lane (77) 766 posts |
No. I have saved out a plain text version of the program – it’s just a text file (filetype &FFF). |
Dave Higton (1515) 3534 posts |
When the programme is listed on the target machine, does it resemble the original? |
Stuart Swales (8827) 1357 posts |
If it’s been supplied as plain text without line numbers, it might be best to explicitly renumber on the remote system so you can see what the error line corresponds to. |
David R. Lane (77) 766 posts |
Stuart, thanks for that suggestion, I will pass it on. I had sent two plain text versions, one with line numbers and one withouit. Dave, I’ll find out. |
David Pitt (9872) 363 posts |
Chipmunk is a very “not BBC” BASIC, it is BASIC as was, or as A plain text copy of a BASIC proglet from the Titanium, without line numbers, did load into Chipmunk. There were errors aplenty but “list” in Chipmunk did show the line numbers which started with 2 and incremented by 2. The proglet, after the BBC BASIC bits were translated to "ordinary’ BASIC, did run. P.S. |