serentty / rusty-dos Goto Github PK
View Code? Open in Web Editor NEWA Rust skeleton for an MS-DOS program for IBM compatibles and the PC-98, including some PC-98-specific functionality
A Rust skeleton for an MS-DOS program for IBM compatibles and the PC-98, including some PC-98-specific functionality
C:\> gcc
Exiting due to signal SIGSEGV
Page fault at eip=00041381, error=0004
eax=00000000 ebx=0016bba0 ecx=00000001 edx=00000000 esi=001f22b8 edi=0000b078
ebp=001f2298 esp=001f20d0 program=C:\DEVEL\DJGPP\BIN\GCC.EXE
cs: sel=00a7 base=00400000 limit=001fffff
ds: sel=00af base=00400000 limit=001fffff
es: sel=00af base=00400000 limit=001fffff
fs: sel=008f base=000034f0 limit=0000ffff
gs: sel=00bf base=00000000 limit=0010ffff
ss: sel=00af base=00400000 limit=001ffffff
App stack: [001f2394..00172394] Exceptn stack: [00171d9c..0016fe5c]
Call frame traceback EIPs:
0x00041381
0x0004080a
0x0014b108
My os: FreeDOS 1.3-rc4,
i have got the package from FreeDOS 1.3 bonus image with additional software and installed using fdimples FreeDOS package manager.
Hmm. Not much luck at all today. GCC on Ubuntu 22.10 may have dropped support for 16bit binaries:
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/home/me/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/aarch64-unknown-linux-gnu/bin:/home/me/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin" VSLANG="1033" "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--gc-sections" "-m16" "-nostdlib" "-march=i386" "-ffreestanding" "-fno-pie" "-Tcom.ld" "/tmp/rustclAL3QR/symbols.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.0.rcgu.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.1.rcgu.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.2.rcgu.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.3.rcgu.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.4.rcgu.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.5.rcgu.o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.dos.5a5b3b06-cgu.6.rcgu.o" "-Wl,--as-needed" "-L" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps" "-L" "/home/me/Documents/Code/rust/other/rusty-dos/target/release/deps" "-L" "/home/me/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/dos/lib" "-Wl,-Bstatic" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libstatic_assertions-609e5ed2fb2e7024.rlib" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libbitflags-c5fa9dcb2204815e.rlib" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/librustc_std_workspace_core-39ea25ee3b450edd.rlib" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libcore-e6792bc159198733.rlib" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libcompiler_builtins-01f05df35140a5a9.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/home/me/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/dos/lib" "-o" "/home/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-455e65f67464e693.com" "-Wl,--gc-sections" "-no-pie" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: cc: error: unrecognized command-line option '-m16'
$ cc --version
cc (Ubuntu 12.2.0-3ubuntu1) 12.2.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
I'm not sure it'll matter but this is an ARM64-based VM.
$ uname -a
Linux ubuntu-arm 5.19.0-38-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 17:36:31 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux
Have you thought of using the latest and greatest in pure DOS programming, i.e. unreal mode which lets you access the whole range of memory from real mode, as a flat address space?
The main drawback is that the resulting binary will not be compatible with exotic shells and OSes like MS Windows or OS/2 Warp, but seriously, who cares about them?
djgpp has been packaged for Linux https://launchpad.net/~stsp-0/+archive/ubuntu/djgpp/+packages could that help, or is the aim just to have 16 bit code ?
I'm pretty fuzzy on how this works (though managed to compile the example and run in dosbox).
I read your post -
https://www.reddit.com/r/rust/comments/ask2v5/dos_the_final_frontier/
As I'm new to rust, I'm pretty fuzzy on how this works, and where to extend things to play with this..
BlogOS has some VGA text mode routines, which looks like an interesting place to start playing with, though at the moment, not even sure how to build another file apart from dos.com
I entirely expect this is because I'm not using actual gcc
but I hit link-time errors when building at the moment:
WARN rustc_codegen_ssa::back::link Linker does not support -no-pie command line option. Retrying without.
error: linking with `cc` failed: exit status: 1
|
= note: LC_ALL="C" PATH="/Users/me/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/aarch64-apple-darwin/bin:/Users/me/.cargo/bin:/opt/homebrew/opt/openjdk/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Applications/VMware Fusion Tech Preview.app/Contents/Public" VSLANG="1033" "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-Wl,--gc-sections" "-m16" "-nostdlib" "-march=i386" "-ffreestanding" "-fno-pie" "-Tcom.ld" "/var/folders/db/k7txrdsj4cl_p_bf5_5gz9c00000gn/T/rustceH6GoE/symbols.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.0.rcgu.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.1.rcgu.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.2.rcgu.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.3.rcgu.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.4.rcgu.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.5.rcgu.o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.dos.49079d62-cgu.6.rcgu.o" "-Wl,--as-needed" "-L" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps" "-L" "/Users/me/Documents/Code/rust/other/rusty-dos/target/release/deps" "-L" "/Users/me/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/dos/lib" "-Wl,-Bstatic" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libstatic_assertions-7b3a22f385d712a5.rlib" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libbitflags-df4d6f15de3bffa7.rlib" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/librustc_std_workspace_core-72e6f8c8fd97affe.rlib" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libcore-9701ff8d25450f25.rlib" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/libcompiler_builtins-1f1e3cf246152175.rlib" "-Wl,-Bdynamic" "-Wl,--eh-frame-hdr" "-Wl,-z,noexecstack" "-L" "/Users/me/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/dos/lib" "-o" "/Users/me/Documents/Code/rust/other/rusty-dos/target/dos/release/deps/dos-094b9fa3f51d414f.com" "-Wl,--gc-sections" "-Wl,-z,relro,-z,now" "-nodefaultlibs"
= note: ld: warning: directory not found for option '-L/Users/me/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/dos/lib'
ld: warning: directory not found for option '-L/Users/me/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/dos/lib'
ld: unknown option: --as-needed
clang: error: linker command failed with exit code 1 (use -v to see invocation)
warning: `dos` (bin "dos") generated 14 warnings
error: could not compile `dos` (bin "dos") due to previous error; 14 warnings emitted
MyMachin:rusty-dos me$ cc --version
Apple clang version 14.0.0 (clang-1400.0.29.202)
Target: arm64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.