Rust 中的可启动的 x86 蛇游戏
This is the game snake, bootable on a x86_64 CPU, written completely in rust. Its foundation is following the very interesting Writing an OS in Rust blog which I would recommend everybody who is interested in this kind of stuff.
But it's not just snake. Thanks to @MoZhonghua its now possible to add different games to the OS and to play them. So apart from snake you can also enjoy a round of 2048.
Use the Makefile to build the game.
The only dependencies are podman and buildah which are used to setup the build environment.
make snakeos.imgThis will first setup a build container with the necessary dependencies and then build the game.
Alternatively, you can use the rust compiler directly with some tricks applied:
rustup override set nightly
rustup toolchain install nightly
rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
rustup component add llvm-tools-preview
cargo run \
--release \
--target x86_64-custom.json \
-Zbuild-std=core,alloc \
-Zbuild-std-features=compiler-builtins-mem -- \
--no-run
ln -sf target/x86_64-custom/release/boot-bios-snakeos.img snakeos.imgTo now run the game, you can use the following command:
make runwhich will actually run qemu-system-x86_64 --enable-kvm -drive format=raw,file=snakeos.img for you. From here you can use either w, a, s and d or the arrow keys to control the snake.
暂无开放 Issues,或尚未同步最近议题。