Lovebyte 2022 ARM Pi baremetal bootsector demo


Background

Lovebyte is a demoparty aimed directly at sizecoding! In addition to my usual Apple II submissions I also did some ARM/Linux work.

Source Code

The full source code for theis entries is available on my armdemo github project.

The Entry

High-end 512B -- Ocean Rain



This is a bootsector entry that runs on an ARM1176 Raspberry Pi (so model 1B/1A or similar).

This runs bare-metal, no operating system at all. To install take a SD card with a fresh Raspberry Pi OS image on it, and replace the kernel.img file in /boot with the one included here.

The code is based on my own vmwos operating system project, as well as taking some inspiration from the code to PiFox.

At boot the GPU on the Pi loads firmware from the SD card and starts the ThreadX operating system. It then starts up the ARM processor and runs the kernel.img. Our replacement kernel.img is the demo. The fisrt 128B of code/data requests a 640x480 32-bit framebuffer from the GPU (we have stripped the code down to the bare minimum and have removed most of the safety checks).

We then set up a DOS mode13h alike framebuffer with palette in software. There's a routine that copies this to the 32bpp framebuffer expected by the GPU.

The first effect is just PSX Doom Fire, but with a blue palette so it looks like ocean waves.

After a number of frames, we transition to a raindrop type effect based on an Atari demo by Seban/Slight. This one is trickier as it requires two framebuffers. We don't erase the doom fire so it make the nice foam effect while dissipating as rain.

Since this targets an old Pi it doesn't have Thumb2 support. The code is mostly just ARM32 assembly, though we did convert at least one routine to THUMB. (Unlike Thumb2, you can't easily mix 16 and 32 bit width instructions. Generally you can only pick 32 or 16 for entire functions at a time).

Update: 17 February 2022: the source code in github has been updated with a newer version that enables the L1 caches (but still fitting in 512B) and this runs twice as fast. I haven't updated the executable download though.

Finish: 10/11 512 Byte Modern Intro
Video: https://youtu.be/uzZ5Q7-97DE
Download: ocean_rain_pouet.zip
Sourcecode: kernel_main.s
Pouet: https://www.pouet.net/prod.php?which=90945


See my Lovebyte 2022 entries for ARM Thumb2 ELF/Linux on Rapberry Pi

See my Lovebyte 2022 entries for the Apple II platform


Back to my Demos