This project uses CMake as its build system. The structure is modular, with core libraries and frontends built separately.
ndlib/ - Core library for common functionalitycpu/ - CPU emulation moduledevices/ - Device emulation modulesmachine/ - Machine integration moduledebugger/ - DAP Debugging support (Linux/Windows only)frontend/nd100x/ - Native frontendfrontend/nd100wasm/ - WebAssembly frontend# Configure and build in debug mode
./build.sh
# Build in release mode
./build.sh --release
# Build WebAssembly version
./build.sh --wasm
# Specify custom build directory
./build.sh --build-dir my_build
# Specify custom installation prefix
./build.sh --install-prefix ~/local
# Configure and build in debug mode
build.bat
# Build in release mode
build.bat --release
# Build WebAssembly version
build.bat --wasm
# Specify custom build directory
build.bat --build-dir my_build
# Specify custom installation prefix
build.bat --install-prefix "C:\Program Files\ND100X"
# Create a build directory
mkdir build && cd build
# Configure
cmake ..
# Build
cmake --build .
# Install
cmake --install .
The project uses a modern CMake approach with proper target-based dependency management:
target_link_librariesThe debugger is only available on Linux and Windows builds. It uses the DAP (Debug Adapter Protocol) from external/libdap. The preprocessor symbol WITH_DEBUGGER is defined when the debugger is available.
The build system follows CMake best practices for out-of-source builds:
This project provides two build systems:
A Makefile is included to simplify the process if you prefer using make.
Use “make help” to list the options
$make help
ND100X Makefile Help
-------------------------------------------------------------------------------
Targets:
all (default) - Same as 'debug'
debug - Build debug version
release - Build release version
sanitize - Build with address sanitizer
wasm - Build WebAssembly version
(Requires Emscripten SDK, run in browser via HTTP server)
dap-tools - Build with DAP tools (dap_debugger and dap_mock_server)
(Only available on Linux/Windows with libdap)
clean - Remove build directories
install - Install the build
run - Build and run nd100x (uses defaults below)
help - Show this help
Run options (environment variables):
BOOT_TYPE=smd|floppy|bpun|aout|bp Boot type (default: smd)
IMAGE_FILE=path Image file to load
START_ADDR=0 Start address (default: 0)
VERBOSE=1 Enable verbose output
DEBUGGER=1 Enable DAP debugger
DISASM=1 Enable disassembly output
Platform-specific features:
Linux/Windows: WITH_DEBUGGER is automatically set for cpu/debugger
This enables Debug Adapter Protocol (DAP) support
WebAssembly: Debugger is disabled, optimized for browser performance
WebAssembly options:
The wasm target builds a browser-compatible version of the emulator.
After building, serve the build_wasm/bin directory via HTTP
and open index.html in a browser.
Example:
BOOT_TYPE=floppy IMAGE_FILE=FLOPPY.IMG make run
This Makefile is a wrapper around CMake. If you prefer, you can use CMake directly:
./build.sh - For more build options
make debug
make release
make sanitize
The build system supports three different build types:
debug: Includes debug symbols and disables optimizationsrelease: Enables high-level optimizations for best performancesanitize: Includes Address Sanitizer for debugging memory issuesmkdir -p build
cd build
cmake ..
cmake --build .
cmake --install .
# Or to specify an installation prefix:
cmake --install . --prefix /path/to/install
For convenience, a build script is provided that handles common build configurations:
# Configure and build in debug mode
./build.sh
# Build in release mode
./build.sh --release
# Build WebAssembly version
./build.sh --wasm
# Specify custom build directory
./build.sh --build-dir my_build
# Specify custom installation prefix
./build.sh --install-prefix ~/local
# Build with DAP test tools (dap_debugger, dap_mock_server)
./build.sh --with-dap-tools
On Windows, you can use the provided batch file:
# Configure and build in debug mode
build.bat
# Build in release mode
build.bat --release
# Specify custom build directory
build.bat --build-dir my_build
# Specify custom installation prefix
build.bat --install-prefix "C:\Program Files\ND100X"
# Build with DAP test tools
build.bat --with-dap-tools
To build for WebAssembly, you need to have Emscripten SDK installed and activated:
# Using emcmake directly
mkdir -p build_wasm
emcmake cmake -B build_wasm -S .
cmake --build build_wasm
# Or using the build script
./build.sh --wasm
By default, the DAP (Debug Adapter Protocol) test tools (dap_debugger and dap_mock_server) are not built to reduce compilation time and dependencies. If you need these tools for development or testing, you can enable them:
# Using CMake directly
cmake -B build -S . -DBUILD_DAP_TOOLS=ON
cmake --build build
# Or using the build script
./build.sh --with-dap-tools
The project uses a modern CMake approach:
target_link_librariesThe debugger is only available on Linux and Windows builds. It uses the DAP (Debug Adapter Protocol) from external/libdap. The preprocessor symbol WITH_DEBUGGER is defined when the debugger is available.
The build system respects the existing code structure and uses the mkptypes tool to generate prototype headers, just like the original Makefile system.