root/doc_inner/gnu_global/S/2632.html

/* [<][>][^][v][top][bottom][index][help] */
<!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>as/app/sum/sum_10_2.casl</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/2861.html'>as</a>/<a href='../files/2862.html'>app</a>/<a href='../files/2865.html'>sum</a>/sum_10_2.casl</h2>
<em class='comment'>/* [&lt;][&gt;][^][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>   1 ;;; sum_10.casl
<a id='L2' name='L2'></a>   2 ;;; 出力 GR0: 1から10までの整数をすべて加算した値
<a id='L3' name='L3'></a>   3 ;;; 依存プログラム: mull1.casl divl1.casl
<a id='L4' name='L4'></a>   4 MAIN    START
<a id='L5' name='L5'></a>   5         PUSH    0,GR1
<a id='L6' name='L6'></a>   6         PUSH    0,GR2
<a id='L7' name='L7'></a>   7         LD      GR1,FST         ; GR1 &lt;- (初項 + 末項)
<a id='L8' name='L8'></a>   8         ADDL    GR1,LST         ; ↓
<a id='L9' name='L9'></a>   9         PUSH    0,GR1           ; GR1を退避
<a id='L10' name='L10'></a>  10         LD      GR1,LST         ; GR1 &lt;- (末項 - 初項)
<a id='L11' name='L11'></a>  11         SUBL    GR1,FST         ; ↓
<a id='L12' name='L12'></a>  12         LD      GR2,GR1         ; ↓
<a id='L13' name='L13'></a>  13         LD      GR2,STEP        ; GR2 &lt;- STEP
<a id='L14' name='L14'></a>  14         CALL    DIVL            ; GR0 &lt;- GR1 / GR2
<a id='L15' name='L15'></a>  15         LD      GR2,GR0         ; GR2 &lt;- GR0
<a id='L16' name='L16'></a>  16         LAD     GR2,1,GR2       ; GR2 &lt;- GR2 + 1
<a id='L17' name='L17'></a>  17         SRL     GR2,1           ; GR2 &lt;- GR2 / 2
<a id='L18' name='L18'></a>  18         POP     GR1             ; GR1を復元
<a id='L19' name='L19'></a>  19         CALL    MULL            ; GR0 &lt;- GR1 * GR2
<a id='L20' name='L20'></a>  20         POP     GR2
<a id='L21' name='L21'></a>  21         POP     GR1
<a id='L22' name='L22'></a>  22         RET
<a id='L23' name='L23'></a>  23 FST     DC      1               ; 初項
<a id='L24' name='L24'></a>  24 LST     DC      10              ; 末項
<a id='L25' name='L25'></a>  25 STEP    DC      1               ; 公差
<a id='L26' name='L26'></a>  26         END
</pre>
<hr />
<a id='BOTTOM' name='BOTTOM'></a>
<em class='comment'>/* [&lt;][&gt;][^][v]<a href='#TOP'>[top]</a>[bottom]<a href='../mains.html'>[index]</a><a href='../help.html'>[help]</a> */</em>
</body>
</html>

/* [<][>][^][v][top][bottom][index][help] */