From 52daf0722f7f4ad9d3f29e3cbbbaddde066f49f3 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 20 May 2019 01:44:06 -0700 Subject: 5211 Update syntax-highlighted renderings after a _long_ time. --- html/subx/examples/ex1.subx.html | 2 +- html/subx/examples/ex10.subx.html | 8 ++--- html/subx/examples/ex11.subx.html | 14 ++++----- html/subx/examples/ex12.subx.html | 4 +-- html/subx/examples/ex2.subx.html | 4 +-- html/subx/examples/ex3.subx.html | 4 +-- html/subx/examples/ex4.subx.html | 65 ++++++++++++++++++++------------------- html/subx/examples/ex5.subx.html | 2 +- html/subx/examples/ex6.subx.html | 4 +-- html/subx/examples/ex7.subx.html | 4 +-- html/subx/examples/ex8.subx.html | 12 ++++---- html/subx/examples/ex9.subx.html | 2 +- 12 files changed, 63 insertions(+), 62 deletions(-) (limited to 'html/subx/examples') diff --git a/html/subx/examples/ex1.subx.html b/html/subx/examples/ex1.subx.html index b4bb151b..3185d270 100644 --- a/html/subx/examples/ex1.subx.html +++ b/html/subx/examples/ex1.subx.html @@ -62,7 +62,7 @@ if ('onhashchange' in window) { 8 # $ echo $? 9 # 42 10 -11 == code +11 == code 0x09000000 12 13 # syscall(exit, 42) 14 bb/copy-to-EBX 2a/imm32 # 42 in hex diff --git a/html/subx/examples/ex10.subx.html b/html/subx/examples/ex10.subx.html index c3b047b7..a305d66d 100644 --- a/html/subx/examples/ex10.subx.html +++ b/html/subx/examples/ex10.subx.html @@ -66,7 +66,7 @@ if ('onhashchange' in window) { 7 # $ echo $? 8 # 0 # false 9 -10 == code +10 == code 0x09000000 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 @@ -104,14 +104,14 @@ if ('onhashchange' in window) { 45 bb/copy-to-EBX 0/imm32 46 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 3/r32/BL . . # copy byte at *EDX to BL 47 # if (c1 == 0) break -48 3d/compare-EAX 0/imm32 +48 3d/compare-EAX-and 0/imm32 49 74/jump-if-equal $argv-equal:break/disp8 50 # if (c1 != c2) return false 51 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . . # compare EAX and EBX 52 75/jump-if-not-equal $argv-equal:false/disp8 53 # ++s1, ++s2 -54 41/inc-ECX -55 42/inc-EDX +54 41/increment-ECX +55 42/increment-EDX 56 # end while 57 eb/jump $argv-equal:loop/disp8 58 $argv-equal:break: diff --git a/html/subx/examples/ex11.subx.html b/html/subx/examples/ex11.subx.html index f0b64cf8..3904ee88 100644 --- a/html/subx/examples/ex11.subx.html +++ b/html/subx/examples/ex11.subx.html @@ -76,7 +76,7 @@ if ('onhashchange' in window) { 14 # because checking for it would require the function being tested! Breakage 15 # would cause tests to not run, rather than to fail as we'd like.) 16 - 17 == code + 17 == code 0x09000000 18 # instruction effective address register displacement immediate 19 # . op subop mod rm32 base index scale r32 20 # . 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 @@ -142,22 +142,22 @@ if ('onhashchange' in window) { 80 # c2 = *s2 81 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 3/r32/BL . . # copy byte at *ESI to BL 82 # if (c1 == 0) return false - 83 3d/compare-EAX 0/imm32 + 83 3d/compare-EAX-and 0/imm32 84 74/jump-if-equal $kernel-string-equal?:false/disp8 85 # if (c1 != c2) return false 86 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . . # compare EAX and EBX 87 75/jump-if-not-equal $kernel-string-equal?:false/disp8 88 # ++i - 89 41/inc-ECX + 89 41/increment-ECX 90 # ++s1 - 91 47/inc-EDI + 91 47/increment-EDI 92 # ++s2 - 93 46/inc-ESI + 93 46/increment-ESI 94 eb/jump $kernel-string-equal?:loop/disp8 95 $kernel-string-equal?:break: 96 # return *s1 == 0 97 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 0/r32/AL . . # copy byte at *EDI to AL - 98 3d/compare-EAX 0/imm32 + 98 3d/compare-EAX-and 0/imm32 99 75/jump-if-not-equal $kernel-string-equal?:false/disp8 100 $kernel-string-equal?:true: 101 b8/copy-to-EAX 1/imm32 @@ -401,7 +401,7 @@ if ('onhashchange' in window) { 339 5d/pop-to-EBP 340 c3/return 341 -342 == data +342 == data 0x0a000000 343 344 Newline: 345 # size diff --git a/html/subx/examples/ex12.subx.html b/html/subx/examples/ex12.subx.html index 02792b12..6e491637 100644 --- a/html/subx/examples/ex12.subx.html +++ b/html/subx/examples/ex12.subx.html @@ -63,7 +63,7 @@ if ('onhashchange' in window) { 6 # $ ./subx run examples/ex12 7 # You shouldn't get a segmentation fault. 8 - 9 == code + 9 == code 0x09000000 10 # instruction effective address register displacement immediate 11 # . op subop mod rm32 base index scale r32 12 # . 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 @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 24 b8/copy-to-EAX 1/imm32/exit 25 cd/syscall 0x80/imm8 26 -27 == data +27 == data 0x0a000000 28 29 # various constants used here were found in the Linux sources (search for file mman-common.h) 30 Mmap-new-segment: # type mmap_arg_struct diff --git a/html/subx/examples/ex2.subx.html b/html/subx/examples/ex2.subx.html index a7c19e82..6ea72349 100644 --- a/html/subx/examples/ex2.subx.html +++ b/html/subx/examples/ex2.subx.html @@ -61,12 +61,12 @@ if ('onhashchange' in window) { 7 # $ echo $? 8 # 2 9 -10 == code +10 == code 0x09000000 11 12 # EBX = 1 13 bb/copy-to-EBX 1/imm32 14 # increment EBX -15 43/inc-EBX +15 43/increment-EBX 16 # syscall(exit, EBX) 17 b8/copy-to-EAX 1/imm32/exit 18 cd/syscall 0x80/imm8 diff --git a/html/subx/examples/ex3.subx.html b/html/subx/examples/ex3.subx.html index d7ace88f..096ff79c 100644 --- a/html/subx/examples/ex3.subx.html +++ b/html/subx/examples/ex3.subx.html @@ -64,7 +64,7 @@ if ('onhashchange' in window) { 7 # $ echo $? 8 # 55 9 -10 == code +10 == code 0x09000000 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 @@ -81,7 +81,7 @@ if ('onhashchange' in window) { 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 +27 41/increment-ECX 28 # loop 29 eb/jump $loop/disp8 30 diff --git a/html/subx/examples/ex4.subx.html b/html/subx/examples/ex4.subx.html index 917e1359..7e0512b0 100644 --- a/html/subx/examples/ex4.subx.html +++ b/html/subx/examples/ex4.subx.html @@ -60,40 +60,41 @@ if ('onhashchange' in window) { 4 # $ ./subx translate examples/ex4.subx -o examples/ex4 5 # $ ./subx run examples/ex4 6 - 7 == code + 7 == data 0x0a000000 8 - 9 # syscall(read, stdin, X, 1) -10 # . fd = 0 (stdin) -11 bb/copy-to-EBX 0/imm32 -12 # . data = 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 + 9 # the global variable we save to +10 X: +11 0/imm32 # space for read() to write to +12 +13 == code 0x09000000 +14 +15 # syscall(read, stdin, X, 1) +16 # . fd = 0 (stdin) +17 bb/copy-to-EBX 0/imm32 +18 # . data = X (location to write result to) +19 b9/copy-to-ECX X/imm32 +20 # . size = 1 character +21 ba/copy-to-EDX 1/imm32 +22 # . syscall +23 b8/copy-to-EAX 3/imm32/read +24 cd/syscall 0x80/imm8 +25 +26 # syscall(write, stdout, X, 1) +27 # . fd = 1 (stdout) +28 bb/copy-to-EBX 1/imm32 +29 # . initialize X (location to read from) +30 b9/copy-to-ECX X/imm32 +31 # . size = 1 character +32 ba/copy-to-EDX 1/imm32 +33 # . syscall +34 b8/copy-to-EAX 4/imm32/write +35 cd/syscall 0x80/imm8 36 -37 X: -38 0/imm32 # space for read() to write to -39 -40 # . . vim:nowrap:textwidth=0 +37 # syscall(exit, EBX) +38 b8/copy-to-EAX 1/imm32/exit +39 cd/syscall 0x80/imm8 +40 +41 # . . vim:nowrap:textwidth=0 diff --git a/html/subx/examples/ex5.subx.html b/html/subx/examples/ex5.subx.html index 44ba1b76..1223f307 100644 --- a/html/subx/examples/ex5.subx.html +++ b/html/subx/examples/ex5.subx.html @@ -61,7 +61,7 @@ if ('onhashchange' in window) { 4 # $ ./subx translate examples/ex5.subx -o examples/ex5 5 # $ ./subx run examples/ex5 6 - 7 == code + 7 == code 0x09000000 8 # instruction effective address register displacement immediate 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 diff --git a/html/subx/examples/ex6.subx.html b/html/subx/examples/ex6.subx.html index dc0f4217..6cbabe19 100644 --- a/html/subx/examples/ex6.subx.html +++ b/html/subx/examples/ex6.subx.html @@ -62,7 +62,7 @@ if ('onhashchange' in window) { 5 # $ ./subx run examples/ex6 6 # Hello, world! 7 - 8 == code + 8 == code 0x09000000 9 # instruction effective address register displacement immediate 10 # . op subop mod rm32 base index scale r32 11 # . 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 @@ -82,7 +82,7 @@ if ('onhashchange' in window) { 25 b8/copy-to-EAX 1/imm32/exit 26 cd/syscall 0x80/imm8 27 -28 == data +28 == data 0x0a000000 29 30 Size: # size of string 31 0x0e/imm32 # 14 diff --git a/html/subx/examples/ex7.subx.html b/html/subx/examples/ex7.subx.html index 98468078..996cb242 100644 --- a/html/subx/examples/ex7.subx.html +++ b/html/subx/examples/ex7.subx.html @@ -68,7 +68,7 @@ if ('onhashchange' in window) { 11 # $ echo $? 12 # 97 13 - 14 == code + 14 == code 0x09000000 15 # instruction effective address register displacement immediate 16 # . op subop mod rm32 base index scale r32 17 # . 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 @@ -148,7 +148,7 @@ if ('onhashchange' in window) { 91 b8/copy-to-EAX 1/imm32/exit 92 cd/syscall 0x80/imm8 93 - 94 == data + 94 == data 0x0a000000 95 96 Stream: 97 0/imm32 diff --git a/html/subx/examples/ex8.subx.html b/html/subx/examples/ex8.subx.html index 03c23e36..b65a4faa 100644 --- a/html/subx/examples/ex8.subx.html +++ b/html/subx/examples/ex8.subx.html @@ -72,7 +72,7 @@ if ('onhashchange' in window) { 14 # ... 15 # Locals start from ESP-4 downwards. 16 -17 == code +17 == code 0x09000000 18 # instruction effective address register displacement immediate 19 # . op subop mod rm32 base index scale r32 20 # . 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 @@ -97,19 +97,19 @@ if ('onhashchange' in window) { 39 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 2/r32/EDX 4/disp8 . # copy *(ESP+4) to EDX 40 # var result/EAX = 0 41 b8/copy-to-EAX 0/imm32 -42 $ascii-length-loop: +42 $ascii-length:loop: 43 # var c/ECX = *s 44 8a/copy-byte 0/mod/* 2/rm32/EDX . . . 1/r32/CL . . # copy byte at *EDX to CL 45 # if (c == '\0') break 46 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0/imm32 # compare ECX -47 74/jump-if-equal $ascii-length-ret/disp8 +47 74/jump-if-equal $ascii-length:end/disp8 48 # ++s 49 42/increment-EDX 50 # ++result -51 40/inc-EAX +51 40/increment-EAX 52 # loop -53 eb/jump $ascii-length-loop/disp8 -54 $ascii-length-ret: +53 eb/jump $ascii-length:loop/disp8 +54 $ascii-length:end: 55 # return EAX 56 c3/return 57 diff --git a/html/subx/examples/ex9.subx.html b/html/subx/examples/ex9.subx.html index ab4693d3..38663f30 100644 --- a/html/subx/examples/ex9.subx.html +++ b/html/subx/examples/ex9.subx.html @@ -74,7 +74,7 @@ if ('onhashchange' in window) { 17 # ... 18 # Locals start from ESP-4 downwards. 19 -20 == code +20 == code 0x09000000 21 # instruction effective address register displacement immediate 22 # . op subop mod rm32 base index scale r32 23 # . 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 -- cgit 1.4.1-2-gfad0