2018-12-01 00:45:15 +00:00
|
|
|
# First program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
|
2018-07-16 14:55:07 +00:00
|
|
|
# Just return 42.
|
2018-07-01 07:01:13 +00:00
|
|
|
#
|
2019-08-20 06:45:04 +00:00
|
|
|
# To run:
|
2019-09-15 07:01:12 +00:00
|
|
|
# $ ./subx translate init.linux examples/ex1.2.subx -o examples/ex1
|
2018-12-30 08:36:07 +00:00
|
|
|
# $ ./subx run examples/ex1
|
2018-07-27 23:53:47 +00:00
|
|
|
# Expected result:
|
|
|
|
# $ echo $?
|
|
|
|
# 42
|
2018-07-01 07:01:13 +00:00
|
|
|
|
2019-09-12 02:04:49 +00:00
|
|
|
== code
|
2018-11-26 08:26:20 +00:00
|
|
|
|
2019-07-15 19:26:41 +00:00
|
|
|
Entry:
|
2019-09-12 02:04:49 +00:00
|
|
|
# exit(42)
|
2019-08-26 18:55:26 +00:00
|
|
|
bb/copy-to-ebx 2a/imm32 # 42 in hex
|
2019-09-12 02:04:49 +00:00
|
|
|
e8/call syscall_exit/disp32
|
2019-07-15 19:26:41 +00:00
|
|
|
|
2018-11-30 19:10:44 +00:00
|
|
|
# . . vim:nowrap:textwidth=0
|