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


                  
 
       
 
      
          
                                       
                            
 
                            
# First program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
# Just return 42.
#
# To run:
#   $ ./subx translate init.linux examples/ex1.2.subx -o examples/ex1
#   $ ./subx run examples/ex1
# Expected result:
#   $ echo $?
#   42

== code

Entry:
# exit(42)
bb/copy-to-ebx  0x2a/imm32  # 42 in hex
e8/call  syscall_exit/disp32

# . . vim:nowrap:textwidth=0