From d1c9392a5461e0d33e226375a8f7986a97d2d66b Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 26 Nov 2018 01:19:47 -0800 Subject: 4782 --- html/subx/examples/ex3.subx.html | 45 ++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 22 deletions(-) (limited to 'html/subx/examples/ex3.subx.html') diff --git a/html/subx/examples/ex3.subx.html b/html/subx/examples/ex3.subx.html index 140d9224..8323af89 100644 --- a/html/subx/examples/ex3.subx.html +++ b/html/subx/examples/ex3.subx.html @@ -67,28 +67,29 @@ if ('onhashchange' in window) { 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 # result: EBX = 0 -15 bb/copy-to-EBX 0/imm32 -16 # counter: ECX = 1 -17 b9/copy-to-ECX 1/imm32 -18 -19 $loop: -20 # while (counter <= 10) -21 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0xa/imm32 # compare ECX -22 7f/jump-if-greater $exit/disp8 -23 # result += counter -24 01/add 3/mod/direct 3/rm32/EBX . . . 1/r32/ECX . . # add ECX to EBX -25 # ++counter -26 41/inc-ECX -27 # loop -28 eb/jump $loop/disp8 -29 -30 $exit: -31 # exit(EBX) -32 b8/copy-to-EAX 1/imm32 -33 cd/syscall 0x80/imm8 -34 -35 # vim:nowrap:textwidth=0 +14 +15 # result: EBX = 0 +16 bb/copy-to-EBX 0/imm32 +17 # counter: ECX = 1 +18 b9/copy-to-ECX 1/imm32 +19 +20 $loop: +21 # while (counter <= 10) +22 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0xa/imm32 # compare ECX +23 7f/jump-if-greater $exit/disp8 +24 # result += counter +25 01/add 3/mod/direct 3/rm32/EBX . . . 1/r32/ECX . . # add ECX to EBX +26 # ++counter +27 41/inc-ECX +28 # loop +29 eb/jump $loop/disp8 +30 +31 $exit: +32 # exit(EBX) +33 b8/copy-to-EAX 1/imm32 +34 cd/syscall 0x80/imm8 +35 +36 # vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0