From bb2b6ba7fd72bbebc3a4490d090f080e7b8628cc Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sat, 4 Aug 2018 17:00:27 -0700 Subject: 4478 --- html/subx/ex2.subx.html | 79 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 html/subx/ex2.subx.html (limited to 'html/subx/ex2.subx.html') diff --git a/html/subx/ex2.subx.html b/html/subx/ex2.subx.html new file mode 100644 index 00000000..b0b0e50f --- /dev/null +++ b/html/subx/ex2.subx.html @@ -0,0 +1,79 @@ + + + + +Mu - subx/ex2.subx + + + + + + + + + + +
+ 1 ## add 1 and 1, and return the result in the exit code
+ 2 #
+ 3 # To run:
+ 4 #   $ subx translate ex2.subx ex2
+ 5 #   $ subx run ex2
+ 6 # Expected result:
+ 7 #   $ echo $?
+ 8 #   2
+ 9 
+10 == 0x08048054  # code segment, after leaving room for ELF header
+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 1 to EBX
+15   81          0/subop/add         3/mod/direct    3/rm32/ebx                                                                      1/imm32           # add 1 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
+
+ + + -- cgit 1.4.1-2-gfad0