diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-12-02 20:43:39 -0800 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-12-02 22:41:28 -0800 |
commit | 0eb0f69616bb928359aed5ec137c973b14b03788 (patch) | |
tree | 30590486138c2611e9cf33e64f0c1952f528e0e6 | |
parent | ef31035a9f41ec38bb4e11a18770c3cf2d8eba09 (diff) | |
download | mu-0eb0f69616bb928359aed5ec137c973b14b03788.tar.gz |
4821
-rw-r--r-- | html/subx/061error.subx.html | 114 | ||||
-rw-r--r-- | html/subx/apps/crenshaw2-1.subx.html | 173 | ||||
-rw-r--r-- | html/subx/apps/crenshaw2-1b.subx.html | 173 | ||||
-rw-r--r-- | subx/061error.subx | 47 | ||||
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 6462 -> 6462 bytes | |||
-rw-r--r-- | subx/apps/crenshaw2-1.subx | 41 | ||||
-rwxr-xr-x | subx/apps/crenshaw2-1b | bin | 7023 -> 7023 bytes | |||
-rw-r--r-- | subx/apps/crenshaw2-1b.subx | 41 | ||||
-rwxr-xr-x | subx/apps/factorial | bin | 5262 -> 5353 bytes |
9 files changed, 293 insertions, 296 deletions
diff --git a/html/subx/061error.subx.html b/html/subx/061error.subx.html new file mode 100644 index 00000000..a606c428 --- /dev/null +++ b/html/subx/061error.subx.html @@ -0,0 +1,114 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> +<html> +<head> +<meta http-equiv="content-type" content="text/html; charset=UTF-8"> +<title>Mu - subx/061error.subx</title> +<meta name="Generator" content="Vim/8.0"> +<meta name="plugin-version" content="vim7.4_v2"> +<meta name="syntax" content="none"> +<meta name="settings" content="number_lines,use_css,pre_wrap,no_foldcolumn,expand_tabs,line_ids,prevent_copy="> +<meta name="colorscheme" content="minimal"> +<style type="text/css"> +<!-- +pre { white-space: pre-wrap; font-family: monospace; color: #aaaaaa; background-color: #080808; } +body { font-size:12pt; font-family: monospace; color: #aaaaaa; background-color: #080808; } +.subxS2Comment a { color:inherit; } +.subxS1Comment a { color:inherit; } +.subxComment a { color:inherit; } +.subxH2Comment a { color:inherit; } +.subxH1Comment a { color:inherit; } +* { font-size:12pt; font-size: 1em; } +.subxComment { color:#16bfff; } +.subxS2Comment { color:#4466ff; } +.LineNr { color:#444444; } +.subxS1Comment { color:#2d8cff; } +.CommentedCode { color: #6c6c6c; } +.subxFunction { color: #ff8700; } +.Constant { color:#00a0a0; } +.SpecialChar { color: #ff0000; } +--> +</style> + +<script type='text/javascript'> +<!-- + +/* function to open any folds containing a jumped-to line before jumping to it */ +function JumpToLine() +{ + var lineNum; + lineNum = window.location.hash; + lineNum = lineNum.substr(1); /* strip off '#' */ + + if (lineNum.indexOf('L') == -1) { + lineNum = 'L'+lineNum; + } + lineElem = document.getElementById(lineNum); + /* Always jump to new location even if the line was hidden inside a fold, or + * we corrected the raw number to a line ID. + */ + if (lineElem) { + lineElem.scrollIntoView(true); + } + return true; +} +if ('onhashchange' in window) { + window.onhashchange = JumpToLine; +} + +--> +</script> +</head> +<body onload='JumpToLine();'> +<a href='https://github.com/akkartik/mu/blob/master/subx/061error.subx'>https://github.com/akkartik/mu/blob/master/subx/061error.subx</a> +<pre id='vimCodeElement'> +<span id="L1" class="LineNr"> 1 </span><span class="subxComment"># Print an error message and exit.</span> +<span id="L2" class="LineNr"> 2 </span> +<span id="L3" class="LineNr"> 3 </span>== code +<span id="L4" class="LineNr"> 4 </span><span class="subxComment"># instruction effective address register displacement immediate</span> +<span id="L5" class="LineNr"> 5 </span><span class="subxS1Comment"># . op subop mod rm32 base index scale r32</span> +<span id="L6" class="LineNr"> 6 </span><span class="subxS1Comment"># . 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</span> +<span id="L7" class="LineNr"> 7 </span> +<span id="L8" class="LineNr"> 8 </span><span class="subxComment"># write(out, "Error: "+msg+"\n") then stop(ed, 1)</span> +<span id="L9" class="LineNr"> 9 </span><span class="subxFunction">error</span>: <span class="subxComment"># ed : (address exit-descriptor), out : fd or (address stream), msg : (address array byte) -> <void></span> +<span id="L10" class="LineNr">10 </span> <span class="subxS1Comment"># . prolog</span> +<span id="L11" class="LineNr">11 </span> 55/push-EBP +<span id="L12" class="LineNr">12 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> +<span id="L13" class="LineNr">13 </span> <span class="subxComment"># write(out, "Error: ")</span> +<span id="L14" class="LineNr">14 </span> <span class="subxS2Comment"># . . push args</span> +<span id="L15" class="LineNr">15 </span> 68/push <span class="Constant">"Error: "</span>/imm32 +<span id="L16" class="LineNr">16 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> +<span id="L17" class="LineNr">17 </span> <span class="subxS2Comment"># . . call</span> +<span id="L18" class="LineNr">18 </span> e8/call write/disp32 +<span id="L19" class="LineNr">19 </span> <span class="subxS2Comment"># . . discard args</span> +<span id="L20" class="LineNr">20 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> +<span id="L21" class="LineNr">21 </span> <span class="subxComment"># write(out, msg)</span> +<span id="L22" class="LineNr">22 </span> <span class="subxS2Comment"># . . push args</span> +<span id="L23" class="LineNr">23 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+16)</span> +<span id="L24" class="LineNr">24 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> +<span id="L25" class="LineNr">25 </span> <span class="subxS2Comment"># . . call</span> +<span id="L26" class="LineNr">26 </span> e8/call write/disp32 +<span id="L27" class="LineNr">27 </span> <span class="subxS2Comment"># . . discard args</span> +<span id="L28" class="LineNr">28 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> +<span id="L29" class="LineNr">29 </span> <span class="subxComment"># write(out, Newline)</span> +<span id="L30" class="LineNr">30 </span> <span class="subxS2Comment"># . . push args</span> +<span id="L31" class="LineNr">31 </span> 68/push <span class="SpecialChar">Newline</span>/imm32 +<span id="L32" class="LineNr">32 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> +<span id="L33" class="LineNr">33 </span> <span class="subxS2Comment"># . . call</span> +<span id="L34" class="LineNr">34 </span> e8/call write/disp32 +<span id="L35" class="LineNr">35 </span> <span class="subxS2Comment"># . . discard args</span> +<span id="L36" class="LineNr">36 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> +<span id="L37" class="LineNr">37 </span> <span class="subxComment"># stop(ed, 1)</span> +<span id="L38" class="LineNr">38 </span> <span class="subxS2Comment"># . . push args</span> +<span id="L39" class="LineNr">39 </span> 68/push 1/imm32 +<span id="L40" class="LineNr">40 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> +<span id="L41" class="LineNr">41 </span> <span class="subxS2Comment"># . . call</span> +<span id="L42" class="LineNr">42 </span> e8/call stop/disp32 +<span id="L43" class="LineNr">43 </span> <span class="subxComment"># should never get past this point</span> +<span id="L44" class="LineNr">44 </span> <span class="subxS1Comment"># . epilog</span> +<span id="L45" class="LineNr">45 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> +<span id="L46" class="LineNr">46 </span> 5d/pop-to-EBP +<span id="L47" class="LineNr">47 </span> c3/return +</pre> +</body> +</html> +<!-- vim: set foldmethod=manual : --> 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) { <span id="L526" class="LineNr">526 </span> 5d/pop-to-EBP <span id="L527" class="LineNr">527 </span> c3/return <span id="L528" class="LineNr">528 </span> -<span id="L529" class="LineNr">529 </span><span class="subxComment"># write(f, "Error: "+s+"\n") then stop(ed, 1)</span> -<span id="L530" class="LineNr">530 </span><span class="subxFunction">error</span>: <span class="subxComment"># ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void></span> +<span id="L529" class="LineNr">529 </span><span class="subxComment"># read a byte from 'f', and save it in 'Look'</span> +<span id="L530" class="LineNr">530 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (address buffered-file) -> <void></span> <span id="L531" class="LineNr">531 </span> <span class="subxS1Comment"># . prolog</span> <span id="L532" class="LineNr">532 </span> 55/push-EBP <span id="L533" class="LineNr">533 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> -<span id="L534" class="LineNr">534 </span> <span class="subxComment"># write(f, "Error: ")</span> -<span id="L535" class="LineNr">535 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L536" class="LineNr">536 </span> 68/push <span class="Constant">"Error: "</span>/imm32 -<span id="L537" class="LineNr">537 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> -<span id="L538" class="LineNr">538 </span> <span class="subxS2Comment"># . . call</span> -<span id="L539" class="LineNr">539 </span> e8/call write/disp32 -<span id="L540" class="LineNr">540 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L541" class="LineNr">541 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> -<span id="L542" class="LineNr">542 </span> <span class="subxComment"># write(f, s)</span> -<span id="L543" class="LineNr">543 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L544" class="LineNr">544 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+16)</span> -<span id="L545" class="LineNr">545 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> -<span id="L546" class="LineNr">546 </span> <span class="subxS2Comment"># . . call</span> -<span id="L547" class="LineNr">547 </span> e8/call write/disp32 -<span id="L548" class="LineNr">548 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L549" class="LineNr">549 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> -<span id="L550" class="LineNr">550 </span> <span class="subxComment"># write(f, Newline)</span> -<span id="L551" class="LineNr">551 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L552" class="LineNr">552 </span> 68/push <span class="SpecialChar">Newline</span>/imm32 -<span id="L553" class="LineNr">553 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> -<span id="L554" class="LineNr">554 </span> <span class="subxS2Comment"># . . call</span> -<span id="L555" class="LineNr">555 </span> e8/call write/disp32 -<span id="L556" class="LineNr">556 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L557" class="LineNr">557 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> -<span id="L558" class="LineNr">558 </span> <span class="subxComment"># stop(ed, 1)</span> -<span id="L559" class="LineNr">559 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L560" class="LineNr">560 </span> 68/push 1/imm32 -<span id="L561" class="LineNr">561 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> -<span id="L562" class="LineNr">562 </span> <span class="subxS2Comment"># . . call</span> -<span id="L563" class="LineNr">563 </span> e8/call stop/disp32 -<span id="L564" class="LineNr">564 </span> <span class="subxComment"># should never get past this point</span> -<span id="L565" class="LineNr">565 </span> <span class="subxS1Comment"># . epilog</span> -<span id="L566" class="LineNr">566 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> -<span id="L567" class="LineNr">567 </span> 5d/pop-to-EBP -<span id="L568" class="LineNr">568 </span> c3/return -<span id="L569" class="LineNr">569 </span> -<span id="L570" class="LineNr">570 </span><span class="subxComment"># read a byte from 'f', and save it in 'Look'</span> -<span id="L571" class="LineNr">571 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (address buffered-file) -> <void></span> -<span id="L572" class="LineNr">572 </span> <span class="subxS1Comment"># . prolog</span> -<span id="L573" class="LineNr">573 </span> 55/push-EBP -<span id="L574" class="LineNr">574 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> -<span id="L575" class="LineNr">575 </span> <span class="subxS1Comment"># . save registers</span> -<span id="L576" class="LineNr">576 </span> 50/push-EAX -<span id="L577" class="LineNr">577 </span> <span class="subxComment"># read-byte(f)</span> -<span id="L578" class="LineNr">578 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L579" class="LineNr">579 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> -<span id="L580" class="LineNr">580 </span> <span class="subxS2Comment"># . . call</span> -<span id="L581" class="LineNr">581 </span> e8/call read-byte/disp32 -<span id="L582" class="LineNr">582 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L583" class="LineNr">583 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/imm32 <span class="subxComment"># add to ESP</span> -<span id="L584" class="LineNr">584 </span> <span class="subxComment"># save EAX to Look</span> -<span id="L585" class="LineNr">585 </span> 89/copy 0/mod/indirect 5/rm32/.disp32 <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="SpecialChar">Look</span>/disp32 <span class="CommentedCode"> . </span> <span class="subxComment"># copy EAX to *Look</span> -<span id="L586" class="LineNr">586 </span> <span class="subxS1Comment"># . restore registers</span> -<span id="L587" class="LineNr">587 </span> 58/pop-to-EAX -<span id="L588" class="LineNr">588 </span> <span class="subxS1Comment"># . epilog</span> -<span id="L589" class="LineNr">589 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> -<span id="L590" class="LineNr">590 </span> 5d/pop-to-EBP -<span id="L591" class="LineNr">591 </span> c3/return -<span id="L592" class="LineNr">592 </span> -<span id="L593" class="LineNr">593 </span>is-digit?: <span class="subxComment"># c : int -> bool/EAX</span> -<span id="L594" class="LineNr">594 </span> <span class="subxS1Comment"># . prolog</span> -<span id="L595" class="LineNr">595 </span> 55/push-EBP -<span id="L596" class="LineNr">596 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> -<span id="L597" class="LineNr">597 </span> <span class="subxComment"># EAX = false</span> -<span id="L598" class="LineNr">598 </span> b8/copy-to-EAX 0/imm32 -<span id="L599" class="LineNr">599 </span> <span class="subxComment"># if c < '0' return false</span> -<span id="L600" class="LineNr">600 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x30/imm32 <span class="subxComment"># compare *(EBP+8)</span> -<span id="L601" class="LineNr">601 </span> 7c/jump-if-lesser $is-digit?:end/disp8 -<span id="L602" class="LineNr">602 </span> <span class="subxComment"># if c > '9' return false</span> -<span id="L603" class="LineNr">603 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x39/imm32 <span class="subxComment"># compare *(EBP+8)</span> -<span id="L604" class="LineNr">604 </span> 7f/jump-if-greater $is-digit?:end/disp8 -<span id="L605" class="LineNr">605 </span> <span class="subxComment"># otherwise return true</span> -<span id="L606" class="LineNr">606 </span> b8/copy-to-EAX 1/imm32 -<span id="L607" class="LineNr">607 </span>$is-digit?:end: -<span id="L608" class="LineNr">608 </span> <span class="subxS1Comment"># . epilog</span> -<span id="L609" class="LineNr">609 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> -<span id="L610" class="LineNr">610 </span> 5d/pop-to-EBP -<span id="L611" class="LineNr">611 </span> c3/return -<span id="L612" class="LineNr">612 </span> -<span id="L613" class="LineNr">613 </span>== data -<span id="L614" class="LineNr">614 </span> -<span id="L615" class="LineNr">615 </span><span class="SpecialChar">Look</span>: <span class="subxComment"># (char)</span> -<span id="L616" class="LineNr">616 </span> 00 00 00 00 <span class="subxComment"># = 0</span> -<span id="L617" class="LineNr">617 </span> -<span id="L618" class="LineNr">618 </span><span class="subxMinorFunction">_test-output-stream</span>: -<span id="L619" class="LineNr">619 </span> <span class="subxComment"># current write index</span> -<span id="L620" class="LineNr">620 </span> 00 00 00 00 -<span id="L621" class="LineNr">621 </span> <span class="subxComment"># current read index</span> -<span id="L622" class="LineNr">622 </span> 00 00 00 00 -<span id="L623" class="LineNr">623 </span> <span class="subxComment"># length (= 8)</span> -<span id="L624" class="LineNr">624 </span> 08 00 00 00 -<span id="L625" class="LineNr">625 </span> <span class="subxComment"># data</span> -<span id="L626" class="LineNr">626 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> -<span id="L627" class="LineNr">627 </span> -<span id="L628" class="LineNr">628 </span><span class="subxMinorFunction">_test-error-stream</span>: -<span id="L629" class="LineNr">629 </span> <span class="subxComment"># current write index</span> -<span id="L630" class="LineNr">630 </span> 00 00 00 00 -<span id="L631" class="LineNr">631 </span> <span class="subxComment"># current read index</span> -<span id="L632" class="LineNr">632 </span> 00 00 00 00 -<span id="L633" class="LineNr">633 </span> <span class="subxComment"># length (= 8)</span> -<span id="L634" class="LineNr">634 </span> 08 00 00 00 -<span id="L635" class="LineNr">635 </span> <span class="subxComment"># data</span> -<span id="L636" class="LineNr">636 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> -<span id="L637" class="LineNr">637 </span> -<span id="L638" class="LineNr">638 </span><span class="subxS2Comment"># . . vim:nowrap:textwidth=0</span> +<span id="L534" class="LineNr">534 </span> <span class="subxS1Comment"># . save registers</span> +<span id="L535" class="LineNr">535 </span> 50/push-EAX +<span id="L536" class="LineNr">536 </span> <span class="subxComment"># read-byte(f)</span> +<span id="L537" class="LineNr">537 </span> <span class="subxS2Comment"># . . push args</span> +<span id="L538" class="LineNr">538 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> +<span id="L539" class="LineNr">539 </span> <span class="subxS2Comment"># . . call</span> +<span id="L540" class="LineNr">540 </span> e8/call read-byte/disp32 +<span id="L541" class="LineNr">541 </span> <span class="subxS2Comment"># . . discard args</span> +<span id="L542" class="LineNr">542 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/imm32 <span class="subxComment"># add to ESP</span> +<span id="L543" class="LineNr">543 </span> <span class="subxComment"># save EAX to Look</span> +<span id="L544" class="LineNr">544 </span> 89/copy 0/mod/indirect 5/rm32/.disp32 <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="SpecialChar">Look</span>/disp32 <span class="CommentedCode"> . </span> <span class="subxComment"># copy EAX to *Look</span> +<span id="L545" class="LineNr">545 </span> <span class="subxS1Comment"># . restore registers</span> +<span id="L546" class="LineNr">546 </span> 58/pop-to-EAX +<span id="L547" class="LineNr">547 </span> <span class="subxS1Comment"># . epilog</span> +<span id="L548" class="LineNr">548 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> +<span id="L549" class="LineNr">549 </span> 5d/pop-to-EBP +<span id="L550" class="LineNr">550 </span> c3/return +<span id="L551" class="LineNr">551 </span> +<span id="L552" class="LineNr">552 </span>is-digit?: <span class="subxComment"># c : int -> bool/EAX</span> +<span id="L553" class="LineNr">553 </span> <span class="subxS1Comment"># . prolog</span> +<span id="L554" class="LineNr">554 </span> 55/push-EBP +<span id="L555" class="LineNr">555 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> +<span id="L556" class="LineNr">556 </span> <span class="subxComment"># EAX = false</span> +<span id="L557" class="LineNr">557 </span> b8/copy-to-EAX 0/imm32 +<span id="L558" class="LineNr">558 </span> <span class="subxComment"># if c < '0' return false</span> +<span id="L559" class="LineNr">559 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x30/imm32 <span class="subxComment"># compare *(EBP+8)</span> +<span id="L560" class="LineNr">560 </span> 7c/jump-if-lesser $is-digit?:end/disp8 +<span id="L561" class="LineNr">561 </span> <span class="subxComment"># if c > '9' return false</span> +<span id="L562" class="LineNr">562 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x39/imm32 <span class="subxComment"># compare *(EBP+8)</span> +<span id="L563" class="LineNr">563 </span> 7f/jump-if-greater $is-digit?:end/disp8 +<span id="L564" class="LineNr">564 </span> <span class="subxComment"># otherwise return true</span> +<span id="L565" class="LineNr">565 </span> b8/copy-to-EAX 1/imm32 +<span id="L566" class="LineNr">566 </span>$is-digit?:end: +<span id="L567" class="LineNr">567 </span> <span class="subxS1Comment"># . epilog</span> +<span id="L568" class="LineNr">568 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> +<span id="L569" class="LineNr">569 </span> 5d/pop-to-EBP +<span id="L570" class="LineNr">570 </span> c3/return +<span id="L571" class="LineNr">571 </span> +<span id="L572" class="LineNr">572 </span>== data +<span id="L573" class="LineNr">573 </span> +<span id="L574" class="LineNr">574 </span><span class="SpecialChar">Look</span>: <span class="subxComment"># (char)</span> +<span id="L575" class="LineNr">575 </span> 00 00 00 00 <span class="subxComment"># = 0</span> +<span id="L576" class="LineNr">576 </span> +<span id="L577" class="LineNr">577 </span><span class="subxMinorFunction">_test-output-stream</span>: +<span id="L578" class="LineNr">578 </span> <span class="subxComment"># current write index</span> +<span id="L579" class="LineNr">579 </span> 00 00 00 00 +<span id="L580" class="LineNr">580 </span> <span class="subxComment"># current read index</span> +<span id="L581" class="LineNr">581 </span> 00 00 00 00 +<span id="L582" class="LineNr">582 </span> <span class="subxComment"># length (= 8)</span> +<span id="L583" class="LineNr">583 </span> 08 00 00 00 +<span id="L584" class="LineNr">584 </span> <span class="subxComment"># data</span> +<span id="L585" class="LineNr">585 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> +<span id="L586" class="LineNr">586 </span> +<span id="L587" class="LineNr">587 </span><span class="subxMinorFunction">_test-error-stream</span>: +<span id="L588" class="LineNr">588 </span> <span class="subxComment"># current write index</span> +<span id="L589" class="LineNr">589 </span> 00 00 00 00 +<span id="L590" class="LineNr">590 </span> <span class="subxComment"># current read index</span> +<span id="L591" class="LineNr">591 </span> 00 00 00 00 +<span id="L592" class="LineNr">592 </span> <span class="subxComment"># length (= 8)</span> +<span id="L593" class="LineNr">593 </span> 08 00 00 00 +<span id="L594" class="LineNr">594 </span> <span class="subxComment"># data</span> +<span id="L595" class="LineNr">595 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> +<span id="L596" class="LineNr">596 </span> +<span id="L597" class="LineNr">597 </span><span class="subxS2Comment"># . . vim:nowrap:textwidth=0</span> </pre> </body> </html> 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) { <span id="L725" class="LineNr">725 </span> 5d/pop-to-EBP <span id="L726" class="LineNr">726 </span> c3/return <span id="L727" class="LineNr">727 </span> -<span id="L728" class="LineNr">728 </span><span class="subxComment"># write(f, "Error: "+s+"\n") then stop(ed, 1)</span> -<span id="L729" class="LineNr">729 </span><span class="subxFunction">error</span>: <span class="subxComment"># ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void></span> +<span id="L728" class="LineNr">728 </span><span class="subxComment"># read a byte from 'f', and save it in 'Look'</span> +<span id="L729" class="LineNr">729 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (address buffered-file) -> <void></span> <span id="L730" class="LineNr">730 </span> <span class="subxS1Comment"># . prolog</span> <span id="L731" class="LineNr">731 </span> 55/push-EBP <span id="L732" class="LineNr">732 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> -<span id="L733" class="LineNr">733 </span> <span class="subxComment"># write(f, "Error: ")</span> -<span id="L734" class="LineNr">734 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L735" class="LineNr">735 </span> 68/push <span class="Constant">"Error: "</span>/imm32 -<span id="L736" class="LineNr">736 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> -<span id="L737" class="LineNr">737 </span> <span class="subxS2Comment"># . . call</span> -<span id="L738" class="LineNr">738 </span> e8/call write/disp32 -<span id="L739" class="LineNr">739 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L740" class="LineNr">740 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> -<span id="L741" class="LineNr">741 </span> <span class="subxComment"># write(f, s)</span> -<span id="L742" class="LineNr">742 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L743" class="LineNr">743 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x10/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+16)</span> -<span id="L744" class="LineNr">744 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> -<span id="L745" class="LineNr">745 </span> <span class="subxS2Comment"># . . call</span> -<span id="L746" class="LineNr">746 </span> e8/call write/disp32 -<span id="L747" class="LineNr">747 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L748" class="LineNr">748 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> -<span id="L749" class="LineNr">749 </span> <span class="subxComment"># write(f, Newline)</span> -<span id="L750" class="LineNr">750 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L751" class="LineNr">751 </span> 68/push <span class="SpecialChar">Newline</span>/imm32 -<span id="L752" class="LineNr">752 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0xc/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+12)</span> -<span id="L753" class="LineNr">753 </span> <span class="subxS2Comment"># . . call</span> -<span id="L754" class="LineNr">754 </span> e8/call write/disp32 -<span id="L755" class="LineNr">755 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L756" class="LineNr">756 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/imm32 <span class="subxComment"># add to ESP</span> -<span id="L757" class="LineNr">757 </span> <span class="subxComment"># stop(ed, 1)</span> -<span id="L758" class="LineNr">758 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L759" class="LineNr">759 </span> 68/push 1/imm32 -<span id="L760" class="LineNr">760 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> -<span id="L761" class="LineNr">761 </span> <span class="subxS2Comment"># . . call</span> -<span id="L762" class="LineNr">762 </span> e8/call stop/disp32 -<span id="L763" class="LineNr">763 </span> <span class="subxComment"># should never get past this point</span> -<span id="L764" class="LineNr">764 </span> <span class="subxS1Comment"># . epilog</span> -<span id="L765" class="LineNr">765 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> -<span id="L766" class="LineNr">766 </span> 5d/pop-to-EBP -<span id="L767" class="LineNr">767 </span> c3/return -<span id="L768" class="LineNr">768 </span> -<span id="L769" class="LineNr">769 </span><span class="subxComment"># read a byte from 'f', and save it in 'Look'</span> -<span id="L770" class="LineNr">770 </span><span class="subxFunction">get-char</span>: <span class="subxComment"># f : (address buffered-file) -> <void></span> -<span id="L771" class="LineNr">771 </span> <span class="subxS1Comment"># . prolog</span> -<span id="L772" class="LineNr">772 </span> 55/push-EBP -<span id="L773" class="LineNr">773 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> -<span id="L774" class="LineNr">774 </span> <span class="subxS1Comment"># . save registers</span> -<span id="L775" class="LineNr">775 </span> 50/push-EAX -<span id="L776" class="LineNr">776 </span> <span class="subxComment"># read-byte(f)</span> -<span id="L777" class="LineNr">777 </span> <span class="subxS2Comment"># . . push args</span> -<span id="L778" class="LineNr">778 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> -<span id="L779" class="LineNr">779 </span> <span class="subxS2Comment"># . . call</span> -<span id="L780" class="LineNr">780 </span> e8/call read-byte/disp32 -<span id="L781" class="LineNr">781 </span> <span class="subxS2Comment"># . . discard args</span> -<span id="L782" class="LineNr">782 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/imm32 <span class="subxComment"># add to ESP</span> -<span id="L783" class="LineNr">783 </span> <span class="subxComment"># save EAX to Look</span> -<span id="L784" class="LineNr">784 </span> 89/copy 0/mod/indirect 5/rm32/.disp32 <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="SpecialChar">Look</span>/disp32 <span class="CommentedCode"> . </span> <span class="subxComment"># copy EAX to *Look</span> -<span id="L785" class="LineNr">785 </span> <span class="subxS1Comment"># . restore registers</span> -<span id="L786" class="LineNr">786 </span> 58/pop-to-EAX -<span id="L787" class="LineNr">787 </span> <span class="subxS1Comment"># . epilog</span> -<span id="L788" class="LineNr">788 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> -<span id="L789" class="LineNr">789 </span> 5d/pop-to-EBP -<span id="L790" class="LineNr">790 </span> c3/return -<span id="L791" class="LineNr">791 </span> -<span id="L792" class="LineNr">792 </span>is-digit?: <span class="subxComment"># c : int -> bool/EAX</span> -<span id="L793" class="LineNr">793 </span> <span class="subxS1Comment"># . prolog</span> -<span id="L794" class="LineNr">794 </span> 55/push-EBP -<span id="L795" class="LineNr">795 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> -<span id="L796" class="LineNr">796 </span> <span class="subxComment"># EAX = false</span> -<span id="L797" class="LineNr">797 </span> b8/copy-to-EAX 0/imm32 -<span id="L798" class="LineNr">798 </span> <span class="subxComment"># if c < '0' return false</span> -<span id="L799" class="LineNr">799 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x30/imm32 <span class="subxComment"># compare *(EBP+8)</span> -<span id="L800" class="LineNr">800 </span> 7c/jump-if-lesser $is-digit?:end/disp8 -<span id="L801" class="LineNr">801 </span> <span class="subxComment"># if c > '9' return false</span> -<span id="L802" class="LineNr">802 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x39/imm32 <span class="subxComment"># compare *(EBP+8)</span> -<span id="L803" class="LineNr">803 </span> 7f/jump-if-greater $is-digit?:end/disp8 -<span id="L804" class="LineNr">804 </span> <span class="subxComment"># otherwise return true</span> -<span id="L805" class="LineNr">805 </span> b8/copy-to-EAX 1/imm32 -<span id="L806" class="LineNr">806 </span>$is-digit?:end: -<span id="L807" class="LineNr">807 </span> <span class="subxS1Comment"># . epilog</span> -<span id="L808" class="LineNr">808 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> -<span id="L809" class="LineNr">809 </span> 5d/pop-to-EBP -<span id="L810" class="LineNr">810 </span> c3/return -<span id="L811" class="LineNr">811 </span> -<span id="L812" class="LineNr">812 </span>== data -<span id="L813" class="LineNr">813 </span> -<span id="L814" class="LineNr">814 </span><span class="SpecialChar">Look</span>: <span class="subxComment"># (char)</span> -<span id="L815" class="LineNr">815 </span> 00 00 00 00 <span class="subxComment"># = 0</span> -<span id="L816" class="LineNr">816 </span> -<span id="L817" class="LineNr">817 </span><span class="subxMinorFunction">_test-output-stream</span>: -<span id="L818" class="LineNr">818 </span> <span class="subxComment"># current write index</span> -<span id="L819" class="LineNr">819 </span> 00 00 00 00 -<span id="L820" class="LineNr">820 </span> <span class="subxComment"># current read index</span> -<span id="L821" class="LineNr">821 </span> 00 00 00 00 -<span id="L822" class="LineNr">822 </span> <span class="subxComment"># length (= 8)</span> -<span id="L823" class="LineNr">823 </span> 08 00 00 00 -<span id="L824" class="LineNr">824 </span> <span class="subxComment"># data</span> -<span id="L825" class="LineNr">825 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> -<span id="L826" class="LineNr">826 </span> -<span id="L827" class="LineNr">827 </span><span class="subxMinorFunction">_test-error-stream</span>: -<span id="L828" class="LineNr">828 </span> <span class="subxComment"># current write index</span> -<span id="L829" class="LineNr">829 </span> 00 00 00 00 -<span id="L830" class="LineNr">830 </span> <span class="subxComment"># current read index</span> -<span id="L831" class="LineNr">831 </span> 00 00 00 00 -<span id="L832" class="LineNr">832 </span> <span class="subxComment"># length (= 8)</span> -<span id="L833" class="LineNr">833 </span> 08 00 00 00 -<span id="L834" class="LineNr">834 </span> <span class="subxComment"># data</span> -<span id="L835" class="LineNr">835 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> -<span id="L836" class="LineNr">836 </span> -<span id="L837" class="LineNr">837 </span><span class="subxS2Comment"># . . vim:nowrap:textwidth=0</span> +<span id="L733" class="LineNr">733 </span> <span class="subxS1Comment"># . save registers</span> +<span id="L734" class="LineNr">734 </span> 50/push-EAX +<span id="L735" class="LineNr">735 </span> <span class="subxComment"># read-byte(f)</span> +<span id="L736" class="LineNr">736 </span> <span class="subxS2Comment"># . . push args</span> +<span id="L737" class="LineNr">737 </span> ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 <span class="CommentedCode"> . </span> <span class="subxComment"># push *(EBP+8)</span> +<span id="L738" class="LineNr">738 </span> <span class="subxS2Comment"># . . call</span> +<span id="L739" class="LineNr">739 </span> e8/call read-byte/disp32 +<span id="L740" class="LineNr">740 </span> <span class="subxS2Comment"># . . discard args</span> +<span id="L741" class="LineNr">741 </span> 81 0/subop/add 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/imm32 <span class="subxComment"># add to ESP</span> +<span id="L742" class="LineNr">742 </span> <span class="subxComment"># save EAX to Look</span> +<span id="L743" class="LineNr">743 </span> 89/copy 0/mod/indirect 5/rm32/.disp32 <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0/r32/EAX <span class="SpecialChar">Look</span>/disp32 <span class="CommentedCode"> . </span> <span class="subxComment"># copy EAX to *Look</span> +<span id="L744" class="LineNr">744 </span> <span class="subxS1Comment"># . restore registers</span> +<span id="L745" class="LineNr">745 </span> 58/pop-to-EAX +<span id="L746" class="LineNr">746 </span> <span class="subxS1Comment"># . epilog</span> +<span id="L747" class="LineNr">747 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> +<span id="L748" class="LineNr">748 </span> 5d/pop-to-EBP +<span id="L749" class="LineNr">749 </span> c3/return +<span id="L750" class="LineNr">750 </span> +<span id="L751" class="LineNr">751 </span>is-digit?: <span class="subxComment"># c : int -> bool/EAX</span> +<span id="L752" class="LineNr">752 </span> <span class="subxS1Comment"># . prolog</span> +<span id="L753" class="LineNr">753 </span> 55/push-EBP +<span id="L754" class="LineNr">754 </span> 89/copy 3/mod/direct 5/rm32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 4/r32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy ESP to EBP</span> +<span id="L755" class="LineNr">755 </span> <span class="subxComment"># EAX = false</span> +<span id="L756" class="LineNr">756 </span> b8/copy-to-EAX 0/imm32 +<span id="L757" class="LineNr">757 </span> <span class="subxComment"># if c < '0' return false</span> +<span id="L758" class="LineNr">758 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x30/imm32 <span class="subxComment"># compare *(EBP+8)</span> +<span id="L759" class="LineNr">759 </span> 7c/jump-if-lesser $is-digit?:end/disp8 +<span id="L760" class="LineNr">760 </span> <span class="subxComment"># if c > '9' return false</span> +<span id="L761" class="LineNr">761 </span> 81 7/subop/compare 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 0x8/disp8 0x39/imm32 <span class="subxComment"># compare *(EBP+8)</span> +<span id="L762" class="LineNr">762 </span> 7f/jump-if-greater $is-digit?:end/disp8 +<span id="L763" class="LineNr">763 </span> <span class="subxComment"># otherwise return true</span> +<span id="L764" class="LineNr">764 </span> b8/copy-to-EAX 1/imm32 +<span id="L765" class="LineNr">765 </span>$is-digit?:end: +<span id="L766" class="LineNr">766 </span> <span class="subxS1Comment"># . epilog</span> +<span id="L767" class="LineNr">767 </span> 89/copy 3/mod/direct 4/rm32/ESP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> 5/r32/EBP <span class="CommentedCode"> . </span> <span class="CommentedCode"> . </span> <span class="subxComment"># copy EBP to ESP</span> +<span id="L768" class="LineNr">768 </span> 5d/pop-to-EBP +<span id="L769" class="LineNr">769 </span> c3/return +<span id="L770" class="LineNr">770 </span> +<span id="L771" class="LineNr">771 </span>== data +<span id="L772" class="LineNr">772 </span> +<span id="L773" class="LineNr">773 </span><span class="SpecialChar">Look</span>: <span class="subxComment"># (char)</span> +<span id="L774" class="LineNr">774 </span> 00 00 00 00 <span class="subxComment"># = 0</span> +<span id="L775" class="LineNr">775 </span> +<span id="L776" class="LineNr">776 </span><span class="subxMinorFunction">_test-output-stream</span>: +<span id="L777" class="LineNr">777 </span> <span class="subxComment"># current write index</span> +<span id="L778" class="LineNr">778 </span> 00 00 00 00 +<span id="L779" class="LineNr">779 </span> <span class="subxComment"># current read index</span> +<span id="L780" class="LineNr">780 </span> 00 00 00 00 +<span id="L781" class="LineNr">781 </span> <span class="subxComment"># length (= 8)</span> +<span id="L782" class="LineNr">782 </span> 08 00 00 00 +<span id="L783" class="LineNr">783 </span> <span class="subxComment"># data</span> +<span id="L784" class="LineNr">784 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> +<span id="L785" class="LineNr">785 </span> +<span id="L786" class="LineNr">786 </span><span class="subxMinorFunction">_test-error-stream</span>: +<span id="L787" class="LineNr">787 </span> <span class="subxComment"># current write index</span> +<span id="L788" class="LineNr">788 </span> 00 00 00 00 +<span id="L789" class="LineNr">789 </span> <span class="subxComment"># current read index</span> +<span id="L790" class="LineNr">790 </span> 00 00 00 00 +<span id="L791" class="LineNr">791 </span> <span class="subxComment"># length (= 8)</span> +<span id="L792" class="LineNr">792 </span> 08 00 00 00 +<span id="L793" class="LineNr">793 </span> <span class="subxComment"># data</span> +<span id="L794" class="LineNr">794 </span> 00 00 00 00 00 00 00 00 <span class="subxComment"># 8 bytes</span> +<span id="L795" class="LineNr">795 </span> +<span id="L796" class="LineNr">796 </span><span class="subxS2Comment"># . . vim:nowrap:textwidth=0</span> </pre> </body> </html> diff --git a/subx/061error.subx b/subx/061error.subx new file mode 100644 index 00000000..b03cfde2 --- /dev/null +++ b/subx/061error.subx @@ -0,0 +1,47 @@ +# Print an error message and exit. + +== code +# instruction effective address register displacement immediate +# . op subop mod rm32 base index scale r32 +# . 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 + +# write(out, "Error: "+msg+"\n") then stop(ed, 1) +error: # ed : (address exit-descriptor), out : fd or (address stream), msg : (address array byte) -> <void> + # . prolog + 55/push-EBP + 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP + # write(out, "Error: ") + # . . push args + 68/push "Error: "/imm32 + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # write(out, msg) + # . . push args + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # write(out, Newline) + # . . push args + 68/push Newline/imm32 + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) + # . . call + e8/call write/disp32 + # . . discard args + 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP + # stop(ed, 1) + # . . push args + 68/push 1/imm32 + ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) + # . . call + e8/call stop/disp32 + # should never get past this point + # . epilog + 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP + 5d/pop-to-EBP + c3/return diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 962c6d53..a02751f0 100755 --- a/subx/apps/crenshaw2-1 +++ b/subx/apps/crenshaw2-1 Binary files differdiff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx index a246a594..ccad452d 100644 --- a/subx/apps/crenshaw2-1.subx +++ b/subx/apps/crenshaw2-1.subx @@ -526,47 +526,6 @@ expected: # ed : (address exit-descriptor), f : fd or (address stream), s : (ad 5d/pop-to-EBP c3/return -# write(f, "Error: "+s+"\n") then stop(ed, 1) -error: # ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void> - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # write(f, "Error: ") - # . . push args - 68/push "Error: "/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, s) - # . . push args - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, Newline) - # . . push args - 68/push Newline/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # stop(ed, 1) - # . . push args - 68/push 1/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call stop/disp32 - # should never get past this point - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - # read a byte from 'f', and save it in 'Look' get-char: # f : (address buffered-file) -> <void> # . prolog diff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b index 7faa0d83..2c7d0d0d 100755 --- a/subx/apps/crenshaw2-1b +++ b/subx/apps/crenshaw2-1b Binary files differdiff --git a/subx/apps/crenshaw2-1b.subx b/subx/apps/crenshaw2-1b.subx index 08786b90..0c17e3f9 100644 --- a/subx/apps/crenshaw2-1b.subx +++ b/subx/apps/crenshaw2-1b.subx @@ -725,47 +725,6 @@ expected: # ed : (address exit-descriptor), f : fd or (address stream), s : (ad 5d/pop-to-EBP c3/return -# write(f, "Error: "+s+"\n") then stop(ed, 1) -error: # ed : (address exit-descriptor), f : fd or (address stream), s : (address array byte) -> <void> - # . prolog - 55/push-EBP - 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP - # write(f, "Error: ") - # . . push args - 68/push "Error: "/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, s) - # . . push args - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0x10/disp8 . # push *(EBP+16) - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # write(f, Newline) - # . . push args - 68/push Newline/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 0xc/disp8 . # push *(EBP+12) - # . . call - e8/call write/disp32 - # . . discard args - 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32 # add to ESP - # stop(ed, 1) - # . . push args - 68/push 1/imm32 - ff 6/subop/push 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none . . 8/disp8 . # push *(EBP+8) - # . . call - e8/call stop/disp32 - # should never get past this point - # . epilog - 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP - 5d/pop-to-EBP - c3/return - # read a byte from 'f', and save it in 'Look' get-char: # f : (address buffered-file) -> <void> # . prolog diff --git a/subx/apps/factorial b/subx/apps/factorial index d767ff59..5fb3daf7 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differ |