This weekend, I learned how to switch from VGA text mode to graphics mode without rebooting my OS to display a picture by writing it to the VGA framebuffer. It was really fun to play with pixels! #osdev #rust #rustlang #buildinpublic #hackathon

https://github.com/vinc/moros/pull/687

Add VGA graphics by vinc · Pull Request #687 · vinc/moros

This PR started as a test to see if we could switch between VGA text mode and graphics mode when the OS is running and after a quick test with the vga crate the answer is yes! This part of the vga ...

GitHub
I tried to display a picture of a path in the woods on the screen. At first I could barely see the shapes of the trees:
Then I had all the colors wrong:
It took me a while to understand how to work with the 256-colors VGA palette, both on GIMP on the host system to produce the right image and in my OS to load the palette, but after a while I got it:
Then I switched from PPM to BMP files that can embed their own custom palette and finally got this beautiful picture on real hardware:
The rest of the weekend was spent refactoring the driver, creating more images and coding a program to cycle between them. Next I will make the device files required to do that from userspace, and it will be one more step closer to porting DOOM to MOROS!