about summary refs log blame commit diff stats
path: root/mu-init.subx
blob: bf9e5b0d6c06971cb871bb0c624163d20a72f79d (plain) (tree)
1
2
3
4
5
6
7
8
9

                                                 
                                          
 

                                                                          


       
      













                                                 
 



                      
# Initialize the minimal runtime for Mu programs.
#
# See translate for how this file is used.
#
# Mu programs start at a function called 'main' without inouts or outputs.
# All tests must pass first (the "power-on unit test").

== code

Entry:
  # initialize stack
  bd/copy-to-ebp 0/imm32
  # always first run tests
  (run-tests)
  (num-test-failures)  # => eax
  # call main if tests all passed
  {
    3d/compare-eax-and 0/imm32
    75/jump-if-!= break/disp8
    (clear-real-screen)
    c7 0/subop/copy *Real-screen-cursor-x 0/imm32
    c7 0/subop/copy *Real-screen-cursor-y 0/imm32
    (main)
  }

  # hang indefinitely
  {
    eb/jump loop/disp8
  }