4 ms·
A fun alternative way to play with Rust on bare-metal, is https://github.com/rust-console/gba https://github.com/rust-console/gba, which is a Rust crate for wri
by derefr 7y ago
A fun alternative way to play with Rust on bare-metal, is https://github.com/rust-console/gba https://github.com/rust-console/gba, which is a Rust crate for writing (unavoidably bare-metal) homebrew for the Gameboy Advance.
See the second half of https://rust-console.github.io/gba/bitmap-video.html https://rust-console.github.io/gba/bitmap-video.html for an example of what code using the gba crate looks like.
Tangent: IMHO, the GBA is a nearly-perfect platform to get started with bare-metal programming on. It's not painfully-constrained like the 8-bit micros of old, but it doesn't have any extra layers of abstraction like virtual memory, either. Plus, multimedia IO (drawing to the screen, playing sounds, reading buttons) are all just banging bits, similar to using POKEs in BASIC on an Apple II, which makes for immediate gratification, important for younger learners. And you can run GBA software through emulation on pretty much any device you own; with there being some excellent visual debuggers available as well for Windows/Linux.
- MuffinFlavored 7y ago> are all just banging bits At the end of the day, isn't playing the latest and greatest game on a new nVIDIA graphics card at 5k across 2 monitors also just "banging bits" too? :)
- BubRoss 7y agoNo, because you aren't writing directly to the frame buffer, you have to go through drivers, kernels and PCIe bus.
- MuffinFlavored 7y agoWhat do the drivers in the kernel talking to the device do over the PCI-e bus? Just send data, right?
- BubRoss 7y agoIn the previous scenario the cpu isn't running using virtual memory and doesn't need to go through the kernel to do something outside of writing to its isolated memory space. It can write to certain memory addresses that make up the frame buffer that the screen is being drawn from. This is not how a modern PC works. There are system calls (specific assembly instructions) that a user space program can use to communicate with global resources. These go through the kernel and thus are an escape hatch to isolated processes. These are two very different scenarios with the fundamental difference between virtual memory and multiple isolated processes. There isn't much semantic wiggle room.
- jacquesm 7y agoBitbanging traditionally refers to doing what comms hardware can do in software, for instance to create a serial port using just software and a single bit of digital output and input. https://en.wikipedia.org/wiki/Bit_banging https://en.wikipedia.org/wiki/Bit_banging