Skip to main content

embed/sandbox

Returns a HTML code to embed clear ZX Spectrum emulator to <iframe> tag on any other HTML page

Access Point

GET https://api.zxlab.org/v1/embed/sandbox?<URL parameters>

  • URL Parameters may include one or more of these values:

    • play (0|1, default=1) - Whether we should show the title screen and wait for user to click on the Play button to start the binary
    • debug (0|1, default=1) - Open the debug port in the embedded emulator to allow debugging from the parent HTML page, enabled by default for "sandbox" mode
    • machine_type (2,3,6,12; default=2) - The type of the emulated ZX Spectrum machine:
      • ZX Spectrum 48 = 2
      • ZX Spectrum 128 = 3
      • Pentagon 128 = 6
      • Scorpion ZS 256 = 12

    The machine_type parameter has a priority over the value set inside binary settings, so you can start the same binary on different platforms.

Debug the Sandbox

When Sandbox emulator is open, you can use ZXLab Debug API to control this virtual ZX Spectrum from your application.

Examples

sandbox.html
<html>
<body>
<iframe id="zxlab" src="https://api.zxlab.org/v1/embed/sandbox/?play=1&amp;debug=1" style="width:576px;height:448px" width="576" height="448" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen="true"></iframe>
</body>
</html>

This snippet will open a very basic HTML page with embedded ZX Spectrum emulator in sandbox mode.