From e99038ea514a8703b170689d5a0730c8d2e542e7 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 18 Feb 2019 22:43:01 -0800 Subject: 4982 --- html/subx/examples/ex5.subx.html | 64 +++++++++++++++++++++------------------- 1 file changed, 33 insertions(+), 31 deletions(-) (limited to 'html/subx/examples/ex5.subx.html') diff --git a/html/subx/examples/ex5.subx.html b/html/subx/examples/ex5.subx.html index 9dd1a45e..44ba1b76 100644 --- a/html/subx/examples/ex5.subx.html +++ b/html/subx/examples/ex5.subx.html @@ -18,6 +18,7 @@ a { color:inherit; } .subxS2Comment { color: #8a8a8a; } .LineNr { } .subxS1Comment { color: #0000af; } +.SpecialChar { color: #d70000; } .Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } --> @@ -65,37 +66,38 @@ if ('onhashchange' in window) { 9 # . op subop mod rm32 base index scale r32 10 # . 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 11 -12 # main: -13 # allocate x on the stack -14 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # subtract from ESP -15 -16 # syscall(read, stdin, x, 1) -17 # . fd = 0 (stdin) -18 bb/copy-to-EBX 0/imm32 -19 # . data = x (location to write result to) -20 8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 1/r32/ECX 4/disp8 . # copy ESP+4 to ECX -21 # . size = 1 character -22 ba/copy-to-EDX 1/imm32 -23 # . syscall -24 b8/copy-to-EAX 3/imm32/read -25 cd/syscall 0x80/imm8 -26 -27 # syscall(write, stdout, x, 1) -28 # . fd = 1 (stdout) -29 bb/copy-to-EBX 1/imm32 -30 # . data = x (location to read from) -31 8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 1/r32/ECX 4/disp8 . # copy ESP+4 to ECX -32 # . size = 1 character -33 ba/copy-to-EDX 1/imm32 -34 # . syscall -35 b8/copy-to-EAX 4/imm32/write -36 cd/syscall 0x80/imm8 -37 -38 # syscall(exit, EBX) -39 b8/copy-to-EAX 1/imm32/exit -40 cd/syscall 0x80/imm8 -41 -42 # . . vim:nowrap:textwidth=0 +12 Entry: +13 +14 # allocate x on the stack +15 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # subtract from ESP +16 +17 # syscall(read, stdin, x, 1) +18 # . fd = 0 (stdin) +19 bb/copy-to-EBX 0/imm32 +20 # . data = x (location to write result to) +21 8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 1/r32/ECX 4/disp8 . # copy ESP+4 to ECX +22 # . size = 1 character +23 ba/copy-to-EDX 1/imm32 +24 # . syscall +25 b8/copy-to-EAX 3/imm32/read +26 cd/syscall 0x80/imm8 +27 +28 # syscall(write, stdout, x, 1) +29 # . fd = 1 (stdout) +30 bb/copy-to-EBX 1/imm32 +31 # . data = x (location to read from) +32 8d/copy-address 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none 1/r32/ECX 4/disp8 . # copy ESP+4 to ECX +33 # . size = 1 character +34 ba/copy-to-EDX 1/imm32 +35 # . syscall +36 b8/copy-to-EAX 4/imm32/write +37 cd/syscall 0x80/imm8 +38 +39 # syscall(exit, EBX) +40 b8/copy-to-EAX 1/imm32/exit +41 cd/syscall 0x80/imm8 +42 +43 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0