1 ## first program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html
 2 # Just return 42.
 3 #
 4 # To run:
 5 #   $ subx translate ex1.2.subx ex1
 6 #   $ subx run ex1
 7 # Expected result:
 8 #   $ echo $?
 9 #   42
10 
11 == code
12 # instruction                     effective address                                                   operand     displacement    immediate
13 # op          subop               mod             rm32          base        index         scale       r32
14 # 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
15   bb/copy                                                                                                                         2a/imm32          # copy 42 to EBX
16   # exit(EBX)
17   b8/copy                                                                                                                         1/imm32           # copy 1 to EAX
18   cd/syscall                                                                                                                      0x80/imm8         # int 80h
19 
20 # vim:ft=subx