Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please do not abort (solved)
#1
Help! This program resets the computer.

What am I doing wrong?
Can the compiler be fixed?

Code:
11 DIM start1 AS LONG = 16384 12 DIM start2 AS LONG = start1+8*8*32 18 DIM p(192) AS LONG 36 GO SUB 300 40 STOP 200 REM test index y 220 LET y=1 230 POKE p(y+1)+1,255 295 RETURN 300 REM generate plain 310 GO SUB 500 390 RETURN 500 REM init index y 510 DIM addr AS LONG = start1 520 DIM ix AS LONG = 191 530 REM --- ciclo1 --- 540 LET p(ix+1)=addr 550 LET addr=addr+32 580 IF addr<start2 THEN GO TO 530 790 RETURN
Reply
#2
It seems you might have a bug writing beyond the array boundaries.
Can you compile with --debug-array to check if this is the case?
If the program stops with the error "Subscript out of range", then bug should be in line 540.

Try this and tell me.  Rolleyes
Reply
#3
--debug-array will not change anything.

I changed this line.
"18 DIM p(200) AS LONG"

But still resets the emulator.

The problem disappears when removing some unused lines - so, I think it's a compiler bug.
Reply
#4
(2023-02-03, 04:38 PM)zarsoft Wrote: --debug-array will not change anything.

I changed this line.
"18 DIM p(200) AS LONG"

But still resets the emulator.

The problem disappears when removing some unused lines - so, I think it's a compiler bug.

I have tested your first example and it runs ok in my emulator (Fuse). See the screenshot attached:
[Image: attachment.php?aid=320]

What compiler version do you have?
Try this one:
http://www.boriel.com/files/zxb/zxbasic-...a10.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...beta10.zip
http://www.boriel.com/files/zxb/zxbasic-...-win32.zip
http://www.boriel.com/files/zxb/zxbasic-...x64.tar.gz
http://www.boriel.com/files/zxb/zxbasic-...cos.tar.gz


Attached Files
.png   screensot-2023-02-04_13.17.28.png (Size: 33.9 KB / Downloads: 961)
Reply
#5
Works fine on that compiler version.
Thanks.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)