From 09492d3867b5da6d0b2f21b139d097cd481a8fa1 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Wed, 10 Apr 2019 21:18:55 -0700 Subject: 5077 --- html/subx/apps/crenshaw2-1b.subx.html | 215 ++++++++++++++++++---------------- 1 file changed, 112 insertions(+), 103 deletions(-) (limited to 'html/subx/apps/crenshaw2-1b.subx.html') diff --git a/html/subx/apps/crenshaw2-1b.subx.html b/html/subx/apps/crenshaw2-1b.subx.html index 932e7ed5..5aa5f873 100644 --- a/html/subx/apps/crenshaw2-1b.subx.html +++ b/html/subx/apps/crenshaw2-1b.subx.html @@ -114,7 +114,7 @@ if ('onhashchange' in window) { 51 # . . discard args 52 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP 53 # . check result - 54 3d/compare-EAX 1/imm32 + 54 3d/compare-EAX-and 1/imm32 55 75/jump-if-not-equal $run-main/disp8 56 # . run-tests() 57 e8/call run-tests/disp32 @@ -157,7 +157,7 @@ if ('onhashchange' in window) { 94 # . . push args 95 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) 96 # . . call - 97 e8/call get-char/disp32 + 97 e8/call get-char/disp32 98 # . . discard args 99 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 100 # var num/ECX : (address stream) on the stack @@ -292,13 +292,13 @@ if ('onhashchange' in window) { 229 # - if (is-digit?(Look)) expected(ed, err, "integer") 230 # . EAX = is-digit?(Look) 231 # . . push args -232 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Look/disp32 . # push *Look +232 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Look/disp32 . # push *Look 233 # . . call -234 e8/call is-digit?/disp32 +234 e8/call is-digit?/disp32 235 # . . discard args 236 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 237 # . if (EAX == 0) -238 3d/compare-EAX 0/imm32 +238 3d/compare-EAX-and 0/imm32 239 75/jump-if-not-equal $get-num:main/disp8 240 # . expected(ed, err, "integer") 241 # . . push args @@ -343,7 +343,7 @@ if ('onhashchange' in window) { 280 $get-num:loop-stage2: 281 # out->data[out->write] = LSB(Look) 282 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/EDI 1/index/ECX . 3/r32/EBX 0xc/disp8 . # copy EDI+ECX+12 to EBX -283 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy *Look to EAX +283 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy *Look to EAX 284 88/copy-byte 0/mod/indirect 3/rm32/EBX . . . 0/r32/AL . . # copy byte at AL to *EBX 285 # ++out->write 286 41/increment-ECX @@ -351,19 +351,19 @@ if ('onhashchange' in window) { 288 # . . push args 289 56/push-ESI 290 # . . call -291 e8/call get-char/disp32 +291 e8/call get-char/disp32 292 # . . discard args 293 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 294 # if (is-digit?(Look)) loop 295 # . EAX = is-digit?(Look) 296 # . . push args -297 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Look/disp32 . # push *Look +297 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Look/disp32 . # push *Look 298 # . . call -299 e8/call is-digit?/disp32 +299 e8/call is-digit?/disp32 300 # . . discard args 301 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 302 # . if (EAX != 0) loop -303 3d/compare-EAX 0/imm32 +303 3d/compare-EAX-and 0/imm32 304 0f 85/jump-if-not-equal $get-num:loop/disp32 305 $get-num:loop-end: 306 # persist necessary variables from registers @@ -405,14 +405,14 @@ if ('onhashchange' in window) { 342 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 343 # . clear-stream(_test-output-stream) 344 # . . push args -345 68/push _test-output-stream/imm32 +345 68/push _test-output-stream/imm32 346 # . . call 347 e8/call clear-stream/disp32 348 # . . discard args 349 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 350 # . clear-stream(_test-error-stream) 351 # . . push args -352 68/push _test-error-stream/imm32 +352 68/push _test-error-stream/imm32 353 # . . call 354 e8/call clear-stream/disp32 355 # . . discard args @@ -443,14 +443,14 @@ if ('onhashchange' in window) { 380 # . . push args 381 68/push _test-buffered-file/imm32 382 # . . call -383 e8/call get-char/disp32 +383 e8/call get-char/disp32 384 # . . discard args 385 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 386 # get-num(in, out, err, ed) 387 # . . push args 388 50/push-EAX/ed -389 68/push _test-error-stream/imm32 -390 68/push _test-output-stream/imm32 +389 68/push _test-error-stream/imm32 +390 68/push _test-output-stream/imm32 391 68/push _test-buffered-file/imm32 392 # . . call 393 e8/call get-num/disp32 @@ -461,7 +461,7 @@ if ('onhashchange' in window) { 398 # . . push args 399 68/push "F - test-get-num-reads-single-digit"/imm32 400 68/push 0x33/imm32 -401 b8/copy-to-EAX _test-output-stream/imm32 +401 b8/copy-to-EAX _test-output-stream/imm32 402 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12) 403 # . . call 404 e8/call check-ints-equal/disp32 @@ -496,14 +496,14 @@ if ('onhashchange' in window) { 433 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 434 # . clear-stream(_test-output-stream) 435 # . . push args -436 68/push _test-output-stream/imm32 +436 68/push _test-output-stream/imm32 437 # . . call 438 e8/call clear-stream/disp32 439 # . . discard args 440 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 441 # . clear-stream(_test-error-stream) 442 # . . push args -443 68/push _test-error-stream/imm32 +443 68/push _test-error-stream/imm32 444 # . . call 445 e8/call clear-stream/disp32 446 # . . discard args @@ -533,8 +533,8 @@ if ('onhashchange' in window) { 470 # get-num(in, out, err, ed) 471 # . . push args 472 50/push-EAX/ed -473 68/push _test-error-stream/imm32 -474 68/push _test-output-stream/imm32 +473 68/push _test-error-stream/imm32 +474 68/push _test-output-stream/imm32 475 68/push _test-buffered-file/imm32 476 # . . call 477 e8/call get-num/disp32 @@ -581,14 +581,14 @@ if ('onhashchange' in window) { 518 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 519 # . clear-stream(_test-output-stream) 520 # . . push args -521 68/push _test-output-stream/imm32 +521 68/push _test-output-stream/imm32 522 # . . call 523 e8/call clear-stream/disp32 524 # . . discard args 525 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 526 # . clear-stream(_test-error-stream) 527 # . . push args -528 68/push _test-error-stream/imm32 +528 68/push _test-error-stream/imm32 529 # . . call 530 e8/call clear-stream/disp32 531 # . . discard args @@ -619,14 +619,14 @@ if ('onhashchange' in window) { 556 # . . push args 557 68/push _test-buffered-file/imm32 558 # . . call -559 e8/call get-char/disp32 +559 e8/call get-char/disp32 560 # . . discard args 561 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 562 # get-num(in, out, err, ed) 563 # . . push args 564 50/push-EAX/ed -565 68/push _test-error-stream/imm32 -566 68/push _test-output-stream/imm32 +565 68/push _test-error-stream/imm32 +566 68/push _test-output-stream/imm32 567 68/push _test-buffered-file/imm32 568 # . . call 569 e8/call get-num/disp32 @@ -637,7 +637,7 @@ if ('onhashchange' in window) { 574 # . . push args 575 68/push "F - test-get-num-reads-multiple-digits"/imm32 576 68/push 0x36353433/imm32 -577 b8/copy-to-EAX _test-output-stream/imm32 +577 b8/copy-to-EAX _test-output-stream/imm32 578 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12) 579 # . . call 580 e8/call check-ints-equal/disp32 @@ -672,14 +672,14 @@ if ('onhashchange' in window) { 609 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 610 # . clear-stream(_test-output-stream) 611 # . . push args -612 68/push _test-output-stream/imm32 +612 68/push _test-output-stream/imm32 613 # . . call 614 e8/call clear-stream/disp32 615 # . . discard args 616 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 617 # . clear-stream(_test-error-stream) 618 # . . push args -619 68/push _test-error-stream/imm32 +619 68/push _test-error-stream/imm32 620 # . . call 621 e8/call clear-stream/disp32 622 # . . discard args @@ -710,14 +710,14 @@ if ('onhashchange' in window) { 647 # . . push args 648 68/push _test-buffered-file/imm32 649 # . . call -650 e8/call get-char/disp32 +650 e8/call get-char/disp32 651 # . . discard args 652 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 653 # get-num(in, out, err, ed) 654 # . . push args 655 50/push-EAX/ed -656 68/push _test-error-stream/imm32 -657 68/push _test-output-stream/imm32 +656 68/push _test-error-stream/imm32 +657 68/push _test-output-stream/imm32 658 68/push _test-buffered-file/imm32 659 # . . call 660 e8/call get-num/disp32 @@ -728,7 +728,7 @@ if ('onhashchange' in window) { 665 # . . push args 666 68/push "F - test-get-num-reads-multiple-digits-followed-by-nondigit"/imm32 667 68/push 0x36353433/imm32 -668 b8/copy-to-EAX _test-output-stream/imm32 +668 b8/copy-to-EAX _test-output-stream/imm32 669 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 . # push *(EAX+12) 670 # . . call 671 e8/call check-ints-equal/disp32 @@ -785,80 +785,89 @@ if ('onhashchange' in window) { 722 # . . call 723 e8/call stop/disp32 724 # should never get past this point -725 # . epilog -726 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -727 5d/pop-to-EBP -728 c3/return -729 -730 # read a byte from 'f', and save it in 'Look' -731 get-char: # f : (address buffered-file) -> <void> -732 # . prolog -733 55/push-EBP -734 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -735 # . save registers -736 50/push-EAX -737 # read-byte(f) -738 # . . push args -739 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) -740 # . . call -741 e8/call read-byte/disp32 -742 # . . discard args -743 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -744 # save EAX to Look -745 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy EAX to *Look -746 # . restore registers -747 58/pop-to-EAX -748 # . epilog -749 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -750 5d/pop-to-EBP -751 c3/return -752 -753 is-digit?: # c : int -> EAX : boolean -754 # . prolog -755 55/push-EBP -756 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -757 # EAX = false -758 b8/copy-to-EAX 0/imm32 -759 # if (c < '0') return false -760 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 0x30/imm32 # compare *(EBP+8) -761 7c/jump-if-lesser $is-digit?:end/disp8 -762 # if (c > '9') return false -763 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 0x39/imm32 # compare *(EBP+8) -764 7f/jump-if-greater $is-digit?:end/disp8 -765 # otherwise return true -766 b8/copy-to-EAX 1/imm32 -767 $is-digit?:end: -768 # . epilog -769 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -770 5d/pop-to-EBP -771 c3/return -772 -773 == data +725 $expected:dead-end: +726 # . epilog +727 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +728 5d/pop-to-EBP +729 c3/return +730 +731 # read a byte from 'f', and save it in 'Look' +732 get-char: # f : (address buffered-file) -> <void> +733 # . prolog +734 55/push-EBP +735 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +736 # . save registers +737 50/push-EAX +738 # read-byte(f) +739 # . . push args +740 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 . # push *(EBP+8) +741 # . . call +742 e8/call read-byte/disp32 +743 # . . discard args +744 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +745 # save EAX to Look +746 89/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/EAX Look/disp32 . # copy EAX to *Look +747 $get-char:end: +748 # . restore registers +749 58/pop-to-EAX +750 # . epilog +751 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +752 5d/pop-to-EBP +753 c3/return +754 +755 is-digit?: # c : int -> EAX : boolean +756 # . prolog +757 55/push-EBP +758 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +759 # EAX = false +760 b8/copy-to-EAX 0/imm32 +761 # if (c < '0') return false +762 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 0x30/imm32 # compare *(EBP+8) +763 7c/jump-if-lesser $is-digit?:end/disp8 +764 # if (c > '9') return false +765 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 0x39/imm32 # compare *(EBP+8) +766 7f/jump-if-greater $is-digit?:end/disp8 +767 # otherwise return true +768 b8/copy-to-EAX 1/imm32 +769 $is-digit?:end: +770 # . epilog +771 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +772 5d/pop-to-EBP +773 c3/return 774 -775 Look: # (char with some extra padding) -776 0/imm32 -777 -778 _test-output-stream: -779 # current write index -780 0/imm32 -781 # current read index +775 == data +776 +777 Look: # (char with some extra padding) +778 0/imm32 +779 +780 _test-output-stream: +781 # current write index 782 0/imm32 -783 # length -784 8/imm32 -785 # data -786 00 00 00 00 00 00 00 00 # 8 bytes -787 -788 _test-error-stream: -789 # current write index -790 0/imm32 -791 # current read index +783 # current read index +784 0/imm32 +785 # length +786 8/imm32 +787 # data +788 00 00 00 00 00 00 00 00 # 8 bytes +789 +790 _test-error-stream: +791 # current write index 792 0/imm32 -793 # length -794 8/imm32 -795 # data -796 00 00 00 00 00 00 00 00 # 8 bytes -797 -798 # . . vim:nowrap:textwidth=0 +793 # current read index +794 0/imm32 +795 # length +796 0x40/imm32 +797 # data +798 00 00 00 00 00 00 00 00 # 8 bytes +799 00 00 00 00 00 00 00 00 # 8 bytes +800 00 00 00 00 00 00 00 00 # 8 bytes +801 00 00 00 00 00 00 00 00 # 8 bytes +802 00 00 00 00 00 00 00 00 # 8 bytes +803 00 00 00 00 00 00 00 00 # 8 bytes +804 00 00 00 00 00 00 00 00 # 8 bytes +805 00 00 00 00 00 00 00 00 # 8 bytes +806 +807 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0