Due to unusually high levels of website traffic you will be presenting with regular Cloudflare checks for the time being.

New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Struggling with Fuse or trying to find an emulator with a specific feature. Ask your questions here.
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Luzie »

As seen on: https://worldofspectrum.org/forums/disc ... lator-raze
rodrigo
September 14

New online emulator RAZE

Hi!

I would like to share my latest projects, a ZX Spectrum emulator for WebAssembly, that is it runs inside your web browser, at near native speed.

Here is the live version: https://rodrigorc.github.io/raze/

And here is the documentation and source code (100% written in Rust, Open Source, MIT license): https://github.com/rodrigorc/raze

Any suggestions for improvements, bugs reports or comments are welcome, just write down here or open an issue in the github page.

Thanks!
Image
User avatar
Mpk
Dynamite Dan
Posts: 1018
Joined: Tue Feb 09, 2021 8:10 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Mpk »

People with giant brains will be momentarily along to suggest important timing options and things but for me, any emulator needs a pop-out keyboard map so I can see where BEEP and FLASH are.
dfzx
Manic Miner
Posts: 705
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by dfzx »

Mpk wrote: Wed Sep 15, 2021 10:43 am People with giant brains will be momentarily along to suggest important timing options and things but for me, any emulator needs a pop-out keyboard map so I can see where BEEP and FLASH are.
I tried to type

Code: Select all

BEEP 1,0
but since Ctrl-N is caught by Firefox (for new window) I couldn't get the comma. So I didn't get very far. :(

Maybe there's some keyboard trickery I couldn't find?
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2643
Joined: Mon Nov 13, 2017 3:16 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Ast A. Moore »

Mpk wrote: Wed Sep 15, 2021 10:43 am People with giant brains will be momentarily along to suggest important timing options and things . . .
Yep. Timing-wise, it’s very inaccurate. Don’t have time to do any extensive testing at the moment, though.

Audio lag is very small, though. Which is excellent!
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

Hi, developer of RAZE here, greetings!
Ast A. Moore wrote: Wed Sep 15, 2021 10:41 pm Yep. Timing-wise, it’s very inaccurate. Don’t have time to do any extensive testing at the moment, though.
Well, I don't think it is so inaccurate, although I admit that perfect timing was never a priority. Memory contention timing is only an approximation, but CPU timing should be mostly accurate, although I probably have some bugs here and there. If you have some code with gross miss-timing I'd like to have a look.

Unless you are on Apple... See, I'm using the web browser audio stream to get high resolution timer events. And to get the timing rights I have to use non-standard audio frequencies (20833 for 48k, 21112 for 128k). No big deal, the browser or the OS will do the resampling, unless you are on an Apple device, then it will not work, I have to go up to 22050 Hz. That is a speed up of 6% for the 48k. I'm sure it can be fixed, but I have limited access to Apple devices, and they are... weird, from a WebAssembly point of view.
dfzx wrote: Wed Sep 15, 2021 1:05 pm I tried to type

Code: Select all

BEEP 1,0
but since Ctrl-N is caught by Firefox (for new window) I couldn't get the comma. So I didn't get very far. :(
You are right. Ctrl-N will not work :oops:. I admit I didn't test the 48K BASIC too much. I'll map "Alt" to "SymbolShift", too, as a workaround. Later, I'll take your advice and add an online keyboard.
dfzx
Manic Miner
Posts: 705
Joined: Mon Nov 13, 2017 6:55 pm
Location: New Forest, UK
Contact:

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by dfzx »

rodrigo wrote: Thu Sep 16, 2021 2:05 pm Hi, developer of RAZE here, greetings!
Greetings yourself! Good to have you onboard, you clearly have excellent and unusual skills. Good to see you're not taking feedback as criticism, we can be a tough crowd. :)
Derek Fountain, author of the ZX Spectrum C Programmer's Getting Started Guide and various open source games, hardware and other projects, including an IF1 and ZX Microdrive emulator.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2643
Joined: Mon Nov 13, 2017 3:16 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Ast A. Moore »

Yes, I tested your emulator on my MacBook Pro.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

Ast A. Moore wrote: Thu Sep 16, 2021 3:03 pm Yes, I tested your emulator on my MacBook Pro.
That is weird... I've just borrowed an iPad and the audio works perfectly even disabling the Safari specific hacks. Maybe previously I was using a very old iPad or something, I don't know, but the speed here should be correct.

Would you help me debug this issue? Can you tell me your Safari version? Also, can you open a Safari console and type "window.AudioContext" and then "window.webkitAudioContext" and copy the output here?

Thank you!
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2643
Joined: Mon Nov 13, 2017 3:16 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Ast A. Moore »

Sure (see below).
Though, my issue isn’t so much with the sound as it is with the screen update timing. (Could be just the floating bus not detected correctly, though.)


Image

Safari 13.1.2 (14609.3.5.1.5)
macOS 10.14.6
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

Ast A. Moore wrote: Thu Sep 16, 2021 9:32 pm ...my issue isn’t so much with the sound as it is with the screen update timing. (Could be just the floating bus not detected correctly, though.)
Ah, floating bus is tricky to get right. I tested a few games that depend on it (Terra Cresta comes to mind) and I managed to get them to run. But if it is an emulator issue maybe you could share the program so that I could test and debug the issue?
Safari 13.1.2 (14609.3.5.1.5)
macOS 10.14.6
Oh, that is interesting! although I admit that I know nothing about Apple release scheduling. According to MDN proper AudioContext is supported in Safari 14.1 or later. And according to Wikipedia. "Safari 14 was released as a standalone update to macOS Catalina [10.15] and Mojave [10.14] users on September 16, 2020", :mrgreen: just saying...
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

Mpk wrote: Wed Sep 15, 2021 10:43 am ...but for me, any emulator needs a pop-out keyboard map so I can see where BEEP and FLASH are.
I couldn't agree more! 8-). So now I proudly present... my keyboard!

Image

It is written in HTML, so it is not as fancy as those of emulators, but it gets the job done, I think.

Also, SymbolShift and CapsShift are sticky keys, so you can have your BEEPs and FLASHes just using the mouse.
hikoki
Manic Miner
Posts: 589
Joined: Thu Nov 16, 2017 10:54 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by hikoki »

Thanks for your emulator. Seems really fast on my slow PCs.
I leave here two sketches that I made as a suggestion for touch screen keyboards

https://i.postimg.cc/sD847TRL/gui3.png

https://i.postimg.cc/Prc0JbVX/gui2.png
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2643
Joined: Mon Nov 13, 2017 3:16 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Ast A. Moore »

rodrigo wrote: Thu Sep 16, 2021 11:20 pm But if it is an emulator issue maybe you could share the program so that I could test and debug the issue?
Sure. Grab my Yankee (link in my sig).
rodrigo wrote: Thu Sep 16, 2021 11:20 pm And according to Wikipedia. "Safari 14 was released as a standalone update to macOS Catalina [10.15] and Mojave [10.14] users on September 16, 2020", :mrgreen: just saying...
I know. :D I rolled back to v13, because v14 force-switched my laptop to use the discrete graphics chip.
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
Alone Coder
Manic Miner
Posts: 401
Joined: Fri Jan 03, 2020 10:00 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Alone Coder »

Waiting for TR-DOS and ATM-Turbo :) My dream is to run NedoOS online :)
User avatar
chip-fork
Drutt
Posts: 18
Joined: Tue Nov 13, 2018 12:42 pm
Contact:

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by chip-fork »

Oh wow! I was just writing to request an onscreen d pad as a feature. when I realised you already have it! But it only appears on the page when I'm on android. Not on a PC. Which makes sense.
I would like the option to have the d pad and fire either side of the screen when in landscape mode. I've wanted something like this for a while and holding it horizontal is how I imagined it. But it is very usable in game boy style vertical mode. with room for the keyboard this way.
Perhaps this is just me being daft but it took me a minute to work out that the cursor keys & lctrl bit was actually the control to select the joystick mode. But I got there in the end.
Great job, Thanks
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

chip-fork wrote: Fri Sep 17, 2021 11:52 pm Oh wow! I was just writing to request an onscreen d pad as a feature. when I realised you already have it! But it only appears on the page when I'm on android. Not on a PC. Which makes sense.
Yes, it is not very discoverable, developed as an afterthought, actually. I have plans to make D-pad overlay when in full screen, let's see how it goes...
... it took me a minute to work out that the cursor keys & lctrl bit was actually the control to select the joystick mode. But I got there in the end.
Many people say that this control is not very intuitive. They are probably right, but I guess you get used to it.
Great job, Thanks
Thank you, I'm happy you liked it.
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

Ast A. Moore wrote: Fri Sep 17, 2021 6:07 pm Sure. Grab my Yankee (link in my sig).
Oh! Nice game! And indeed it flickers terribly. I have also read you explanation of the floating bus... very helpful, but basically this is what I had implemented, only that I cut a lot of corners to make it fast. Except that... oh, my!!! :shock: I'm using the pixel row number to compute the memory of the attribute byte. It should be divided by 8, of course.

I have fixed the bug and pushed the new version. Now the Yankee is flicker free, as it should be.

Now, the Yankee TZX does not load, because you have some weird blocks... but don't worry, it will, eventually.

Thank you so much for helping me with this.
User avatar
Ast A. Moore
Rick Dangerous
Posts: 2643
Joined: Mon Nov 13, 2017 3:16 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Ast A. Moore »

rodrigo wrote: Sat Sep 18, 2021 2:05 am I have fixed the bug and pushed the new version. Now the Yankee is flicker free, as it should be.
Awesome! I just checked the new version and it works brilliantly! As far as I’m concerned, this is the best ZX Spectrum emulator I’ve seen. Most don’t produce any sound on macOS.
rodrigo wrote: Sat Sep 18, 2021 2:05 am Now, the Yankee TZX does not load, because you have some weird blocks... but don't worry, it will, eventually.
Ah, that’s probably because of the Generalized Data Block (ID 19) I use.
rodrigo wrote: Sat Sep 18, 2021 2:05 am Thank you so much for helping me with this.
You’re most welcome!
Every man should plant a tree, build a house, and write a ZX Spectrum game.

Author of A Yankee in Iraq, a 50 fps shoot-’em-up—the first game to utilize the floating bus on the +2A/+3,
and zasm Z80 Assembler syntax highlighter.
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Luzie »

Suggestion: How about support for USB-Joysticks? Would be nice.
User avatar
uglifruit
Manic Miner
Posts: 705
Joined: Thu Jan 17, 2019 12:41 pm
Location: Leicester
Contact:

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by uglifruit »

This is great!


An idea: I don't want to appear greedy ... but if it'd be possible to a 'load tap/snapshot' from a URL, I'd appreciate that.

And - I'm not sure if this is possible - it'd be cool if I could embed the file load a tap/snap into an extended URL query/similar so I could potentially have a URL like: razeemulator.com/load?ht tp://filehoast.com/myfile.tap
... if you see what I mean.

(It'd mean it'd be able to send spectrum illiterate friends a URL and have them straight into testing something I'd written).
CLEAR 23855
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Luzie »

uglifruit wrote: Sat Nov 06, 2021 9:58 pm This is great!


An idea: I don't want to appear greedy ... but if it'd be possible to a 'load tap/snapshot' from a URL, I'd appreciate that.

And - I'm not sure if this is possible - it'd be cool if I could embed the file load a tap/snap into an extended URL query/similar so I could potentially have a URL like: razeemulator.com/load?ht tp://filehoast.com/myfile.tap
... if you see what I mean.

(It'd mean it'd be able to send spectrum illiterate friends a URL and have them straight into testing something I'd written).
"Qaop/JS – ZX Spectrum emulator" seems to support loading via URL: http://torinak.com/qaop/info
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

Luzie wrote: Sat Nov 06, 2021 8:14 pm Suggestion: How about support for USB-Joysticks? Would be nice.
It already have a somewhat experimental support for the JS gamepad API. It works for my gamepad, but YMMV, particularly because every gamepad/joystick is different, and currently there is no way to configure anything.
rodrigo
Drutt
Posts: 9
Joined: Thu Sep 16, 2021 8:38 am

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by rodrigo »

uglifruit wrote: Sat Nov 06, 2021 9:58 pm An idea: I don't want to appear greedy ... but if it'd be possible to a 'load tap/snapshot' from a URL, I'd appreciate that.
It already has this functionality, there is a note somewhere in the documentation (https://github.com/rodrigorc/raze#what-can-it-do).

Basically, for a tape you link :
https://rodrigorc.github.io/raze/?tape= ... myfile.tap

Or for a snapshot:
https://rodrigorc.github.io/raze/?snaps ... myfile.z80

If you link a tape it will load in 128K mode by default, you can force 48K (snapshots do not need that option):
https://rodrigorc.github.io/raze/?tape= ... .tap&48k=Y

HTH
User avatar
uglifruit
Manic Miner
Posts: 705
Joined: Thu Jan 17, 2019 12:41 pm
Location: Leicester
Contact:

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by uglifruit »

Amazing. Thank you very much.
CLEAR 23855
User avatar
Luzie
Manic Miner
Posts: 913
Joined: Fri May 01, 2020 2:07 pm

Re: New online emulator RAZE (100% written in Rust, Open Source, MIT license)

Post by Luzie »

Dear @rodrigo,

can your Emulator (written in Rust) working in Offline-Mode? Or can you build a Windows or MacOS-Executable from it?

Are there special needs to run RAZE as WebAssembly in Browsers or should every modern browser (Google Chrome, Microsoft Edge, Mozilla Firefox, Chromium) run it?

I ask because I´m in search for a crossplatform programming language which should feature:
  • TUI or GUI with Mouse-Support
  • Full Portability
  • Run Offline in Browsers
  • Has access to files on local harddisk (to call sub-programs or change bits in config-files) - This maybe a problem with all things "running in a browser/Browser sandbox"?!
btw. Trying to build R.A.Z.E WebAssembly from Sourcecode under Windows, but get this error:

Code: Select all

error: failed to run custom build command for `openssl-sys v0.9.72`
Are you building it under MacOS?

Regards
Luzie
Last edited by Luzie on Tue Apr 19, 2022 5:53 pm, edited 1 time in total.
Post Reply