remy / txt2bas

ZX Spectrum BASIC conversion tooling (specific support for NextBASIC)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

VSCode plugin generates errors for SPRITE OVER statements

paulossilva opened this issue Β· comments

Using the NextBASIC VSCode plugin, errors in BASIC are reported by the interpreter when a SPRITE OVER statement is assigned to an integer variable AND its second parameter is greater than 32.

How to reproduce this error:

  1. Run the following code from the plugin:
#program test
#autoline 1,1
#autostart

PROC test()
STOP
DEFPROC test()
local %a 
LET %a=% SPRITE OVER (0,35,1,1)
IF %a=0 THEN PRINT "0": ELSE PRINT "1"
PAUSE 0
ENDPROC

  1. Run it on CSpect (you can also try to run it on a real machine)
  2. The emulator will show Next's start menu
  3. Select NextBASIC
  4. Type RUN
  5. An error will appear (it depends on the value of the second parameter passed to SPRITE OVER)
  6. Make any simple edit on LINE 5
  7. Run the program again
  8. Now it runs fine!

It seems the plugin is generating some bad token for line 5 as editing it in the native editor makes the error to go away.

I have tried this in CSpect V.2.12.30 and on a real machine both running ZXNextOS 2.06K and got the exact same result.

Yet, values lower or equal to 32 seem to not cause this behaviour. I have also tested this using a range for the second parameter, like 1 TO 50.

Finally, I have moved the text file to the real machine and used the native .txt2bas, which resulted in a flawlessly running code.

Definitely sounds like an encoding error in my txt2bas. I'll try to get it fixed this morning and push a release.

Thank you for a great example of how to replicate πŸ‘

πŸŽ‰ This issue has been resolved in version 1.12.10 πŸŽ‰

The release is available on:

Your semantic-release bot πŸ“¦πŸš€

That's been fixed and the update to the vscode plugin is being published - it should be live in the next few minutes or so. Thanks again.