News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu
avatar_scruss

easy to deploy JS CPC emulator?

Started by scruss, 17:46, 16 June 18

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

scruss

I'm trying to have a few CPC programs run in browser-based emulators hosted on my own site. I've been able to do this easily for ZX Spectrum images with JSSpeccy, but the Amstrad emulators I've looked at have either source or instructions AWOL, or just plain huge (jsmess i am looking at you ...).
Any suggestions for an easier installation?

GUNHED

#1
Devilmarkus can do this. He created the JavaCPC emulator. Very nice!

On my homepage there is an integrated emulator, you can email him, maybe he can help you.

That's how if works for me:
http://futureos.cpc-live.com/

Click at "FutureOS online". (Doesn't work with chrome).
http://futureos.de --> Get the revolutionary FutureOS (Update: 2023.11.30)
http://futureos.cpc-live.com/files/LambdaSpeak_RSX_by_TFM.zip --> Get the RSX-ROM for LambdaSpeak :-) (Updated: 2021.12.26)

scruss

Thanks, but that's Java. I'm looking for JavaScript.
Java doesn't run on any browser on any system I own. I had a couple of JavaCPC deployments on the web, but none of them work now.

pelrun

Quote from: scruss on 17:46, 16 June 18
I'm trying to have a few CPC programs run in browser-based emulators hosted on my own site. I've been able to do this easily for ZX Spectrum images with JSSpeccy, but the Amstrad emulators I've looked at have either source or instructions AWOL, or just plain huge (jsmess i am looking at you ...).
Any suggestions for an easier installation?


@pmeier just got vvvv4k running online using Roland, so they might have some insight. I see that the source link on the Roland site is broken, as far as I can tell the current location is actually https://sourceforge.net/projects/emuscriptoria/.

mr_lou

Quote from: scruss on 00:58, 18 June 18
Thanks, but that's Java. I'm looking for JavaScript.
Java doesn't run on any browser on any system I own.
Which systems are those?

pmeier

#5
No, Roland is written in Javascript and GLP'ed:
https://sourceforge.net/projects/emuscriptoria/
http://roland.retrolandia.net/

Just download the 6128s.html and _6128s.rom.
Install it on your Apache or run it locally with Firefox. (Other browsers seem more restrictive and require a web server.)

My Roland version supports touch controls: http://timealias.bplaced.net/cpc/
Press F1 for instructions. (F8 for reset.)

scruss

Quote from: mr_lou on 06:17, 18 June 18
Which systems are those?
Linux (x86_64 and armv6l/armv7l), Mac OS and Windows 10. The plugin API that Java applets use has been dead since 2015 (Chrome/Chromium, Firefox and Edge won't recognize them), and it's been absent from the JDK since Java 9.

scruss

Quote from: pmeier on 08:24, 18 June 18
Just download the 6128s.html and _6128s.rom.
Ah, thanks! Got those two files from your site, and indeed I pulled up a full-screen 6128 ... unfortunately, the keys seem to think that the space bar is X, which is not a good look.

pmeier

 ;D No, I turned on joystick by default. Just press F2 to disable joystick.

scruss

thanks!

I'm finding the original code from emuscriptoria a bear to build: the non-standard build scripts written in php, reliance on a local patched version of yui-compressor, no docs at all ... may I ask how you managed to generate the 6128s.html and _6128s.rom files? Your version's lovely (and that vvvvvv port is extremely neat), but I don't want to have to advise users about having to hit F2 every time they start.

pmeier

#10
Quote from: scruss on 15:52, 23 June 18
thanks!

I'm finding the original code from emuscriptoria a bear to build: the non-standard build scripts written in php, reliance on a local patched version of yui-compressor, no docs at all ... may I ask how you managed to generate the 6128s.html and _6128s.rom files? Your version's lovely (and that vvvvvv port is extremely neat), but I don't want to have to advise users about having to hit F2 every time they start.
Well, looks like you found it out already  :laugh: To build 6128s.html and _6128s.rom.deflate, you need to comment out the blocks in compila.php

Then load the file with your webbrowser. The .htaccess is required, otherwise the rom is not uncrunched (inflated  ;) ). My webspace does not allow that. So you could patch the php file or download the rom from your local apache.
I think installing yui is optional. Otherwise download the jar and add it to the classpath. (I did.)

Or you could use the default Roland emulator, which has joystick turned off by default. I patched it, because I didn't want to tell gamers how to turn on joystick. (Where is F2 on mobile devices??  :picard: )
PS: I found it a little bit tricky to get it compiled, too. And I saw so many different makefile ecosystems before.  :o But good software is always a motivation to look deeper...

scruss

Quote from: pmeier on 16:18, 23 June 18
... But good software is always a motivation to look deeper...
It's kind of hard to say "good software" and "undocumented PHP-based build system" in the same sentence and keep a straight face ...
Anyway, I worked it out. This for a single emulator for the 6128:


       
  • Download the whole archive using subversion:
    svn checkout svn://svn.code.sf.net/p/emuscriptoria/code/ emuscriptoria-code
  • Copy compila.php to a different name, say compila-6128s.php
  • Edit compila-6128s.php:

            
    • Comment out the lines in the function yui
    • In function comp, add the line:
      file_put_contents('_'.$out.'.rom', $in);
      above the line:
      file_put_contents('_'.$out.'.rom.deflate', gzdeflate($in));
    • Comment out everything from the first line that says:
      ob_start();
      all the way to the line before the one saying:
      yui('6128s');
    • Comment out everything after the line:
      unlink('6128s.js');
      all the way to the line before the one saying:
      stderr('6128s.html');
    • Comment out everything after the line:
      compg('6128s');
      all the way to the line before the one saying:
      if( $slow ){
  • Build the project using:
    php -n -f compila-6128s.php > /dev/null
    This should result in a few files being created, with the interesting ones being 6128s.html and _6128s.rom
  • Copy these two files to a folder on your webserver
  • In that same folder, create a subfolder called games
  • Copy disk image(s) into the games subfolder
  • You can auto-run a game that uses RUN"DISC on disc.dsk by opening the URL:
    http://...yourdomain.../6128s.html/disk.dsk/run"disc
Hope this helps someone!

scruss

#12
Probably best asking the author this, but: anyone know the control code (if one exists) to fake a Return press on a CPC? I'd like to see if I can run a one-liner by substituting some BASIC for the run"disc argument. I can get it to accept one line, but the user then has to manually type RUN.
Like this:http://scruss.com/cpc/6128s.html?stardoj.dsk/10%20PRINT%20CHR$(199+2*RND);:%20GOTO%2010

reidrac

#13
Quote from: mr_lou on 06:17, 18 June 18
Which systems are those?

Any using a modern browser; and for good reasons.

* https://support.mozilla.org/en-US/kb/npapi-plugins
* https://java.com/en/download/faq/chrome.xml

So Firefox since March 2917 and Chrome since September 2015. Because those two browsers account for over 70% of the desktop marketshare (these stats are unreliable, but hey! https://en.wikipedia.org/wiki/Usage_share_of_web_browsers), I wouldn't rely on Java on the browser.

I've been looking for a CPC emulator implementation in Javascript for a while, but unfortunately I haven't found anything "good enough" to play my games.

EDIT: actually, MAME looks close enough, but sound is awful; and it is a nightmare to setup.

See: http://clienteretro.consolaviejuna.com/emulador/amstrad/index.html?amstrad&Golden%20Tail&juanjmartinez_goldent.dsk&goldent
Released The Return of Traxtor, Golden Tail, Magica, The Dawn of Kernel, Kitsune`s Curse, Brick Rick and Hyperdrive for the CPC.

If you like my games and want to show some appreciation, you can always buy me a coffee.

scruss

The emuscriptoria one is fine for me, but my needs are modest. Once you have it built, it's very easy to deploy

mr_lou

Quote from: reidrac on 19:54, 02 July 18
Any using a modern browser; and for good reasons.
Only Applets aren't supported any longer. You can stlll run Webstart Java apps.

Powered by SMFPacks Menu Editor Mod