https://github.com/akkartik/mu/blob/master/examples/ex4.subx
 1 # Read a character from stdin, save it to a global, write it to stdout.
 2 #
 3 # To run (from the subx directory):
 4 #   $ ./subx translate examples/ex4.subx -o examples/ex4
 5 #   $ ./subx run examples/ex4
 6 
 7 == data 0x0a000000
 8 
 9 # the global variable we save to
10 X:
11     0/imm32  # space for read() to write to
12 
13 == code 0x09000000
14 
15 Entry:
16 # syscall(read, stdin, X, 1)
17 # . fd = 0 (stdin)
18 bb/copy-to-EBX  0/imm32
19 # . data = X (location to write result to)
20 b9/copy-to-ECX  X/imm32
21 # . size = 1 character
22 ba/copy-to-EDX  1/imm32
23 # . syscall
24 b8/copy-to-EAX  3/imm32/read
25 cd/syscall  0x80/imm8
26 
27 # syscall(write, stdout, X, 1)
28 # . fd = 1 (stdout)
29 bb/copy-to-EBX  1/imm32
30 # . initialize X (location to read from)
31 b9/copy-to-ECX  X/imm32
32 # . size = 1 character
33 ba/copy-to-EDX  1/imm32
34 # . syscall
35 b8/copy-to-EAX  4/imm32/write
36 cd/syscall  0x80/imm8
37 
38 # syscall(exit, EBX)
39 b8/copy-to-EAX  1/imm32/exit
40 cd/syscall  0x80/imm8
41 
42 # . . vim:nowrap:textwidth=0