News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

JavaScript compiler for z80 machines is available!

Started by reeagbo, Yesterday at 08:14

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

reeagbo

Hi all,

I´m coming from the ZX spectrum world and I have some news that might be interesting for some of you. As some of you I'm spending long hours writing code in z80 assembly. In the case of the ZX Spectrum, there is also its embedded (and not very useful) Basic interpreter. Well, I've spent last months writing a JavaScript cross-compiler for the ZX, but now I´m thinking that with little adaptations it could work in other z80 machines as MSX, Amstrad o Gameboy. That's why I´m here.

All the information can be found here:
https://github.com/reeagbo/Jassco

If you are curious about what it does, there is a technical description here:
https://github.com/reeagbo/Jassco/blob/ ... ription.md

Basically, the compiler is written in Python and you can run it easily in your PC. It can create z80 assembly code for pretty much any code written in JavaScript ES2, which is an old version, but it already does a lot of things (if/break continue, while/do, do/while, for, switch, etc...). It works with 16-bits signed integers. It does binary expressions, unaries, ternaries, comparisons, arrays, matrices, bit-wise operation, logical operations...

I´d like to know if the GB community would be interested in having something like this. Supporting GB would not be a big deal since I've separated all the I/O stuff from the main code.

Please, let me know what you think and if someone would be willing to help me with the adaptation.

eto

Quote from: reeagbo on Yesterday at 08:14I´d like to know if the GB community would be interested in having something like this. Supporting GB would not be a big deal since I've separated all the I/O stuff from the main code.
Not sure about the GB community as they are not really on this forum ;-) but I definitely am.

reeagbo

My bad. I confused the GameBoy forum and the CPC forum, that's why it reads GB.

Anyway, if you are interested in trying itÇ:
- the latest version is in the Software folder.
- there is a User Manual, explaining how to do the "Hello, World!" thing in Eclipse or in a more pedestrian environment. It´s not so great but it helps.
- And then, once you manage to make it work, you can find some tested examples in the Example folder, showing the kind of complexity the compiler allows. It's not something you can use directly in your CPC emulator. 

As I mentioned, all the output compilation is ZX Spectrum oriented, but only by adapting the "io.asc" file to the requirements of the CPC, it should work (I guess).

Let me know if you want to try yourself and, if so, how far you got.
Alex



Quote from: eto on Yesterday at 13:15
Quote from: reeagbo on Yesterday at 08:14I´d like to know if the GB community would be interested in having something like this. Supporting GB would not be a big deal since I've separated all the I/O stuff from the main code.
Not sure about the GB community as they are not really on this forum ;-) but I definitely am.

Powered by SMFPacks Menu Editor Mod