1 # Multiply 2 numbers. 2 # 3 # To run: 4 # $ bootstrap/bootstrap translate apps/ex14.subx -o ex14 5 # $ bootstrap/bootstrap run ex14 6 # Expected result: 7 # $ echo $? 8 # 6 9 10 == code 11 # instruction effective address register 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 15 Entry: 16 b8/copy-to-eax 1/imm32 17 b9/copy-to-ecx 2/imm32 18 bb/copy-to-ebx 3/imm32 19 20 69/multiply 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx 3/imm32 # ebx = ecx * 3 21 22 $exit: 23 # exit(ebx) 24 e8/call syscall_exit/disp32 25 26 # . . vim:nowrap:textwidth=0