A simple terminal emulator implemented in C and compiled to WebAssembly, rendered in an HTML canvas.
- Emscripten SDK (emsdk)
- CMake (version 3.13 or higher)
- A modern web browser with WebAssembly support
-
First, ensure you have activated the Emscripten environment:
source /path/to/emsdk/emsdk_env.sh -
Create a build directory and navigate to it:
mkdir build cd build -
Configure the project with CMake:
emcmake cmake ..
-
Build the project:
emmake make
-
The build process will generate:
terminal.wasm: The WebAssembly binaryterminal.js: The JavaScript glue code
-
Copy these files to your project root directory.
You can serve the files using any HTTP server. For example, using Python:
python3 -m http.server 8000Then open your browser and navigate to http://localhost:8000
- Basic terminal emulation
- Text input and display
- Cursor movement
- Scrolling support
- Classic green-on-black terminal styling
The terminal is implemented with the following components:
terminal.c: Core terminal logic in Cterminal.js: WebAssembly integration and canvas renderingindex.html: HTML canvas container and styling