remy / zx-tools

A collection of ZX web based tools and libraries
https://zx.remysharp.com
41 stars 3 forks source link

vs code extension - next basic 2.08 update #72

Closed speccynut closed 5 months ago

speccynut commented 1 year ago

Remy - as per chat on messenger - heres the post by Kevin Reilly from the next basic group. I'm sure its just caused by the missing updated from 2.07 to 2.08.

I wasn't sure whether to post this here or in the main Next group because it relates to NextBASIC but may be a bug in an external utility (Remy's VS Code extension). But Remy was good enough to respond here to another of my queries a couple of years ago so I'm going to take a punt. If it's off-topic in here let me know and I'll delete/repost it elsewhere. These are the simplest steps to reproduce the issue: Create a new VS Code project using the NextBASIC format and enter the following program:

10 %a=1 20 PRINT (%a)+1

(I know you wouldn't normally use parentheses here but this started as a much more complex statement and the parentheses are essential for triggering the bug.) Export using the export to binary .bas function and save it to an SD card. Put the SD card into a freshly rebooted Next, then load and run the program. The program should produce the result "2" but instead produces "1" followed by an N Statement Lost, 20:1 error. You can experiment with other variable names, maths functions and constants from within the VS Code editor and the results are broadly similar when exported. Here's where it gets really odd. Use the native NextBASIC editor to do anything to line 20 that results in an editor update (the easiest thing is to add and delete a superfluous character, or change the line number). Once the line has been refreshed, run the program again. This time the output is "2" as expected. My gut feeling is that the export function is exporting the ASCII character for the number "1" on line 20 but not exporting the encoded format that normally follows it. I suspect this because at one point I had a TAB statement after the PRINT and the calculation seemed to be using the value from the TAB rather than the constant. Having said that, the program was more complex at that point so there could have been other factors at play. If I knew with 100% certainty that the issue was with the VS Code extension I'd drop a bug report straight onto the Git page, but I need confirmation first. Before I do anything more, can someone please try this out and see if you can reproduce it? I've simplified it as much as possible to hopefully eliminate any variables specific to my setup but as with all things tech, it's possible I've missed something obvious. Even a report of non-reproducibility would help at this point, because I can start looking for that obvious something.

Firmware 1.44, Core 3.02.00, NextZXOS 2.08. VS Code 1.18.1, Extension 1.8.5

remy commented 1 year ago

Sod, I started reply but obviously never hit send (or I replied to something else random!).

Just to say that I've got this kind of use case already working locally, but it's the new if logic that is more work.

What I really need is a lot of samples of code for snippets that use new syntax, then I can create tests around them and fix as I go along.

FWIW, this is my local dev running new code:

echo "10 %a=1
20 PRINT (%a)+1" | node -r esm cli/txt2bas.js| node -r esm cli/bas2txt.js
10 %a=1
20 PRINT (%a)+1

Basically eating it from text to binary and back again correctly.

What I'll try to find time to do either today or tomorrow is release the code as it is, so we get past initial blockers and then keep working on the new if logic.

speccynut commented 1 year ago

Thanks Remy,

Do yiou want me to add a post on the fb group (or do you want to) explaining what you need? I'm not using 2.08 yet so don’t have any examples I'm afraid but I'm pretty sure the others in the grouop can assist.

Let me know

Adrian

From: Remy Sharp @.> Sent: 24 August 2023 11:31 To: remy/zx-tools @.> Cc: sinclair photography @.>; Author @.> Subject: Re: [remy/zx-tools] vs code extension - next basic 2.08 update (Issue #72)

Sod, I started reply but obviously never hit send (or I replied to something else random!).

Just to say that I've got this kind of use case already working locally, but it's the new if logic that is more work.

What I really need is a lot of samples of code for snippets that use new syntax, then I can create tests around them and fix as I go along.

FWIW, this is my local dev running new code:

echo "10 %a=1

20 PRINT (%a)+1" | node -r esm cli/txt2bas.js| node -r esm cli/bas2txt.js

10 %a=1

20 PRINT (%a)+1

Basically eating it from text to binary and back again correctly.

What I'll try to find time to do either today or tomorrow is release the code as it is, so we get past initial blockers and then keep working on the new if logic.

— Reply to this email directly, view it on GitHubhttps://github.com/remy/zx-tools/issues/72#issuecomment-1691426468, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ARIQG2SPYERA4MJRNU7B2NDXW4UOLANCNFSM6AAAAAA3Z4OI24. You are receiving this because you authored the thread.Message ID: @.**@.>>

remy commented 1 year ago

So this particular example is now working in the latest VS Code release, but the new if statement parsing logic (i.e. if you leave off the endif) isn't there yet. I'll leave this issue open until it's fixed.

remy commented 5 months ago

A little (lot) late, but you should find that the VSCode extension is now supporting 2.08+ and I'm in the process of adding the update to the zx.remysharp tools too (should be live this week)