emuscripten bas2tap or zmakebas

Propose new game/software design concepts or new game/software ideas. They can be as whimsical as you like, just be careful you don't ask someone to make it for you...
Post Reply
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

emuscripten bas2tap or zmakebas

Post by firelord »

Anyone managed/tried to compile any text2basic converter to javascript?

With a js library like that it might be easy to implement an online IDE for siclair basic.
My main idea is to use a modified eg CKEditor for basic and then we feed the text to the js library to create a tap/z80/sna. The resulted output could be fed in a js spectrum emulator.

I have made many mods in js libraries.

I haven't compiled a C/C++ program for nany-nany years( I stopped using C/C++ when I found out that in java compiling was much simpler).
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: emuscripten bas2tap or zmakebas

Post by flatduckrecords »

[mention]firelord[/mention] Remy Sharp has some really nice online tools, including a JavaScript/HTML text-to-bas editor (and a public API):
https://zx.remysharp.com/bas/

I think it’s NextBASIC-flavoured but I’ve used it successfully for Sinclair BASIC. The code is open source.
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

Thanks!
I think this will help me do what I want.
User avatar
flatduckrecords
Manic Miner
Posts: 787
Joined: Thu May 07, 2020 11:47 am
Location: Oban, Scotland
Contact:

Re: emuscripten bas2tap or zmakebas

Post by flatduckrecords »

Ace! Let us know how you get on - it sounds like a great idea; certainly something I'd find useful!
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

Quote from my other thread (Elementary...)
firelord wrote: Sun Feb 06, 2022 3:52 pm I found a crude solution for running a simple Basin-like enviroment on low-end linux PCs...
I use tinymce as editor then with php I use Html2txt to filter html elements. Then I run server-side zmakebas to create a TAP file and after that I open the resulting file with qaop ( I 've done it also with jsspeccy-mobile but jsspeccy can't save).
Just for a few days for testing , I have uploaded the scripts here : basic2tape.dimotika.tk
Text is not in english but it's quite easy to use :
Just type (or copy/paste) Sinclair basic code inside the textarea, enter your name (or a program name) and press submit.
If everything is ok you will have a second tab in your browser with QAOP running your program.

I have tried this and works on android.
I won't leave this online for long.
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

Just posting to say that a guy in gihub actually did it!!!
He compiled bas2tap using emuscripten (https://github.com/stever/bas2tap) AND make it interact with JSSpeccy3 in the same page (https://github.com/stever/jsspeccy3)!!!

You can see his amazing work here : https://stever.github.io/jsspeccy3/

Thanks stever!
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

I 'm just posting the updated links :
zxplay.org Online Dev enviroment with Sinclair Basic & Assebler (Pasmo)

https://github.com/zxplay
https://github.com/zxplay/zmakebas
https://github.com/zxplay/bas2tap
User avatar
Turtle_Quality
Manic Miner
Posts: 506
Joined: Fri Dec 07, 2018 10:19 pm

Re: emuscripten bas2tap or zmakebas

Post by Turtle_Quality »

That's really very neat.

For an assembly developer (who doesn't happen to be an infallible cyborg), some kind of debugging environment would be needed - view registers, single step etc.. And then there's includes, saving changes to your code (yes I know I could cut and paste back to a file)
Definition of loop : see loop
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

From my side I wanted a simple dev system for simple BASIC programs (check this post viewtopic.php?f=6&t=5859)
A simple version of BASIN that could run without WINE in linux.
For very serious development I don't think the browser is the best enviroment.
I did proposed to the developer to try and add a Boriel ZXBasic tab though...
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

firelord wrote: Fri Feb 25, 2022 7:44 pm
I did proposed to the developer to try and add a Boriel ZXBasic tab though...
And he done it !!
zxplay.org
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

Now zxplay.org supports C to ZX spectrum
So not it supports Sinclair Basic, ZX Boriel Basic, Assembly and C!
User avatar
uglifruit
Manic Miner
Posts: 703
Joined: Thu Jan 17, 2019 12:41 pm
Location: Leicester
Contact:

Re: emuscripten bas2tap or zmakebas

Post by uglifruit »

This is brilliant.

I can actually knock simple things together on my phone in the browser. Which is pretty flipping sweet.
CLEAR 23855
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

That was the main idea!
I turned my old tablet with an external keyboard to a Basic dev enviroment ( with the help of pastebin or a notepad app for saving). I already have an entry ready for CSSCGC :)

The "bad" thing is that zxplay is becoming too advanced for some of my use-cases( usage by kids) and also I have trouble running wasm in some older systems I use.

Also,I found out that my js knowledge is not enough to integrate the es6 zmakebas to my vanilla js project.

Anyone knows if it is easy to convert zmakebas.c to php ( to avoid using shell_exec)?
User avatar
arjun
Microbot
Posts: 151
Joined: Sat Sep 19, 2020 7:34 am
Location: India
Contact:

Re: emuscripten bas2tap or zmakebas

Post by arjun »

firelord wrote: Sat Mar 19, 2022 9:45 am Also,I found out that my js knowledge is not enough to integrate the es6 zmakebas to my vanilla js project.
Wouldn't it be easier to go the other way? That is, convert your vanilla project to ES6 and then integrate zmakebas as-is.
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

arjun wrote: Sun Mar 20, 2022 5:19 am
firelord wrote: Sat Mar 19, 2022 9:45 am Also,I found out that my js knowledge is not enough to integrate the es6 zmakebas to my vanilla js project.
Wouldn't it be easier to go the other way? That is, convert your vanilla project to ES6 and then integrate zmakebas as-is.
Yes, but I don't want to mess (again) with compiling/dependency resolve & installing dev enviroments in every PC I use.
Each year I work with different computer labs. In each lab I use a different PC. PCs range from old Core2Duo to i5( this is the first time I use an i5 at work!).

With vanila JS I can write code and test it even in pentium4! Anyone ever tried to setup a node dev enviroment in P4 or in PCs with less than 1GB ram? :)

A note : I now code for myself and my own needs. So quick and dirty coding works for me (and it worked so far in the long run) :)
User avatar
arjun
Microbot
Posts: 151
Joined: Sat Sep 19, 2020 7:34 am
Location: India
Contact:

Re: emuscripten bas2tap or zmakebas

Post by arjun »

firelord wrote: Sun Mar 20, 2022 10:28 am Yes, but I don't want to mess (again) with compiling/dependency resolve & installing dev enviroments in every PC I use.
Each year I work with different computer labs. In each lab I use a different PC. PCs range from old Core2Duo to i5( this is the first time I use an i5 at work!).
Fair enough. What about hand converting the C code (seems to be a single file) to vanilla JS then? ;)
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

arjun wrote: Mon Mar 21, 2022 4:52 am
firelord wrote: Sun Mar 20, 2022 10:28 am Yes, but I don't want to mess (again) with compiling/dependency resolve & installing dev enviroments in every PC I use.
Each year I work with different computer labs. In each lab I use a different PC. PCs range from old Core2Duo to i5( this is the first time I use an i5 at work!).
Fair enough. What about hand converting the C code (seems to be a single file) to vanilla JS then? ;)
I tried it but did not succeed :)
I must brush up my C skills to complete this task . I haven't coded in C/C++ for more than 20+ years. I switched in Java very early...
I also must stop being lazy and sit down and understand what actually happens in a .TAP file :)
From my experience with my app (basic2tape which I use shell_exec), I think in the end PHP might be better (for my use case).
firelord
Manic Miner
Posts: 557
Joined: Wed Nov 03, 2021 10:57 am
Location: Greece - Thessaloniki

Re: emuscripten bas2tap or zmakebas

Post by firelord »

From CSSCGC 2023 topic:
patters wrote: Sat Jan 14, 2023 10:04 am I would recommend this version of zmakebas:
https://github.com/ohnosec/zmakebas

The maintainer of this fork has fixed a few things I have reported recently.
Does anyone has the knowledge to convert it to something that can be used with Vanilla JS or PHP?
During my student year it would be easy for me to convert C->php but It's been decades I abandoned C (I moved aways from C for the same reasons I avoid modern JS libraries).
I spend quite a while trying to use the emscripten version of zmakebas (of zxplay.org) but I'm not that smart :)

At this moment I POST the code to a php scripts , then I use "exec()" with the native version of zmakebas of the platform I use*. The BASIC text and TAP files ARE stored temporarily in the server** . Then php executes QAOP or JSSpeccy to run the TAP file in a new tab.

*so far I use it on 32bit linux,64bit linux and 64bit windows)
** This is important for me because I use these files for grading students.



@PeterJ is it possible to change topic title to emscripten? I always use the (wrong) word emuscripten because I discovered it in the emulator scheme and my mind is stuck with it :)
Post Reply