https://github.com/akkartik/mu/blob/master/mu-init.subx
 1 # Initialize the minimal runtime for Mu programs.
 2 #
 3 # See translate_mu for how this file is used.
 4 #
 5 # Mu programs start at a function called 'main' with this signature:
 6 #   fn main args: (addr array kernel-string) -> exit-status/ebx: int
 7 # If your program doesn't need commandline arguments you can drop it:
 8 #   fn main -> exit-status/ebx: int
 9 #
10 # Notice that the output must be in ebx, so that the exit() syscall can pick
11 # it up.
12 
13 == code
14 
15 Entry:
16     # we don't use ebp in Entry; just initialize it
17     bd/copy-to-ebp 0/imm32
18     # var args/eax: (addr array kernel-string)
19     89/<- %eax 4/r32/esp
20     # initialize the heap
21     (new-segment *Heap-size Heap)
22     # run Mu program
23     (main %eax)
24     # exit
25     (syscall_exit)