From fb893cf9b40d141a0d66f131dba3e0fef28549ab Mon Sep 17 00:00:00 2001 From: j8takagi Date: Tue, 2 Feb 2010 00:54:57 +0900 Subject: [PATCH] =?utf8?q?*.casl=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?utf8?q?=E3=81=AE=E6=95=B4=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- as/FUNC/Makefile | 6 + as/FUNC/abs.casl | 8 +- as/FUNC/addl32.casl | 22 + as/FUNC/divl0.casl | 26 +- as/FUNC/divl1.casl | 49 +- as/FUNC/mull1.casl | 32 +- as/FUNC/outa.casl | 88 +-- as/FUNC/outa_main.casl | 44 ++ as/FUNC/outb.casl | 72 ++- as/FUNC/outb_main.casl | 42 ++ as/FUNC/outd_q15.casl | 4 +- as/FUNC/outl.casl | 72 ++- as/FUNC/outl_main.casl | 35 ++ as/FUNC/rev.casl | 26 +- test/integration/casl2/abs_call/0.txt | 634 +------------------ test/integration/casl2/abs_call/Makefile | 5 +- test/integration/casl2/count_call/0.txt | 652 +------------------ test/integration/casl2/count_call/Makefile | 3 +- test/integration/casl2/divl0_call/0.txt | 2 +- test/integration/casl2/divl0_call/Makefile | 2 +- test/integration/casl2/divl1_call/0.txt | 2 +- test/integration/casl2/divl1_call/Makefile | 2 +- test/integration/casl2/minim_call/0.txt | 657 +------------------- test/integration/casl2/minim_call/Makefile | 5 +- test/integration/comet2/TEST.mk | 6 +- test/integration/comet2/abs_call/Makefile | 2 +- test/integration/comet2/abs_call/a.o | Bin 624 -> 628 bytes test/integration/comet2/count_call/a.o | Bin 624 -> 650 bytes test/integration/comet2/divl0_call/Makefile | 2 +- test/integration/comet2/divl0_call/a.o | Bin 836 -> 716 bytes test/integration/comet2/divl1_call/Makefile | 2 +- test/integration/comet2/divl1_call/a.o | Bin 916 -> 798 bytes test/integration/comet2/fib_outl/a.o | Bin 550 -> 564 bytes test/integration/comet2/minim_call/a.o | Bin 644 -> 670 bytes test/integration/comet2/mula0_call/a.o | Bin 1102 -> 1128 bytes test/integration/comet2/mula1_call/a.o | Bin 1120 -> 1146 bytes test/integration/comet2/mull0_call/a.o | Bin 902 -> 916 bytes test/integration/comet2/mull1_call/a.o | Bin 926 -> 950 bytes test/integration/comet2/outa_call/a.o | Bin 654 -> 680 bytes test/integration/comet2/outb_call/a.o | Bin 626 -> 640 bytes test/integration/comet2/outl_call/a.o | Bin 600 -> 614 bytes test/integration/comet2/ptn1/a.o | Bin 568 -> 582 bytes test/integration/comet2/ptn2/a.o | Bin 568 -> 582 bytes test/integration/comet2/ptn3/a.o | Bin 554 -> 568 bytes test/integration/comet2/ptn4/a.o | Bin 636 -> 650 bytes test/integration/comet2/sum_call/a.o | Bin 550 -> 564 bytes 46 files changed, 368 insertions(+), 2134 deletions(-) create mode 100644 as/FUNC/Makefile create mode 100644 as/FUNC/addl32.casl create mode 100644 as/FUNC/outa_main.casl create mode 100644 as/FUNC/outb_main.casl create mode 100644 as/FUNC/outl_main.casl diff --git a/as/FUNC/Makefile b/as/FUNC/Makefile new file mode 100644 index 0000000..fb93443 --- /dev/null +++ b/as/FUNC/Makefile @@ -0,0 +1,6 @@ +outl.casl: outl_main.casl divl1.casl rev.casl + cat $^ >$@ +outa.casl: outa_main.casl divl1.casl rev.casl abs.casl + cat $^ >$@ +outb.casl: outb_main.casl divl1.casl rev.casl + cat $^ >$@ diff --git a/as/FUNC/abs.casl b/as/FUNC/abs.casl index 8a25f8b..ef7d045 100644 --- a/as/FUNC/abs.casl +++ b/as/FUNC/abs.casl @@ -1,9 +1,9 @@ ;;; GR1を絶対値に変換する ABS START AND GR1,GR1 - JPL ABSFIN - JZE ABSFIN + JPL FIN + JZE FIN XOR GR1,=#FFFF - LAD GR1,1,GR1 -ABSFIN RET + ADDA GR1,=1 +FIN RET END diff --git a/as/FUNC/addl32.casl b/as/FUNC/addl32.casl new file mode 100644 index 0000000..63a6bba --- /dev/null +++ b/as/FUNC/addl32.casl @@ -0,0 +1,22 @@ +;;; 2つの32ビット数値を加算する +;;; 32ビットの値は、連続する2語の領域に格納 +MAIN START BEGIN +BEGIN LAD GR1,1 ; GR1にAの下位語を転送 + LD GR1,A,GR1 ; ↓ + LAD GR2,1 ; GR2にBの下位語を転送 + LD GR2,B,GR2 ; ↓ + ADDL GR1,GR2 ; GR1 <- GR1 + GR2 + JOV CARR ; オーバーフロー時は、CARRにジャンプ + JUMP STL +CARR LAD GR2,1 ; Cの上位語に1を格納 + ST GR2,C ; ↓ +STL LAD GR2,1 ; Cの下位語にGR1の内容を格納 + ST GR1,C,GR2 ; ↓ + LD GR1,A ; GR1にAの上位語を転送 + ADDL GR1,B ; GR1 <- GR1 + B + ADDL GR1,C ; GR1 <- GR1 + C + RET +A DC 0,65534 +B DC 0,65535 +C DS 2 + END diff --git a/as/FUNC/divl0.casl b/as/FUNC/divl0.casl index c827b9d..28357a9 100644 --- a/as/FUNC/divl0.casl +++ b/as/FUNC/divl0.casl @@ -1,20 +1,22 @@ -;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -;;; 0〜65535の範囲の数値を扱う +;;; 0〜65535の範囲にある正数の割算を行う +;;; 入力 GR1:被除数 GR2:除数 +;;; 出力 GR0:商 GR3:剰余 +;;; GR2が0の場合は、GR0、GR3とも0になり、オーバーフロー DIVL START PUSH 0,GR1 AND GR2,GR2 ; (GR2 = 0)の場合、DYZへジャンプ - JZE DYZ ; ↓ + JZE DIVZERO ; ↓ LAD GR0,0 ; GR0を初期化 LD GR3,GR1 ; GR3 <- GR1 -DLOOP CPL GR3,GR2 ; ループ先頭。(GR3 < GR2)の場合、終了 - JMI DFIN ; ↓ +LOOP CPL GR3,GR2 ; ループ先頭。(GR3 < GR2)の場合、終了 + JMI FIN ; ↓ SUBL GR3,GR2 ; GR3 <- GR3 - GR2 - ADDL GR0,DONE ; ↓ - JUMP DLOOP ; ループ終端 -DYZ LAD GR3,#FFFF ; 強制的にオーバーフローを発生させ、GR3 <- 0 - ADDL GR3,=1 ; ↓ - JUMP DFIN ; DFINへジャンプ -DFIN POP GR1 + ADDL GR0,ONE ; ↓ + JUMP LOOP ; ループ終端 +DIVZERO LAD GR3,#8000 ; 強制的にオーバーフローを発生させ、GR3 <- 0 + SLL GR3,1 ; ↓ + JUMP FIN ; FIN へジャンプ +FIN POP GR1 RET -DONE DC 1 +ONE DC 1 END diff --git a/as/FUNC/divl1.casl b/as/FUNC/divl1.casl index 400cf05..f7bb887 100644 --- a/as/FUNC/divl1.casl +++ b/as/FUNC/divl1.casl @@ -6,39 +6,40 @@ DIVL START PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR4 - AND GR2,GR2 ; (GR2 = 0)の場合、DFZへジャンプ - JZE DYZ ; ↓ - ST GR2,DY ; DYにGR2の初期値を保存 + AND GR2,GR2 ; (GR2 = 0)の場合、DIVZEROへジャンプ + JZE DIVZERO ; ↓ + ST GR2,Y ; YにGR2の初期値を保存 LAD GR0,0 ; GR0の初期化 LAD GR3,0 ; GR3の初期化 LAD GR4,1 ; GR4の初期化。対象ビットを表す -DSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、DLOOPへループ脱出 - JPL DLOOP ; ↓ +SL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、LOOPへループ脱出 + JPL LOOP ; ↓ SLL GR4,1 ; GR4を1回左シフト + ST GR2,TMP ; GR2の値をTMPに退避 SLL GR2,1 ; GR2を1回左シフト - JOV DYOV ; オーバーフローの場合は、DYOVにジャンプ - JUMP DSL ; ループ終端 -DYOV SRL GR2,1 - LAD GR2,#8000,GR2 - SRL GR4,1 - JUMP DLPIN -DLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - JZE DCP ; (GR4 = 0)の場合、ループ脱出 + JOV YOV ; オーバーフローの場合は、YOVへジャンプ + JUMP SL ; ループ終端 +YOV LD GR2,TMP ; GR2の値をTMPから復元 + SRL GR4,1 ; GR4を1回右シフト + JUMP LPIN ; LPINへジャンプ +LOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト + JZE SETMOD ; (GR4 = 0)の場合、SETMODへループ脱出 SRL GR2,1 ; GR2を1回右シフト - CPL GR1,DY ; (GR1 < DY)の場合、ループ脱出 - JMI DCP ; ↓ + CPL GR1,Y ; (GR1 < Y)の場合、SETMODへループ脱出 + JMI SETMOD ; ↓ CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - JMI DLOOP ; ↓ -DLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 + JMI LOOP ; ↓ +LPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - JUMP DLOOP ; ループ終端 -DYZ LAD GR3,#FFFF ; 強制的にオーバーフローを発生させ、GR3 <- 0 - ADDL GR3,=1 ; ↓ - JUMP DFIN ; DFINへジャンプ -DCP LD GR3,GR1 -DFIN POP GR4 + JUMP LOOP ; ループ終端 +DIVZERO LAD GR3,#8000 ; 強制的にオーバーフローを発生させ、GR3 <- 0 + SLL GR3,1 ; ↓ + JUMP FIN ; FIN へジャンプ +SETMOD LD GR3,GR1 ; GR3 <- GR1。剰余の設定 +FIN POP GR4 POP GR2 POP GR1 RET -DY DS 1 +Y DS 1 +TMP DS 1 END diff --git a/as/FUNC/mull1.casl b/as/FUNC/mull1.casl index 916f386..86a6557 100644 --- a/as/FUNC/mull1.casl +++ b/as/FUNC/mull1.casl @@ -1,22 +1,24 @@ -;GR1の値とGR2の値の積をGR0に格納 +;;; GR1の値とGR2の値の積をGR0に格納 MULL START RPUSH XOR GR0,GR0 ; 積 - LAD GR3,1 ; 対象ビット -MLOOP PUSH 0,GR3 ; ループ先頭。GR2の、GR3が示したビットが0の場合、MNEXTへジャンプ - AND GR3,GR2 ; ↓ - POP GR3 ; ↓ - JZE MNEXT ; ↓ + LAD GR4,1 ; 対象ビット +LOOP PUSH 0,GR4 ; ループ先頭。GR2の、GR4が示したビットが0の場合、NEXTへジャンプ + AND GR4,GR2 ; ↓ + POP GR4 ; ↓ + JZE NEXT ; ↓ ADDL GR0,GR1 ; GR0 <- GR0 + GR1 - JOV MFIN ; オーバーフローした場合、ループ脱出 -MNEXT SLL GR3,1 ; GR3を1回左シフト - AND GR3,GR3 ; (GR3 = 0)の場合、ループ脱出 - JZE MFIN ; ↓ - CPL GR3,GR2 ; (GR3 > GR2)の場合、ループ脱出 - JPL MFIN ; ↓ + JOV FIN ; オーバーフローした場合、OVPへジャンプ +NEXT SLL GR4,1 ; GR4を1回左シフト + AND GR4,GR4 ; (GR4 = 0)の場合、ループ脱出 + JZE FIN ; ↓ + CPL GR4,GR2 ; (GR4 > GR2)の場合、ループ脱出 + JPL FIN ; ↓ SLL GR1,1 ; GR1を1回左シフト - JOV MFIN ; オーバーフローした場合、ループ脱出 - JUMP MLOOP ; ループ終端 -MFIN RPOP + JOV FIN ; オーバーフローした場合、ループ脱出 + JUMP LOOP ; ループ終端 +OVP ADDL GR3,=1 + JUMP NEXT +FIN RPOP RET END diff --git a/as/FUNC/outa.casl b/as/FUNC/outa.casl index 52c5c60..f902b4f 100644 --- a/as/FUNC/outa.casl +++ b/as/FUNC/outa.casl @@ -9,10 +9,10 @@ OUTA START JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ JPL STI ; GR1が正数の場合、STIにジャンプ LAD GR4,1 ; GR1が負数の場合、GR4をオン - CALL OABS ; GR1を正数に変換 + CALL ABS ; GR1を正数に変換 STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 JMI STLST ; ↓ - CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 + CALL DIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 LD GR1,GR3 ; GR1にGR3をコピー LD GR1,NCHAR,GR1 ; GR1を文字に変換 ST GR1,STR,GR5 ; (STR + GR5) <- GR1 @@ -42,74 +42,82 @@ STR DS 17 LEN DS 1 NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' END -;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -;;; 0〜65535の範囲の数値を扱う -ODIVL START +;;; 0〜65535の範囲にある正数の割算(筆算方式)を行う +;;; 入力 GR1:被除数 GR2:除数 +;;; 出力 GR0:商 GR3:剰余 +;;; GR2が0の場合は、GR0、GR3とも0になり、オーバーフロー +DIVL START PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR4 - AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - JZE ODFIN ; ↓ - ST GR2,ODY ; ODYにGR2の初期値を保存 + AND GR2,GR2 ; (GR2 = 0)の場合、DIVZEROへジャンプ + JZE DIVZERO ; ↓ + ST GR2,Y ; YにGR2の初期値を保存 LAD GR0,0 ; GR0の初期化 LAD GR3,0 ; GR3の初期化 LAD GR4,1 ; GR4の初期化。対象ビットを表す -ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - JPL ODLOOP ; ↓ +SL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、LOOPへループ脱出 + JPL LOOP ; ↓ SLL GR4,1 ; GR4を1回左シフト + ST GR2,TMP ; GR2の値をTMPに退避 SLL GR2,1 ; GR2を1回左シフト - JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - JUMP ODSL ; ループ終端 -ODYOV SRL GR2,1 - LAD GR2,#8000,GR2 - SRL GR4,1 - JUMP ODLPIN -ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 + JOV YOV ; オーバーフローの場合は、YOVへジャンプ + JUMP SL ; ループ終端 +YOV LD GR2,TMP ; GR2の値をTMPから復元 + SRL GR4,1 ; GR4を1回右シフト + JUMP LPIN ; LPINへジャンプ +LOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト + JZE SETMOD ; (GR4 = 0)の場合、SETMODへループ脱出 SRL GR2,1 ; GR2を1回右シフト - CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - JMI ODFIN ; ↓ + CPL GR1,Y ; (GR1 < Y)の場合、SETMODへループ脱出 + JMI SETMOD ; ↓ CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - JMI ODLOOP ; ↓ -ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 + JMI LOOP ; ↓ +LPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - JUMP ODLOOP ; ループ終端 -ODFIN LD GR3,GR1 - POP GR4 + JUMP LOOP ; ループ終端 +DIVZERO LAD GR3,#8000 ; 強制的にオーバーフローを発生させ、GR3 <- 0 + SLL GR3,1 ; ↓ + JUMP FIN ; FIN へジャンプ +SETMOD LD GR3,GR1 +FIN POP GR4 POP GR2 POP GR1 RET -ODY DS 1 +Y DS 1 +TMP DS 1 END ;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える ;; 例: 12345 -> 54321、54321- -> -12345 REV START RPUSH LAD GR3,0 ; GR3の初期化 -RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - JZE RNEXT ; ↓ +PU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE NEXT ; ↓ LD GR4,GR1 ; GR4にGR1の値をコピー ADDL GR4,GR3 ; GR4 <- GR4 + GR3 LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 PUSH 0,GR5 ; GR5をプッシュ LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - JUMP RPU ; ループ終端 -RNEXT LAD GR3,0 ; GR3の初期化 -RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - JZE RFIN ; ↓ + JUMP PU ; ループ終端 +NEXT LAD GR3,0 ; GR3の初期化 +PO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE FIN ; ↓ POP GR5 ; GR5にポップ LD GR4,GR1 ; GR4にGR1の値をコピー ADDL GR4,GR3 ; GR4 <- GR4 + GR3 ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - JUMP RPO ; ループ終端 -RFIN RPOP + JUMP PO ; ループ終端 +FIN RPOP RET END -;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -;; 例: -10 -> 10, -20 -> 20 -OABS START - XOR GR1,=#FFFF ; GR1の値を反転 - LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - RET +;;; GR1を絶対値に変換する +ABS START + AND GR1,GR1 + JPL FIN + JZE FIN + XOR GR1,=#FFFF + ADDA GR1,=1 +FIN RET END diff --git a/as/FUNC/outa_main.casl b/as/FUNC/outa_main.casl new file mode 100644 index 0000000..6f8f84d --- /dev/null +++ b/as/FUNC/outa_main.casl @@ -0,0 +1,44 @@ +;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 +OUTA START + RPUSH + LAD GR2,10 ; GR2に10進数の「10」を格納。 + LAD GR0,0 ; GR0 <- 0 + LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 + LAD GR5,0 ; 整数値の長さ + AND GR1,GR1 ; GR1をテスト + JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ + JPL STI ; GR1が正数の場合、STIにジャンプ + LAD GR4,1 ; GR1が負数の場合、GR4をオン + CALL ABS ; GR1を正数に変換 +STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 + JMI STLST ; ↓ + CALL DIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 + LD GR1,GR3 ; GR1にGR3をコピー + LD GR1,NCHAR,GR1 ; GR1を文字に変換 + ST GR1,STR,GR5 ; (STR + GR5) <- GR1 + LAD GR5,1,GR5 ; GR5 <- GR5 + 1 + LD GR1,GR0 ; GR0をGR1にコピー + JUMP STI ; ループ終端 +STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 + ST GR1,STR,GR5 ; (STR + GR5) <- GR1 + LAD GR5,1,GR5 ; GR5 <- GR5 + 1 + AND GR4,GR4 ; 正数の場合 + JZE PRT ; ↓ + LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 + ST GR1,STR,GR5 ; (STR + GR5) <- GR1 + LAD GR5,1,GR5 ; GR5 <- GR5 + 1 + JUMP PRT ; PRTにジャンプ +ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 + ST GR1,STR,GR5 ; (STR + GR5) <- GR1 + LAD GR5,1,GR5 ; GR5 <- GR5 + 1 +PRT ST GR5,LEN ; LEN <- GR5 + LD GR2,LEN ; GR2にLENの値を格納 + LAD GR1,STR ; GR1に文字列のアドレスを格納 + CALL REV ; 文字列を逆順に並べ替え + OUT STR,LEN ; 文字列を出力 + RPOP + RET +STR DS 17 +LEN DS 1 +NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + END diff --git a/as/FUNC/outb.casl b/as/FUNC/outb.casl index a619779..7d429e6 100644 --- a/as/FUNC/outb.casl +++ b/as/FUNC/outb.casl @@ -8,7 +8,7 @@ OUTB START JZE ZERO ; GR1が0の場合、ZEROにジャンプ STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 JMI STLST ; ↓ - CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 + CALL DIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 LD GR1,GR3 ; GR1にGR3をコピー LD GR1,NCHAR,GR1 ; GR1を文字に変換 ST GR1,STR,GR4 ; (STR + GR4) <- GR1 @@ -40,67 +40,73 @@ LEN DS 1 NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' DIG DC 16 END -;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -;;; 0〜65535の範囲の数値を扱う -ODIVL START +;;; 0〜65535の範囲にある正数の割算(筆算方式)を行う +;;; 入力 GR1:被除数 GR2:除数 +;;; 出力 GR0:商 GR3:剰余 +;;; GR2が0の場合は、GR0、GR3とも0になり、オーバーフロー +DIVL START PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR4 - AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - JZE ODFIN ; ↓ - ST GR2,ODY ; ODYにGR2の初期値を保存 + AND GR2,GR2 ; (GR2 = 0)の場合、DIVZEROへジャンプ + JZE DIVZERO ; ↓ + ST GR2,Y ; YにGR2の初期値を保存 LAD GR0,0 ; GR0の初期化 LAD GR3,0 ; GR3の初期化 LAD GR4,1 ; GR4の初期化。対象ビットを表す -ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - JPL ODLOOP ; ↓ +SL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、LOOPへループ脱出 + JPL LOOP ; ↓ SLL GR4,1 ; GR4を1回左シフト + ST GR2,TMP ; GR2の値をTMPに退避 SLL GR2,1 ; GR2を1回左シフト - JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - JUMP ODSL ; ループ終端 -ODYOV SRL GR2,1 - LAD GR2,#8000,GR2 - SRL GR4,1 - JUMP ODLPIN -ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 + JOV YOV ; オーバーフローの場合は、YOVへジャンプ + JUMP SL ; ループ終端 +YOV LD GR2,TMP ; GR2の値をTMPから復元 + SRL GR4,1 ; GR4を1回右シフト + JUMP LPIN ; LPINへジャンプ +LOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト + JZE SETMOD ; (GR4 = 0)の場合、SETMODへループ脱出 SRL GR2,1 ; GR2を1回右シフト - CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - JMI ODFIN ; ↓ + CPL GR1,Y ; (GR1 < Y)の場合、SETMODへループ脱出 + JMI SETMOD ; ↓ CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - JMI ODLOOP ; ↓ -ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 + JMI LOOP ; ↓ +LPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - JUMP ODLOOP ; ループ終端 -ODFIN LD GR3,GR1 - POP GR4 + JUMP LOOP ; ループ終端 +DIVZERO LAD GR3,#8000 ; 強制的にオーバーフローを発生させ、GR3 <- 0 + SLL GR3,1 ; ↓ + JUMP FIN ; FIN へジャンプ +SETMOD LD GR3,GR1 +FIN POP GR4 POP GR2 POP GR1 RET -ODY DS 1 +Y DS 1 +TMP DS 1 END ;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える ;; 例: 12345 -> 54321、54321- -> -12345 REV START RPUSH LAD GR3,0 ; GR3の初期化 -RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - JZE RNEXT ; ↓ +PU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE NEXT ; ↓ LD GR4,GR1 ; GR4にGR1の値をコピー ADDL GR4,GR3 ; GR4 <- GR4 + GR3 LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 PUSH 0,GR5 ; GR5をプッシュ LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - JUMP RPU ; ループ終端 -RNEXT LAD GR3,0 ; GR3の初期化 -RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - JZE RFIN ; ↓ + JUMP PU ; ループ終端 +NEXT LAD GR3,0 ; GR3の初期化 +PO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE FIN ; ↓ POP GR5 ; GR5にポップ LD GR4,GR1 ; GR4にGR1の値をコピー ADDL GR4,GR3 ; GR4 <- GR4 + GR3 ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - JUMP RPO ; ループ終端 -RFIN RPOP + JUMP PO ; ループ終端 +FIN RPOP RET END diff --git a/as/FUNC/outb_main.casl b/as/FUNC/outb_main.casl new file mode 100644 index 0000000..91ee4fa --- /dev/null +++ b/as/FUNC/outb_main.casl @@ -0,0 +1,42 @@ +;;; GR1に格納された値を、2進数値として表示 +OUTB START + RPUSH + LAD GR2,2 ; GR2に2進数の「2」を格納。 + LAD GR0,0 ; GR0 <- 0 + XOR GR4,GR4 ; 2進数値の長さ + AND GR1,GR1 ; GR1をテスト + JZE ZERO ; GR1が0の場合、ZEROにジャンプ +STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 + JMI STLST ; ↓ + CALL DIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 + LD GR1,GR3 ; GR1にGR3をコピー + LD GR1,NCHAR,GR1 ; GR1を文字に変換 + ST GR1,STR,GR4 ; (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; GR4 <- GR4 + 1 + LD GR1,GR0 ; GR0をGR1にコピー + JUMP STI ; ループ終端 +STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 + ST GR1,STR,GR4 ; (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; GR4 <- GR4 + 1 + JUMP EMB ; EMBにジャンプ +ZERO LD GR1,NCHAR ; 「0」をSTR領域に格納 + ST GR1,STR,GR4 ; ↓ (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; ↓ GR4 <- GR4 + 1 +EMB LD GR1,NCHAR ; GR1 <- '0' +EMLOOP CPA GR4,DIG ; ループ先頭。(GR4 = DIG)の場合は、ループ脱出 + JZE PRT ; ↓ + ST GR1,STR,GR4 ; ↓ (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; ↓ GR4 <- GR4 + 1 + JUMP EMLOOP ; ループ終端 +PRT ST GR4,LEN ; LEN <- GR4 + LD GR2,LEN ; GR2にLENの値を格納 + LAD GR1,STR ; GR1に文字列のアドレスを格納 + CALL REV ; 文字列を逆順に並べ替え + OUT STR,LEN ; 文字列を出力 + RPOP + RET +STR DS 17 +LEN DS 1 +NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' +DIG DC 16 + END diff --git a/as/FUNC/outd_q15.casl b/as/FUNC/outd_q15.casl index 9792d4d..4728936 100644 --- a/as/FUNC/outd_q15.casl +++ b/as/FUNC/outd_q15.casl @@ -23,7 +23,7 @@ STDN LD GR5,='0' ; 「0」をSTR領域に格納 LD GR5,='.' ; 「.」をSTR領域に格納 ST GR5,STR,GR4 ; ↓ LAD GR4,1,GR4 ; ↓ GR4 <- GR4 + 1 -;; GR1の内容を小数値と見なし、10進数文字に変換してSTRに格納 +;; GR1の内容を小数値と見なし、10進数の文字列に変換してSTRに格納 TODIG AND GR1,GR1 ; GR1が0の場合は、ループを脱出 JZE PRT ; ↓ CALL MUL ; GR1とGR2の、積をGR1、オーバーフロー値をGR3に格納 @@ -43,7 +43,7 @@ STR DS 20 LEN DS 1 END ;; GR1の値を10倍にし、GR3にオーバーフロー値を格納 -MUL START +MUL START PUSH 0,GR5 PUSH 0,GR6 LAD GR3,0 ; GR3は、オーバーフロー値を格納 diff --git a/as/FUNC/outl.casl b/as/FUNC/outl.casl index 1e06891..ea419c0 100644 --- a/as/FUNC/outl.casl +++ b/as/FUNC/outl.casl @@ -8,7 +8,7 @@ OUTL START JZE ZERO ; GR1が0の場合、ZEROにジャンプ STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 JMI STLST ; ↓ - CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 + CALL DIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 LD GR1,GR3 ; GR1にGR3をコピー LD GR1,NCHAR,GR1 ; GR1を文字に変換 ST GR1,STR,GR4 ; (STR + GR4) <- GR1 @@ -33,67 +33,73 @@ STR DS 17 LEN DS 1 NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' END -;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -;;; 0〜65535の範囲の数値を扱う -ODIVL START +;;; 0〜65535の範囲にある正数の割算(筆算方式)を行う +;;; 入力 GR1:被除数 GR2:除数 +;;; 出力 GR0:商 GR3:剰余 +;;; GR2が0の場合は、GR0、GR3とも0になり、オーバーフロー +DIVL START PUSH 0,GR1 PUSH 0,GR2 PUSH 0,GR4 - AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - JZE ODFIN ; ↓ - ST GR2,ODY ; ODYにGR2の初期値を保存 + AND GR2,GR2 ; (GR2 = 0)の場合、DIVZEROへジャンプ + JZE DIVZERO ; ↓ + ST GR2,Y ; YにGR2の初期値を保存 LAD GR0,0 ; GR0の初期化 LAD GR3,0 ; GR3の初期化 LAD GR4,1 ; GR4の初期化。対象ビットを表す -ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - JPL ODLOOP ; ↓ +SL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、LOOPへループ脱出 + JPL LOOP ; ↓ SLL GR4,1 ; GR4を1回左シフト + ST GR2,TMP ; GR2の値をTMPに退避 SLL GR2,1 ; GR2を1回左シフト - JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - JUMP ODSL ; ループ終端 -ODYOV SRL GR2,1 - LAD GR2,#8000,GR2 - SRL GR4,1 - JUMP ODLPIN -ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 + JOV YOV ; オーバーフローの場合は、YOVへジャンプ + JUMP SL ; ループ終端 +YOV LD GR2,TMP ; GR2の値をTMPから復元 + SRL GR4,1 ; GR4を1回右シフト + JUMP LPIN ; LPINへジャンプ +LOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト + JZE SETMOD ; (GR4 = 0)の場合、SETMODへループ脱出 SRL GR2,1 ; GR2を1回右シフト - CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - JMI ODFIN ; ↓ + CPL GR1,Y ; (GR1 < Y)の場合、SETMODへループ脱出 + JMI SETMOD ; ↓ CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - JMI ODLOOP ; ↓ -ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 + JMI LOOP ; ↓ +LPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - JUMP ODLOOP ; ループ終端 -ODFIN LD GR3,GR1 - POP GR4 + JUMP LOOP ; ループ終端 +DIVZERO LAD GR3,#8000 ; 強制的にオーバーフローを発生させ、GR3 <- 0 + SLL GR3,1 ; ↓ + JUMP FIN ; FIN へジャンプ +SETMOD LD GR3,GR1 +FIN POP GR4 POP GR2 POP GR1 RET -ODY DS 1 +Y DS 1 +TMP DS 1 END ;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える ;; 例: 12345 -> 54321、54321- -> -12345 REV START RPUSH LAD GR3,0 ; GR3の初期化 -RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - JZE RNEXT ; ↓ +PU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE NEXT ; ↓ LD GR4,GR1 ; GR4にGR1の値をコピー ADDL GR4,GR3 ; GR4 <- GR4 + GR3 LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 PUSH 0,GR5 ; GR5をプッシュ LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - JUMP RPU ; ループ終端 -RNEXT LAD GR3,0 ; GR3の初期化 -RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - JZE RFIN ; ↓ + JUMP PU ; ループ終端 +NEXT LAD GR3,0 ; GR3の初期化 +PO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE FIN ; ↓ POP GR5 ; GR5にポップ LD GR4,GR1 ; GR4にGR1の値をコピー ADDL GR4,GR3 ; GR4 <- GR4 + GR3 ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - JUMP RPO ; ループ終端 -RFIN RPOP + JUMP PO ; ループ終端 +FIN RPOP RET END diff --git a/as/FUNC/outl_main.casl b/as/FUNC/outl_main.casl new file mode 100644 index 0000000..74da31d --- /dev/null +++ b/as/FUNC/outl_main.casl @@ -0,0 +1,35 @@ +;;; GR1に格納された値を、10進数の整数値(0〜65535)として表示 +OUTL START + RPUSH + LAD GR2,10 ; GR2に10進数の「10」を格納。 + LAD GR0,0 ; GR0 <- 0 + XOR GR4,GR4 ; 整数値の長さ + AND GR1,GR1 ; GR1をテスト + JZE ZERO ; GR1が0の場合、ZEROにジャンプ +STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 + JMI STLST ; ↓ + CALL DIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 + LD GR1,GR3 ; GR1にGR3をコピー + LD GR1,NCHAR,GR1 ; GR1を文字に変換 + ST GR1,STR,GR4 ; (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; GR4 <- GR4 + 1 + LD GR1,GR0 ; GR0をGR1にコピー + JUMP STI ; ループ終端 +STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 + ST GR1,STR,GR4 ; (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; GR4 <- GR4 + 1 + JUMP PRT ; PRTにジャンプ +ZERO LD GR1,NCHAR ; 「0」をSTR領域に格納 + ST GR1,STR,GR4 ; ↓ (STR + GR4) <- GR1 + LAD GR4,1,GR4 ; ↓ GR4 <- GR4 + 1 +PRT ST GR4,LEN ; LEN <- GR4 + LD GR2,LEN ; GR2にLENの値を格納 + LAD GR1,STR ; GR1に文字列のアドレスを格納 + CALL REV ; 文字列を逆順に並べ替え + OUT STR,LEN ; 文字列を出力 + RPOP + RET +STR DS 17 +LEN DS 1 +NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' + END diff --git a/as/FUNC/rev.casl b/as/FUNC/rev.casl index 09d81d1..8674381 100644 --- a/as/FUNC/rev.casl +++ b/as/FUNC/rev.casl @@ -1,25 +1,25 @@ ;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -;; 例: 12345 => 54321、54321- => -12345 +;; 例: 12345 -> 54321、54321- -> -12345 REV START RPUSH LAD GR3,0 ; GR3の初期化 -RPU CPL GR3,GR2 ; ループ開始。(GR3 = GR2)の場合、ループ脱出 - JZE RNEXT ; ↓ +PU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE NEXT ; ↓ LD GR4,GR1 ; GR4にGR1の値をコピー - ADDL GR4,GR3 ; GR4 <= GR4 + GR3 + ADDL GR4,GR3 ; GR4 <- GR4 + GR3 LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 PUSH 0,GR5 ; GR5をプッシュ - LAD GR3,1,GR3 ; GR3 <= GR3 + 1 - JUMP RPU ; ループ終了 -RNEXT LAD GR3,0 ; GR3の初期化 -RPO CPL GR3,GR2 ; ループ開始。(GR3 = GR2)の場合、ループ脱出 - JZE RFIN ; ↓ + LAD GR3,1,GR3 ; GR3 <- GR3 + 1 + JUMP PU ; ループ終端 +NEXT LAD GR3,0 ; GR3の初期化 +PO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 + JZE FIN ; ↓ POP GR5 ; GR5にポップ LD GR4,GR1 ; GR4にGR1の値をコピー - ADDL GR4,GR3 ; GR4 <= GR4 + GR3 + ADDL GR4,GR3 ; GR4 <- GR4 + GR3 ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - LAD GR3,1,GR3 ; GR3 <= GR3 + 1 - JUMP RPO ; ループ終了 -RFIN RPOP + LAD GR3,1,GR3 ; GR3 <- GR3 + 1 + JUMP PO ; ループ終端 +FIN RPOP RET END diff --git a/test/integration/casl2/abs_call/0.txt b/test/integration/casl2/abs_call/0.txt index 23f0ffa..26ab901 100644 --- a/test/integration/casl2/abs_call/0.txt +++ b/test/integration/casl2/abs_call/0.txt @@ -1,636 +1,4 @@ -../../../../casl2 -sla ../../../../as/FUNC/abs_call.casl ../../../../as/FUNC/abs.casl ../../../../as/FUNC/outa.casl - -Assemble ../../../../as/FUNC/abs_call.casl (0) -../../../../as/FUNC/abs_call.casl: 1:;;; ABSを呼び出す -../../../../as/FUNC/abs_call.casl: 2:;;; casl2 abs_call.casl abs.casl outa.casl -../../../../as/FUNC/abs_call.casl: 3:MAIN START -../../../../as/FUNC/abs_call.casl: 4: LAD GR2,0 -../../../../as/FUNC/abs_call.casl: 5:MLOOP CPA GR2,MLEN -../../../../as/FUNC/abs_call.casl: 6: JZE MFIN -../../../../as/FUNC/abs_call.casl: 7: LD GR1,MVAL,GR2 -../../../../as/FUNC/abs_call.casl: 8: CALL ABS -../../../../as/FUNC/abs_call.casl: 9: CALL OUTA -../../../../as/FUNC/abs_call.casl: 10: LAD GR2,1,GR2 -../../../../as/FUNC/abs_call.casl: 11: JUMP MLOOP -../../../../as/FUNC/abs_call.casl: 12:MFIN RET -../../../../as/FUNC/abs_call.casl: 13:MVAL DC 12,-12,1,-1,32767,-32767,0,-32768 -../../../../as/FUNC/abs_call.casl: 14:MLEN DC 8 -../../../../as/FUNC/abs_call.casl: 15: END - -Assemble ../../../../as/FUNC/abs.casl (0) -../../../../as/FUNC/abs.casl: 1:;;; GR1を絶対値に変換する -../../../../as/FUNC/abs.casl: 2:ABS START -../../../../as/FUNC/abs.casl: 3: AND GR1,GR1 -../../../../as/FUNC/abs.casl: 4: JPL ABSFIN -../../../../as/FUNC/abs.casl: 5: JZE ABSFIN -../../../../as/FUNC/abs.casl: 6: XOR GR1,=#FFFF -../../../../as/FUNC/abs.casl: 7: LAD GR1,1,GR1 -../../../../as/FUNC/abs.casl: 8:ABSFIN RET -../../../../as/FUNC/abs.casl: 9: END - -Assemble ../../../../as/FUNC/outa.casl (0) -../../../../as/FUNC/outa.casl: 1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 -../../../../as/FUNC/outa.casl: 2:OUTA START -../../../../as/FUNC/outa.casl: 3: RPUSH -../../../../as/FUNC/outa.casl: 4: LAD GR2,10 ; GR2に10進数の「10」を格納。 -../../../../as/FUNC/outa.casl: 5: LAD GR0,0 ; GR0 <- 0 -../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 -../../../../as/FUNC/outa.casl: 7: LAD GR5,0 ; 整数値の長さ -../../../../as/FUNC/outa.casl: 8: AND GR1,GR1 ; GR1をテスト -../../../../as/FUNC/outa.casl: 9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ -../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ -../../../../as/FUNC/outa.casl: 11: LAD GR4,1 ; GR1が負数の場合、GR4をオン -../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 -../../../../as/FUNC/outa.casl: 13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 -../../../../as/FUNC/outa.casl: 14: JMI STLST ; ↓ -../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 -../../../../as/FUNC/outa.casl: 16: LD GR1,GR3 ; GR1にGR3をコピー -../../../../as/FUNC/outa.casl: 17: LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 18: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 19: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 20: LD GR1,GR0 ; GR0をGR1にコピー -../../../../as/FUNC/outa.casl: 21: JUMP STI ; ループ終端 -../../../../as/FUNC/outa.casl: 22:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 23: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 24: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 25: AND GR4,GR4 ; 正数の場合 -../../../../as/FUNC/outa.casl: 26: JZE PRT ; ↓ -../../../../as/FUNC/outa.casl: 27: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 28: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 29: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 30: JUMP PRT ; PRTにジャンプ -../../../../as/FUNC/outa.casl: 31:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 32: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 33: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 34:PRT ST GR5,LEN ; LEN <- GR5 -../../../../as/FUNC/outa.casl: 35: LD GR2,LEN ; GR2にLENの値を格納 -../../../../as/FUNC/outa.casl: 36: LAD GR1,STR ; GR1に文字列のアドレスを格納 -../../../../as/FUNC/outa.casl: 37: CALL REV ; 文字列を逆順に並べ替え -../../../../as/FUNC/outa.casl: 38: OUT STR,LEN ; 文字列を出力 -../../../../as/FUNC/outa.casl: 39: RPOP -../../../../as/FUNC/outa.casl: 40: RET -../../../../as/FUNC/outa.casl: 41:STR DS 17 -../../../../as/FUNC/outa.casl: 42:LEN DS 1 -../../../../as/FUNC/outa.casl: 43:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' -../../../../as/FUNC/outa.casl: 44: END -../../../../as/FUNC/outa.casl: 45:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 46:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 47:ODIVL START -../../../../as/FUNC/outa.casl: 48: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 49: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 50: PUSH 0,GR4 -../../../../as/FUNC/outa.casl: 51: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ -../../../../as/FUNC/outa.casl: 52: JZE ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 53: ST GR2,ODY ; ODYにGR2の初期値を保存 -../../../../as/FUNC/outa.casl: 54: LAD GR0,0 ; GR0の初期化 -../../../../as/FUNC/outa.casl: 55: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 56: LAD GR4,1 ; GR4の初期化。対象ビットを表す -../../../../as/FUNC/outa.casl: 57:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 -../../../../as/FUNC/outa.casl: 58: JPL ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 59: SLL GR4,1 ; GR4を1回左シフト -../../../../as/FUNC/outa.casl: 60: SLL GR2,1 ; GR2を1回左シフト -../../../../as/FUNC/outa.casl: 61: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ -../../../../as/FUNC/outa.casl: 62: JUMP ODSL ; ループ終端 -../../../../as/FUNC/outa.casl: 63:ODYOV SRL GR2,1 -../../../../as/FUNC/outa.casl: 64: LAD GR2,#8000,GR2 -../../../../as/FUNC/outa.casl: 65: SRL GR4,1 -../../../../as/FUNC/outa.casl: 66: JUMP ODLPIN -../../../../as/FUNC/outa.casl: 67:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト -../../../../as/FUNC/outa.casl: 68: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 69: SRL GR2,1 ; GR2を1回右シフト -../../../../as/FUNC/outa.casl: 70: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 71: JMI ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 72: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ -../../../../as/FUNC/outa.casl: 73: JMI ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 74:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 -../../../../as/FUNC/outa.casl: 75: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 -../../../../as/FUNC/outa.casl: 76: JUMP ODLOOP ; ループ終端 -../../../../as/FUNC/outa.casl: 77:ODFIN LD GR3,GR1 -../../../../as/FUNC/outa.casl: 78: POP GR4 -../../../../as/FUNC/outa.casl: 79: POP GR2 -../../../../as/FUNC/outa.casl: 80: POP GR1 -../../../../as/FUNC/outa.casl: 81: RET -../../../../as/FUNC/outa.casl: 82:ODY DS 1 -../../../../as/FUNC/outa.casl: 83: END -../../../../as/FUNC/outa.casl: 84:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 85:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 86:REV START -../../../../as/FUNC/outa.casl: 87: RPUSH -../../../../as/FUNC/outa.casl: 88: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 89:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 90: JZE RNEXT ; ↓ -../../../../as/FUNC/outa.casl: 91: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 92: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 93: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 -../../../../as/FUNC/outa.casl: 94: PUSH 0,GR5 ; GR5をプッシュ -../../../../as/FUNC/outa.casl: 95: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 96: JUMP RPU ; ループ終端 -../../../../as/FUNC/outa.casl: 97:RNEXT LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 98:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 99: JZE RFIN ; ↓ -../../../../as/FUNC/outa.casl: 100: POP GR5 ; GR5にポップ -../../../../as/FUNC/outa.casl: 101: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 102: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 103: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 -../../../../as/FUNC/outa.casl: 104: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 105: JUMP RPO ; ループ終端 -../../../../as/FUNC/outa.casl: 106:RFIN RPOP -../../../../as/FUNC/outa.casl: 107: RET -../../../../as/FUNC/outa.casl: 108: END -../../../../as/FUNC/outa.casl: 109:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 110:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 111:OABS START -../../../../as/FUNC/outa.casl: 112: XOR GR1,=#FFFF ; GR1の値を反転 -../../../../as/FUNC/outa.casl: 113: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 -../../../../as/FUNC/outa.casl: 114: RET -../../../../as/FUNC/outa.casl: 115: END - -Label:::: -ODIVL.ODY ---> #00FB -ABS.ABSFIN ---> #0023 -OUTA.LEN ---> #009C -ODIVL.ODLOOP ---> #00E5 -ODIVL.ODLPIN ---> #00F2 -OUTA.ZPRT ---> #0063 -ABS ---> #001A -OUTA.STI ---> #0043 -MAIN.MLOOP ---> #0002 -REV.RFIN ---> #0127 -OUTA.STR ---> #008B -ODIVL.ODFIN ---> #00F6 -REV.RPO ---> #011B -REV.RPU ---> #010C -ODIVL.ODYOV ---> #00DD -REV ---> #00FC -REV.RNEXT ---> #0119 -OABS ---> #012F -OUTA.NCHAR ---> #009D -MAIN.MFIN ---> #0010 -ODIVL.ODSL ---> #00D2 -OUTA.STLST ---> #0052 -MAIN ---> #0000 -MAIN.MLEN ---> #0019 -ODIVL ---> #00C1 -MAIN.MVAL ---> #0011 -OUTA ---> #0024 -OUTA.PRT ---> #0069 - -Assemble ../../../../as/FUNC/abs_call.casl (1) -../../../../as/FUNC/abs_call.casl: 1:;;; ABSを呼び出す -../../../../as/FUNC/abs_call.casl: 2:;;; casl2 abs_call.casl abs.casl outa.casl -../../../../as/FUNC/abs_call.casl: 3:MAIN START -../../../../as/FUNC/abs_call.casl: 4: LAD GR2,0 - #0000 #1220 - #0001 #0000 -../../../../as/FUNC/abs_call.casl: 5:MLOOP CPA GR2,MLEN - #0002 #4020 - #0003 #0019 -../../../../as/FUNC/abs_call.casl: 6: JZE MFIN - #0004 #6300 - #0005 #0010 -../../../../as/FUNC/abs_call.casl: 7: LD GR1,MVAL,GR2 - #0006 #1012 - #0007 #0011 -../../../../as/FUNC/abs_call.casl: 8: CALL ABS - #0008 #8000 - #0009 #001A -../../../../as/FUNC/abs_call.casl: 9: CALL OUTA - #000A #8000 - #000B #0024 -../../../../as/FUNC/abs_call.casl: 10: LAD GR2,1,GR2 - #000C #1222 - #000D #0001 -../../../../as/FUNC/abs_call.casl: 11: JUMP MLOOP - #000E #6400 - #000F #0002 -../../../../as/FUNC/abs_call.casl: 12:MFIN RET - #0010 #8100 -../../../../as/FUNC/abs_call.casl: 13:MVAL DC 12,-12,1,-1,32767,-32767,0,-32768 - #0011 #000C - #0012 #FFF4 - #0013 #0001 - #0014 #FFFF - #0015 #7FFF - #0016 #8001 - #0017 #0000 - #0018 #8000 -../../../../as/FUNC/abs_call.casl: 14:MLEN DC 8 - #0019 #0008 -../../../../as/FUNC/abs_call.casl: 15: END - -Assemble ../../../../as/FUNC/abs.casl (1) -../../../../as/FUNC/abs.casl: 1:;;; GR1を絶対値に変換する -../../../../as/FUNC/abs.casl: 2:ABS START -../../../../as/FUNC/abs.casl: 3: AND GR1,GR1 - #001A #3411 -../../../../as/FUNC/abs.casl: 4: JPL ABSFIN - #001B #6500 - #001C #0023 -../../../../as/FUNC/abs.casl: 5: JZE ABSFIN - #001D #6300 - #001E #0023 -../../../../as/FUNC/abs.casl: 6: XOR GR1,=#FFFF - #0134 #FFFF - #001F #3210 - #0020 #0134 -../../../../as/FUNC/abs.casl: 7: LAD GR1,1,GR1 - #0021 #1211 - #0022 #0001 -../../../../as/FUNC/abs.casl: 8:ABSFIN RET - #0023 #8100 -../../../../as/FUNC/abs.casl: 9: END - -Assemble ../../../../as/FUNC/outa.casl (1) -../../../../as/FUNC/outa.casl: 1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 -../../../../as/FUNC/outa.casl: 2:OUTA START -../../../../as/FUNC/outa.casl: 3: RPUSH - #0024 #7001 - #0025 #0000 - #0026 #7002 - #0027 #0000 - #0028 #7003 - #0029 #0000 - #002A #7004 - #002B #0000 - #002C #7005 - #002D #0000 - #002E #7006 - #002F #0000 - #0030 #7007 - #0031 #0000 -../../../../as/FUNC/outa.casl: 4: LAD GR2,10 ; GR2に10進数の「10」を格納。 - #0032 #1220 - #0033 #000A -../../../../as/FUNC/outa.casl: 5: LAD GR0,0 ; GR0 <- 0 - #0034 #1200 - #0035 #0000 -../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 - #0036 #1240 - #0037 #0000 -../../../../as/FUNC/outa.casl: 7: LAD GR5,0 ; 整数値の長さ - #0038 #1250 - #0039 #0000 -../../../../as/FUNC/outa.casl: 8: AND GR1,GR1 ; GR1をテスト - #003A #3411 -../../../../as/FUNC/outa.casl: 9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ - #003B #6300 - #003C #0063 -../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ - #003D #6500 - #003E #0043 -../../../../as/FUNC/outa.casl: 11: LAD GR4,1 ; GR1が負数の場合、GR4をオン - #003F #1240 - #0040 #0001 -../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 - #0041 #8000 - #0042 #012F -../../../../as/FUNC/outa.casl: 13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 - #0043 #4512 -../../../../as/FUNC/outa.casl: 14: JMI STLST ; ↓ - #0044 #6100 - #0045 #0052 -../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 - #0046 #8000 - #0047 #00C1 -../../../../as/FUNC/outa.casl: 16: LD GR1,GR3 ; GR1にGR3をコピー - #0048 #1413 -../../../../as/FUNC/outa.casl: 17: LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #0049 #1011 - #004A #009D -../../../../as/FUNC/outa.casl: 18: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #004B #1115 - #004C #008B -../../../../as/FUNC/outa.casl: 19: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #004D #1255 - #004E #0001 -../../../../as/FUNC/outa.casl: 20: LD GR1,GR0 ; GR0をGR1にコピー - #004F #1410 -../../../../as/FUNC/outa.casl: 21: JUMP STI ; ループ終端 - #0050 #6400 - #0051 #0043 -../../../../as/FUNC/outa.casl: 22:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #0052 #1011 - #0053 #009D -../../../../as/FUNC/outa.casl: 23: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0054 #1115 - #0055 #008B -../../../../as/FUNC/outa.casl: 24: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0056 #1255 - #0057 #0001 -../../../../as/FUNC/outa.casl: 25: AND GR4,GR4 ; 正数の場合 - #0058 #3444 -../../../../as/FUNC/outa.casl: 26: JZE PRT ; ↓ - #0059 #6300 - #005A #0069 -../../../../as/FUNC/outa.casl: 27: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 - #0135 #002D - #005B #1010 - #005C #0135 -../../../../as/FUNC/outa.casl: 28: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #005D #1115 - #005E #008B -../../../../as/FUNC/outa.casl: 29: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #005F #1255 - #0060 #0001 -../../../../as/FUNC/outa.casl: 30: JUMP PRT ; PRTにジャンプ - #0061 #6400 - #0062 #0069 -../../../../as/FUNC/outa.casl: 31:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 - #0063 #1010 - #0064 #009D -../../../../as/FUNC/outa.casl: 32: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0065 #1115 - #0066 #008B -../../../../as/FUNC/outa.casl: 33: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0067 #1255 - #0068 #0001 -../../../../as/FUNC/outa.casl: 34:PRT ST GR5,LEN ; LEN <- GR5 - #0069 #1150 - #006A #009C -../../../../as/FUNC/outa.casl: 35: LD GR2,LEN ; GR2にLENの値を格納 - #006B #1020 - #006C #009C -../../../../as/FUNC/outa.casl: 36: LAD GR1,STR ; GR1に文字列のアドレスを格納 - #006D #1210 - #006E #008B -../../../../as/FUNC/outa.casl: 37: CALL REV ; 文字列を逆順に並べ替え - #006F #8000 - #0070 #00FC -../../../../as/FUNC/outa.casl: 38: OUT STR,LEN ; 文字列を出力 - #0071 #7001 - #0072 #0000 - #0073 #7002 - #0074 #0000 - #0075 #1210 - #0076 #008B - #0077 #1020 - #0078 #009C - #0079 #F000 - #007A #0002 - #007B #1210 - #007C #0136 - #0136 #000A - #007D #1220 - #007E #0001 - #007F #F000 - #0080 #0002 - #0081 #7120 - #0082 #7110 -../../../../as/FUNC/outa.casl: 39: RPOP - #0083 #7170 - #0084 #7160 - #0085 #7150 - #0086 #7140 - #0087 #7130 - #0088 #7120 - #0089 #7110 -../../../../as/FUNC/outa.casl: 40: RET - #008A #8100 -../../../../as/FUNC/outa.casl: 41:STR DS 17 - #008B #0000 - #008C #0000 - #008D #0000 - #008E #0000 - #008F #0000 - #0090 #0000 - #0091 #0000 - #0092 #0000 - #0093 #0000 - #0094 #0000 - #0095 #0000 - #0096 #0000 - #0097 #0000 - #0098 #0000 - #0099 #0000 - #009A #0000 - #009B #0000 -../../../../as/FUNC/outa.casl: 42:LEN DS 1 - #009C #0000 -../../../../as/FUNC/outa.casl: 43:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - #009D #0030 - #009E #0031 - #009F #0032 - #00A0 #0033 - #00A1 #0034 - #00A2 #0035 - #00A3 #0036 - #00A4 #0037 - #00A5 #0038 - #00A6 #0039 - #00A7 #0041 - #00A8 #0042 - #00A9 #0043 - #00AA #0044 - #00AB #0045 - #00AC #0046 - #00AD #0047 - #00AE #0048 - #00AF #0049 - #00B0 #004A - #00B1 #004B - #00B2 #004C - #00B3 #004D - #00B4 #004E - #00B5 #004F - #00B6 #0050 - #00B7 #0051 - #00B8 #0052 - #00B9 #0053 - #00BA #0054 - #00BB #0055 - #00BC #0056 - #00BD #0057 - #00BE #0058 - #00BF #0059 - #00C0 #005A -../../../../as/FUNC/outa.casl: 44: END -../../../../as/FUNC/outa.casl: 45:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 46:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 47:ODIVL START -../../../../as/FUNC/outa.casl: 48: PUSH 0,GR1 - #00C1 #7001 - #00C2 #0000 -../../../../as/FUNC/outa.casl: 49: PUSH 0,GR2 - #00C3 #7002 - #00C4 #0000 -../../../../as/FUNC/outa.casl: 50: PUSH 0,GR4 - #00C5 #7004 - #00C6 #0000 -../../../../as/FUNC/outa.casl: 51: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - #00C7 #3422 -../../../../as/FUNC/outa.casl: 52: JZE ODFIN ; ↓ - #00C8 #6300 - #00C9 #00F6 -../../../../as/FUNC/outa.casl: 53: ST GR2,ODY ; ODYにGR2の初期値を保存 - #00CA #1120 - #00CB #00FB -../../../../as/FUNC/outa.casl: 54: LAD GR0,0 ; GR0の初期化 - #00CC #1200 - #00CD #0000 -../../../../as/FUNC/outa.casl: 55: LAD GR3,0 ; GR3の初期化 - #00CE #1230 - #00CF #0000 -../../../../as/FUNC/outa.casl: 56: LAD GR4,1 ; GR4の初期化。対象ビットを表す - #00D0 #1240 - #00D1 #0001 -../../../../as/FUNC/outa.casl: 57:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - #00D2 #4521 -../../../../as/FUNC/outa.casl: 58: JPL ODLOOP ; ↓ - #00D3 #6500 - #00D4 #00E5 -../../../../as/FUNC/outa.casl: 59: SLL GR4,1 ; GR4を1回左シフト - #00D5 #5240 - #00D6 #0001 -../../../../as/FUNC/outa.casl: 60: SLL GR2,1 ; GR2を1回左シフト - #00D7 #5220 - #00D8 #0001 -../../../../as/FUNC/outa.casl: 61: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - #00D9 #6600 - #00DA #00DD -../../../../as/FUNC/outa.casl: 62: JUMP ODSL ; ループ終端 - #00DB #6400 - #00DC #00D2 -../../../../as/FUNC/outa.casl: 63:ODYOV SRL GR2,1 - #00DD #5320 - #00DE #0001 -../../../../as/FUNC/outa.casl: 64: LAD GR2,#8000,GR2 - #00DF #1222 - #00E0 #8000 -../../../../as/FUNC/outa.casl: 65: SRL GR4,1 - #00E1 #5340 - #00E2 #0001 -../../../../as/FUNC/outa.casl: 66: JUMP ODLPIN - #00E3 #6400 - #00E4 #00F2 -../../../../as/FUNC/outa.casl: 67:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - #00E5 #5340 - #00E6 #0001 -../../../../as/FUNC/outa.casl: 68: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 - #00E7 #6300 - #00E8 #00F6 -../../../../as/FUNC/outa.casl: 69: SRL GR2,1 ; GR2を1回右シフト - #00E9 #5320 - #00EA #0001 -../../../../as/FUNC/outa.casl: 70: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - #00EB #4110 - #00EC #00FB -../../../../as/FUNC/outa.casl: 71: JMI ODFIN ; ↓ - #00ED #6100 - #00EE #00F6 -../../../../as/FUNC/outa.casl: 72: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - #00EF #4512 -../../../../as/FUNC/outa.casl: 73: JMI ODLOOP ; ↓ - #00F0 #6100 - #00F1 #00E5 -../../../../as/FUNC/outa.casl: 74:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 - #00F2 #2712 -../../../../as/FUNC/outa.casl: 75: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - #00F3 #2604 -../../../../as/FUNC/outa.casl: 76: JUMP ODLOOP ; ループ終端 - #00F4 #6400 - #00F5 #00E5 -../../../../as/FUNC/outa.casl: 77:ODFIN LD GR3,GR1 - #00F6 #1431 -../../../../as/FUNC/outa.casl: 78: POP GR4 - #00F7 #7140 -../../../../as/FUNC/outa.casl: 79: POP GR2 - #00F8 #7120 -../../../../as/FUNC/outa.casl: 80: POP GR1 - #00F9 #7110 -../../../../as/FUNC/outa.casl: 81: RET - #00FA #8100 -../../../../as/FUNC/outa.casl: 82:ODY DS 1 - #00FB #0000 -../../../../as/FUNC/outa.casl: 83: END -../../../../as/FUNC/outa.casl: 84:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 85:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 86:REV START -../../../../as/FUNC/outa.casl: 87: RPUSH - #00FC #7001 - #00FD #0000 - #00FE #7002 - #00FF #0000 - #0100 #7003 - #0101 #0000 - #0102 #7004 - #0103 #0000 - #0104 #7005 - #0105 #0000 - #0106 #7006 - #0107 #0000 - #0108 #7007 - #0109 #0000 -../../../../as/FUNC/outa.casl: 88: LAD GR3,0 ; GR3の初期化 - #010A #1230 - #010B #0000 -../../../../as/FUNC/outa.casl: 89:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #010C #4532 -../../../../as/FUNC/outa.casl: 90: JZE RNEXT ; ↓ - #010D #6300 - #010E #0119 -../../../../as/FUNC/outa.casl: 91: LD GR4,GR1 ; GR4にGR1の値をコピー - #010F #1441 -../../../../as/FUNC/outa.casl: 92: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0110 #2643 -../../../../as/FUNC/outa.casl: 93: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 - #0111 #1054 - #0112 #0000 -../../../../as/FUNC/outa.casl: 94: PUSH 0,GR5 ; GR5をプッシュ - #0113 #7005 - #0114 #0000 -../../../../as/FUNC/outa.casl: 95: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0115 #1233 - #0116 #0001 -../../../../as/FUNC/outa.casl: 96: JUMP RPU ; ループ終端 - #0117 #6400 - #0118 #010C -../../../../as/FUNC/outa.casl: 97:RNEXT LAD GR3,0 ; GR3の初期化 - #0119 #1230 - #011A #0000 -../../../../as/FUNC/outa.casl: 98:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #011B #4532 -../../../../as/FUNC/outa.casl: 99: JZE RFIN ; ↓ - #011C #6300 - #011D #0127 -../../../../as/FUNC/outa.casl: 100: POP GR5 ; GR5にポップ - #011E #7150 -../../../../as/FUNC/outa.casl: 101: LD GR4,GR1 ; GR4にGR1の値をコピー - #011F #1441 -../../../../as/FUNC/outa.casl: 102: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0120 #2643 -../../../../as/FUNC/outa.casl: 103: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - #0121 #1154 - #0122 #0000 -../../../../as/FUNC/outa.casl: 104: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0123 #1233 - #0124 #0001 -../../../../as/FUNC/outa.casl: 105: JUMP RPO ; ループ終端 - #0125 #6400 - #0126 #011B -../../../../as/FUNC/outa.casl: 106:RFIN RPOP - #0127 #7170 - #0128 #7160 - #0129 #7150 - #012A #7140 - #012B #7130 - #012C #7120 - #012D #7110 -../../../../as/FUNC/outa.casl: 107: RET - #012E #8100 -../../../../as/FUNC/outa.casl: 108: END -../../../../as/FUNC/outa.casl: 109:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 110:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 111:OABS START -../../../../as/FUNC/outa.casl: 112: XOR GR1,=#FFFF ; GR1の値を反転 - #0137 #FFFF - #012F #3210 - #0130 #0137 -../../../../as/FUNC/outa.casl: 113: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - #0131 #1211 - #0132 #0001 -../../../../as/FUNC/outa.casl: 114: RET - #0133 #8100 -../../../../as/FUNC/outa.casl: 115: END +../../../../casl2 ../../../../as/FUNC/abs_call.casl ../../../../as/FUNC/abs.casl ../../../../as/FUNC/outa_main.casl ../../../../as/FUNC/divl1.casl ../../../../as/FUNC/rev.casl 12 12 1 diff --git a/test/integration/casl2/abs_call/Makefile b/test/integration/casl2/abs_call/Makefile index 1dab35a..a83a47d 100644 --- a/test/integration/casl2/abs_call/Makefile +++ b/test/integration/casl2/abs_call/Makefile @@ -1,6 +1,5 @@ include ../CMD.mk # YACASL2DIR, CASL2 -CASL2FLAG = -sla ASDIR = $(YACASL2DIR)/as/FUNC -ASFILE = $(ASDIR)/abs_call.casl $(ASDIR)/abs.casl $(ASDIR)/outa.casl -CMD = $(CASL2) $(CASL2FLAG) $(ASFILE) $(IN) +ASFILE = $(ASDIR)/abs_call.casl $(ASDIR)/abs.casl $(ASDIR)/outa_main.casl $(ASDIR)/divl1.casl $(ASDIR)/rev.casl +CMD = $(CASL2) $(ASFILE) include ../TEST.mk diff --git a/test/integration/casl2/count_call/0.txt b/test/integration/casl2/count_call/0.txt index 6cb4d54..029f1d1 100644 --- a/test/integration/casl2/count_call/0.txt +++ b/test/integration/casl2/count_call/0.txt @@ -1,654 +1,4 @@ -../../../../casl2 -sla ../../../../as/FUNC/count1_call.casl ../../../../as/FUNC/count1.casl ../../../../as/FUNC/outa.casl - -Assemble ../../../../as/FUNC/count1_call.casl (0) -../../../../as/FUNC/count1_call.casl: 1:;; count1.casl(「アセンブラ言語の仕様」プログラム例)を呼び出し、出力結果を表示 -../../../../as/FUNC/count1_call.casl: 2:;; 使い方: casl2 count1_call.casl count1.casl outa.casl -../../../../as/FUNC/count1_call.casl: 3:MAIN START -../../../../as/FUNC/count1_call.casl: 4: LAD GR2,0 -../../../../as/FUNC/count1_call.casl: 5:LOOP CPA GR2,MAX ; ループ開始。GR2がMAXの値になったらループ脱出 -../../../../as/FUNC/count1_call.casl: 6: JZE FIN ; ↓ -../../../../as/FUNC/count1_call.casl: 7: LD GR1,GR2 ; GR1にVALの値をロード -../../../../as/FUNC/count1_call.casl: 8: CALL COUNT1 ; COUNT1を呼び出す。出力はGR0に格納 -../../../../as/FUNC/count1_call.casl: 9: LD GR1,GR0 ; GR1にGR0の値をコピー -../../../../as/FUNC/count1_call.casl: 10: CALL OUTA ; OUTAを呼び出す -../../../../as/FUNC/count1_call.casl: 11: LAD GR2,1,GR2 ; GR2 <= GR2 + 1 -../../../../as/FUNC/count1_call.casl: 12: JUMP LOOP ; ループ終端 -../../../../as/FUNC/count1_call.casl: 13:FIN RET -../../../../as/FUNC/count1_call.casl: 14:MAX DC 256 -../../../../as/FUNC/count1_call.casl: 15: END - -Assemble ../../../../as/FUNC/count1.casl (0) -../../../../as/FUNC/count1.casl: 1:COUNT1 START -../../../../as/FUNC/count1.casl: 2:; 入力 GR1:検索する語 -../../../../as/FUNC/count1.casl: 3:; 処理 GR1中の'1'のビットの個数を求める -../../../../as/FUNC/count1.casl: 4:; 出力 GR0:GR1中の'1'のビットの個数 -../../../../as/FUNC/count1.casl: 5: PUSH 0,GR1 -../../../../as/FUNC/count1.casl: 6: PUSH 0,GR2 -../../../../as/FUNC/count1.casl: 7: SUBA GR2,GR2 -../../../../as/FUNC/count1.casl: 8: AND GR1,GR1 -../../../../as/FUNC/count1.casl: 9: JZE RETURN -../../../../as/FUNC/count1.casl: 10:MORE LAD GR2,1,GR2 -../../../../as/FUNC/count1.casl: 11: LAD GR0,-1,GR1 -../../../../as/FUNC/count1.casl: 12: AND GR1,GR0 -../../../../as/FUNC/count1.casl: 13: JNZ MORE -../../../../as/FUNC/count1.casl: 14:RETURN LD GR0,GR2 -../../../../as/FUNC/count1.casl: 15: POP GR2 -../../../../as/FUNC/count1.casl: 16: POP GR1 -../../../../as/FUNC/count1.casl: 17: RET -../../../../as/FUNC/count1.casl: 18: END - -Assemble ../../../../as/FUNC/outa.casl (0) -../../../../as/FUNC/outa.casl: 1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 -../../../../as/FUNC/outa.casl: 2:OUTA START -../../../../as/FUNC/outa.casl: 3: RPUSH -../../../../as/FUNC/outa.casl: 4: LAD GR2,10 ; GR2に10進数の「10」を格納。 -../../../../as/FUNC/outa.casl: 5: LAD GR0,0 ; GR0 <- 0 -../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 -../../../../as/FUNC/outa.casl: 7: LAD GR5,0 ; 整数値の長さ -../../../../as/FUNC/outa.casl: 8: AND GR1,GR1 ; GR1をテスト -../../../../as/FUNC/outa.casl: 9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ -../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ -../../../../as/FUNC/outa.casl: 11: LAD GR4,1 ; GR1が負数の場合、GR4をオン -../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 -../../../../as/FUNC/outa.casl: 13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 -../../../../as/FUNC/outa.casl: 14: JMI STLST ; ↓ -../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 -../../../../as/FUNC/outa.casl: 16: LD GR1,GR3 ; GR1にGR3をコピー -../../../../as/FUNC/outa.casl: 17: LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 18: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 19: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 20: LD GR1,GR0 ; GR0をGR1にコピー -../../../../as/FUNC/outa.casl: 21: JUMP STI ; ループ終端 -../../../../as/FUNC/outa.casl: 22:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 23: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 24: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 25: AND GR4,GR4 ; 正数の場合 -../../../../as/FUNC/outa.casl: 26: JZE PRT ; ↓ -../../../../as/FUNC/outa.casl: 27: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 28: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 29: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 30: JUMP PRT ; PRTにジャンプ -../../../../as/FUNC/outa.casl: 31:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 32: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 33: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 34:PRT ST GR5,LEN ; LEN <- GR5 -../../../../as/FUNC/outa.casl: 35: LD GR2,LEN ; GR2にLENの値を格納 -../../../../as/FUNC/outa.casl: 36: LAD GR1,STR ; GR1に文字列のアドレスを格納 -../../../../as/FUNC/outa.casl: 37: CALL REV ; 文字列を逆順に並べ替え -../../../../as/FUNC/outa.casl: 38: OUT STR,LEN ; 文字列を出力 -../../../../as/FUNC/outa.casl: 39: RPOP -../../../../as/FUNC/outa.casl: 40: RET -../../../../as/FUNC/outa.casl: 41:STR DS 17 -../../../../as/FUNC/outa.casl: 42:LEN DS 1 -../../../../as/FUNC/outa.casl: 43:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' -../../../../as/FUNC/outa.casl: 44: END -../../../../as/FUNC/outa.casl: 45:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 46:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 47:ODIVL START -../../../../as/FUNC/outa.casl: 48: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 49: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 50: PUSH 0,GR4 -../../../../as/FUNC/outa.casl: 51: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ -../../../../as/FUNC/outa.casl: 52: JZE ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 53: ST GR2,ODY ; ODYにGR2の初期値を保存 -../../../../as/FUNC/outa.casl: 54: LAD GR0,0 ; GR0の初期化 -../../../../as/FUNC/outa.casl: 55: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 56: LAD GR4,1 ; GR4の初期化。対象ビットを表す -../../../../as/FUNC/outa.casl: 57:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 -../../../../as/FUNC/outa.casl: 58: JPL ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 59: SLL GR4,1 ; GR4を1回左シフト -../../../../as/FUNC/outa.casl: 60: SLL GR2,1 ; GR2を1回左シフト -../../../../as/FUNC/outa.casl: 61: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ -../../../../as/FUNC/outa.casl: 62: JUMP ODSL ; ループ終端 -../../../../as/FUNC/outa.casl: 63:ODYOV SRL GR2,1 -../../../../as/FUNC/outa.casl: 64: LAD GR2,#8000,GR2 -../../../../as/FUNC/outa.casl: 65: SRL GR4,1 -../../../../as/FUNC/outa.casl: 66: JUMP ODLPIN -../../../../as/FUNC/outa.casl: 67:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト -../../../../as/FUNC/outa.casl: 68: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 69: SRL GR2,1 ; GR2を1回右シフト -../../../../as/FUNC/outa.casl: 70: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 71: JMI ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 72: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ -../../../../as/FUNC/outa.casl: 73: JMI ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 74:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 -../../../../as/FUNC/outa.casl: 75: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 -../../../../as/FUNC/outa.casl: 76: JUMP ODLOOP ; ループ終端 -../../../../as/FUNC/outa.casl: 77:ODFIN LD GR3,GR1 -../../../../as/FUNC/outa.casl: 78: POP GR4 -../../../../as/FUNC/outa.casl: 79: POP GR2 -../../../../as/FUNC/outa.casl: 80: POP GR1 -../../../../as/FUNC/outa.casl: 81: RET -../../../../as/FUNC/outa.casl: 82:ODY DS 1 -../../../../as/FUNC/outa.casl: 83: END -../../../../as/FUNC/outa.casl: 84:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 85:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 86:REV START -../../../../as/FUNC/outa.casl: 87: RPUSH -../../../../as/FUNC/outa.casl: 88: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 89:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 90: JZE RNEXT ; ↓ -../../../../as/FUNC/outa.casl: 91: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 92: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 93: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 -../../../../as/FUNC/outa.casl: 94: PUSH 0,GR5 ; GR5をプッシュ -../../../../as/FUNC/outa.casl: 95: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 96: JUMP RPU ; ループ終端 -../../../../as/FUNC/outa.casl: 97:RNEXT LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 98:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 99: JZE RFIN ; ↓ -../../../../as/FUNC/outa.casl: 100: POP GR5 ; GR5にポップ -../../../../as/FUNC/outa.casl: 101: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 102: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 103: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 -../../../../as/FUNC/outa.casl: 104: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 105: JUMP RPO ; ループ終端 -../../../../as/FUNC/outa.casl: 106:RFIN RPOP -../../../../as/FUNC/outa.casl: 107: RET -../../../../as/FUNC/outa.casl: 108: END -../../../../as/FUNC/outa.casl: 109:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 110:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 111:OABS START -../../../../as/FUNC/outa.casl: 112: XOR GR1,=#FFFF ; GR1の値を反転 -../../../../as/FUNC/outa.casl: 113: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 -../../../../as/FUNC/outa.casl: 114: RET -../../../../as/FUNC/outa.casl: 115: END - -Label:::: -ODIVL.ODY ---> #00FC -COUNT1 ---> #0012 -OUTA.LEN ---> #009D -ODIVL.ODLOOP ---> #00E6 -ODIVL.ODLPIN ---> #00F3 -OUTA.ZPRT ---> #0064 -OUTA.STI ---> #0044 -REV.RFIN ---> #0128 -OUTA.STR ---> #008C -ODIVL.ODFIN ---> #00F7 -REV.RPO ---> #011C -REV.RPU ---> #010D -COUNT1.MORE ---> #001A -ODIVL.ODYOV ---> #00DE -REV ---> #00FD -MAIN.FIN ---> #0010 -REV.RNEXT ---> #011A -OABS ---> #0130 -OUTA.NCHAR ---> #009E -ODIVL.ODSL ---> #00D3 -OUTA.STLST ---> #0053 -MAIN ---> #0000 -ODIVL ---> #00C2 -COUNT1.RETURN ---> #0021 -OUTA ---> #0025 -MAIN.LOOP ---> #0002 -OUTA.PRT ---> #006A -MAIN.MAX ---> #0011 - -Assemble ../../../../as/FUNC/count1_call.casl (1) -../../../../as/FUNC/count1_call.casl: 1:;; count1.casl(「アセンブラ言語の仕様」プログラム例)を呼び出し、出力結果を表示 -../../../../as/FUNC/count1_call.casl: 2:;; 使い方: casl2 count1_call.casl count1.casl outa.casl -../../../../as/FUNC/count1_call.casl: 3:MAIN START -../../../../as/FUNC/count1_call.casl: 4: LAD GR2,0 - #0000 #1220 - #0001 #0000 -../../../../as/FUNC/count1_call.casl: 5:LOOP CPA GR2,MAX ; ループ開始。GR2がMAXの値になったらループ脱出 - #0002 #4020 - #0003 #0011 -../../../../as/FUNC/count1_call.casl: 6: JZE FIN ; ↓ - #0004 #6300 - #0005 #0010 -../../../../as/FUNC/count1_call.casl: 7: LD GR1,GR2 ; GR1にVALの値をロード - #0006 #1412 -../../../../as/FUNC/count1_call.casl: 8: CALL COUNT1 ; COUNT1を呼び出す。出力はGR0に格納 - #0007 #8000 - #0008 #0012 -../../../../as/FUNC/count1_call.casl: 9: LD GR1,GR0 ; GR1にGR0の値をコピー - #0009 #1410 -../../../../as/FUNC/count1_call.casl: 10: CALL OUTA ; OUTAを呼び出す - #000A #8000 - #000B #0025 -../../../../as/FUNC/count1_call.casl: 11: LAD GR2,1,GR2 ; GR2 <= GR2 + 1 - #000C #1222 - #000D #0001 -../../../../as/FUNC/count1_call.casl: 12: JUMP LOOP ; ループ終端 - #000E #6400 - #000F #0002 -../../../../as/FUNC/count1_call.casl: 13:FIN RET - #0010 #8100 -../../../../as/FUNC/count1_call.casl: 14:MAX DC 256 - #0011 #0100 -../../../../as/FUNC/count1_call.casl: 15: END - -Assemble ../../../../as/FUNC/count1.casl (1) -../../../../as/FUNC/count1.casl: 1:COUNT1 START -../../../../as/FUNC/count1.casl: 2:; 入力 GR1:検索する語 -../../../../as/FUNC/count1.casl: 3:; 処理 GR1中の'1'のビットの個数を求める -../../../../as/FUNC/count1.casl: 4:; 出力 GR0:GR1中の'1'のビットの個数 -../../../../as/FUNC/count1.casl: 5: PUSH 0,GR1 - #0012 #7001 - #0013 #0000 -../../../../as/FUNC/count1.casl: 6: PUSH 0,GR2 - #0014 #7002 - #0015 #0000 -../../../../as/FUNC/count1.casl: 7: SUBA GR2,GR2 - #0016 #2522 -../../../../as/FUNC/count1.casl: 8: AND GR1,GR1 - #0017 #3411 -../../../../as/FUNC/count1.casl: 9: JZE RETURN - #0018 #6300 - #0019 #0021 -../../../../as/FUNC/count1.casl: 10:MORE LAD GR2,1,GR2 - #001A #1222 - #001B #0001 -../../../../as/FUNC/count1.casl: 11: LAD GR0,-1,GR1 - #001C #1201 - #001D #FFFF -../../../../as/FUNC/count1.casl: 12: AND GR1,GR0 - #001E #3410 -../../../../as/FUNC/count1.casl: 13: JNZ MORE - #001F #6200 - #0020 #001A -../../../../as/FUNC/count1.casl: 14:RETURN LD GR0,GR2 - #0021 #1402 -../../../../as/FUNC/count1.casl: 15: POP GR2 - #0022 #7120 -../../../../as/FUNC/count1.casl: 16: POP GR1 - #0023 #7110 -../../../../as/FUNC/count1.casl: 17: RET - #0024 #8100 -../../../../as/FUNC/count1.casl: 18: END - -Assemble ../../../../as/FUNC/outa.casl (1) -../../../../as/FUNC/outa.casl: 1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 -../../../../as/FUNC/outa.casl: 2:OUTA START -../../../../as/FUNC/outa.casl: 3: RPUSH - #0025 #7001 - #0026 #0000 - #0027 #7002 - #0028 #0000 - #0029 #7003 - #002A #0000 - #002B #7004 - #002C #0000 - #002D #7005 - #002E #0000 - #002F #7006 - #0030 #0000 - #0031 #7007 - #0032 #0000 -../../../../as/FUNC/outa.casl: 4: LAD GR2,10 ; GR2に10進数の「10」を格納。 - #0033 #1220 - #0034 #000A -../../../../as/FUNC/outa.casl: 5: LAD GR0,0 ; GR0 <- 0 - #0035 #1200 - #0036 #0000 -../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 - #0037 #1240 - #0038 #0000 -../../../../as/FUNC/outa.casl: 7: LAD GR5,0 ; 整数値の長さ - #0039 #1250 - #003A #0000 -../../../../as/FUNC/outa.casl: 8: AND GR1,GR1 ; GR1をテスト - #003B #3411 -../../../../as/FUNC/outa.casl: 9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ - #003C #6300 - #003D #0064 -../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ - #003E #6500 - #003F #0044 -../../../../as/FUNC/outa.casl: 11: LAD GR4,1 ; GR1が負数の場合、GR4をオン - #0040 #1240 - #0041 #0001 -../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 - #0042 #8000 - #0043 #0130 -../../../../as/FUNC/outa.casl: 13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 - #0044 #4512 -../../../../as/FUNC/outa.casl: 14: JMI STLST ; ↓ - #0045 #6100 - #0046 #0053 -../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 - #0047 #8000 - #0048 #00C2 -../../../../as/FUNC/outa.casl: 16: LD GR1,GR3 ; GR1にGR3をコピー - #0049 #1413 -../../../../as/FUNC/outa.casl: 17: LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #004A #1011 - #004B #009E -../../../../as/FUNC/outa.casl: 18: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #004C #1115 - #004D #008C -../../../../as/FUNC/outa.casl: 19: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #004E #1255 - #004F #0001 -../../../../as/FUNC/outa.casl: 20: LD GR1,GR0 ; GR0をGR1にコピー - #0050 #1410 -../../../../as/FUNC/outa.casl: 21: JUMP STI ; ループ終端 - #0051 #6400 - #0052 #0044 -../../../../as/FUNC/outa.casl: 22:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #0053 #1011 - #0054 #009E -../../../../as/FUNC/outa.casl: 23: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0055 #1115 - #0056 #008C -../../../../as/FUNC/outa.casl: 24: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0057 #1255 - #0058 #0001 -../../../../as/FUNC/outa.casl: 25: AND GR4,GR4 ; 正数の場合 - #0059 #3444 -../../../../as/FUNC/outa.casl: 26: JZE PRT ; ↓ - #005A #6300 - #005B #006A -../../../../as/FUNC/outa.casl: 27: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 - #0135 #002D - #005C #1010 - #005D #0135 -../../../../as/FUNC/outa.casl: 28: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #005E #1115 - #005F #008C -../../../../as/FUNC/outa.casl: 29: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0060 #1255 - #0061 #0001 -../../../../as/FUNC/outa.casl: 30: JUMP PRT ; PRTにジャンプ - #0062 #6400 - #0063 #006A -../../../../as/FUNC/outa.casl: 31:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 - #0064 #1010 - #0065 #009E -../../../../as/FUNC/outa.casl: 32: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0066 #1115 - #0067 #008C -../../../../as/FUNC/outa.casl: 33: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0068 #1255 - #0069 #0001 -../../../../as/FUNC/outa.casl: 34:PRT ST GR5,LEN ; LEN <- GR5 - #006A #1150 - #006B #009D -../../../../as/FUNC/outa.casl: 35: LD GR2,LEN ; GR2にLENの値を格納 - #006C #1020 - #006D #009D -../../../../as/FUNC/outa.casl: 36: LAD GR1,STR ; GR1に文字列のアドレスを格納 - #006E #1210 - #006F #008C -../../../../as/FUNC/outa.casl: 37: CALL REV ; 文字列を逆順に並べ替え - #0070 #8000 - #0071 #00FD -../../../../as/FUNC/outa.casl: 38: OUT STR,LEN ; 文字列を出力 - #0072 #7001 - #0073 #0000 - #0074 #7002 - #0075 #0000 - #0076 #1210 - #0077 #008C - #0078 #1020 - #0079 #009D - #007A #F000 - #007B #0002 - #007C #1210 - #007D #0136 - #0136 #000A - #007E #1220 - #007F #0001 - #0080 #F000 - #0081 #0002 - #0082 #7120 - #0083 #7110 -../../../../as/FUNC/outa.casl: 39: RPOP - #0084 #7170 - #0085 #7160 - #0086 #7150 - #0087 #7140 - #0088 #7130 - #0089 #7120 - #008A #7110 -../../../../as/FUNC/outa.casl: 40: RET - #008B #8100 -../../../../as/FUNC/outa.casl: 41:STR DS 17 - #008C #0000 - #008D #0000 - #008E #0000 - #008F #0000 - #0090 #0000 - #0091 #0000 - #0092 #0000 - #0093 #0000 - #0094 #0000 - #0095 #0000 - #0096 #0000 - #0097 #0000 - #0098 #0000 - #0099 #0000 - #009A #0000 - #009B #0000 - #009C #0000 -../../../../as/FUNC/outa.casl: 42:LEN DS 1 - #009D #0000 -../../../../as/FUNC/outa.casl: 43:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - #009E #0030 - #009F #0031 - #00A0 #0032 - #00A1 #0033 - #00A2 #0034 - #00A3 #0035 - #00A4 #0036 - #00A5 #0037 - #00A6 #0038 - #00A7 #0039 - #00A8 #0041 - #00A9 #0042 - #00AA #0043 - #00AB #0044 - #00AC #0045 - #00AD #0046 - #00AE #0047 - #00AF #0048 - #00B0 #0049 - #00B1 #004A - #00B2 #004B - #00B3 #004C - #00B4 #004D - #00B5 #004E - #00B6 #004F - #00B7 #0050 - #00B8 #0051 - #00B9 #0052 - #00BA #0053 - #00BB #0054 - #00BC #0055 - #00BD #0056 - #00BE #0057 - #00BF #0058 - #00C0 #0059 - #00C1 #005A -../../../../as/FUNC/outa.casl: 44: END -../../../../as/FUNC/outa.casl: 45:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 46:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 47:ODIVL START -../../../../as/FUNC/outa.casl: 48: PUSH 0,GR1 - #00C2 #7001 - #00C3 #0000 -../../../../as/FUNC/outa.casl: 49: PUSH 0,GR2 - #00C4 #7002 - #00C5 #0000 -../../../../as/FUNC/outa.casl: 50: PUSH 0,GR4 - #00C6 #7004 - #00C7 #0000 -../../../../as/FUNC/outa.casl: 51: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - #00C8 #3422 -../../../../as/FUNC/outa.casl: 52: JZE ODFIN ; ↓ - #00C9 #6300 - #00CA #00F7 -../../../../as/FUNC/outa.casl: 53: ST GR2,ODY ; ODYにGR2の初期値を保存 - #00CB #1120 - #00CC #00FC -../../../../as/FUNC/outa.casl: 54: LAD GR0,0 ; GR0の初期化 - #00CD #1200 - #00CE #0000 -../../../../as/FUNC/outa.casl: 55: LAD GR3,0 ; GR3の初期化 - #00CF #1230 - #00D0 #0000 -../../../../as/FUNC/outa.casl: 56: LAD GR4,1 ; GR4の初期化。対象ビットを表す - #00D1 #1240 - #00D2 #0001 -../../../../as/FUNC/outa.casl: 57:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - #00D3 #4521 -../../../../as/FUNC/outa.casl: 58: JPL ODLOOP ; ↓ - #00D4 #6500 - #00D5 #00E6 -../../../../as/FUNC/outa.casl: 59: SLL GR4,1 ; GR4を1回左シフト - #00D6 #5240 - #00D7 #0001 -../../../../as/FUNC/outa.casl: 60: SLL GR2,1 ; GR2を1回左シフト - #00D8 #5220 - #00D9 #0001 -../../../../as/FUNC/outa.casl: 61: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - #00DA #6600 - #00DB #00DE -../../../../as/FUNC/outa.casl: 62: JUMP ODSL ; ループ終端 - #00DC #6400 - #00DD #00D3 -../../../../as/FUNC/outa.casl: 63:ODYOV SRL GR2,1 - #00DE #5320 - #00DF #0001 -../../../../as/FUNC/outa.casl: 64: LAD GR2,#8000,GR2 - #00E0 #1222 - #00E1 #8000 -../../../../as/FUNC/outa.casl: 65: SRL GR4,1 - #00E2 #5340 - #00E3 #0001 -../../../../as/FUNC/outa.casl: 66: JUMP ODLPIN - #00E4 #6400 - #00E5 #00F3 -../../../../as/FUNC/outa.casl: 67:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - #00E6 #5340 - #00E7 #0001 -../../../../as/FUNC/outa.casl: 68: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 - #00E8 #6300 - #00E9 #00F7 -../../../../as/FUNC/outa.casl: 69: SRL GR2,1 ; GR2を1回右シフト - #00EA #5320 - #00EB #0001 -../../../../as/FUNC/outa.casl: 70: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - #00EC #4110 - #00ED #00FC -../../../../as/FUNC/outa.casl: 71: JMI ODFIN ; ↓ - #00EE #6100 - #00EF #00F7 -../../../../as/FUNC/outa.casl: 72: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - #00F0 #4512 -../../../../as/FUNC/outa.casl: 73: JMI ODLOOP ; ↓ - #00F1 #6100 - #00F2 #00E6 -../../../../as/FUNC/outa.casl: 74:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 - #00F3 #2712 -../../../../as/FUNC/outa.casl: 75: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - #00F4 #2604 -../../../../as/FUNC/outa.casl: 76: JUMP ODLOOP ; ループ終端 - #00F5 #6400 - #00F6 #00E6 -../../../../as/FUNC/outa.casl: 77:ODFIN LD GR3,GR1 - #00F7 #1431 -../../../../as/FUNC/outa.casl: 78: POP GR4 - #00F8 #7140 -../../../../as/FUNC/outa.casl: 79: POP GR2 - #00F9 #7120 -../../../../as/FUNC/outa.casl: 80: POP GR1 - #00FA #7110 -../../../../as/FUNC/outa.casl: 81: RET - #00FB #8100 -../../../../as/FUNC/outa.casl: 82:ODY DS 1 - #00FC #0000 -../../../../as/FUNC/outa.casl: 83: END -../../../../as/FUNC/outa.casl: 84:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 85:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 86:REV START -../../../../as/FUNC/outa.casl: 87: RPUSH - #00FD #7001 - #00FE #0000 - #00FF #7002 - #0100 #0000 - #0101 #7003 - #0102 #0000 - #0103 #7004 - #0104 #0000 - #0105 #7005 - #0106 #0000 - #0107 #7006 - #0108 #0000 - #0109 #7007 - #010A #0000 -../../../../as/FUNC/outa.casl: 88: LAD GR3,0 ; GR3の初期化 - #010B #1230 - #010C #0000 -../../../../as/FUNC/outa.casl: 89:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #010D #4532 -../../../../as/FUNC/outa.casl: 90: JZE RNEXT ; ↓ - #010E #6300 - #010F #011A -../../../../as/FUNC/outa.casl: 91: LD GR4,GR1 ; GR4にGR1の値をコピー - #0110 #1441 -../../../../as/FUNC/outa.casl: 92: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0111 #2643 -../../../../as/FUNC/outa.casl: 93: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 - #0112 #1054 - #0113 #0000 -../../../../as/FUNC/outa.casl: 94: PUSH 0,GR5 ; GR5をプッシュ - #0114 #7005 - #0115 #0000 -../../../../as/FUNC/outa.casl: 95: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0116 #1233 - #0117 #0001 -../../../../as/FUNC/outa.casl: 96: JUMP RPU ; ループ終端 - #0118 #6400 - #0119 #010D -../../../../as/FUNC/outa.casl: 97:RNEXT LAD GR3,0 ; GR3の初期化 - #011A #1230 - #011B #0000 -../../../../as/FUNC/outa.casl: 98:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #011C #4532 -../../../../as/FUNC/outa.casl: 99: JZE RFIN ; ↓ - #011D #6300 - #011E #0128 -../../../../as/FUNC/outa.casl: 100: POP GR5 ; GR5にポップ - #011F #7150 -../../../../as/FUNC/outa.casl: 101: LD GR4,GR1 ; GR4にGR1の値をコピー - #0120 #1441 -../../../../as/FUNC/outa.casl: 102: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0121 #2643 -../../../../as/FUNC/outa.casl: 103: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - #0122 #1154 - #0123 #0000 -../../../../as/FUNC/outa.casl: 104: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0124 #1233 - #0125 #0001 -../../../../as/FUNC/outa.casl: 105: JUMP RPO ; ループ終端 - #0126 #6400 - #0127 #011C -../../../../as/FUNC/outa.casl: 106:RFIN RPOP - #0128 #7170 - #0129 #7160 - #012A #7150 - #012B #7140 - #012C #7130 - #012D #7120 - #012E #7110 -../../../../as/FUNC/outa.casl: 107: RET - #012F #8100 -../../../../as/FUNC/outa.casl: 108: END -../../../../as/FUNC/outa.casl: 109:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 110:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 111:OABS START -../../../../as/FUNC/outa.casl: 112: XOR GR1,=#FFFF ; GR1の値を反転 - #0137 #FFFF - #0130 #3210 - #0131 #0137 -../../../../as/FUNC/outa.casl: 113: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - #0132 #1211 - #0133 #0001 -../../../../as/FUNC/outa.casl: 114: RET - #0134 #8100 -../../../../as/FUNC/outa.casl: 115: END +../../../../casl2 ../../../../as/FUNC/count1_call.casl ../../../../as/FUNC/count1.casl ../../../../as/FUNC/outa.casl 0 1 1 diff --git a/test/integration/casl2/count_call/Makefile b/test/integration/casl2/count_call/Makefile index 62ee597..5f8544b 100644 --- a/test/integration/casl2/count_call/Makefile +++ b/test/integration/casl2/count_call/Makefile @@ -1,6 +1,5 @@ include ../CMD.mk # YACASL2DIR, CASL2 -CASL2FLAG = -sla ASDIR = $(YACASL2DIR)/as/FUNC ASFILE = $(ASDIR)/count1_call.casl $(ASDIR)/count1.casl $(ASDIR)/outa.casl -CMD = $(CASL2) $(CASL2FLAG) $(ASFILE) $(IN) +CMD = $(CASL2) $(ASFILE) include ../TEST.mk diff --git a/test/integration/casl2/divl0_call/0.txt b/test/integration/casl2/divl0_call/0.txt index 9a30896..ed9b1d4 100644 --- a/test/integration/casl2/divl0_call/0.txt +++ b/test/integration/casl2/divl0_call/0.txt @@ -1,4 +1,4 @@ -../../../../casl2 ../../../../as/FUNC/divl_call.casl ../../../../as/FUNC/divl0.casl ../../../../as/FUNC/outl.casl +../../../../casl2 ../../../../as/FUNC/divl_call.casl ../../../../as/FUNC/divl0.casl ../../../../as/FUNC/outl_main.casl ../../../../as/FUNC/rev.casl -------------------- 100 0 diff --git a/test/integration/casl2/divl0_call/Makefile b/test/integration/casl2/divl0_call/Makefile index e9f8ad6..ef00902 100644 --- a/test/integration/casl2/divl0_call/Makefile +++ b/test/integration/casl2/divl0_call/Makefile @@ -1,5 +1,5 @@ include ../CMD.mk # YACASL2DIR, CASL2 ASDIR = $(YACASL2DIR)/as/FUNC -ASFILE = $(ASDIR)/divl_call.casl $(ASDIR)/divl0.casl $(ASDIR)/outl.casl +ASFILE = $(ASDIR)/divl_call.casl $(ASDIR)/divl0.casl $(ASDIR)/outl_main.casl $(ASDIR)/rev.casl CMD = $(CASL2) $(ASFILE) include ../TEST.mk diff --git a/test/integration/casl2/divl1_call/0.txt b/test/integration/casl2/divl1_call/0.txt index a6fa4ad..95808d5 100644 --- a/test/integration/casl2/divl1_call/0.txt +++ b/test/integration/casl2/divl1_call/0.txt @@ -1,4 +1,4 @@ -../../../../casl2 ../../../../as/FUNC/divl_call.casl ../../../../as/FUNC/divl1.casl ../../../../as/FUNC/outl.casl +../../../../casl2 ../../../../as/FUNC/divl_call.casl ../../../../as/FUNC/divl1.casl ../../../../as/FUNC/outl_main.casl ../../../../as/FUNC/rev.casl -------------------- 100 0 diff --git a/test/integration/casl2/divl1_call/Makefile b/test/integration/casl2/divl1_call/Makefile index decdea0..f566163 100644 --- a/test/integration/casl2/divl1_call/Makefile +++ b/test/integration/casl2/divl1_call/Makefile @@ -1,5 +1,5 @@ include ../CMD.mk # YACASL2DIR, CASL2 ASDIR = $(YACASL2DIR)/as/FUNC -ASFILE = $(ASDIR)/divl_call.casl $(ASDIR)/divl1.casl $(ASDIR)/outl.casl +ASFILE = $(ASDIR)/divl_call.casl $(ASDIR)/divl1.casl $(ASDIR)/outl_main.casl $(ASDIR)/rev.casl CMD = $(CASL2) $(ASFILE) include ../TEST.mk diff --git a/test/integration/casl2/minim_call/0.txt b/test/integration/casl2/minim_call/0.txt index 8ac1f07..d36a803 100644 --- a/test/integration/casl2/minim_call/0.txt +++ b/test/integration/casl2/minim_call/0.txt @@ -1,657 +1,2 @@ -../../../../casl2 -sla ../../../../as/FUNC/minim_call.casl ../../../../as/FUNC/minim.casl ../../../../as/FUNC/outa.casl - -Assemble ../../../../as/FUNC/minim_call.casl (0) -../../../../as/FUNC/minim_call.casl: 1:;;; casl2 minim_call.casl minim.casl outa.casl -../../../../as/FUNC/minim_call.casl: 2:MAIN START -../../../../as/FUNC/minim_call.casl: 3: LAD GR1,DATA -../../../../as/FUNC/minim_call.casl: 4: LD GR2,CNT -../../../../as/FUNC/minim_call.casl: 5: CALL MINIM -../../../../as/FUNC/minim_call.casl: 6: LD GR1,GR0 -../../../../as/FUNC/minim_call.casl: 7: CALL OUTA -../../../../as/FUNC/minim_call.casl: 8: RET -../../../../as/FUNC/minim_call.casl: 9:DATA DC 23,78,2,45,67,-39,86 -../../../../as/FUNC/minim_call.casl: 10:CNT DC 7 -../../../../as/FUNC/minim_call.casl: 11: END - -Assemble ../../../../as/FUNC/minim.casl (0) -../../../../as/FUNC/minim.casl: 1:;;; GR1のアドレスに格納されたGR2の個数の値の中で、最小値をGR0に格納する -../../../../as/FUNC/minim.casl: 2:MINIM START -../../../../as/FUNC/minim.casl: 3: LD GR0,0,GR1 -../../../../as/FUNC/minim.casl: 4: ST GR0,MIN -../../../../as/FUNC/minim.casl: 5: LAD GR3,0 -../../../../as/FUNC/minim.casl: 6:S1 CPA GR3,GR2 -../../../../as/FUNC/minim.casl: 7: JZE LRET -../../../../as/FUNC/minim.casl: 8: LAD GR1,1,GR1 -../../../../as/FUNC/minim.casl: 9: LD GR0,0,GR1 -../../../../as/FUNC/minim.casl: 10: CPA GR0,MIN -../../../../as/FUNC/minim.casl: 11: JPL S2 -../../../../as/FUNC/minim.casl: 12: JZE S2 -../../../../as/FUNC/minim.casl: 13: ST GR0,MIN -../../../../as/FUNC/minim.casl: 14:S2 LAD GR3,1,GR3 -../../../../as/FUNC/minim.casl: 15: JUMP S1 -../../../../as/FUNC/minim.casl: 16:LRET LD GR0,MIN -../../../../as/FUNC/minim.casl: 17: RET -../../../../as/FUNC/minim.casl: 18:MIN DS 1 -../../../../as/FUNC/minim.casl: 19: END - -Assemble ../../../../as/FUNC/outa.casl (0) -../../../../as/FUNC/outa.casl: 1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 -../../../../as/FUNC/outa.casl: 2:OUTA START -../../../../as/FUNC/outa.casl: 3: RPUSH -../../../../as/FUNC/outa.casl: 4: LAD GR2,10 ; GR2に10進数の「10」を格納。 -../../../../as/FUNC/outa.casl: 5: LAD GR0,0 ; GR0 <- 0 -../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 -../../../../as/FUNC/outa.casl: 7: LAD GR5,0 ; 整数値の長さ -../../../../as/FUNC/outa.casl: 8: AND GR1,GR1 ; GR1をテスト -../../../../as/FUNC/outa.casl: 9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ -../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ -../../../../as/FUNC/outa.casl: 11: LAD GR4,1 ; GR1が負数の場合、GR4をオン -../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 -../../../../as/FUNC/outa.casl: 13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 -../../../../as/FUNC/outa.casl: 14: JMI STLST ; ↓ -../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 -../../../../as/FUNC/outa.casl: 16: LD GR1,GR3 ; GR1にGR3をコピー -../../../../as/FUNC/outa.casl: 17: LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 18: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 19: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 20: LD GR1,GR0 ; GR0をGR1にコピー -../../../../as/FUNC/outa.casl: 21: JUMP STI ; ループ終端 -../../../../as/FUNC/outa.casl: 22:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 23: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 24: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 25: AND GR4,GR4 ; 正数の場合 -../../../../as/FUNC/outa.casl: 26: JZE PRT ; ↓ -../../../../as/FUNC/outa.casl: 27: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 28: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 29: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 30: JUMP PRT ; PRTにジャンプ -../../../../as/FUNC/outa.casl: 31:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 32: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 -../../../../as/FUNC/outa.casl: 33: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 -../../../../as/FUNC/outa.casl: 34:PRT ST GR5,LEN ; LEN <- GR5 -../../../../as/FUNC/outa.casl: 35: LD GR2,LEN ; GR2にLENの値を格納 -../../../../as/FUNC/outa.casl: 36: LAD GR1,STR ; GR1に文字列のアドレスを格納 -../../../../as/FUNC/outa.casl: 37: CALL REV ; 文字列を逆順に並べ替え -../../../../as/FUNC/outa.casl: 38: OUT STR,LEN ; 文字列を出力 -../../../../as/FUNC/outa.casl: 39: RPOP -../../../../as/FUNC/outa.casl: 40: RET -../../../../as/FUNC/outa.casl: 41:STR DS 17 -../../../../as/FUNC/outa.casl: 42:LEN DS 1 -../../../../as/FUNC/outa.casl: 43:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' -../../../../as/FUNC/outa.casl: 44: END -../../../../as/FUNC/outa.casl: 45:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 46:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 47:ODIVL START -../../../../as/FUNC/outa.casl: 48: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 49: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 50: PUSH 0,GR4 -../../../../as/FUNC/outa.casl: 51: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ -../../../../as/FUNC/outa.casl: 52: JZE ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 53: ST GR2,ODY ; ODYにGR2の初期値を保存 -../../../../as/FUNC/outa.casl: 54: LAD GR0,0 ; GR0の初期化 -../../../../as/FUNC/outa.casl: 55: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 56: LAD GR4,1 ; GR4の初期化。対象ビットを表す -../../../../as/FUNC/outa.casl: 57:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 -../../../../as/FUNC/outa.casl: 58: JPL ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 59: SLL GR4,1 ; GR4を1回左シフト -../../../../as/FUNC/outa.casl: 60: SLL GR2,1 ; GR2を1回左シフト -../../../../as/FUNC/outa.casl: 61: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ -../../../../as/FUNC/outa.casl: 62: JUMP ODSL ; ループ終端 -../../../../as/FUNC/outa.casl: 63:ODYOV SRL GR2,1 -../../../../as/FUNC/outa.casl: 64: LAD GR2,#8000,GR2 -../../../../as/FUNC/outa.casl: 65: SRL GR4,1 -../../../../as/FUNC/outa.casl: 66: JUMP ODLPIN -../../../../as/FUNC/outa.casl: 67:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト -../../../../as/FUNC/outa.casl: 68: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 69: SRL GR2,1 ; GR2を1回右シフト -../../../../as/FUNC/outa.casl: 70: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 71: JMI ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 72: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ -../../../../as/FUNC/outa.casl: 73: JMI ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 74:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 -../../../../as/FUNC/outa.casl: 75: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 -../../../../as/FUNC/outa.casl: 76: JUMP ODLOOP ; ループ終端 -../../../../as/FUNC/outa.casl: 77:ODFIN LD GR3,GR1 -../../../../as/FUNC/outa.casl: 78: POP GR4 -../../../../as/FUNC/outa.casl: 79: POP GR2 -../../../../as/FUNC/outa.casl: 80: POP GR1 -../../../../as/FUNC/outa.casl: 81: RET -../../../../as/FUNC/outa.casl: 82:ODY DS 1 -../../../../as/FUNC/outa.casl: 83: END -../../../../as/FUNC/outa.casl: 84:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 85:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 86:REV START -../../../../as/FUNC/outa.casl: 87: RPUSH -../../../../as/FUNC/outa.casl: 88: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 89:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 90: JZE RNEXT ; ↓ -../../../../as/FUNC/outa.casl: 91: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 92: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 93: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 -../../../../as/FUNC/outa.casl: 94: PUSH 0,GR5 ; GR5をプッシュ -../../../../as/FUNC/outa.casl: 95: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 96: JUMP RPU ; ループ終端 -../../../../as/FUNC/outa.casl: 97:RNEXT LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 98:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 99: JZE RFIN ; ↓ -../../../../as/FUNC/outa.casl: 100: POP GR5 ; GR5にポップ -../../../../as/FUNC/outa.casl: 101: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 102: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 103: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 -../../../../as/FUNC/outa.casl: 104: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 105: JUMP RPO ; ループ終端 -../../../../as/FUNC/outa.casl: 106:RFIN RPOP -../../../../as/FUNC/outa.casl: 107: RET -../../../../as/FUNC/outa.casl: 108: END -../../../../as/FUNC/outa.casl: 109:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 110:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 111:OABS START -../../../../as/FUNC/outa.casl: 112: XOR GR1,=#FFFF ; GR1の値を反転 -../../../../as/FUNC/outa.casl: 113: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 -../../../../as/FUNC/outa.casl: 114: RET -../../../../as/FUNC/outa.casl: 115: END - -Label:::: -ODIVL.ODY ---> #0106 -OUTA.LEN ---> #00A7 -ODIVL.ODLOOP ---> #00F0 -ODIVL.ODLPIN ---> #00FD -OUTA.ZPRT ---> #006E -OUTA.STI ---> #004E -REV.RFIN ---> #0132 -OUTA.STR ---> #0096 -ODIVL.ODFIN ---> #0101 -REV.RPO ---> #0126 -REV.RPU ---> #0117 -ODIVL.ODYOV ---> #00E8 -REV ---> #0107 -MINIM.LRET ---> #002B -MINIM.S1 ---> #0018 -MINIM.S2 ---> #0027 -MINIM.MIN ---> #002E -REV.RNEXT ---> #0124 -OABS ---> #013A -OUTA.NCHAR ---> #00A8 -ODIVL.ODSL ---> #00DD -OUTA.STLST ---> #005D -MAIN ---> #0000 -ODIVL ---> #00CC -OUTA ---> #002F -MINIM ---> #0012 -OUTA.PRT ---> #0074 -MAIN.DATA ---> #000A -MAIN.CNT ---> #0011 - -Assemble ../../../../as/FUNC/minim_call.casl (1) -../../../../as/FUNC/minim_call.casl: 1:;;; casl2 minim_call.casl minim.casl outa.casl -../../../../as/FUNC/minim_call.casl: 2:MAIN START -../../../../as/FUNC/minim_call.casl: 3: LAD GR1,DATA - #0000 #1210 - #0001 #000A -../../../../as/FUNC/minim_call.casl: 4: LD GR2,CNT - #0002 #1020 - #0003 #0011 -../../../../as/FUNC/minim_call.casl: 5: CALL MINIM - #0004 #8000 - #0005 #0012 -../../../../as/FUNC/minim_call.casl: 6: LD GR1,GR0 - #0006 #1410 -../../../../as/FUNC/minim_call.casl: 7: CALL OUTA - #0007 #8000 - #0008 #002F -../../../../as/FUNC/minim_call.casl: 8: RET - #0009 #8100 -../../../../as/FUNC/minim_call.casl: 9:DATA DC 23,78,2,45,67,-39,86 - #000A #0017 - #000B #004E - #000C #0002 - #000D #002D - #000E #0043 - #000F #FFD9 - #0010 #0056 -../../../../as/FUNC/minim_call.casl: 10:CNT DC 7 - #0011 #0007 -../../../../as/FUNC/minim_call.casl: 11: END - -Assemble ../../../../as/FUNC/minim.casl (1) -../../../../as/FUNC/minim.casl: 1:;;; GR1のアドレスに格納されたGR2の個数の値の中で、最小値をGR0に格納する -../../../../as/FUNC/minim.casl: 2:MINIM START -../../../../as/FUNC/minim.casl: 3: LD GR0,0,GR1 - #0012 #1001 - #0013 #0000 -../../../../as/FUNC/minim.casl: 4: ST GR0,MIN - #0014 #1100 - #0015 #002E -../../../../as/FUNC/minim.casl: 5: LAD GR3,0 - #0016 #1230 - #0017 #0000 -../../../../as/FUNC/minim.casl: 6:S1 CPA GR3,GR2 - #0018 #4432 -../../../../as/FUNC/minim.casl: 7: JZE LRET - #0019 #6300 - #001A #002B -../../../../as/FUNC/minim.casl: 8: LAD GR1,1,GR1 - #001B #1211 - #001C #0001 -../../../../as/FUNC/minim.casl: 9: LD GR0,0,GR1 - #001D #1001 - #001E #0000 -../../../../as/FUNC/minim.casl: 10: CPA GR0,MIN - #001F #4000 - #0020 #002E -../../../../as/FUNC/minim.casl: 11: JPL S2 - #0021 #6500 - #0022 #0027 -../../../../as/FUNC/minim.casl: 12: JZE S2 - #0023 #6300 - #0024 #0027 -../../../../as/FUNC/minim.casl: 13: ST GR0,MIN - #0025 #1100 - #0026 #002E -../../../../as/FUNC/minim.casl: 14:S2 LAD GR3,1,GR3 - #0027 #1233 - #0028 #0001 -../../../../as/FUNC/minim.casl: 15: JUMP S1 - #0029 #6400 - #002A #0018 -../../../../as/FUNC/minim.casl: 16:LRET LD GR0,MIN - #002B #1000 - #002C #002E -../../../../as/FUNC/minim.casl: 17: RET - #002D #8100 -../../../../as/FUNC/minim.casl: 18:MIN DS 1 - #002E #0000 -../../../../as/FUNC/minim.casl: 19: END - -Assemble ../../../../as/FUNC/outa.casl (1) -../../../../as/FUNC/outa.casl: 1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示 -../../../../as/FUNC/outa.casl: 2:OUTA START -../../../../as/FUNC/outa.casl: 3: RPUSH - #002F #7001 - #0030 #0000 - #0031 #7002 - #0032 #0000 - #0033 #7003 - #0034 #0000 - #0035 #7004 - #0036 #0000 - #0037 #7005 - #0038 #0000 - #0039 #7006 - #003A #0000 - #003B #7007 - #003C #0000 -../../../../as/FUNC/outa.casl: 4: LAD GR2,10 ; GR2に10進数の「10」を格納。 - #003D #1220 - #003E #000A -../../../../as/FUNC/outa.casl: 5: LAD GR0,0 ; GR0 <- 0 - #003F #1200 - #0040 #0000 -../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 - #0041 #1240 - #0042 #0000 -../../../../as/FUNC/outa.casl: 7: LAD GR5,0 ; 整数値の長さ - #0043 #1250 - #0044 #0000 -../../../../as/FUNC/outa.casl: 8: AND GR1,GR1 ; GR1をテスト - #0045 #3411 -../../../../as/FUNC/outa.casl: 9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ - #0046 #6300 - #0047 #006E -../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ - #0048 #6500 - #0049 #004E -../../../../as/FUNC/outa.casl: 11: LAD GR4,1 ; GR1が負数の場合、GR4をオン - #004A #1240 - #004B #0001 -../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 - #004C #8000 - #004D #013A -../../../../as/FUNC/outa.casl: 13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出 - #004E #4512 -../../../../as/FUNC/outa.casl: 14: JMI STLST ; ↓ - #004F #6100 - #0050 #005D -../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 - #0051 #8000 - #0052 #00CC -../../../../as/FUNC/outa.casl: 16: LD GR1,GR3 ; GR1にGR3をコピー - #0053 #1413 -../../../../as/FUNC/outa.casl: 17: LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #0054 #1011 - #0055 #00A8 -../../../../as/FUNC/outa.casl: 18: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0056 #1115 - #0057 #0096 -../../../../as/FUNC/outa.casl: 19: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0058 #1255 - #0059 #0001 -../../../../as/FUNC/outa.casl: 20: LD GR1,GR0 ; GR0をGR1にコピー - #005A #1410 -../../../../as/FUNC/outa.casl: 21: JUMP STI ; ループ終端 - #005B #6400 - #005C #004E -../../../../as/FUNC/outa.casl: 22:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #005D #1011 - #005E #00A8 -../../../../as/FUNC/outa.casl: 23: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #005F #1115 - #0060 #0096 -../../../../as/FUNC/outa.casl: 24: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0061 #1255 - #0062 #0001 -../../../../as/FUNC/outa.casl: 25: AND GR4,GR4 ; 正数の場合 - #0063 #3444 -../../../../as/FUNC/outa.casl: 26: JZE PRT ; ↓ - #0064 #6300 - #0065 #0074 -../../../../as/FUNC/outa.casl: 27: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 - #013F #002D - #0066 #1010 - #0067 #013F -../../../../as/FUNC/outa.casl: 28: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0068 #1115 - #0069 #0096 -../../../../as/FUNC/outa.casl: 29: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #006A #1255 - #006B #0001 -../../../../as/FUNC/outa.casl: 30: JUMP PRT ; PRTにジャンプ - #006C #6400 - #006D #0074 -../../../../as/FUNC/outa.casl: 31:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 - #006E #1010 - #006F #00A8 -../../../../as/FUNC/outa.casl: 32: ST GR1,STR,GR5 ; (STR + GR5) <- GR1 - #0070 #1115 - #0071 #0096 -../../../../as/FUNC/outa.casl: 33: LAD GR5,1,GR5 ; GR5 <- GR5 + 1 - #0072 #1255 - #0073 #0001 -../../../../as/FUNC/outa.casl: 34:PRT ST GR5,LEN ; LEN <- GR5 - #0074 #1150 - #0075 #00A7 -../../../../as/FUNC/outa.casl: 35: LD GR2,LEN ; GR2にLENの値を格納 - #0076 #1020 - #0077 #00A7 -../../../../as/FUNC/outa.casl: 36: LAD GR1,STR ; GR1に文字列のアドレスを格納 - #0078 #1210 - #0079 #0096 -../../../../as/FUNC/outa.casl: 37: CALL REV ; 文字列を逆順に並べ替え - #007A #8000 - #007B #0107 -../../../../as/FUNC/outa.casl: 38: OUT STR,LEN ; 文字列を出力 - #007C #7001 - #007D #0000 - #007E #7002 - #007F #0000 - #0080 #1210 - #0081 #0096 - #0082 #1020 - #0083 #00A7 - #0084 #F000 - #0085 #0002 - #0086 #1210 - #0087 #0140 - #0140 #000A - #0088 #1220 - #0089 #0001 - #008A #F000 - #008B #0002 - #008C #7120 - #008D #7110 -../../../../as/FUNC/outa.casl: 39: RPOP - #008E #7170 - #008F #7160 - #0090 #7150 - #0091 #7140 - #0092 #7130 - #0093 #7120 - #0094 #7110 -../../../../as/FUNC/outa.casl: 40: RET - #0095 #8100 -../../../../as/FUNC/outa.casl: 41:STR DS 17 - #0096 #0000 - #0097 #0000 - #0098 #0000 - #0099 #0000 - #009A #0000 - #009B #0000 - #009C #0000 - #009D #0000 - #009E #0000 - #009F #0000 - #00A0 #0000 - #00A1 #0000 - #00A2 #0000 - #00A3 #0000 - #00A4 #0000 - #00A5 #0000 - #00A6 #0000 -../../../../as/FUNC/outa.casl: 42:LEN DS 1 - #00A7 #0000 -../../../../as/FUNC/outa.casl: 43:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - #00A8 #0030 - #00A9 #0031 - #00AA #0032 - #00AB #0033 - #00AC #0034 - #00AD #0035 - #00AE #0036 - #00AF #0037 - #00B0 #0038 - #00B1 #0039 - #00B2 #0041 - #00B3 #0042 - #00B4 #0043 - #00B5 #0044 - #00B6 #0045 - #00B7 #0046 - #00B8 #0047 - #00B9 #0048 - #00BA #0049 - #00BB #004A - #00BC #004B - #00BD #004C - #00BE #004D - #00BF #004E - #00C0 #004F - #00C1 #0050 - #00C2 #0051 - #00C3 #0052 - #00C4 #0053 - #00C5 #0054 - #00C6 #0055 - #00C7 #0056 - #00C8 #0057 - #00C9 #0058 - #00CA #0059 - #00CB #005A -../../../../as/FUNC/outa.casl: 44: END -../../../../as/FUNC/outa.casl: 45:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 46:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 47:ODIVL START -../../../../as/FUNC/outa.casl: 48: PUSH 0,GR1 - #00CC #7001 - #00CD #0000 -../../../../as/FUNC/outa.casl: 49: PUSH 0,GR2 - #00CE #7002 - #00CF #0000 -../../../../as/FUNC/outa.casl: 50: PUSH 0,GR4 - #00D0 #7004 - #00D1 #0000 -../../../../as/FUNC/outa.casl: 51: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - #00D2 #3422 -../../../../as/FUNC/outa.casl: 52: JZE ODFIN ; ↓ - #00D3 #6300 - #00D4 #0101 -../../../../as/FUNC/outa.casl: 53: ST GR2,ODY ; ODYにGR2の初期値を保存 - #00D5 #1120 - #00D6 #0106 -../../../../as/FUNC/outa.casl: 54: LAD GR0,0 ; GR0の初期化 - #00D7 #1200 - #00D8 #0000 -../../../../as/FUNC/outa.casl: 55: LAD GR3,0 ; GR3の初期化 - #00D9 #1230 - #00DA #0000 -../../../../as/FUNC/outa.casl: 56: LAD GR4,1 ; GR4の初期化。対象ビットを表す - #00DB #1240 - #00DC #0001 -../../../../as/FUNC/outa.casl: 57:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - #00DD #4521 -../../../../as/FUNC/outa.casl: 58: JPL ODLOOP ; ↓ - #00DE #6500 - #00DF #00F0 -../../../../as/FUNC/outa.casl: 59: SLL GR4,1 ; GR4を1回左シフト - #00E0 #5240 - #00E1 #0001 -../../../../as/FUNC/outa.casl: 60: SLL GR2,1 ; GR2を1回左シフト - #00E2 #5220 - #00E3 #0001 -../../../../as/FUNC/outa.casl: 61: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - #00E4 #6600 - #00E5 #00E8 -../../../../as/FUNC/outa.casl: 62: JUMP ODSL ; ループ終端 - #00E6 #6400 - #00E7 #00DD -../../../../as/FUNC/outa.casl: 63:ODYOV SRL GR2,1 - #00E8 #5320 - #00E9 #0001 -../../../../as/FUNC/outa.casl: 64: LAD GR2,#8000,GR2 - #00EA #1222 - #00EB #8000 -../../../../as/FUNC/outa.casl: 65: SRL GR4,1 - #00EC #5340 - #00ED #0001 -../../../../as/FUNC/outa.casl: 66: JUMP ODLPIN - #00EE #6400 - #00EF #00FD -../../../../as/FUNC/outa.casl: 67:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - #00F0 #5340 - #00F1 #0001 -../../../../as/FUNC/outa.casl: 68: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 - #00F2 #6300 - #00F3 #0101 -../../../../as/FUNC/outa.casl: 69: SRL GR2,1 ; GR2を1回右シフト - #00F4 #5320 - #00F5 #0001 -../../../../as/FUNC/outa.casl: 70: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - #00F6 #4110 - #00F7 #0106 -../../../../as/FUNC/outa.casl: 71: JMI ODFIN ; ↓ - #00F8 #6100 - #00F9 #0101 -../../../../as/FUNC/outa.casl: 72: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - #00FA #4512 -../../../../as/FUNC/outa.casl: 73: JMI ODLOOP ; ↓ - #00FB #6100 - #00FC #00F0 -../../../../as/FUNC/outa.casl: 74:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 - #00FD #2712 -../../../../as/FUNC/outa.casl: 75: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - #00FE #2604 -../../../../as/FUNC/outa.casl: 76: JUMP ODLOOP ; ループ終端 - #00FF #6400 - #0100 #00F0 -../../../../as/FUNC/outa.casl: 77:ODFIN LD GR3,GR1 - #0101 #1431 -../../../../as/FUNC/outa.casl: 78: POP GR4 - #0102 #7140 -../../../../as/FUNC/outa.casl: 79: POP GR2 - #0103 #7120 -../../../../as/FUNC/outa.casl: 80: POP GR1 - #0104 #7110 -../../../../as/FUNC/outa.casl: 81: RET - #0105 #8100 -../../../../as/FUNC/outa.casl: 82:ODY DS 1 - #0106 #0000 -../../../../as/FUNC/outa.casl: 83: END -../../../../as/FUNC/outa.casl: 84:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 85:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 86:REV START -../../../../as/FUNC/outa.casl: 87: RPUSH - #0107 #7001 - #0108 #0000 - #0109 #7002 - #010A #0000 - #010B #7003 - #010C #0000 - #010D #7004 - #010E #0000 - #010F #7005 - #0110 #0000 - #0111 #7006 - #0112 #0000 - #0113 #7007 - #0114 #0000 -../../../../as/FUNC/outa.casl: 88: LAD GR3,0 ; GR3の初期化 - #0115 #1230 - #0116 #0000 -../../../../as/FUNC/outa.casl: 89:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #0117 #4532 -../../../../as/FUNC/outa.casl: 90: JZE RNEXT ; ↓ - #0118 #6300 - #0119 #0124 -../../../../as/FUNC/outa.casl: 91: LD GR4,GR1 ; GR4にGR1の値をコピー - #011A #1441 -../../../../as/FUNC/outa.casl: 92: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #011B #2643 -../../../../as/FUNC/outa.casl: 93: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 - #011C #1054 - #011D #0000 -../../../../as/FUNC/outa.casl: 94: PUSH 0,GR5 ; GR5をプッシュ - #011E #7005 - #011F #0000 -../../../../as/FUNC/outa.casl: 95: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0120 #1233 - #0121 #0001 -../../../../as/FUNC/outa.casl: 96: JUMP RPU ; ループ終端 - #0122 #6400 - #0123 #0117 -../../../../as/FUNC/outa.casl: 97:RNEXT LAD GR3,0 ; GR3の初期化 - #0124 #1230 - #0125 #0000 -../../../../as/FUNC/outa.casl: 98:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #0126 #4532 -../../../../as/FUNC/outa.casl: 99: JZE RFIN ; ↓ - #0127 #6300 - #0128 #0132 -../../../../as/FUNC/outa.casl: 100: POP GR5 ; GR5にポップ - #0129 #7150 -../../../../as/FUNC/outa.casl: 101: LD GR4,GR1 ; GR4にGR1の値をコピー - #012A #1441 -../../../../as/FUNC/outa.casl: 102: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #012B #2643 -../../../../as/FUNC/outa.casl: 103: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - #012C #1154 - #012D #0000 -../../../../as/FUNC/outa.casl: 104: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #012E #1233 - #012F #0001 -../../../../as/FUNC/outa.casl: 105: JUMP RPO ; ループ終端 - #0130 #6400 - #0131 #0126 -../../../../as/FUNC/outa.casl: 106:RFIN RPOP - #0132 #7170 - #0133 #7160 - #0134 #7150 - #0135 #7140 - #0136 #7130 - #0137 #7120 - #0138 #7110 -../../../../as/FUNC/outa.casl: 107: RET - #0139 #8100 -../../../../as/FUNC/outa.casl: 108: END -../../../../as/FUNC/outa.casl: 109:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 110:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 111:OABS START -../../../../as/FUNC/outa.casl: 112: XOR GR1,=#FFFF ; GR1の値を反転 - #0141 #FFFF - #013A #3210 - #013B #0141 -../../../../as/FUNC/outa.casl: 113: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - #013C #1211 - #013D #0001 -../../../../as/FUNC/outa.casl: 114: RET - #013E #8100 -../../../../as/FUNC/outa.casl: 115: END +../../../../casl2 ../../../../as/FUNC/minim_call.casl ../../../../as/FUNC/minim.casl ../../../../as/FUNC/outa.casl -39 diff --git a/test/integration/casl2/minim_call/Makefile b/test/integration/casl2/minim_call/Makefile index f3e8dc4..ba0159d 100644 --- a/test/integration/casl2/minim_call/Makefile +++ b/test/integration/casl2/minim_call/Makefile @@ -1,6 +1,5 @@ include ../CMD.mk # YACASL2DIR, CASL2 -CASL2FLAG = -sla ASDIR = $(YACASL2DIR)/as/FUNC -ASFILE = $(ASDIR)/minim_call.casl $(ASDIR)/minim.casl $(ASDIR)/outa.casl -CMD = $(CASL2) $(CASL2FLAG) $(ASFILE) $(IN) +ASFILE = $(ASDIR)/minim_call.casl $(ASDIR)/minim.casl $(ASDIR)/outa.casl +CMD = $(CASL2) $(ASFILE) include ../TEST.mk diff --git a/test/integration/comet2/TEST.mk b/test/integration/comet2/TEST.mk index 0a386cb..ffac1fd 100644 --- a/test/integration/comet2/TEST.mk +++ b/test/integration/comet2/TEST.mk @@ -12,14 +12,14 @@ UNITNAME = `pwd | xargs basename` check: clean report.txt prepare: cleanall 0.txt $(OBJFILE) clean: - @rm -f 1.txt diff.txt report.txt + @rm -f 1.txt diff.txt report.txt $(OBJFILE) cleanall: clean @rm -f 0.txt $(OBJFILE) $(OBJFILE): $(CASL2) $(ASFILE) - @$(CASL2) $(CASL2FLAG) -O $(ASFILE) 2>$(ERRFILE) + @-$(CASL2) $(CASL2FLAG) -O $(ASFILE) 2>$(ERRFILE) 0.txt 1.txt: $(COMET2) $(OBJFILE) @echo $(CMD) >$@; \ - $(CMD) >>$@ 2>$(ERRFILE); \ + if test -s $(OBJFILE); then $(CMD) >>$@ 2>$(ERRFILE); fi; \ if test -s $(ERRFILE); then cat err.txt >>$@; else rm -f $(ERRFILE); fi diff.txt: 1.txt @-diff -c 0.txt 1.txt >$@ 2>&1 diff --git a/test/integration/comet2/abs_call/Makefile b/test/integration/comet2/abs_call/Makefile index 1ffcfec..f7c3353 100644 --- a/test/integration/comet2/abs_call/Makefile +++ b/test/integration/comet2/abs_call/Makefile @@ -1,4 +1,4 @@ include ../CMD.mk # YACASL2DIR, CASL2 ASDIR = $(YACASL2DIR)/as/FUNC -ASFILE = $(ASDIR)/abs_call.casl $(ASDIR)/abs.casl $(ASDIR)/outa.casl +ASFILE = $(ASDIR)/abs_call.casl $(ASDIR)/abs.casl $(ASDIR)/outa_main.casl $(ASDIR)/divl1.casl $(ASDIR)/rev.casl include ../TEST.mk diff --git a/test/integration/comet2/abs_call/a.o b/test/integration/comet2/abs_call/a.o index 742c70c07d950f1cd67612ae601dadc4e709356d..37fdd82d1a6d9e67d516b611dfeba925ecb18ffd 100644 GIT binary patch delta 263 zcmXv|u}%U(6r8u5nouq4S!lIdKm|E45p2v}$Wd4k0QZ z-ZJuT`-gUDoOaS-1)fut3fBozd|ZgDXH9X~ua6~g#@Bo0eV61rbrQ^4G<4;^cKY2> S>LzaJjEj!RhXbLBD*gcxe=~6a delta 251 zcmXw!y-EX75QV>4HWrfN=8`68v07v+NnHOrxgl(@3~Fg%%xazc2BxvG@%H*4zJ|T! z_929TD6HdRijOnQVb08~;zj)8wvMG`g)lmgdJ>*8ISKD+=LeZVq!{~5VqRepX?+^L z-tNA^LSJz@xtDWa;x2_m;o%dC50Wck-}2~GDVEeaUDtgx(1ghvn=>h~Y22kKIcz(h zc;lHvxY)h<%g=JA9T~KT-D?94J?BU_QZ!}brZV=m-`aRPGV`~7?49rb=b7xR{*ifA J9k5MR{Q@|IHoX7< diff --git a/test/integration/comet2/count_call/a.o b/test/integration/comet2/count_call/a.o index ef6936b4d6bb37e0b7ab5b7d1111bffd2e8cc6d7..a29205e29c94307b2b17a4049264e642865b763b 100644 GIT binary patch delta 272 zcmXv|u}%U(6r8y`3a$1wXJNO*1S;bRCbWCt^+c_WtKZdIKxiNpSWUEZ zOl#N&!o(qsFkZg_w-H-N`zYG|;K0QWMzqQ#VX}kHF{z=uQ3tMW^4`H=;84#Oxa9*zbvdOVBj^ delta 238 zcmXwzy^cXq6otPnG?Pe<6U|H%mjaFCB4*knavPPPQu(>m&KuB}L=~~lOh4tV zB?<+?aYONC?d+Ak*4}0g>7R}G(RWi?(QoDbiYy`JP(pPWericFnZ)S y0%jl5&UeZ~1sV5F(=`%i<>gkTXA?j7@(QxFW81UF`p-Po_>$b?Ze8Pz+wBfHJu^N4 diff --git a/test/integration/comet2/divl0_call/Makefile b/test/integration/comet2/divl0_call/Makefile index f78f94d..a70bc4c 100644 --- a/test/integration/comet2/divl0_call/Makefile +++ b/test/integration/comet2/divl0_call/Makefile @@ -1,4 +1,4 @@ include ../CMD.mk # YACASL2DIR, CASL2 ASDIR = $(YACASL2DIR)/as/FUNC -ASFILE = $(ASDIR)/divl_call.casl $(ASDIR)/divl0.casl $(ASDIR)/outl.casl +ASFILE = $(ASDIR)/divl_call.casl $(ASDIR)/divl0.casl $(ASDIR)/outl_main.casl $(ASDIR)/rev.casl include ../TEST.mk diff --git a/test/integration/comet2/divl0_call/a.o b/test/integration/comet2/divl0_call/a.o index 82d543c485bb5b90634a22d5c3156984060d1bff..89984840c9aee066a585962948200410e619f73c 100644 GIT binary patch delta 134 zcmX@Yc7}C=5@XUtSmZ+$7si>KY1^sIAiMM ztBeyT2QZ3E{=mfH<-_PG;;a@Tz`(#-z`$TE#K^#qV$WzG#K2(W%8(qz7*Gh77lg_A ZF%}di6b2MJ6dDvN6bckFG;%ROAOJXV9_Ro7 delta 260 zcmXwzJ5K^p5QWcK9);C%C81r`1PTgPq~2U&wvvLlHgpiKCeXlbO;o6em27S-eNgfv z>?~>hJvd7=lP@PTCo^aErSI}4Nt_S$rhj5%{(ta0mp zm^~F2K-k5^FsMuk1w?{YL_NW6N_|ZP0`9H|qZy<`sIb(cFe4r{-63PPS-a&zyrzhmt_IXm(6c1Z|kcyx~s=ev6w*b`H*4^m}hU9z#UL~8D$!n|Ay@1^vjp15G%o(q(nm7zN(KlADAUDAf9pLA|uTiu}lc%A^q1&8Xksa zdGA)D+P#u;`CM!FoH}Z2b)SKGKS&lk delta 455 zcmY*Vu}T9$6r6WN1q<2RoTadLU{Yui6F=aBrVuQGiWVXmvI#aq7CVD*c7iE9&q~C? zMy!I3oux*>ukZ`Bv^w7&2}YJ-cjvu*GqbmoS5p_k?h7eNz?TDMgi)deRnY<;DaFlo%oF_%*b;6taDlML1%w2Q-Qh zaunz@%69vj@1n{R8a=YkyCjRb0(6)Dr<-5zQ`K83Yzbh3wJWRyeMeTcTtoAj>L#nZ VquL{N%)Y6c(3FP1G!46m@e6MWS}Onm diff --git a/test/integration/comet2/fib_outl/a.o b/test/integration/comet2/fib_outl/a.o index 97e14a47ebb6f5f6e20e00b04034aaf4ae7a99e7..0d35469fe4f8302463dcbab3f2c75f95ae581536 100644 GIT binary patch delta 258 zcmXwzy-q?w5QV?Jtc`?Z*-%KgHqc(>0oWUJTSJrwkg(d3+arMeL`5v*%p5`)H~P5Sqmr|a;|RnJEk zP2>%!QdN+fqfin?D5{IxmL`$kslX%d(Crzs=KEz4%F+Un8 G&e;RMEiu9X delta 213 zcmXwzJqp4=5QV=Du@IYeNh4US7TWsLStUq%Q7@p0c7nNp=n;aIg{>#B70X<}!bXoE z_98e5SbV%;-tgX>-IH6<25e4HO)H1m6SW3M&}N0z8+bc1oAh#=KR_-!f^QU!kVS?+ zR#<`M72-2?qG%enz9{jHLZf@J*MTI=?wF8ShH1Mk;*756CpOUuJ4ieAL7v|Wi9Q70 dur<|Cl6U&jNc<|=bGNKUN#R%j-j}^~ydPOmDOUgh diff --git a/test/integration/comet2/minim_call/a.o b/test/integration/comet2/minim_call/a.o index f71ab5770458a9459298f47ec099d4c7ad474fdc..8faf7847195a059892b01e4b753d66dcd3143183 100644 GIT binary patch delta 237 zcmXv|y=uZx7(FK#6p8ib;$RoKQyhvAe-^id;-YN{wyvd;=I32(a8z78|SHv7NJ9o^OQY|Gst?*Lz2OlnETguQed+ZXr+b50!SUp z`+Q5Ml2dA H;(R79K4mU$ delta 202 zcmXv`y$-=(0K99Iu=sqMU~5Ebl2Dt0HqyPpWFi`~?+rBZ0GcKS!fNs?p1^MG3kYo! z!{z>Rche90@ytSK$oHt~a3%5wDN$FvoKz0ijf&>G@QKk|qTAJm)1Z)qRPV8#+af5$v(^sxBwH7sC cD6?maJGD~2a#TNGBNVpFTGoX&pj0!=F3=COm delta 247 zcmaFCagJkx8Ke9}b9Y9CiS^oyiW^sFGjb>~2`DHtF*HstV3e6`#iYO}H94Bem{DbN zKa;xTb4JDj1_mY|77!|9R1j!qWca`YWUEd-&or0u+2mYi36CH~28Of~j0`Dz85M#V z8I*(=8XSN$L&{x7FrEAmEH2>qjFBPnA)}BhL*fNSA$1lthLj78h9VAy3WWlN42=wv z^BEOcja(U$Stc{G2zz{IG!SB70P%&G0ty{PoYg`E85oR(Kqj*>6%-~E1{69J8bEam W7^yJ{g5(;x7(npcvhU5*5jv~%#Ap#5xtUy^~pnDin7K6-U0LkuS3@8N43&P|!P0nSO1OP=AE(HJp delta 199 zcmbQj-o`$`jB)=&b9crA6YI4Z4{lr?%E;I=nUP7H@z7*RrnyPoj0{2y3-mDUm$Cd-ZdZyQ81R4 zf;K6{2S^z&&tPG1v zOSg&k4-mJR_Z+oD&ndDYn#x1;h1m?E1*(~jz^PKJDwSI#;(J=qjF^pW-hM*4pZ!wi zx_d?K+z~F|i&^GX;p)+HYG+8D@^yvlOlF4+4uv}T4Gfbh4vsN?$KS(6%h3( zda-Y(qZ^jIz@%$Chny)-wu62pyS(?pnzvgxQox*0ZVH2J!_H%)DVt);q;+Rndu7KQ Po0bWT|F60Tdnxt{!>&~r delta 403 zcmYk2J4*vW6ot=;34+z^WUzlW*`VoTv=t1yrj$%+m=jCmG@rsN{V{6huKGh7=Yr6H zC+3U(n()N*g~wz}Cq#Hmvq!9JM80^0XUu#c(-NzeDD;L*iDT+=zJxGl#r19WMKLhC w=V~`yAdd|m*>bl_`wA!sR83YQyydL=!j8@A&a5`(z#iI;^{w|WxP-s+3)*u}$p8QV diff --git a/test/integration/comet2/outa_call/a.o b/test/integration/comet2/outa_call/a.o index df7bd9b2f87a5c53f71a06600513f1d17e473dac..e1706f364dc42036521a97dc60f395dc03d70db8 100644 GIT binary patch delta 255 zcmXv|!D_-l6r4%TrC8W(Ez;YHU`~ZJ_FPsZUX9vwQL^@&{espXD3zRhYoWi?t3Ti= zXML&l!7$7WZ_@?LxE*PF%EUM5~cBtlHEWRyB0o8o<>}-&@jryDQ#ztT$eHY#_%H2m}{`R*5PO zZk`j4I^)5U0zz?zvIDNqW>cD>cx3MX^5~qUEdA2w-umRfIeNf)N)%J7bWYU_+uY$2 HhXZj0<%%xw delta 220 zcmXwyu@1pd7=_OfHDIWlCL$pz0}+wX4n|j~SumM2iq(AsUO+URZ6sdFYBzS~wqZCq z$^Yei|HC*Nmm7!S-Q^^FwpfhFGQFt6t6v}l(9@BEsC(GPkaNP;!R`$NFW3vBA#jws z5oDP5CdcG%jd3-)!#l0%n diff --git a/test/integration/comet2/outb_call/a.o b/test/integration/comet2/outb_call/a.o index 1a5ee93f72b54fa09e3356847844b5a106682493..880c11dad1c08ebdb4d1dcd8ef74205b829a9dbc 100644 GIT binary patch delta 218 zcmXv|u?_)26r9Jc#8Ipb5s6|oL^Ov&X@%=A_yCt%>f0~C9}pkl!~B5if>z_5@RG@7 zX7VQU@($wkpz8VAr0Jzh*S$|rK)^7H&v9@n~IT55; z%NaMsf>ek&gX(!**evfm1o^iu(XeiucGBSpK1zWCqsZ`5Tv~<3qEEB>yt|fwV0X+r dVB3^$8ihzE6uEC+`)316-Nr@ExZv09;{&P-Czt>L delta 187 zcmXwyF%E)26h!BnrO*mDs4WtM?W&FC5~U~T0U)f_{2Sm6G#tQ#*;^8|wZN5V@iNIw z@}_cL;`|`z@|@7R?$b3B1PLgMmV{}HLj#=>d<%|uz}(>P2!TYUZNj|KWzlxM8(Bl% zLdM7&$hin%8Z11`KD&%lJ?@3ufFf@b?p?qsft5Xi8PWH28KY2?aJLWt+l)%iIAP7| Hry1Y_w@xN@ diff --git a/test/integration/comet2/outl_call/a.o b/test/integration/comet2/outl_call/a.o index 31810f6d1e508c6559c3180746df55ace28cbc9a..005a7266bfc68185cd1b441b66dcf05dca143382 100644 GIT binary patch delta 200 zcmcb?@{DD|4axruj0Fq~Oh7Ck)XtzFFoS{N0~3&KH1XqH#=n#M86`pm|1l^8F)}cu z-DY4&IR{kpkHH}r$WM6(p_6|wC;<5aj(-^#5`QoVxiTa^WDrtkQDaDX$Y3DE&|m=4 zo$`~xP{g57p-`ZZp^<@M@;gQ~7a2xJ5ofg!0R{$EpaYDBK+5Z6# z1Tiu&q@7}5NZAWi^OnIO7|2h#3!#&rGbjN00*-GO7!sc|2)QyOUSJSXXHjEFxxio` z#L!>>(w*{x!BE7ZP@zzukfD)*Ve%P9H8*ZXM-gYW5CH}TR-glng+R*wfwV9fxiTb6 cG6ocag_6kx5wgJA;7`1A~z(L$VNKK%t|Evs#EC1B0;;$WXS)hD@RW DP$(og diff --git a/test/integration/comet2/ptn2/a.o b/test/integration/comet2/ptn2/a.o index 0ce215090372977451d9a6510157992fb70e64dc..e0a752f8f7b70df410d714e6223dc904466d9a38 100644 GIT binary patch delta 207 zcmdnNa*Sny9HZhy`Kglc7#Ir}7?^-qK&X^KL7Z6# z1Tiu&q@7}5NZAWi^OnIO7|2h#3!#&rGbjN00*-GO7!sc|2)QyOUSJSXXHjEFxxio` z#L!>>(w*{x!BE7ZP@zzukfD)*Ve%P9H8*ZXM-gYW5CH}TR-glng+R*wfwV9fxiTb6 eG6ocag_6kx5wgJA;7`1A~z(L$VNKK%t|Evs#EC1B0;;$WXS)hD@RW DP$(og diff --git a/test/integration/comet2/ptn3/a.o b/test/integration/comet2/ptn3/a.o index 02eb183b63db144992b0d9850bf20af24d00cf4e..b0b6d2ac14d58e648f801469ab59e3fabdf5b666 100644 GIT binary patch delta 234 zcmXwzy=nqc6okJctB4?6FI%Wdac$OilR)YfF|`;|C*oo$d!NAd5o900-UkS&l0Yh7 zz*-AUo6a_O{V9f-VP+0z<$ZWfrHhc3(LQMv=0-K8HNdItTW%MRN#hqupx~hN6r*PF zS8)1f@wJqF_A2$4+5s~VnEXKe?m7peXXoS1na5j<^QyCl(H7lfv_`kRfOt))NyB^{ z@3`|LYpk-&A^Viz$&-%X4TcJe?turL*N*vw`yOL0eS6Al*Q_LoeY1TV+3<2msPGR2 C7BOuA delta 220 zcmdnNvWi7YK!}xrp@D-zNQ9w*mw};CK|q*MF^B=kntYB?W};bvGh9VAy3WWlNKpW36s=57Ta1?P?3lU&oUxCX^Uwi+c&F7QD7Yl_g4gdfE delta 220 zcmXwyzYoDs9K`SY(uP<(FC9n>uM+KAj7TaXjP>IW(6ll4{Rg$0NW*G0`j6~3c2Tdw zaJkFplDnPxGWN4ZpX@on6}FTBQgGO=up}QG!egUM1!P)WoFMrHcrcxZS(VOI%C1zO zE(qA%f%pcwB(wxlUpwMAz8*0uI3JY=AtNzC_=Io`2k{df%U4nr?^%;Mvo?*av9scU ksXu$7n5mN|fbIlQj{^1WYyZxrM6FezeC7RSkmh*>A2xg|vH$=8 diff --git a/test/integration/comet2/sum_call/a.o b/test/integration/comet2/sum_call/a.o index f83fc4b9e2c0f0f925af97f992588813cb29e613..fd98187a638b1de31f1dcf40566b616d414adc1a 100644 GIT binary patch delta 200 zcmZ3+vV~>BGRbEQj0Fq~Oh7Ckl*gbTP|v{dfeFZ#oVb53216o7mI$0rO7iT4?VTp1EiFbJu$s4=9RU@#D3XfOcj zPICRkj+@g4(1;!Or2SBAtB3_|KGY78kS7z{-m3Ka?k z3K<$FpJG&V`NQBS;;a@Tz`(!?w9;4zWXyX810e