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 # always first run tests
12 (run-tests)
13 (num-test-failures)  # => eax
14 # call main if tests all passed
15 {
16   3d/compare-eax-and 0/imm32
17   75/jump-if-!= break/disp8
18   (clear-real-screen)
19   c7 0/subop/copy *Real-screen-cursor-x 0/imm32
20   c7 0/subop/copy *Real-screen-cursor-y 0/imm32
21   (main)
22 }
23 
24 # hang indefinitely
25 {
26   eb/jump loop/disp8
27 }