agon-bbc-basic icon indicating copy to clipboard operation
agon-bbc-basic copied to clipboard

No such variable at line ...

Open tonedef71 opened this issue 2 years ago • 8 comments

Load and run the example .BAS file. The message No such variable at line 50010 will be displayed.

I'm not sure what is going wrong. Perhaps Agon BBC Basic gets confused when READing DATA within a REPEAT/UNTIL within a procedure after a READ of data was previously performed from a different procedure.

tonedef71 avatar Apr 10 '23 22:04 tonedef71

This all seems to work quite well in a distilled example, so looks like something in the code is either causing issues with BBC BASIC for Z80 core, or my extensions are somehow causing issues.

Testing:

  • Test the code works in BBC BASIC for Z80 on CP/M
  • If that works, then it is a quirk of the code I'm missing.

breakintoprogram avatar Apr 13 '23 18:04 breakintoprogram

The READ command seems to cause issues in the REPEAT/UNTIL. I will have to check this against the original CP/M version to determine whether this is a quirk of the original code or something that's broke since.

If it is a lingering defect in the original CP/M version and you are able to reliably fix it without breaking compatibility with existing software, you will be a hero. I believe something similar occurred during the realization of MEGA65 BASIC.

tonedef71 avatar Apr 13 '23 18:04 tonedef71

@breakintoprogram Another AgonLight customer informed me that the error goes away when you remove the REM statements from the end of the DATA statements. I confirmed that this is true. So it would appear that the issue may be somehow tied to additional BASIC commands being part of a DATA statement when the DATA is being READ in such a manner as it is in this program.

tonedef71 avatar Apr 14 '23 15:04 tonedef71

Thanks - sorry it's taken me so long to get back on this. I'll keep this card open so I can further investigate as I test the agon-bbc-basic-adl.

breakintoprogram avatar Aug 13 '23 22:08 breakintoprogram

Thanks @breakintoprogram. Question: Is Agon BBC Basic ADL ready for testing, and is it supposed to be backwards compatible with the original Agon BBC Basic? If so, the BIN I have of it does not appear to work with any of the BBC BASIC games I have developed which run on the original Agon BBC Basic.

tonedef71 avatar Aug 14 '23 00:08 tonedef71

Hi @tonedef71 no it is not ready for testing, there is (at time of writing) one outstanding issue with a stack imbalance. Yes it should be backwards compatible.

breakintoprogram avatar Nov 15 '23 18:11 breakintoprogram

Hi @tonedef71 just an update to say that agon-bbc-basic-adl is now released and can be found here.

breakintoprogram avatar Nov 24 '23 21:11 breakintoprogram

Hi @breakintoprogram.

I am attaching a shorter BASIC program to use for investigating this issue: NoSuchVariable.zip

  100 MODE 12:CLEAR:COLOUR 128:COLOUR 7:CLS
  110 PROC_REDEFINE_CHARS
  120 PRINT CHR$(130)
  130 END
  140 DEF PROC_REDEFINE_CHARS
  150 LOCAL A%, I%, N%
  160 N% = 0
  170 REPEAT
  180   READ A%:IF A% <> -1 THEN VDU 23, A%:FOR I% = 1 TO 8:READ A%:VDU A%:NEXT I%:N% = N% + 1:PRINT N%
  190 UNTIL A% = -1
  200 ENDPROC
  210 REM THE :REM AT THE END OF A DATA LINE SEEMS TO BE WHAT IS RESPONSIBLE FOR THE ERROR
  220 DATA 130,000,024,024,000,000,024,024,000: REM CHARACTER 130
  230 DATA -1

By the way, I noticed that if the DATA line with the REM statement simply ends with a colon character (i.e. remove the remaining REM statement), then a "Syntax error at line 180" error message occurs instead (for the line with the READ statement).

tonedef71 avatar Nov 25 '23 07:11 tonedef71