aquefir/hinterlib

Create an event system to support GBA, DOS and other baremetal environments

Opened this issue · 1 comments

There is libevent to provide portable event loop support to applications on modern operating systems like Linux, macOS, and Windows. Unfortunately this library does not support ancient environments where even a libc may be absent or sparsely available, and porting it over would be a messy undertaking.

To solve this problem, it is proposed that unilib offer a simple event API that is well-scoped as to work nicely in all environments including old ones, which under the hood either implements event polling using system-specific BIOS calls and interrupts, or wraps libevent where it is already available.

A properly-written event loop is important to virtually every sort of graphical application, as it allows programs to let the CPU idle where possible, providing better responsiveness and power consumption along with the concurrency benefits of the implied async programming.

The meat of current work to bring this feature to fruition is the porting of mt19937lib to C, so that it can run on baremetal. It will find entropy sources on its own for all the hosted platforms, but further work will be needed to source entropy on the GBA. No plan yet on how entropy will be sourced on DOS.