Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

I have proved an old program from the ZX Spectrum Basic to Boriel's Basic.
Some 700 lines of code.
The program can compile now and it is running on a Spectrum emulator.

However I get an error "3 Subscript wrong, 30:1"
wich is a very generic error coming from the "RANDOMIZE USR 32768".

Is there any way to tell where the error occurred in my source file?

Here is what I used for compilation:
python3 -taB program.bas --array-base 1 --string-base 1 --debug-array --debug-memory
Unfortunately, it's hard to debug that.
It basically means that yes, you're having an out of bound array access.
I will add more debug capabilities soon.

An old way to debug this is to execute a PRINT <line number> after each array access, to locate the line more easily.

PS: Try compiling with --enable-break flag. This will update the line number, and probably you'll get a more accurate position
Note that the line number reported in the error won't be the BASIC one (i.e. '1000') but the actual line in your text .bas source code.
Hmm, I used the "--enable-break" and something strange happened:
The error is gone now.

Ok, lets see how far I come...
But if you remove the chkbreak the error happens again :?: Confusedhock:
I can't reproduce that. Now I experience something slightly different.

Seems that input is not working anymore if I enable --enable-break.

The program does load but doesn't react on input anymore:
- Executing task: python3 -taB program.bas --array-base 1 --string-base 1 --debug-memory --enable-break
- Executing task: python3 -taB program.bas --array-base 1 --string-base 1 --debug-array --enable-break <
- Executing task: python3 -taB program.bas --array-base 1 --string-base 1 --enable-break <

The program loads and seems to work correctly (with input):
- Executing task: python3 -taB program.bas --array-base 1 --string-base 1

The program load, I can input something then "3 Subscript wrong, 30:0" error:
- Executing task: python3 -taB program.bas --array-base 1 --string-base 1 --debug-array

Most probably this is also important:
I am using the
#include <input.bas>
in the first line of my program.
Which compiler version are you using?
zxb 1.9.2
Not sure if this was solved in later versions??

Forum Jump:

Users browsing this thread: 1 Guest(s)