Open TheStruggleForAntiSpaghetti opened 1 month ago
What about another approach? I'd happily integrate SjasmPlus with Klive IDE so you can use your well-known compiler with syntax highlighting and all the bells and whistles! If you'd like to help with it (as I suppose you know SjasmPlus), contact me at dotneteer@hotmail.com.
That sounds marvelous.
I'm not a very skilled dev yet and I don't use the more advanced features that SP has (I've read about some in the SP docs (https://z00m128.github.io/sjasmplus/documentation.html) and in your docs see that you seem to support quite some already).
So I'm afraid I wouldn't know how to help you with that.
I don't know if he's up for it, but perhaps you could better ask Peter Ped Helcmanovsky (aka ped7g) who's the maintainer of SP.
I think sjasmplus integration would be an excellent addition, happy to assist
Guys, this is the information I need to start the integration
Can you point out this relevant information?
@ped7g Could you please shed some light on if this is possible?
It's C++ command line tool, supporting all major modern operating systems (linux, macos, freeBSD, netBSD, ...). It should be even possible to port it to wasm, but I'm not familiar with web technologies myself to try. Build instructions: https://github.com/z00m128/sjasmplus/blob/master/INSTALL.md
But I'm not sure what "platform independent CLI version" means for you.
CLI command interface: https://z00m128.github.io/sjasmplus/documentation.html#s_cli
Again I'm not sure what you are looking for, but I think for emulator integration it may be a bit tricky that for some ZX targets you don't specify output on CLI but in the source code (like savenex
command to save NEX file for ZX Next or savesna
for ZX48/128 snapshots). In such case you either have to depend on user doing the right thing (maybe helping to direct them with good starting source template containing required items), or faking it by prepending/appending pieces of source around user src, which could work for trivial cases but will get into way for power users.
https://z00m128.github.io/sjasmplus/documentation.html is also ... "syntax reference", there's lot of it, basics:
source lines must follow precise segmenting, symbols (labels) must start at beginning of line (no indentation enabled), instructions and macros must be indented with whitespace, comment rest of line by ;
can start anywhere.
There are several CLI switches to adjust this and that about the syntax (like enabling macros/directives at beginning of line), so it would be ideal if integration allowed power users to adjust exact syntax, but also I wouldn't mind if you did drive beginner users by using some default like --syntax=abf
(my recommended setting for new projects).
Thanks for your answer! I want to invoke the SjasmPlus compiler, pass it to the primary source code file, and retrieve the machine code result (with some debug information). Then, I will inject this binary code and the debug info into the emulator to provide the source code debugging functionality.
In short, the integration means I just run the SjasmPlus CLI.
@TheStruggleForAntiSpaghetti , I'm about to start SjasmPlus integration in a few days. It means these main tasks:
Can you send me a few typical CLI prompts you often use when compiling programs for the ZX Spectrum 48K/128K? Perhaps some small example projects I can use to test the integration?
Yay! The z80asm plugin abstracts the start of SP with batch files. It basically just does
{SP folder}\sjasmplus.exe %1 where %1 is the path+filename of the current file opened in SublimeText.
I can set you up with a project you can use to test tomorrow.
Sounds great! I cannot promise the integration will be done in a few days... But soon I'll start working on it!
Debug info extraction/source code debugging integration
The SLD file should provide detailed info for every emitted machine code byte where it comes from source-wise, DeZog debugger is using these to provide source level debug.
Some other debuggers attempt to read only labels table (often from listing file), or even parse the listing files fully.
I was hoping to provide some simpler example to get this going, but currently too busy with life, no ZX dev time.
I'm still not sure about "retrieve the machine code result", if you are ready to retrieve different sort of outputs (sna/nex/tap files) or you want only raw machine code byte stream output and directives like savesna
will just create snapshot file in storage, but kliveide will ignore it? Do you have idea how far you want to go with this, and if there's some preferred early-step way to just get this going?
I'm now writing my source in SjasmPlus syntax. I'd like to try out Klive as my main development environment but my concern is:
I have to convert my sources from SP syntax to Klive's. Seeing the features that you've already built, and the fact that I'm not using the more advanced SP features, I can invest that effort. My concern however that if I get stuck somewhere when trying to use Klive for this, for whatever reason, I need to convert it all back again.
A function that does this would be most helpful and could also lower the threshold for others.