X-Git-Url: http://j8takagi.net/cgi-bin/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=as%2FFUNC%2Fsum_10_2.casl;fp=as%2FFUNC%2Fsum_10_2.casl;h=f9d90a619172d5351c03b1877f5cf76ae51b13f8;hb=ed26c70ece2ab7c16d20275fe5dbb471bfe5a0b8;hp=0000000000000000000000000000000000000000;hpb=959c309bcf37cbb534aaa04f27ccfdb6c9453396;p=YACASL2.git diff --git a/as/FUNC/sum_10_2.casl b/as/FUNC/sum_10_2.casl new file mode 100644 index 0000000..f9d90a6 --- /dev/null +++ b/as/FUNC/sum_10_2.casl @@ -0,0 +1,27 @@ +;;; sum_10.casl +;;; 出力 GR0: 1から10までの整数をすべて加算した値 +;;; 依存プログラム: mull1.casl divl1.casl +MAIN START + PUSH 0,GR1 + PUSH 0,GR2 + ;; GR1に(初項 + 末項)を入力 + LD GR1,FST + ADDL GR1,LST + ;; GR2に項数を入力 + LD GR2,LST + SUBL GR2,GR1 + RPUSH + LD GR1,GR2 + LD GR2,STEP + CALL DIVL + RPOP + LAD GR2,1,GR0 + CALL MULL + SRL GR0,1 + POP GR2 + POP GR1 + RET +FST DC 1 +LST DC 10 +STEP DC 1 + END