This is the repository for the DM Playground.
The playground allows you to experiment with DM code purely in your browser.
The frontend is powered by React, while v86 emulates x86 running a Linux environment where BYOND is installed. Everything happens 100% client-side.
Use the playground in an iframe with ?embed to show an editor/output-only layout.
<iframe
src="https://play.dm-lang.org/?embed#<share-b64>"
width="800"
height="500"
></iframe>Supported URL parameters:
embed: enables the minimized embedded layout.autorun: runs the snippet automatically after the runtime is ready.theme=<themeId>: sets the editor theme for the embed. Example values:vs-light,one-dark,dracula.code=<base64>: seeds the editor with base64 text.#<share-b64>: the anchor seeds the editor in the compressed share string format.
Embed requirements:
- If you must
sandboxit, the minimum flags areallow-scripts allow-same-origin allow-popups.
Compressed share payloads use zlib compression for efficient serialization.
You can use the Share Code button in the playground, or use the following scripts:
# From a file
pnpm run share:encode -- ./main.dm
pnpm run share:encode:json -- ./payload.json
# From stdin (bash)
cat payload.json | pnpm run share:encode:json
# From stdin (PowerShell)
Get-Content .\payload.json -Raw | pnpm run share:encode:json
pnpm run share:decode -- "<share-b64>"If you omit the argument, the script reads from stdin when piped or prompts interactively otherwise.
Example (payload.json):
{
"v": 1,
"f": {
"main": "/proc/main()\n world.log << \"hello\"\n"
}
}The serial controller is found here: https://github.com/spacestation13/dm-playground_controller
The buildroot linux image code is found here: https://github.com/spacestation13/dm-playground-linux
If you change the emulator runtime files or BIOS/runtime URLs, bump the cache version so existing entries are invalidated.
pnpm install
pnpm run dev # Starts development server with hot reloadThe bytecode panel relies on a Rust library compiled for i686 Linux. You need the i686 cross-compilation toolchain installed:
rustup target add i686-unknown-linux-gnu
sudo apt-get install gcc-multilib # Debian/Ubuntu
pnpm run build:disasmpnpm run build # Type-check and build
pnpm run preview # Preview production buildpnpm run lint # Lint with Biome
pnpm run format # Format with Biome
pnpm run test # Run playwright tests