2021-07-16 15:09:42 +00:00
|
|
|
# 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:
|
2021-07-20 08:33:47 +00:00
|
|
|
# $ ./translate_subx 000init.subx apps/ex1.subx
|
|
|
|
# $ ./a.elf
|
2021-07-16 15:09:42 +00:00
|
|
|
# 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
|