kounch / vscode_zx

Visual Studio Code Tasks and Scripts for NextBASIC and ZX Basic
GNU General Public License v3.0
15 stars 1 forks source link

fix: #autostart without line num #1

Closed remy closed 4 years ago

remy commented 4 years ago

The autostart was missing when it used the #autostart (no line number) syntax - it should point to the next available line number, otherwise autostart didn't appear to work.

Python isn't my first (or second, or third) language, so I hope this is okay. I've tested it locally and compared to the generated files from the .txt2bas command on the Next (and in cspect) to confirm the bytes are loaded up correctly and this looks to be the right change.

kounch commented 4 years ago

Thanks!

Merged and released v1.0.1 with your fix.

remy commented 4 years ago

I saw the original comments about replication of the issue - were you able to replicate in the end?

In my case, I had #autostart as the first line, then 10 PRINT "X" followed and the autostart was set to 0x8000 still. I was comparing to the binary output from .txt2bas with the same file, and it had set the autostart (in the +3dos header) as 0x0a00 (doing this on my phone, so might not be right with my endian'ness!!!).

My only concern with my change was if your parser could handle empty lines and if there was a blank line after autostart, it would fail?

kounch commented 4 years ago

Yes. At first i didn't understand what the problem was until i did some tests with CSpect.

Regarding the problem you say, it should had been 0x0000, and not 0x8000. 0x8000 is only used when #autostart isn't found.

Empty lines are treated as if they didn't exist (see lines 83-85 of the code -line = line.strip() (...) if line:), so, no, it doesn't fail in that case.