Skip to main content

embed

Returns a HTML code to embed ZX Spectrum emulator to <iframe> tag on any other HTML page and load the specified binary file into it

Access Point

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

  • BinaryID is an unique ID of the binary file uploaded to ZXLab cloud (or "sandbox" word to run clear machine without loaded binary)

  • 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=0) - Open the debug port in the embedded emulator to allow debugging from the parent HTML page
    • 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.

Binary Pages

Each binary from ZXLab cloud automatically gets its own publication page like https://zxlab.org/play/<BinaryID>

Debug the ZX Spectrum program

When ZX Spectrum emulator is open and debug option enables debugging, you can use ZXLab Debug API to control this virtual ZX Spectrum.

Examples

manic_miner.html
<html>
<body>
<iframe id="zxlab" src="https://api.zxlab.org/v1/embed/GLGlz5/?play=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 game.