1 ## first program: same as https://www.muppetlabs.com/~breadbox/software/tiny/teensy.html 2 # Just return 42. 3 # 4 # To run (from the subx directory): 5 # $ subx translate examples/ex1.2.subx -o examples/ex1 6 # $ subx run examples/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 to EAX 18 cd/syscall 0x80/imm8 19 20 # vim:ft=subx