andrivet / ZX81-Debugger

A debugger for ZX81 assembly programs. Edit, compile and debug your programs in Visual Studio Code.
GNU General Public License v3.0
18 stars 1 forks source link

Advanced assembler #6

Open stevexyz opened 3 months ago

stevexyz commented 3 months ago

This is a wonderful project. And surely very nice for a beginner to jump start ZX81 assembler development!

The main limitation I see is related to the assembler, unfortunately very underpowered for more advanced needs (e.g. I’m trying to create a new version of the 1K Real Chess for ZX81),.

Without reimplementing things (standard undocumented instructions, powerful directives, etc), would it be possible to integrate a more powerful ready one as for example sjasmplus (https://github.com/z00m128/sjasmplus) or fasm/fasmg (https://github.com/jacobly0/fasmg-z80)?

andrivet commented 3 months ago

What is missing exactly?

I have not integrated sjasmplus or fasm because there are external binaries. To make the VS Code extension work on any platform, I would have to compile and package those binaries for macOS, Linux and Windows. The embedded assembler is entirely written in Typescript so it does not have such a problem.

stevexyz commented 3 months ago

For starting - and this is really the bare minimum - the complete usable instruction set (meaning also the "documented undocumented").

But there are also a lot of useful directives that are of real help in complex projects: conditional compilation, complex expressions (with a lot of operators and predefined symbols), advanced relocation facilities (eg DISP of sjasmplus), includes/macros, syntactic sugar (eg pseudo ops), structures, etc. (you can look here http://z00m128.github.io/sjasmplus/documentation.html and https://flatassembler.net/docs.php?article=fasmg_manual).

Not everyone use everything, but believe me that even just myself in my last endeavor (the original 1k real chess) in the 10k lines source code I used a lot of those things during development. That said, with a proper subset it can be done with little additional effort or complexity, but some of them should be implemented to use this IDE for advanced projects.

The portability and usability is surely a very good thing, maybe the cosmopolitan C compiler might help in case? (https://github.com/jart/cosmopolitan).

andrivet commented 3 months ago

Do you have a link to the original 1k chess so I can figure out what is needed?

stevexyz commented 3 months ago

The source is a personal project and I have in another house. Anyway if you want you can contact me in private and I can send you the current files in few days.

As said anyway my one is just an example, there are surely many people with different cases (e.g. looking also on the various cases they found for some of the issues open and closed in sjasmplus repo!).

PS: not sure how complex it could be to extend at a proper level the assembler, but if you want to follow this endeavour I can at least be a tester :)

andrivet commented 3 months ago

I see two possibilities (one does not exclude the other):

1) Allow using an external assembler. This would be sjasmplus since I already use the same SLD format. This is already partially implemented but it may need some adjustments.

2) Extend the assembler.