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/ex4.subx.html | 65 +++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'html/subx/examples/ex4.subx.html') diff --git a/html/subx/examples/ex4.subx.html b/html/subx/examples/ex4.subx.html index ba639cde..3db6e2ec 100644 --- a/html/subx/examples/ex4.subx.html +++ b/html/subx/examples/ex4.subx.html @@ -16,6 +16,7 @@ a { color:#eeeeee; text-decoration: none; } a:hover { text-decoration: underline; } * { font-size: 12pt; font-size: 1em; } .LineNr { color: #444444; } +.Special { color: #c00000; } .Comment { color: #9090ff; } .Comment a { color:#0000ee; text-decoration:underline; } .SalientComment { color: #00ffff; } @@ -60,37 +61,39 @@ if ('onhashchange' in window) { 5 # $ subx run examples/ex4 6 7 == code - 8 # syscall(read, stdin, x, 1) - 9 # fd = 0 (stdin) -10 bb/copy-to-EBX 0/imm32 -11 # initialize x (location to write result to) -12 b9/copy-to-ECX x/imm32 -13 # size = 1 character -14 ba/copy-to-EDX 1/imm32 -15 # syscall -16 b8/copy-to-EAX 3/imm32/read -17 cd/syscall 0x80/imm8 -18 -19 # syscall(write, stdout, x, 1) -20 # fd = 1 (stdout) -21 bb/copy-to-EBX 1/imm32 -22 # initialize x (location to read from) -23 b9/copy-to-ECX x/imm32 -24 # size = 1 character -25 ba/copy-to-EDX 1/imm32 -26 # syscall -27 b8/copy-to-EAX 4/imm32/write -28 cd/syscall 0x80/imm8 -29 -30 # syscall(exit, EBX) -31 b8/copy-to-EAX 1/imm32/exit -32 cd/syscall 0x80/imm8 -33 -34 == data -35 x: -36 00 00 00 00 # space for read() to write to -37 -38 # vim:nowrap:textwidth=0 + 8 + 9 # syscall(read, stdin, X, 1) +10 # fd = 0 (stdin) +11 bb/copy-to-EBX 0/imm32 +12 # initialize X (location to write result to) +13 b9/copy-to-ECX X/imm32 +14 # size = 1 character +15 ba/copy-to-EDX 1/imm32 +16 # syscall +17 b8/copy-to-EAX 3/imm32/read +18 cd/syscall 0x80/imm8 +19 +20 # syscall(write, stdout, X, 1) +21 # fd = 1 (stdout) +22 bb/copy-to-EBX 1/imm32 +23 # initialize X (location to read from) +24 b9/copy-to-ECX X/imm32 +25 # size = 1 character +26 ba/copy-to-EDX 1/imm32 +27 # syscall +28 b8/copy-to-EAX 4/imm32/write +29 cd/syscall 0x80/imm8 +30 +31 # syscall(exit, EBX) +32 b8/copy-to-EAX 1/imm32/exit +33 cd/syscall 0x80/imm8 +34 +35 == data +36 +37 X: +38 00 00 00 00 # space for read() to write to +39 +40 # vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0