https://github.com/akkartik/mu/blob/main/mu-init.subx

     1 # Initialize the minimal runtime for Mu programs.
     2 #
     3 # See translate for how this file is used.
     4 #
     5 # Mu programs start at a function called 'main' without inouts or outputs.
     6 # All tests must pass first (the "power-on unit test").
     7
     8 == code
     9
    10 Entry:
    11   # initialize stack
    12   bd/copy-to-ebp 0/imm32
    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-real-screen)
    21     c7 0/subop/copy *Real-screen-cursor-x 0/imm32
    22     c7 0/subop/copy *Real-screen-cursor-y 0/imm32
    23     (main)
    24   }
    25
    26   # hang indefinitely
    27   {
    28     eb/jump loop/disp8
    29   }