百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
R

rust_dos

> 编程语言
开源

Rust DOS:用Rust创建DOS可执行文件

198 stars0 点赞2 次浏览
访问官网GitHub

工具介绍

Rust DOS:用Rust创建DOS可执行文件

Rust DOS (Creating a DOS executable with Rust)

It is possible to create a DOS executable or 1st stage bootloader with Rust.
This is a quick demo of creating COM executable for DOS.

Building

You need a binutils and llvm-tools-preview.

bash
cargo install cargo-binutils
rustup component add llvm-tools-preview

Then you can build the project by running:

bash
cargo build --release

To create a COM executable for DOS, run:

bash
cargo objcopy --release -- -O binary --binary-architecture=i386:x86 rust_dos.com

Running

QEMU

You can copy rust_dos.com to your DOS image.

examples on Linux

bash
$ sudo partx -av freedos.img
partition: none, disk: freedos.img, lower: 0, upper: 0
Trying to use '/dev/loop1' for the loop device
/dev/loop1: partition table type 'dos' detected
range recount: max partno=1, lower=0, upper=0
/dev/loop1: partition #1 added
$ sudo mount /dev/loop1p1 /mnt
$ sudo cp rust_dos.com /mnt/
$ sudo umount /mnt
$ sudo partx -dv /dev/loop1

Then, you can test it using QEMU:

bash
qemu-system-i386 freedos.img -boot c

You can use the println! macro. Below is an example of HelloWorld:

DOSBox

First install DOSBox. Some examples if you like using package managers:

Debian / Ubuntu

bash
sudo apt install dosbox

macOS (Homebrew)

bash
brew install dosbox

Windows (Chocolatey)

choco install dosbox

Once installed, you can launch DOSBox and give it the path to your executable. For example, you can just give it the current working directory like the following:

dosbox .

And this will open DOSBox and have the "C:" drive be the current working directory. It's usually good to do this from another console so you don't have to close DOSBox every time you want to compile your application again.

Others

dpkey module steals key input processing from DOS and converts scan code to ascii code.
about scan code: see PS/2 Keyboard - OSDev Wiki.

Tests

To run the tests suite, you can type on your DOS emulator:

bash
rust_dos.com test

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Rust

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月18日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言