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





                                                                        

                                                 











                                       
# First example: return the answer to the Ultimate Question of Life, the
# Universe, and Everything.
#
# Same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
#
# To run:
#   $ ./translate_subx 000init.subx apps/ex1.subx
#   $ ./a.elf
# 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