https://github.com/akkartik/mu/blob/main/linux/apps/ex4.subx
 1 # Read a character from stdin, save it to a global, write it to stdout.
 2 #
 3 # To run:
 4 #   $ bootstrap/bootstrap translate apps/ex4.subx -o ex4
 5 #   $ bootstrap/bootstrap run ex4
 6 
 7 == data
 8 
 9 # the global variable we save to
10 X:
11     0/imm32  # space for read() to write to
12 
13 == code
14 
15 Entry:
16 # 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 e8/call  syscall_read/disp32
25 
26 # write(stdout, X, 1)
27 # . fd = 1 (stdout)
28 bb/copy-to-ebx  1/imm32
29 # . initialize X (location to read from)
30 b9/copy-to-ecx  X/imm32
31 # . size = 1 character
32 ba/copy-to-edx  1/imm32
33 # . syscall
34 e8/call  syscall_write/disp32
35 
36 # exit(ebx)
37 e8/call  syscall_exit/disp32
38 
39 # . . vim:nowrap:textwidth=0