From af5797eeffdcec43198337f60571ff4ac5f80228 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Tue, 4 Dec 2018 10:40:01 -0800 Subject: 4838 Better to use EDI as a mnemonic for 'destination'. --- html/subx/062write-byte.subx.html | 20 ++++++++++---------- subx/062write-byte.subx | 20 ++++++++++---------- subx/apps/crenshaw2-1 | Bin 6980 -> 6980 bytes subx/apps/crenshaw2-1b | Bin 7541 -> 7541 bytes subx/apps/factorial | Bin 5871 -> 5871 bytes 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/html/subx/062write-byte.subx.html b/html/subx/062write-byte.subx.html index d544a136..e279a005 100644 --- a/html/subx/062write-byte.subx.html +++ b/html/subx/062write-byte.subx.html @@ -107,24 +107,24 @@ if ('onhashchange' in window) { 42 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 43 # . save registers 44 51/push-ECX - 45 56/push-ESI - 46 # ESI = f - 47 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 6/r32/ESI 8/disp8 . # copy *(EBP+8) to ESI + 45 57/push-EDI + 46 # EDI = f + 47 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 7/r32/EDI 8/disp8 . # copy *(EBP+8) to EDI 48 # ECX = f->write - 49 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 . # copy *(ESI+4) to ECX + 49 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 . # copy *(EDI+4) to ECX 50 # if (f->write >= f->length) flush and clear f's stream - 51 3b/compare 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 0xc/disp8 . # compare ECX with *(ESI+12) + 51 3b/compare 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 0xc/disp8 . # compare ECX with *(EDI+12) 52 7c/jump-if-lesser $write-byte:to-stream/disp8 53 # . flush(f) 54 # . . push args - 55 56/push-ESI + 55 57/push-EDI 56 # . . call 57 e8/call flush/disp32 58 # . . discard args 59 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 60 # . clear-stream(stream = f+4) 61 # . . push args - 62 8d/copy-address 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 . # copy ESI+4 to EAX + 62 8d/copy-address 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 . # copy EDI+4 to EAX 63 50/push-EAX 64 # . . call 65 e8/call clear-stream/disp32 @@ -135,12 +135,12 @@ if ('onhashchange' in window) { 70 # f->data[f->read] = LSB(n) 71 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX 72 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/AL 0xc/disp8 . # copy byte at *(EBP+12) to AL - 73 88/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0x10/disp8 . # copy AL to *(ESI+ECX+16) + 73 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/EDI 1/index/ECX . 0/r32/AL 0x10/disp8 . # copy AL to *(EDI+ECX+16) 74 # ++f->read - 75 ff 0/subop/increment 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 . # increment *(ESI+4) + 75 ff 0/subop/increment 1/mod/*+disp8 7/rm32/EDI . . . . 4/disp8 . # increment *(EDI+4) 76 $write-byte:end: 77 # . restore registers - 78 5e/pop-to-ESI + 78 5f/pop-to-EDI 79 59/pop-to-ECX 80 # . epilog 81 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP diff --git a/subx/062write-byte.subx b/subx/062write-byte.subx index 9451ee46..bfb8bcc3 100644 --- a/subx/062write-byte.subx +++ b/subx/062write-byte.subx @@ -42,24 +42,24 @@ write-byte: # f : (address buffered-file), n : num -> 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP # . save registers 51/push-ECX - 56/push-ESI - # ESI = f - 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 6/r32/ESI 8/disp8 . # copy *(EBP+8) to ESI + 57/push-EDI + # EDI = f + 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 7/r32/EDI 8/disp8 . # copy *(EBP+8) to EDI # ECX = f->write - 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 . # copy *(ESI+4) to ECX + 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 . # copy *(EDI+4) to ECX # if (f->write >= f->length) flush and clear f's stream - 3b/compare 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 0xc/disp8 . # compare ECX with *(ESI+12) + 3b/compare 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 0xc/disp8 . # compare ECX with *(EDI+12) 7c/jump-if-lesser $write-byte:to-stream/disp8 # . flush(f) # . . push args - 56/push-ESI + 57/push-EDI # . . call e8/call flush/disp32 # . . discard args 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP # . clear-stream(stream = f+4) # . . push args - 8d/copy-address 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 . # copy ESI+4 to EAX + 8d/copy-address 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 . # copy EDI+4 to EAX 50/push-EAX # . . call e8/call clear-stream/disp32 @@ -70,12 +70,12 @@ $write-byte:to-stream: # f->data[f->read] = LSB(n) 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . 0/r32/AL 0xc/disp8 . # copy byte at *(EBP+12) to AL - 88/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0x10/disp8 . # copy AL to *(ESI+ECX+16) + 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/EDI 1/index/ECX . 0/r32/AL 0x10/disp8 . # copy AL to *(EDI+ECX+16) # ++f->read - ff 0/subop/increment 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 . # increment *(ESI+4) + ff 0/subop/increment 1/mod/*+disp8 7/rm32/EDI . . . . 4/disp8 . # increment *(EDI+4) $write-byte:end: # . restore registers - 5e/pop-to-ESI + 5f/pop-to-EDI 59/pop-to-ECX # . epilog 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 75cf52eb..81739421 100755 Binary files a/subx/apps/crenshaw2-1 and b/subx/apps/crenshaw2-1 differ diff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b index b37c0b92..9975fd8c 100755 Binary files a/subx/apps/crenshaw2-1b and b/subx/apps/crenshaw2-1b differ diff --git a/subx/apps/factorial b/subx/apps/factorial index ae38f80a..35405339 100755 Binary files a/subx/apps/factorial and b/subx/apps/factorial differ -- cgit 1.4.1-2-gfad0