From 651fc300a4087f6ccaa7d17c0d581e6ddd313a48 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Fri, 6 Mar 2020 12:28:57 -0800 Subject: 6084 --- html/055stream.subx.html | 81 +++++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 39 deletions(-) (limited to 'html/055stream.subx.html') diff --git a/html/055stream.subx.html b/html/055stream.subx.html index e08d690c..c66e74fe 100644 --- a/html/055stream.subx.html +++ b/html/055stream.subx.html @@ -21,6 +21,7 @@ a { color:inherit; } .subxFunction { color: #af5f00; text-decoration: underline; } .Normal { color: #000000; background-color: #c6c6c6; padding-bottom: 1px; } .Constant { color: #008787; } +.subxH1Comment { color: #005faf; text-decoration: underline; } --> @@ -89,45 +90,47 @@ if ('onhashchange' in window) { 31 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32 # copy to *eax 32 # f->read = 0 33 c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32 # copy to *(eax+4) -34 # var curr/eax: (addr byte) = f->data -35 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0xc/imm32 # add to eax -36 $clear-stream:loop: -37 # if (curr >= max) break -38 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # compare eax with ecx -39 73/jump-if-addr>= $clear-stream:end/disp8 -40 # *curr = 0 -41 c6 0/subop/copy-byte 0/mod/direct 0/rm32/eax . . . . . 0/imm8 # copy byte to *eax -42 # ++curr -43 40/increment-eax -44 eb/jump $clear-stream:loop/disp8 -45 $clear-stream:end: -46 # . restore registers -47 59/pop-to-ecx -48 58/pop-to-eax -49 # . epilogue -50 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp -51 5d/pop-to-ebp -52 c3/return -53 -54 rewind-stream: # f: (addr stream byte) -55 # . prologue -56 55/push-ebp -57 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp -58 # . save registers -59 50/push-eax -60 # eax = f -61 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to eax -62 # f->read = 0 -63 c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32 # copy to *(eax+4) -64 $rewind-stream:end: -65 # . restore registers -66 58/pop-to-eax -67 # . epilogue -68 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp -69 5d/pop-to-ebp -70 c3/return -71 -72 # . . vim:nowrap:textwidth=0 +34 # - clear all stream data +35 # - this isn't strictly necessary, and it can slow things down *a lot*, but better safe than sorry. +36 # var curr/eax: (addr byte) = f->data +37 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0xc/imm32 # add to eax +38 $clear-stream:loop: +39 # if (curr >= max) break +40 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . . # compare eax with ecx +41 73/jump-if-addr>= $clear-stream:end/disp8 +42 # *curr = 0 +43 c6 0/subop/copy-byte 0/mod/direct 0/rm32/eax . . . . . 0/imm8 # copy byte to *eax +44 # ++curr +45 40/increment-eax +46 eb/jump $clear-stream:loop/disp8 +47 $clear-stream:end: +48 # . restore registers +49 59/pop-to-ecx +50 58/pop-to-eax +51 # . epilogue +52 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp +53 5d/pop-to-ebp +54 c3/return +55 +56 rewind-stream: # f: (addr stream byte) +57 # . prologue +58 55/push-ebp +59 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . . # copy esp to ebp +60 # . save registers +61 50/push-eax +62 # eax = f +63 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 8/disp8 . # copy *(ebp+8) to eax +64 # f->read = 0 +65 c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32 # copy to *(eax+4) +66 $rewind-stream:end: +67 # . restore registers +68 58/pop-to-eax +69 # . epilogue +70 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . . # copy ebp to esp +71 5d/pop-to-ebp +72 c3/return +73 +74 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0