Closed NealeTools closed 2 weeks ago
Repro3: 1000 PRINT "THIS IS A TEST" 1001 PRINT "THIS IS A TESTa" 1002 PRINT "THIS IS A TESTb" 1004 PRINT "THIS IS A TESTc"
The export fails after line 1002. (The fourth line does not get encoded, but I think the data is still in the final file in a binary form.)
Just starting to look at this. I'm suspecting there's an encoding issue with the bank support, only because I can see the four line in the actual binary, but when I try to dump it back out, it's missing:
@NealeTools can you remind me how to test this on the spectrum (my basic is rusty already!)
To test the bank output, type: LOAD "MyBankedCode" BANK 20 BANK 20 MERGE The latter command can only be typed in, not part of a program.
Alternatively, I think you could have a test program with: 10 LOAD "MyBankedCode" BANK 20 20 BANK 20 LIST
I see it working (though I'll try your version now) - but my guess is that it still looses the last line in the import in VS Code.
Is it the Next that's the issue or VS Code?
(fixed screenshot - wrong image went up)
Might be my export process was different too - I'll check that.
Hmmm...Let me double-check my end. I was suffering errors, and then, to troubleshoot, just using your online bas2txt converter to check the output. Now I am wondering if there wasn't a problem...and it was something independent!
I was exporting using the built-in exporter (Command+Shift+E) (or RunInCSpect), with the following #syntax at the top of the txt file:
Which should, I thought, automatically generate a banked section as a separate file. That's the one that I've been looking at/testing.
Okay, I'll try using the #bankfile X
directive. See if that's different.
I just tried (not using the bankfile directive): But using Export To bnk function from the palette. The last line is missing, but perhaps that is just an import problem online?
Yeah, import is definitely not right. So that's one bug, I want to make sure the source is actually correct for the Next though (I'm just testing too)
Okay, the actual file is correct from my testing:
#program 65-test
10 PRINT "hello world."
20 LOAD "65-test.bnk" BANK 15
30 BANK 15 LIST
#bankfile 65-test.bnk
1000 PRINT "THIS IS A TEST"
1001 PRINT "THIS IS A TESTa"
1002 PRINT "THIS IS A TESTb"
1004 PRINT "THIS IS A TESTc"
Export to binary.bas, then push files to SD card. Then run 65-test.bas
:
I'll fix the import
Progress: There is a spurious character before line40:
@NealeTools strongly recommend hexfiend when looking at bytecode - excellent tool.
Definitely an extra opening bracket:
Not sure what that is (atm) - but import is definitely dropping the last line. I can see the parser now failing.
Do you want to share both the plain text version of the source to the bank that made that file and the MyBankedProc01
file here?
I'm intrigued why your export looks OK? Here they are: Note: I added the .txt suffix to permit upload.
This is the starting .txt file ExportTest.txt
This is the export of the whole thing: Test4.bas.txt
This is the split part: MyBankedProc01.txt
Finally, this is the Export as BAS version: ExportAsBas.bas.txt
lol, the bracket you were seeing was line 40
.
I've got the fix for it clipping the last line (pretty sure all files should have been affected… or maybe it was a fluke that it wasn't).
I'll have to also get the web site synced because I know people do use that as a test, but it's released to in a totally different way.
Just writing tests now to confirm fix (though the fix has thrown up something new already covered by the tests - which is a good thing)
So the export is OK? It could be another thing failing then (in the actual code). I may have jumped to a conclusion when I saw the output of the online txt2bas looking truncated. Apologies if that was the case! I'm actually finding that I'm getting a lot of bugs in BANKed code (even when banked by ZXOS itself) where it was fine when running in unbanked code.
Right, worked out how it was never caught, it only affected bank importing (where the type=3
, otherwise the logic was correct for type=1
= program).
Fix is going into txt2bas now. I'll roll out to vscode shortly.
Ah yes - the import into VSCode also looked truncated - so that's what confirmed to me it was broken (when it wasn't?)
Okay, all updated, including web site (though make sure you've got Version: 2024-07-09 18:55
in the bottom right - if not, hit reload and it should clear the service worker cache).
Just checking: Is/was the export OK?
Website import works! :-) (Although format of lines >999) is a bit squiffy:
Local import in VSCode also working now! :-)
Fantastic! Just need to figure out where the actual bug is now (I think it is in ZXOS itself...)
lol, the bracket you were seeing was line
40
.I've got the fix for it clipping the last line (pretty sure all files should have been affected… or maybe it was a fluke that it wasn't).
I'll have to also get the web site synced because I know people do use that as a test, but it's released to in a totally different way.
Q: Where did you get the ZX +3DOS plugin for hexfiend? I can't find it on Github link. 👍
I wrote it, it's this:
little_endian
set checksum 0
requires 0 "504C 5553 3344 4F53"
ascii 8 "signature"
requires 8 "1A 01 00" ;# eof, issue + version
uint8 "soft-eof"
uint8 "issue"
uint8 "version"
uint32 "length incl. header"
section "+3 BASIC Header" {
uint8 "fileType"
uint16 "program length"
uint16 "autostart"
uint16 "var offset"
uint8 "unused"
}
bytes 104 "reserved"
uint8 "checksum"
Thanks @remy ! I'm loving using the new #bankfile directive. It makes splitting code between banks entirely trivial. Such a good workflow. :-) Alongside CSpect, I'm using ExportToBas for saving and syncing (via NextSync),to push code/banks directly to the Next for testing without any manual copying. 🥇
Repro1: 9000 DEFPROC Init(): RUN AT %3: BORDER %0: PAPER %0: BRIGHT %1: INK %7: CLS: PALETTE OVER %0: LAYER %2,%0: LAYER %0: SPRITE CLEAR: SPRITE BORDER %1 9001 PROC LoadFont(): PRINT "LOADING METEOR X V 63 A COPC": PROC LoadPal()
Export to bank fails after the first line. I tried trimming, but cannot spot a pattern. However:
Repro2: (trimmed first few commands) 9000 PALETTE OVER %0: LAYER %2,%0: LAYER %0: SPRITE CLEAR: SPRITE BORDER %1 9001 PROC LoadFont(): PRINT "LOADING METEOR X V 63 A COPC": PROC LoadPal()
Both lines exports fine.
Note: The code above (and the encoding) works fine for RunInCSpect and regular export to .bas file. It is only not workign when I've tried to split or directly export these (and subsequent) lines into a banked section.