mu/examples/ex1.subx

22 lines
434 B
Plaintext
Raw Normal View History

# First program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
2018-07-16 14:55:07 +00:00
# Just return 42.
#
2019-08-20 06:45:04 +00:00
# To run:
2018-12-30 08:36:07 +00:00
# $ ./subx translate examples/ex1.2.subx -o examples/ex1
# $ ./subx run examples/ex1
2018-07-27 23:53:47 +00:00
# Expected result:
# $ echo $?
# 42
== code 0x09000000
2018-11-26 08:26:20 +00:00
Entry:
# syscall(exit, 42)
bb/copy-to-ebx 2a/imm32 # 42 in hex
b8/copy-to-eax 1/imm32/exit
2018-10-06 04:50:20 +00:00
cd/syscall 0x80/imm8
== data 0x0a000000
# . . vim:nowrap:textwidth=0