https://github.com/akkartik/mu/blob/main/shell/main.mu

     1 # Experimental Mu shell
     2 # Currently based on Lisp.
     3
     4 fn main screen: (addr screen), keyboard: (addr keyboard), data-disk: (addr disk) {
     5   var env-storage: environment
     6   var env/esi: (addr environment) <- address env-storage
     7   initialize-environment env, 0x20/fake-screen-width, 8/fake-screen-height
     8   load-state env, data-disk
     9   $main:loop: {
    10     render-environment screen, env
    11     # no way to quit right now; just reboot
    12     {
    13       var key/eax: byte <- read-key keyboard
    14       compare key, 0
    15       loop-if-=
    16       var key/eax: grapheme <- copy key
    17       edit-environment env, key, data-disk
    18     }
    19     loop
    20   }
    21 }