CASLファイルの整理
authorj8takagi <j8takagi@nifty.com>
Tue, 23 Feb 2010 22:07:10 +0000 (07:07 +0900)
committerj8takagi <j8takagi@nifty.com>
Tue, 23 Feb 2010 22:07:10 +0000 (07:07 +0900)
12 files changed:
as/app/fib/fib.casl [new file with mode: 0644]
as/app/fib/fib24.txt [new file with mode: 0644]
as/app/fib/fib24_2.txt [new file with mode: 0644]
as/app/fib/fib_call0.casl [new file with mode: 0644]
as/app/fib/fib_call_io.casl [new file with mode: 0644]
as/app/fib/fib_call_out.casl [new file with mode: 0644]
as/app/fib/fibrec.casl [new file with mode: 0644]
as/app/fib/seq24.txt [new file with mode: 0644]
as/app/sum/sum.casl [moved from as/misc/sum.casl with 100% similarity]
as/app/sum/sum_10_2.casl [moved from as/misc/sum_10_2.casl with 100% similarity]
as/app/sum/sum_2.casl [moved from as/misc/sum_2.casl with 100% similarity]
as/misc/fib.casl [deleted file]

diff --git a/as/app/fib/fib.casl b/as/app/fib/fib.casl
new file mode 100644 (file)
index 0000000..8e0a35f
--- /dev/null
@@ -0,0 +1,27 @@
+;;; 入力 GR1:整数
+;;; 出力 GR0:フィボナッチ数
+FIB     START
+        PUSH    0,GR1
+        PUSH    0,GR2
+        PUSH    0,GR3
+        LAD     GR0,0           ; フィボナッチ数
+        LAD     GR2,0           ; インデックス
+LOOP    CPA     GR2,GR1
+        JZE     FIN
+        LAD     GR3,SEQ,GR2
+        AND     GR2,GR2
+        CPA     GR2,=1
+        JPL     O2
+        LAD     GR0,1
+        JUMP    STSEQ
+O2      LD      GR0,-2,GR3
+        ADDL    GR0,-1,GR3
+STSEQ   ST      GR0,0,GR3
+        LAD     GR2,1,GR2
+        JUMP    LOOP
+FIN     POP     GR3
+        POP     GR2
+        POP     GR1
+        RET
+SEQ     DS      24
+        END
diff --git a/as/app/fib/fib24.txt b/as/app/fib/fib24.txt
new file mode 100644 (file)
index 0000000..58c4a88
--- /dev/null
@@ -0,0 +1,24 @@
+1
+1
+2
+3
+5
+8
+13
+21
+34
+55
+89
+144
+233
+377
+610
+987
+1597
+2584
+4181
+6765
+10946
+17711
+28657
+46368
diff --git a/as/app/fib/fib24_2.txt b/as/app/fib/fib24_2.txt
new file mode 100644 (file)
index 0000000..346d368
--- /dev/null
@@ -0,0 +1,24 @@
+0
+1
+2
+3
+5
+8
+13
+21
+34
+55
+89
+144
+233
+377
+610
+987
+1597
+2584
+4181
+6765
+10946
+17711
+28657
+46368
diff --git a/as/app/fib/fib_call0.casl b/as/app/fib/fib_call0.casl
new file mode 100644 (file)
index 0000000..1829b23
--- /dev/null
@@ -0,0 +1,7 @@
+;;; FIBの結果を表示
+MAIN    START
+        LD      GR1,NUM
+        CALL    FIB
+FIN     RET
+NUM     DC      4
+        END
diff --git a/as/app/fib/fib_call_io.casl b/as/app/fib/fib_call_io.casl
new file mode 100644 (file)
index 0000000..7fad933
--- /dev/null
@@ -0,0 +1,23 @@
+;FIB 呼び出し用メインルーチン
+;1 1 2 3 5 8 13 21 34 55
+MAIN    START
+LOOP    CALL    INL
+        JOV     OV
+        AND     GR0,GR0
+        JZE     FIN
+        CPL     GR0,=#FFFF
+        JZE     NAN
+        CALL    FIB
+        LD      GR1,GR0
+        CALL    OUTL
+        JUMP    LOOP
+OV      OUT     OVMSG,MLEN1
+        JUMP    LOOP
+NAN     OUT     NANMSG,MLEN2
+        JUMP    LOOP
+FIN     RET
+OVMSG   DC      'Over 65535'
+MLEN1   DC      10
+NANMSG  DC      'Not A Number'
+MLEN2   DC      12
+        END
diff --git a/as/app/fib/fib_call_out.casl b/as/app/fib/fib_call_out.casl
new file mode 100644 (file)
index 0000000..1aedacb
--- /dev/null
@@ -0,0 +1,9 @@
+;;; FIBの結果を表示
+MAIN    START
+        LD      GR1,NUM
+        CALL    FIB
+        LD      GR1,GR0
+        CALL    OUTL
+FIN     RET
+NUM     DC      10
+        END
diff --git a/as/app/fib/fibrec.casl b/as/app/fib/fibrec.casl
new file mode 100644 (file)
index 0000000..4944c80
--- /dev/null
@@ -0,0 +1,23 @@
+;;; フィボナッチ数列
+;;; 入力 GR1:整数
+;;; 出力 GR0:フィボナッチ数
+FIB     START
+        PUSH    0,GR1
+        PUSH    0,GR2
+        LAD     GR0,0           ; フィボナッチ数
+        LAD     GR2,0           ; インデックス
+        CPA     GR1,=1
+        JPL     O2
+        LD      GR0,GR1
+        JUMP    FIN
+O2      LAD     GR1,-1,GR1
+        CALL    FIB
+        LD      GR2,GR0
+        LAD     GR1,-1,GR1
+        CALL    FIB
+        ADDL    GR0,GR2
+        JUMP    FIN
+FIN     POP     GR2
+        POP     GR1
+        RET
+        END
diff --git a/as/app/fib/seq24.txt b/as/app/fib/seq24.txt
new file mode 100644 (file)
index 0000000..7ed2844
--- /dev/null
@@ -0,0 +1,24 @@
+1
+2
+3
+4
+5
+6
+7
+8
+9
+10
+11
+12
+13
+14
+15
+16
+17
+18
+19
+20
+21
+22
+23
+24
similarity index 100%
rename from as/misc/sum.casl
rename to as/app/sum/sum.casl
similarity index 100%
rename from as/misc/sum_2.casl
rename to as/app/sum/sum_2.casl
diff --git a/as/misc/fib.casl b/as/misc/fib.casl
deleted file mode 100644 (file)
index 77b3965..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-MAIN    START
-        LAD     GR1,0
-        LAD     GR2,0           ; インデックス
-BEGIN   CPA     GR2,CNT
-        JZE     FIN
-        LAD     GR3,SEQ,GR2
-        AND     GR2,GR2
-        CPA     GR2,=1
-        JPL     SUMP2
-        LD      GR1,GR2
-        JUMP    STSEQ
-SUMP2   LD      GR1,-2,GR3
-        ADDA    GR1,-1,GR3
-STSEQ   ST      GR1,0,GR3
-        LAD     GR2,1,GR2
-        JUMP    BEGIN
-FIN     RET
-CNT     DC      10
-SEQ     DS      10
-        END