mu/examples/ex2.subx

24 lines
410 B
Plaintext
Raw Normal View History

# Add 1 and 1, and return the result in the exit code.
2018-07-24 18:53:45 +00:00
#
2019-08-20 06:45:04 +00:00
# To run:
2018-12-30 08:36:07 +00:00
# $ ./subx translate examples/ex2.subx -o examples/ex2
# $ ./subx run examples/ex2
# Expected result:
# $ echo $?
# 2
== code 0x09000000
2018-11-26 08:26:20 +00:00
Entry:
# EBX = 1
2018-10-06 04:50:20 +00:00
bb/copy-to-EBX 1/imm32
# increment EBX
2019-04-17 05:43:17 +00:00
43/increment-EBX
# syscall(exit, EBX)
2018-12-28 16:56:21 +00:00
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