https://github.com/akkartik/mu/blob/main/baremetal/mu-init.subx
 1 # Initialize the minimal runtime for Mu programs.
 2 #
 3 # See translate_mu_baremetal for how this file is used.
 4 #
 5 # Mu baremetal programs start at a function called 'main' without inouts or outputs.
 6 
 7 == code
 8 
 9 # initialize stack
10 bd/copy-to-ebp 0/imm32
11 # no heap yet
12 #
13 # always first run tests
14 (run-tests)
15 (num-test-failures)  # => eax
16 # call main if tests all passed
17 {
18   3d/compare-eax-and 0/imm32
19   75/jump-if-!= break/disp8
20   (clear-screen)
21   (main)
22 }
23 
24 # hang indefinitely
25 {
26   eb/jump loop/disp8
27 }