From 0eb0f69616bb928359aed5ec137c973b14b03788 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Sun, 2 Dec 2018 20:43:39 -0800 Subject: 4821 --- html/subx/apps/crenshaw2-1.subx.html | 173 +++++++++++++--------------------- html/subx/apps/crenshaw2-1b.subx.html | 173 +++++++++++++--------------------- 2 files changed, 132 insertions(+), 214 deletions(-) (limited to 'html/subx/apps') diff --git a/html/subx/apps/crenshaw2-1.subx.html b/html/subx/apps/crenshaw2-1.subx.html index a3e61523..0ef89d57 100644 --- a/html/subx/apps/crenshaw2-1.subx.html +++ b/html/subx/apps/crenshaw2-1.subx.html @@ -592,116 +592,75 @@ if ('onhashchange' in window) { 526 5d/pop-to-EBP 527 c3/return 528 -529 # write(f, "Error: "+s+"\n") then stop(ed, 1) -530 error: # ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void> +529 # read a byte from 'f', and save it in 'Look' +530 get-char: # f : (address buffered-file) -> <void> 531 # . prolog 532 55/push-EBP 533 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -534 # write(f, "Error: ") -535 # . . push args -536 68/push "Error: "/imm32 -537 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) -538 # . . call -539 e8/call write/disp32 -540 # . . discard args -541 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -542 # write(f, s) -543 # . . push args -544 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) -545 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) -546 # . . call -547 e8/call write/disp32 -548 # . . discard args -549 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -550 # write(f, Newline) -551 # . . push args -552 68/push Newline/imm32 -553 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) -554 # . . call -555 e8/call write/disp32 -556 # . . discard args -557 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -558 # stop(ed, 1) -559 # . . push args -560 68/push 1/imm32 -561 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) -562 # . . call -563 e8/call stop/disp32 -564 # should never get past this point -565 # . epilog -566 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -567 5d/pop-to-EBP -568 c3/return -569 -570 # read a byte from 'f', and save it in 'Look' -571 get-char: # f : (address buffered-file) -> <void> -572 # . prolog -573 55/push-EBP -574 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -575 # . save registers -576 50/push-EAX -577 # read-byte(f) -578 # . . push args -579 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 . # push *(EBP+8) -580 # . . call -581 e8/call read-byte/disp32 -582 # . . discard args -583 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -584 # save EAX to Look -585 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy EAX to *Look -586 # . restore registers -587 58/pop-to-EAX -588 # . epilog -589 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -590 5d/pop-to-EBP -591 c3/return -592 -593 is-digit?: # c : int -> bool/EAX -594 # . prolog -595 55/push-EBP -596 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -597 # EAX = false -598 b8/copy-to-EAX 0/imm32 -599 # if c < '0' return false -600 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x30/imm32 # compare *(EBP+8) -601 7c/jump-if-lesser $is-digit?:end/disp8 -602 # if c > '9' return false -603 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x39/imm32 # compare *(EBP+8) -604 7f/jump-if-greater $is-digit?:end/disp8 -605 # otherwise return true -606 b8/copy-to-EAX 1/imm32 -607 $is-digit?:end: -608 # . epilog -609 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -610 5d/pop-to-EBP -611 c3/return -612 -613 == data -614 -615 Look: # (char) -616 00 00 00 00 # = 0 -617 -618 _test-output-stream: -619 # current write index -620 00 00 00 00 -621 # current read index -622 00 00 00 00 -623 # length (= 8) -624 08 00 00 00 -625 # data -626 00 00 00 00 00 00 00 00 # 8 bytes -627 -628 _test-error-stream: -629 # current write index -630 00 00 00 00 -631 # current read index -632 00 00 00 00 -633 # length (= 8) -634 08 00 00 00 -635 # data -636 00 00 00 00 00 00 00 00 # 8 bytes -637 -638 # . . vim:nowrap:textwidth=0 +534 # . save registers +535 50/push-EAX +536 # read-byte(f) +537 # . . push args +538 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 . # push *(EBP+8) +539 # . . call +540 e8/call read-byte/disp32 +541 # . . discard args +542 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +543 # save EAX to Look +544 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy EAX to *Look +545 # . restore registers +546 58/pop-to-EAX +547 # . epilog +548 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +549 5d/pop-to-EBP +550 c3/return +551 +552 is-digit?: # c : int -> bool/EAX +553 # . prolog +554 55/push-EBP +555 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +556 # EAX = false +557 b8/copy-to-EAX 0/imm32 +558 # if c < '0' return false +559 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x30/imm32 # compare *(EBP+8) +560 7c/jump-if-lesser $is-digit?:end/disp8 +561 # if c > '9' return false +562 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x39/imm32 # compare *(EBP+8) +563 7f/jump-if-greater $is-digit?:end/disp8 +564 # otherwise return true +565 b8/copy-to-EAX 1/imm32 +566 $is-digit?:end: +567 # . epilog +568 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +569 5d/pop-to-EBP +570 c3/return +571 +572 == data +573 +574 Look: # (char) +575 00 00 00 00 # = 0 +576 +577 _test-output-stream: +578 # current write index +579 00 00 00 00 +580 # current read index +581 00 00 00 00 +582 # length (= 8) +583 08 00 00 00 +584 # data +585 00 00 00 00 00 00 00 00 # 8 bytes +586 +587 _test-error-stream: +588 # current write index +589 00 00 00 00 +590 # current read index +591 00 00 00 00 +592 # length (= 8) +593 08 00 00 00 +594 # data +595 00 00 00 00 00 00 00 00 # 8 bytes +596 +597 # . . vim:nowrap:textwidth=0 diff --git a/html/subx/apps/crenshaw2-1b.subx.html b/html/subx/apps/crenshaw2-1b.subx.html index 19773a56..9c3a5cef 100644 --- a/html/subx/apps/crenshaw2-1b.subx.html +++ b/html/subx/apps/crenshaw2-1b.subx.html @@ -791,116 +791,75 @@ if ('onhashchange' in window) { 725 5d/pop-to-EBP 726 c3/return 727 -728 # write(f, "Error: "+s+"\n") then stop(ed, 1) -729 error: # ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void> +728 # read a byte from 'f', and save it in 'Look' +729 get-char: # f : (address buffered-file) -> <void> 730 # . prolog 731 55/push-EBP 732 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -733 # write(f, "Error: ") -734 # . . push args -735 68/push "Error: "/imm32 -736 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) -737 # . . call -738 e8/call write/disp32 -739 # . . discard args -740 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -741 # write(f, s) -742 # . . push args -743 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) -744 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) -745 # . . call -746 e8/call write/disp32 -747 # . . discard args -748 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -749 # write(f, Newline) -750 # . . push args -751 68/push Newline/imm32 -752 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) -753 # . . call -754 e8/call write/disp32 -755 # . . discard args -756 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP -757 # stop(ed, 1) -758 # . . push args -759 68/push 1/imm32 -760 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) -761 # . . call -762 e8/call stop/disp32 -763 # should never get past this point -764 # . epilog -765 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -766 5d/pop-to-EBP -767 c3/return -768 -769 # read a byte from 'f', and save it in 'Look' -770 get-char: # f : (address buffered-file) -> <void> -771 # . prolog -772 55/push-EBP -773 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -774 # . save registers -775 50/push-EAX -776 # read-byte(f) -777 # . . push args -778 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 . # push *(EBP+8) -779 # . . call -780 e8/call read-byte/disp32 -781 # . . discard args -782 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -783 # save EAX to Look -784 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy EAX to *Look -785 # . restore registers -786 58/pop-to-EAX -787 # . epilog -788 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -789 5d/pop-to-EBP -790 c3/return -791 -792 is-digit?: # c : int -> bool/EAX -793 # . prolog -794 55/push-EBP -795 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -796 # EAX = false -797 b8/copy-to-EAX 0/imm32 -798 # if c < '0' return false -799 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x30/imm32 # compare *(EBP+8) -800 7c/jump-if-lesser $is-digit?:end/disp8 -801 # if c > '9' return false -802 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x39/imm32 # compare *(EBP+8) -803 7f/jump-if-greater $is-digit?:end/disp8 -804 # otherwise return true -805 b8/copy-to-EAX 1/imm32 -806 $is-digit?:end: -807 # . epilog -808 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -809 5d/pop-to-EBP -810 c3/return -811 -812 == data -813 -814 Look: # (char) -815 00 00 00 00 # = 0 -816 -817 _test-output-stream: -818 # current write index -819 00 00 00 00 -820 # current read index -821 00 00 00 00 -822 # length (= 8) -823 08 00 00 00 -824 # data -825 00 00 00 00 00 00 00 00 # 8 bytes -826 -827 _test-error-stream: -828 # current write index -829 00 00 00 00 -830 # current read index -831 00 00 00 00 -832 # length (= 8) -833 08 00 00 00 -834 # data -835 00 00 00 00 00 00 00 00 # 8 bytes -836 -837 # . . vim:nowrap:textwidth=0 +733 # . save registers +734 50/push-EAX +735 # read-byte(f) +736 # . . push args +737 ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 . # push *(EBP+8) +738 # . . call +739 e8/call read-byte/disp32 +740 # . . discard args +741 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +742 # save EAX to Look +743 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy EAX to *Look +744 # . restore registers +745 58/pop-to-EAX +746 # . epilog +747 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +748 5d/pop-to-EBP +749 c3/return +750 +751 is-digit?: # c : int -> bool/EAX +752 # . prolog +753 55/push-EBP +754 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +755 # EAX = false +756 b8/copy-to-EAX 0/imm32 +757 # if c < '0' return false +758 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x30/imm32 # compare *(EBP+8) +759 7c/jump-if-lesser $is-digit?:end/disp8 +760 # if c > '9' return false +761 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x8/disp8 0x39/imm32 # compare *(EBP+8) +762 7f/jump-if-greater $is-digit?:end/disp8 +763 # otherwise return true +764 b8/copy-to-EAX 1/imm32 +765 $is-digit?:end: +766 # . epilog +767 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +768 5d/pop-to-EBP +769 c3/return +770 +771 == data +772 +773 Look: # (char) +774 00 00 00 00 # = 0 +775 +776 _test-output-stream: +777 # current write index +778 00 00 00 00 +779 # current read index +780 00 00 00 00 +781 # length (= 8) +782 08 00 00 00 +783 # data +784 00 00 00 00 00 00 00 00 # 8 bytes +785 +786 _test-error-stream: +787 # current write index +788 00 00 00 00 +789 # current read index +790 00 00 00 00 +791 # length (= 8) +792 08 00 00 00 +793 # data +794 00 00 00 00 00 00 00 00 # 8 bytes +795 +796 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0