1 ## add 1 and 1, and return the result in the exit code 2 # 3 # To run (from the subx directory): 4 # $ subx translate examples/ex2.subx -o examples/ex2 5 # $ subx run examples/ex2 6 # Expected result: 7 # $ echo $? 8 # 2 9 10 == code 11 # instruction effective address operand displacement immediate 12 # op subop mod rm32 base index scale r32 13 # 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 14 bb/copy . . . . . . . 1/imm32 # copy to EBX 15 43/inc-EBX 16 # exit(EBX) 17 b8/copy . . . . . . . 1/imm32 # copy to EAX 18 cd/syscall 0x80/imm8 19 20 # vim:ft=subx