From ee0e67b9d7c275480827d856b926d2c403057bb8 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 6 Mar 2020 18:39:16 -0800 Subject: 6091 --- html/apps/ex14.subx.html | 88 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 html/apps/ex14.subx.html (limited to 'html/apps/ex14.subx.html') diff --git a/html/apps/ex14.subx.html b/html/apps/ex14.subx.html new file mode 100644 index 00000000..ed5fa2ee --- /dev/null +++ b/html/apps/ex14.subx.html @@ -0,0 +1,88 @@ + + + + +Mu - apps/ex14.subx + + + + + + + + + + +https://github.com/akkartik/mu/blob/master/apps/ex14.subx +
+ 1 # Multiply 2 numbers.
+ 2 #
+ 3 # To run:
+ 4 #   $ ./bootstrap translate init.linux apps/ex14.subx -o apps/ex14
+ 5 #   $ ./bootstrap run apps/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
+
+ + + -- cgit 1.4.1-2-gfad0