Closed TheHans255 closed 1 year ago
Never mind - upon further investigation, it was apparent that this was a combination of Rust producing extremely efficient printout code compared to C, as well as the putchar implementation having a bug that made it far less complex than it should have been.
Related: https://github.com/llvm-mos/llvm-mos-sdk/issues/102
I'm attempting to use
rust-mos
to write some Rust code for the Apple //e. I've managed to create a new target triple file and get some code running in C, but I have not accomplished the same in Rust - instead, the binary that Rust generates is mostly gibberish.Starting from https://github.com/mrk-its/rust-mos-hello-world and using the provided
devcontainer
, I added the following files:mos-apple-iie-none.json
:appleiielinker.ld
:Additions to
.cargo/config.toml
:Additions to
src/main.rs
:Building this binary with the command
$ cargo build --release --target=mos-apple-iie-none.json
produces an approximately 200B file that is mostly gibberish, with the text "Hello 6502" somewhat visible (with control characters in between) and "gdb_load_rust_pretty_printers.py" clearly visible.By contrast, building this comparable C file:
with
$ mos-common-clang -o main -Os -flto -T appleiielinker.ld main.c
produces a binary that runs as expected.