<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'> <html xmlns='http://www.w3.org/1999/xhtml'> <head> <title>doc/manual_html/End-value.html</title> <meta name='robots' content='noindex,nofollow' /> <meta name='generator' content='GLOBAL-6.6.5' /> <meta http-equiv='Content-Style-Type' content='text/css' /> <link rel='stylesheet' type='text/css' href='../style.css' /> </head> <body> <a id='TOP' name='TOP'></a><h2 class='header'><a href='../mains.html'>root</a>/<a href='../files/2921.html'>doc</a>/<a href='../files/2926.html'>manual_html</a>/End-value.html</h2> <em class='comment'>/* [<][>][^][v][top]<a href='#BOTTOM'>[bottom]</a><a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em> <hr /> <pre> <a id='L1' name='L1'></a><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <a id='L2' name='L2'></a><html> <a id='L3' name='L3'></a><!-- Copyright (C) 2010-2021 j8takagi --> <a id='L4' name='L4'></a><!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ --> <a id='L5' name='L5'></a><head> <a id='L6' name='L6'></a><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <a id='L7' name='L7'></a><title>End value (YACASL2 - CASL II 処理システム)</title> <a id='L8' name='L8'></a> <a id='L9' name='L9'></a><meta name="description" content="End value (YACASL2 - CASL II 処理システム)"> <a id='L10' name='L10'></a><meta name="keywords" content="End value (YACASL2 - CASL II 処理システム)"> <a id='L11' name='L11'></a><meta name="resource-type" content="document"> <a id='L12' name='L12'></a><meta name="distribution" content="global"> <a id='L13' name='L13'></a><meta name="Generator" content="makeinfo"> <a id='L14' name='L14'></a><link href="index.html" rel="start" title="Top"> <a id='L15' name='L15'></a><link href="index.html#SEC_Contents" rel="contents" title="Table of Contents"> <a id='L16' name='L16'></a><link href="Register-and-memory.html" rel="up" title="Register and memory"> <a id='L17' name='L17'></a><link href="Step-count.html" rel="next" title="Step count"> <a id='L18' name='L18'></a><link href="Register-specify.html" rel="prev" title="Register specify"> <a id='L19' name='L19'></a><style type="text/css"> <a id='L20' name='L20'></a><!-- <a id='L21' name='L21'></a>a.summary-letter {text-decoration: none} <a id='L22' name='L22'></a>blockquote.indentedblock {margin-right: 0em} <a id='L23' name='L23'></a>div.display {margin-left: 3.2em} <a id='L24' name='L24'></a>div.example {margin-left: 3.2em} <a id='L25' name='L25'></a>div.lisp {margin-left: 3.2em} <a id='L26' name='L26'></a>kbd {font-style: oblique} <a id='L27' name='L27'></a>pre.display {font-family: inherit} <a id='L28' name='L28'></a>pre.format {font-family: inherit} <a id='L29' name='L29'></a>pre.menu-comment {font-family: serif} <a id='L30' name='L30'></a>pre.menu-preformatted {font-family: serif} <a id='L31' name='L31'></a>span.nolinebreak {white-space: nowrap} <a id='L32' name='L32'></a>span.roman {font-family: initial; font-weight: normal} <a id='L33' name='L33'></a>span.sansserif {font-family: sans-serif; font-weight: normal} <a id='L34' name='L34'></a>ul.no-bullet {list-style: none} <a id='L35' name='L35'></a>--> <a id='L36' name='L36'></a></style> <a id='L37' name='L37'></a><link rel="stylesheet" type="text/css" href="style.css"> <a id='L38' name='L38'></a> <a id='L39' name='L39'></a> <a id='L40' name='L40'></a></head> <a id='L41' name='L41'></a> <a id='L42' name='L42'></a><body lang="ja_JP"> <a id='L43' name='L43'></a><span id="End-value"></span><div class="header"> <a id='L44' name='L44'></a><p> <a id='L45' name='L45'></a>Next: <a href="Step-count.html" accesskey="n" rel="next">Step count</a>, Previous: <a href="Register-specify.html" accesskey="p" rel="prev">Register specify</a>, Up: <a href="Register-and-memory.html" accesskey="u" rel="up">Register and memory</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p> <a id='L46' name='L46'></a></div> <a id='L47' name='L47'></a><hr> <a id='L48' name='L48'></a><span id="puroguramuZhong-Liao-Shi-noZhi-woBiao-Shi"></span><h4 class="subsection">2.3.2 プログラム終了時の値を表示</h4> <a id='L49' name='L49'></a> <a id='L50' name='L50'></a><p><code>grep</code>と<code>tail</code>を組み合わせれば、プログラム終了時の値を表示できます。 <a id='L51' name='L51'></a></p> <a id='L52' name='L52'></a><p><samp>addl.casl</samp>でプログラム終了時のGR1の値を確認するには、次のようにします。 <a id='L53' name='L53'></a></p> <a id='L54' name='L54'></a><div class="example"> <a id='L55' name='L55'></a><pre class="example">$ <kbd>casl2 -t addl.casl | grep 'GR1:' | tail -1</kbd> <a id='L56' name='L56'></a>#0006: GR1: 5 = #0005 = 0000000000000101 <a id='L57' name='L57'></a></pre></div> <a id='L58' name='L58'></a> <a id='L59' name='L59'></a><p><samp>sum_10.casl</samp>は、1から10までの整数の和を求め、GR2に格納してからメモリにストア(書き込み)します。 <a id='L60' name='L60'></a></p> <a id='L61' name='L61'></a><div class="example"> <a id='L62' name='L62'></a><pre class="example">$ <kbd>cat sum_10.casl</kbd> <a id='L63' name='L63'></a>;;; sum_10.casl <a id='L64' name='L64'></a>;;; 1から10までの整数をすべて加算した値をメモリーに格納する <a id='L65' name='L65'></a>MAIN START <a id='L66' name='L66'></a> XOR GR2,GR2 ; GR2を初期化 <a id='L67' name='L67'></a> LD GR1,FST ; GR1に初項をメモリーから転送 <a id='L68' name='L68'></a>LOOP ADDL GR2,GR1 ; ループ先頭。GR2 &lt;- GR2 + GR1 <a id='L69' name='L69'></a> ADDL GR1,STEP ; GR1 &lt;- GR1 + 公差 <a id='L70' name='L70'></a> CPL GR1,LST ; GR1が末項より大きい場合は終了 <a id='L71' name='L71'></a> JPL FIN ; ↓ <a id='L72' name='L72'></a> JUMP LOOP ; ループ終端 <a id='L73' name='L73'></a>FIN ST GR2,RST ; GR2の結果をメモリーに転送 <a id='L74' name='L74'></a> RET <a id='L75' name='L75'></a>FST DC 1 ; 初項 <a id='L76' name='L76'></a>LST DC 10 ; 末項 <a id='L77' name='L77'></a>STEP DC 1 ; 公差 <a id='L78' name='L78'></a>RST DS 1 ; 結果 <a id='L79' name='L79'></a> END <a id='L80' name='L80'></a></pre></div> <a id='L81' name='L81'></a> <a id='L82' name='L82'></a><p><samp>sum_10.casl</samp>でプログラム終了時のGR2の値を確認するには、次のようにします。 <a id='L83' name='L83'></a></p> <a id='L84' name='L84'></a><div class="example"> <a id='L85' name='L85'></a><pre class="example">$ <kbd>casl2 -t sum_10.casl | grep 'GR2:' | tail -1</kbd> <a id='L86' name='L86'></a>#000E: GR2: 55 = #0037 = 0000000000110111 = '7' <a id='L87' name='L87'></a></pre></div> <a id='L88' name='L88'></a> <a id='L89' name='L89'></a> <a id='L90' name='L90'></a> <a id='L91' name='L91'></a> <a id='L92' name='L92'></a></body> <a id='L93' name='L93'></a></html> </pre> <hr /> <a id='BOTTOM' name='BOTTOM'></a> <em class='comment'>/* [<][>][^][v]<a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em> </body> </html>