From: j8takagi Date: Sun, 31 Jan 2010 04:28:31 +0000 (+0900) Subject: CASL2テストで、outa, outl, outb, outd_q15ソースコードの修正を反映 X-Git-Tag: v0.1~74^2~7 X-Git-Url: https://j8takagi.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0dab7eab4cf4b834ba7c4628a334a5f32304c167;p=YACASL2.git CASL2テストで、outa, outl, outb, outd_q15ソースコードの修正を反映 --- diff --git a/test/integration/casl2/abs_call/0.txt b/test/integration/casl2/abs_call/0.txt index 8375a64..23f0ffa 100644 --- a/test/integration/casl2/abs_call/0.txt +++ b/test/integration/casl2/abs_call/0.txt @@ -35,7 +35,7 @@ Assemble ../../../../as/FUNC/outa.casl (0) ../../../../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: ST GR0,LEN ; LENの初期化 +../../../../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にジャンプ @@ -46,142 +46,134 @@ Assemble ../../../../as/FUNC/outa.casl (0) ../../../../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: CALL STSTR ; GR1をSTR領域に格納 -../../../../as/FUNC/outa.casl: 19: LD GR1,GR0 ; GR0をGR1にコピー -../../../../as/FUNC/outa.casl: 20: JUMP STI ; ループ終端 -../../../../as/FUNC/outa.casl: 21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 22: CALL STSTR ; GR1をSTR領域に格納 -../../../../as/FUNC/outa.casl: 23: AND GR4,GR4 ; 正数の場合 -../../../../as/FUNC/outa.casl: 24: JZE PRT ; ↓ -../../../../as/FUNC/outa.casl: 25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 26: CALL STSTR ; ↓ -../../../../as/FUNC/outa.casl: 27: JUMP PRT ; PRTにジャンプ -../../../../as/FUNC/outa.casl: 28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 29: CALL STSTR ; ↓ -../../../../as/FUNC/outa.casl: 30:PRT LD GR2,LEN ; GR2にLENの値を格納 -../../../../as/FUNC/outa.casl: 31: LAD GR1,STR ; GR1に文字列のアドレスを格納 -../../../../as/FUNC/outa.casl: 32: CALL REV ; 文字列を逆順に並べ替え -../../../../as/FUNC/outa.casl: 33: OUT STR,LEN ; 文字列を出力 -../../../../as/FUNC/outa.casl: 34: RPOP -../../../../as/FUNC/outa.casl: 35: RET -../../../../as/FUNC/outa.casl: 36:STR DS 17 -../../../../as/FUNC/outa.casl: 37:LEN DS 1 -../../../../as/FUNC/outa.casl: 38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' -../../../../as/FUNC/outa.casl: 39: END -../../../../as/FUNC/outa.casl: 40:;; GR1をSTR領域に格納し、LENをインクリメント -../../../../as/FUNC/outa.casl: 41:STSTR START -../../../../as/FUNC/outa.casl: 42: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 43: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 44: LD GR2,LEN ; GR2にLENの値をロード -../../../../as/FUNC/outa.casl: 45: ST GR1,STR,GR2 ; STR+GR2 <- GR1 -../../../../as/FUNC/outa.casl: 46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1 -../../../../as/FUNC/outa.casl: 47: ST GR2,LEN ; LENにGR2を格納 -../../../../as/FUNC/outa.casl: 48: POP GR2 -../../../../as/FUNC/outa.casl: 49: POP GR1 -../../../../as/FUNC/outa.casl: 50: RET -../../../../as/FUNC/outa.casl: 51: END -../../../../as/FUNC/outa.casl: 52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 53:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 54:ODIVL START -../../../../as/FUNC/outa.casl: 55: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 56: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 57: PUSH 0,GR4 -../../../../as/FUNC/outa.casl: 58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ -../../../../as/FUNC/outa.casl: 59: JZE ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 60: ST GR2,ODY ; ODYにGR2の初期値を保存 -../../../../as/FUNC/outa.casl: 61: LAD GR0,0 ; GR0の初期化 -../../../../as/FUNC/outa.casl: 62: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 63: LAD GR4,1 ; GR4の初期化。対象ビットを表す -../../../../as/FUNC/outa.casl: 64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 -../../../../as/FUNC/outa.casl: 65: JPL ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 66: SLL GR4,1 ; GR4を1回左シフト -../../../../as/FUNC/outa.casl: 67: SLL GR2,1 ; GR2を1回左シフト -../../../../as/FUNC/outa.casl: 68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ -../../../../as/FUNC/outa.casl: 69: JUMP ODSL ; ループ終端 -../../../../as/FUNC/outa.casl: 70:ODYOV SRL GR2,1 -../../../../as/FUNC/outa.casl: 71: LAD GR2,#8000,GR2 -../../../../as/FUNC/outa.casl: 72: SRL GR4,1 -../../../../as/FUNC/outa.casl: 73: JUMP ODLPIN -../../../../as/FUNC/outa.casl: 74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト -../../../../as/FUNC/outa.casl: 75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 76: SRL GR2,1 ; GR2を1回右シフト -../../../../as/FUNC/outa.casl: 77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 78: JMI ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ -../../../../as/FUNC/outa.casl: 80: JMI ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 -../../../../as/FUNC/outa.casl: 82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 -../../../../as/FUNC/outa.casl: 83: JUMP ODLOOP ; ループ終端 -../../../../as/FUNC/outa.casl: 84:ODFIN LD GR3,GR1 -../../../../as/FUNC/outa.casl: 85: POP GR4 -../../../../as/FUNC/outa.casl: 86: POP GR2 -../../../../as/FUNC/outa.casl: 87: POP GR1 -../../../../as/FUNC/outa.casl: 88: RET -../../../../as/FUNC/outa.casl: 89:ODY DS 1 -../../../../as/FUNC/outa.casl: 90: END -../../../../as/FUNC/outa.casl: 91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 92:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 93:REV START -../../../../as/FUNC/outa.casl: 94: RPUSH -../../../../as/FUNC/outa.casl: 95: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 97: JZE RNEXT ; ↓ -../../../../as/FUNC/outa.casl: 98: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 -../../../../as/FUNC/outa.casl: 101: PUSH 0,GR5 ; GR5をプッシュ -../../../../as/FUNC/outa.casl: 102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 103: JUMP RPU ; ループ終端 -../../../../as/FUNC/outa.casl: 104:RNEXT LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 106: JZE RFIN ; ↓ -../../../../as/FUNC/outa.casl: 107: POP GR5 ; GR5にポップ -../../../../as/FUNC/outa.casl: 108: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 -../../../../as/FUNC/outa.casl: 111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 112: JUMP RPO ; ループ終端 -../../../../as/FUNC/outa.casl: 113:RFIN RPOP +../../../../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 -../../../../as/FUNC/outa.casl: 116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 117:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 118:OABS START -../../../../as/FUNC/outa.casl: 119: XOR GR1,=#FFFF ; GR1の値を反転 -../../../../as/FUNC/outa.casl: 120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 -../../../../as/FUNC/outa.casl: 121: RET -../../../../as/FUNC/outa.casl: 122: END Label:::: -OUTA.STI ---> #0043 -ODIVL.ODYOV ---> #00E2 -STSTR ---> #00B7 -OUTA.STR ---> #0081 -ODIVL.ODY ---> #0100 -REV.RNEXT ---> #011E -ABS ---> #001A -REV.RFIN ---> #012C +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 -REV ---> #0101 +ODIVL.ODSL ---> #00D2 +OUTA.STLST ---> #0052 +MAIN ---> #0000 MAIN.MLEN ---> #0019 -OUTA.PRT ---> #0061 +ODIVL ---> #00C1 MAIN.MVAL ---> #0011 -OABS ---> #0134 -OUTA.NCHAR ---> #0093 -OUTA.STLST ---> #0050 -MAIN ---> #0000 -ODIVL ---> #00C6 -REV.RPO ---> #0120 OUTA ---> #0024 -REV.RPU ---> #0111 -ODIVL.ODSL ---> #00D7 -OUTA.LEN ---> #0092 -ODIVL.ODFIN ---> #00FB -OUTA.ZPRT ---> #005D -ODIVL.ODLOOP ---> #00EA -ODIVL.ODLPIN ---> #00F7 +OUTA.PRT ---> #0069 Assemble ../../../../as/FUNC/abs_call.casl (1) ../../../../as/FUNC/abs_call.casl: 1:;;; ABSを呼び出す @@ -238,9 +230,9 @@ Assemble ../../../../as/FUNC/abs.casl (1) #001D #6300 #001E #0023 ../../../../as/FUNC/abs.casl: 6: XOR GR1,=#FFFF - #0139 #FFFF + #0134 #FFFF #001F #3210 - #0020 #0139 + #0020 #0134 ../../../../as/FUNC/abs.casl: 7: LAD GR1,1,GR1 #0021 #1211 #0022 #0001 @@ -275,14 +267,14 @@ Assemble ../../../../as/FUNC/outa.casl (1) ../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 #0036 #1240 #0037 #0000 -../../../../as/FUNC/outa.casl: 7: ST GR0,LEN ; LENの初期化 - #0038 #1100 - #0039 #0092 +../../../../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 #005D + #003C #0063 ../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ #003D #6500 #003E #0043 @@ -291,105 +283,110 @@ Assemble ../../../../as/FUNC/outa.casl (1) #0040 #0001 ../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 #0041 #8000 - #0042 #0134 + #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 #0050 + #0045 #0052 ../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 #0046 #8000 - #0047 #00C6 + #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 #0093 -../../../../as/FUNC/outa.casl: 18: CALL STSTR ; GR1をSTR領域に格納 - #004B #8000 - #004C #00B7 -../../../../as/FUNC/outa.casl: 19: LD GR1,GR0 ; GR0をGR1にコピー - #004D #1410 -../../../../as/FUNC/outa.casl: 20: JUMP STI ; ループ終端 - #004E #6400 - #004F #0043 -../../../../as/FUNC/outa.casl: 21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #0050 #1011 - #0051 #0093 -../../../../as/FUNC/outa.casl: 22: CALL STSTR ; GR1をSTR領域に格納 - #0052 #8000 - #0053 #00B7 -../../../../as/FUNC/outa.casl: 23: AND GR4,GR4 ; 正数の場合 - #0054 #3444 -../../../../as/FUNC/outa.casl: 24: JZE PRT ; ↓ - #0055 #6300 - #0056 #0061 -../../../../as/FUNC/outa.casl: 25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 - #013A #002D - #0057 #1010 - #0058 #013A -../../../../as/FUNC/outa.casl: 26: CALL STSTR ; ↓ - #0059 #8000 - #005A #00B7 -../../../../as/FUNC/outa.casl: 27: JUMP PRT ; PRTにジャンプ - #005B #6400 - #005C #0061 -../../../../as/FUNC/outa.casl: 28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 - #005D #1010 - #005E #0093 -../../../../as/FUNC/outa.casl: 29: CALL STSTR ; ↓ - #005F #8000 - #0060 #00B7 -../../../../as/FUNC/outa.casl: 30:PRT LD GR2,LEN ; GR2にLENの値を格納 - #0061 #1020 - #0062 #0092 -../../../../as/FUNC/outa.casl: 31: LAD GR1,STR ; GR1に文字列のアドレスを格納 - #0063 #1210 - #0064 #0081 -../../../../as/FUNC/outa.casl: 32: CALL REV ; 文字列を逆順に並べ替え - #0065 #8000 - #0066 #0101 -../../../../as/FUNC/outa.casl: 33: OUT STR,LEN ; 文字列を出力 - #0067 #7001 - #0068 #0000 - #0069 #7002 - #006A #0000 - #006B #1210 - #006C #0081 - #006D #1020 - #006E #0092 - #006F #F000 - #0070 #0002 - #0071 #1210 - #0072 #013B - #013B #000A - #0073 #1220 - #0074 #0001 - #0075 #F000 - #0076 #0002 - #0077 #7120 - #0078 #7110 -../../../../as/FUNC/outa.casl: 34: RPOP - #0079 #7170 - #007A #7160 - #007B #7150 - #007C #7140 - #007D #7130 - #007E #7120 - #007F #7110 -../../../../as/FUNC/outa.casl: 35: RET - #0080 #8100 -../../../../as/FUNC/outa.casl: 36:STR DS 17 - #0081 #0000 - #0082 #0000 - #0083 #0000 - #0084 #0000 - #0085 #0000 - #0086 #0000 - #0087 #0000 - #0088 #0000 - #0089 #0000 - #008A #0000 + #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 @@ -397,260 +394,243 @@ Assemble ../../../../as/FUNC/outa.casl (1) #008F #0000 #0090 #0000 #0091 #0000 -../../../../as/FUNC/outa.casl: 37:LEN DS 1 #0092 #0000 -../../../../as/FUNC/outa.casl: 38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - #0093 #0030 - #0094 #0031 - #0095 #0032 - #0096 #0033 - #0097 #0034 - #0098 #0035 - #0099 #0036 - #009A #0037 - #009B #0038 - #009C #0039 - #009D #0041 - #009E #0042 - #009F #0043 - #00A0 #0044 - #00A1 #0045 - #00A2 #0046 - #00A3 #0047 - #00A4 #0048 - #00A5 #0049 - #00A6 #004A - #00A7 #004B - #00A8 #004C - #00A9 #004D - #00AA #004E - #00AB #004F - #00AC #0050 - #00AD #0051 - #00AE #0052 - #00AF #0053 - #00B0 #0054 - #00B1 #0055 - #00B2 #0056 - #00B3 #0057 - #00B4 #0058 - #00B5 #0059 - #00B6 #005A -../../../../as/FUNC/outa.casl: 39: END -../../../../as/FUNC/outa.casl: 40:;; GR1をSTR領域に格納し、LENをインクリメント -../../../../as/FUNC/outa.casl: 41:STSTR START -../../../../as/FUNC/outa.casl: 42: PUSH 0,GR1 - #00B7 #7001 - #00B8 #0000 -../../../../as/FUNC/outa.casl: 43: PUSH 0,GR2 - #00B9 #7002 - #00BA #0000 -../../../../as/FUNC/outa.casl: 44: LD GR2,LEN ; GR2にLENの値をロード - #00BB #1020 - #00BC #0092 -../../../../as/FUNC/outa.casl: 45: ST GR1,STR,GR2 ; STR+GR2 <- GR1 - #00BD #1112 - #00BE #0081 -../../../../as/FUNC/outa.casl: 46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1 - #00BF #1222 - #00C0 #0001 -../../../../as/FUNC/outa.casl: 47: ST GR2,LEN ; LENにGR2を格納 - #00C1 #1120 - #00C2 #0092 -../../../../as/FUNC/outa.casl: 48: POP GR2 - #00C3 #7120 -../../../../as/FUNC/outa.casl: 49: POP GR1 - #00C4 #7110 -../../../../as/FUNC/outa.casl: 50: RET - #00C5 #8100 -../../../../as/FUNC/outa.casl: 51: END -../../../../as/FUNC/outa.casl: 52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 53:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 54:ODIVL START -../../../../as/FUNC/outa.casl: 55: PUSH 0,GR1 - #00C6 #7001 - #00C7 #0000 -../../../../as/FUNC/outa.casl: 56: PUSH 0,GR2 - #00C8 #7002 - #00C9 #0000 -../../../../as/FUNC/outa.casl: 57: PUSH 0,GR4 - #00CA #7004 - #00CB #0000 -../../../../as/FUNC/outa.casl: 58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - #00CC #3422 -../../../../as/FUNC/outa.casl: 59: JZE ODFIN ; ↓ - #00CD #6300 - #00CE #00FB -../../../../as/FUNC/outa.casl: 60: ST GR2,ODY ; ODYにGR2の初期値を保存 - #00CF #1120 - #00D0 #0100 -../../../../as/FUNC/outa.casl: 61: LAD GR0,0 ; GR0の初期化 - #00D1 #1200 - #00D2 #0000 -../../../../as/FUNC/outa.casl: 62: LAD GR3,0 ; GR3の初期化 - #00D3 #1230 - #00D4 #0000 -../../../../as/FUNC/outa.casl: 63: LAD GR4,1 ; GR4の初期化。対象ビットを表す - #00D5 #1240 + #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: 64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - #00D7 #4521 -../../../../as/FUNC/outa.casl: 65: JPL ODLOOP ; ↓ - #00D8 #6500 - #00D9 #00EA -../../../../as/FUNC/outa.casl: 66: SLL GR4,1 ; GR4を1回左シフト - #00DA #5240 - #00DB #0001 -../../../../as/FUNC/outa.casl: 67: SLL GR2,1 ; GR2を1回左シフト - #00DC #5220 - #00DD #0001 -../../../../as/FUNC/outa.casl: 68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - #00DE #6600 - #00DF #00E2 -../../../../as/FUNC/outa.casl: 69: JUMP ODSL ; ループ終端 - #00E0 #6400 - #00E1 #00D7 -../../../../as/FUNC/outa.casl: 70:ODYOV SRL GR2,1 - #00E2 #5320 - #00E3 #0001 -../../../../as/FUNC/outa.casl: 71: LAD GR2,#8000,GR2 - #00E4 #1222 - #00E5 #8000 -../../../../as/FUNC/outa.casl: 72: SRL GR4,1 - #00E6 #5340 - #00E7 #0001 -../../../../as/FUNC/outa.casl: 73: JUMP ODLPIN - #00E8 #6400 - #00E9 #00F7 -../../../../as/FUNC/outa.casl: 74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - #00EA #5340 - #00EB #0001 -../../../../as/FUNC/outa.casl: 75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 - #00EC #6300 - #00ED #00FB -../../../../as/FUNC/outa.casl: 76: SRL GR2,1 ; GR2を1回右シフト - #00EE #5320 - #00EF #0001 -../../../../as/FUNC/outa.casl: 77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - #00F0 #4110 - #00F1 #0100 -../../../../as/FUNC/outa.casl: 78: JMI ODFIN ; ↓ - #00F2 #6100 - #00F3 #00FB -../../../../as/FUNC/outa.casl: 79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - #00F4 #4512 -../../../../as/FUNC/outa.casl: 80: JMI ODLOOP ; ↓ - #00F5 #6100 - #00F6 #00EA -../../../../as/FUNC/outa.casl: 81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 - #00F7 #2712 -../../../../as/FUNC/outa.casl: 82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - #00F8 #2604 -../../../../as/FUNC/outa.casl: 83: JUMP ODLOOP ; ループ終端 - #00F9 #6400 - #00FA #00EA -../../../../as/FUNC/outa.casl: 84:ODFIN LD GR3,GR1 - #00FB #1431 -../../../../as/FUNC/outa.casl: 85: POP GR4 - #00FC #7140 -../../../../as/FUNC/outa.casl: 86: POP GR2 - #00FD #7120 -../../../../as/FUNC/outa.casl: 87: POP GR1 - #00FE #7110 -../../../../as/FUNC/outa.casl: 88: RET - #00FF #8100 -../../../../as/FUNC/outa.casl: 89:ODY DS 1 - #0100 #0000 -../../../../as/FUNC/outa.casl: 90: END -../../../../as/FUNC/outa.casl: 91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 92:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 93:REV START -../../../../as/FUNC/outa.casl: 94: RPUSH - #0101 #7001 - #0102 #0000 - #0103 #7002 - #0104 #0000 - #0105 #7003 - #0106 #0000 - #0107 #7004 - #0108 #0000 - #0109 #7005 - #010A #0000 - #010B #7006 - #010C #0000 - #010D #7007 - #010E #0000 -../../../../as/FUNC/outa.casl: 95: LAD GR3,0 ; GR3の初期化 - #010F #1230 - #0110 #0000 -../../../../as/FUNC/outa.casl: 96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #0111 #4532 -../../../../as/FUNC/outa.casl: 97: JZE RNEXT ; ↓ - #0112 #6300 - #0113 #011E -../../../../as/FUNC/outa.casl: 98: LD GR4,GR1 ; GR4にGR1の値をコピー - #0114 #1441 -../../../../as/FUNC/outa.casl: 99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0115 #2643 -../../../../as/FUNC/outa.casl: 100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 - #0116 #1054 - #0117 #0000 -../../../../as/FUNC/outa.casl: 101: PUSH 0,GR5 ; GR5をプッシュ - #0118 #7005 - #0119 #0000 -../../../../as/FUNC/outa.casl: 102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #011A #1233 - #011B #0001 -../../../../as/FUNC/outa.casl: 103: JUMP RPU ; ループ終端 - #011C #6400 - #011D #0111 -../../../../as/FUNC/outa.casl: 104:RNEXT LAD GR3,0 ; GR3の初期化 - #011E #1230 - #011F #0000 -../../../../as/FUNC/outa.casl: 105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #0120 #4532 -../../../../as/FUNC/outa.casl: 106: JZE RFIN ; ↓ - #0121 #6300 - #0122 #012C -../../../../as/FUNC/outa.casl: 107: POP GR5 ; GR5にポップ - #0123 #7150 -../../../../as/FUNC/outa.casl: 108: LD GR4,GR1 ; GR4にGR1の値をコピー - #0124 #1441 -../../../../as/FUNC/outa.casl: 109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0125 #2643 -../../../../as/FUNC/outa.casl: 110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - #0126 #1154 - #0127 #0000 -../../../../as/FUNC/outa.casl: 111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0128 #1233 - #0129 #0001 -../../../../as/FUNC/outa.casl: 112: JUMP RPO ; ループ終端 - #012A #6400 - #012B #0120 -../../../../as/FUNC/outa.casl: 113:RFIN RPOP - #012C #7170 - #012D #7160 - #012E #7150 - #012F #7140 - #0130 #7130 - #0131 #7120 - #0132 #7110 +../../../../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 -../../../../as/FUNC/outa.casl: 116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 117:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 118:OABS START -../../../../as/FUNC/outa.casl: 119: XOR GR1,=#FFFF ; GR1の値を反転 - #013C #FFFF - #0134 #3210 - #0135 #013C -../../../../as/FUNC/outa.casl: 120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - #0136 #1211 - #0137 #0001 -../../../../as/FUNC/outa.casl: 121: RET - #0138 #8100 -../../../../as/FUNC/outa.casl: 122: END 12 12 1 diff --git a/test/integration/casl2/adda0/0.txt b/test/integration/casl2/adda0/0.txt index 5ed0812..4224ac1 100644 --- a/test/integration/casl2/adda0/0.txt +++ b/test/integration/casl2/adda0/0.txt @@ -9,8 +9,8 @@ Assemble ../../../../as/CMD/adda0.casl (0) ../../../../as/CMD/adda0.casl: 6: END Label:::: -MAIN.A ---> #0005 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0005 MAIN ---> #0000 Assemble ../../../../as/CMD/adda0.casl (1) diff --git a/test/integration/casl2/adda1/0.txt b/test/integration/casl2/adda1/0.txt index 631b1e7..8182429 100644 --- a/test/integration/casl2/adda1/0.txt +++ b/test/integration/casl2/adda1/0.txt @@ -11,9 +11,9 @@ Assemble ../../../../as/CMD/adda1.casl (0) ../../../../as/CMD/adda1.casl: 8: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0006 MAIN.B ---> #0007 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/adda1.casl (1) diff --git a/test/integration/casl2/adda_overflow/0.txt b/test/integration/casl2/adda_overflow/0.txt index 3e16daf..5138380 100644 --- a/test/integration/casl2/adda_overflow/0.txt +++ b/test/integration/casl2/adda_overflow/0.txt @@ -9,8 +9,8 @@ Assemble ../../../../as/CMD/adda_overflow.casl (0) ../../../../as/CMD/adda_overflow.casl: 6: END Label:::: -MAIN.A ---> #0005 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0005 MAIN ---> #0000 Assemble ../../../../as/CMD/adda_overflow.casl (1) diff --git a/test/integration/casl2/addl/0.txt b/test/integration/casl2/addl/0.txt index 8a10cf7..2060c00 100644 --- a/test/integration/casl2/addl/0.txt +++ b/test/integration/casl2/addl/0.txt @@ -12,10 +12,10 @@ Assemble ../../../../as/CMD/addl.casl (0) ../../../../as/CMD/addl.casl: 9: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0007 MAIN.B ---> #0008 MAIN.C ---> #0009 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/addl.casl (1) diff --git a/test/integration/casl2/addl_overflow/0.txt b/test/integration/casl2/addl_overflow/0.txt index c04fdbc..8deee58 100644 --- a/test/integration/casl2/addl_overflow/0.txt +++ b/test/integration/casl2/addl_overflow/0.txt @@ -14,11 +14,11 @@ Assemble ../../../../as/CMD/addl_overflow.casl (0) ../../../../as/CMD/addl_overflow.casl: 11: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0009 MAIN.B ---> #000A MAIN.C ---> #000B MAIN.D ---> #000C -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/addl_overflow.casl (1) diff --git a/test/integration/casl2/and1/0.txt b/test/integration/casl2/and1/0.txt index 010aedb..cb78020 100644 --- a/test/integration/casl2/and1/0.txt +++ b/test/integration/casl2/and1/0.txt @@ -9,8 +9,8 @@ Assemble ../../../../as/CMD/and1.casl (0) ../../../../as/CMD/and1.casl: 6: END Label:::: -MAIN.A ---> #0005 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0005 MAIN ---> #0000 Assemble ../../../../as/CMD/and1.casl (1) diff --git a/test/integration/casl2/binout/0.txt b/test/integration/casl2/binout/0.txt index af15cc3..e8eab0e 100644 --- a/test/integration/casl2/binout/0.txt +++ b/test/integration/casl2/binout/0.txt @@ -3,22 +3,22 @@ Assemble ../../../../as/YAKUWA/binout.casl (0) Label:::: -BINOUT.LOOP1 ---> #0023 -BINOUT.LOOP2 ---> #002B -BINOUT.ONE ---> #0031 -BINOUT.OLNG ---> #0070 -MAIN.MLOOP ---> #0002 -MAIN.MFIN ---> #000E -MAIN.MLEN ---> #0013 BINOUT.OBUF ---> #0060 BINOUT.ZERO ---> #002D -MAIN ---> #0000 -BINOUT.STORE ---> #0033 BINOUT.OUT1 ---> #0041 BINOUT.OUT2 ---> #0047 +BINOUT.STORE ---> #0033 +MAIN.MLOOP ---> #0002 +BINOUT.NZERO ---> #0071 +BINOUT.LOOP1 ---> #0023 +BINOUT.LOOP2 ---> #002B +MAIN.MFIN ---> #000E +MAIN ---> #0000 +BINOUT.OLNG ---> #0070 MAIN.MWORD ---> #000F +MAIN.MLEN ---> #0013 BINOUT ---> #0014 -BINOUT.NZERO ---> #0071 +BINOUT.ONE ---> #0031 Assemble ../../../../as/YAKUWA/binout.casl (1) ../../../../as/YAKUWA/binout.casl: 1:;;; BINOUT: 主プログラムから渡された1語の内容を、 diff --git a/test/integration/casl2/call0/0.txt b/test/integration/casl2/call0/0.txt index a6b7e27..9bc9168 100644 --- a/test/integration/casl2/call0/0.txt +++ b/test/integration/casl2/call0/0.txt @@ -15,10 +15,10 @@ Assemble ../../../../as/CMD/call0.casl (0) ../../../../as/CMD/call0.casl: 12: END Label:::: +MAIN.BEGIN ---> #0000 +COPY ---> #0009 MAIN.A ---> #0007 MAIN.B ---> #0008 -COPY ---> #0009 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/call0.casl (1) diff --git a/test/integration/casl2/call1/0.txt b/test/integration/casl2/call1/0.txt index 3fd309b..b2106fc 100644 --- a/test/integration/casl2/call1/0.txt +++ b/test/integration/casl2/call1/0.txt @@ -14,9 +14,9 @@ Assemble ../../../../as/CMD/call1.casl (0) ../../../../as/CMD/call1.casl: 11: END Label:::: -MAIN.B ---> #0007 -COPY ---> #0008 MAIN.BEGIN ---> #0000 +COPY ---> #0008 +MAIN.B ---> #0007 MAIN ---> #0000 Assemble ../../../../as/CMD/call1.casl (1) diff --git a/test/integration/casl2/call2/0.txt b/test/integration/casl2/call2/0.txt index ad3fba7..351c120 100644 --- a/test/integration/casl2/call2/0.txt +++ b/test/integration/casl2/call2/0.txt @@ -14,11 +14,11 @@ Assemble ../../../../as/CMD/call2.casl (0) ../../../../as/CMD/call2.casl: 11:FIN END Label:::: -MAIN.A ---> #0007 +INCR.FIN ---> #000B INCR ---> #0008 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0007 MAIN ---> #0000 -INCR.FIN ---> #000B Assemble ../../../../as/CMD/call2.casl (1) ../../../../as/CMD/call2.casl: 1:MAIN START BEGIN diff --git a/test/integration/casl2/count_call/0.txt b/test/integration/casl2/count_call/0.txt index 3e86948..6cb4d54 100644 --- a/test/integration/casl2/count_call/0.txt +++ b/test/integration/casl2/count_call/0.txt @@ -44,7 +44,7 @@ Assemble ../../../../as/FUNC/outa.casl (0) ../../../../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: ST GR0,LEN ; LENの初期化 +../../../../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にジャンプ @@ -55,142 +55,134 @@ Assemble ../../../../as/FUNC/outa.casl (0) ../../../../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: CALL STSTR ; GR1をSTR領域に格納 -../../../../as/FUNC/outa.casl: 19: LD GR1,GR0 ; GR0をGR1にコピー -../../../../as/FUNC/outa.casl: 20: JUMP STI ; ループ終端 -../../../../as/FUNC/outa.casl: 21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 22: CALL STSTR ; GR1をSTR領域に格納 -../../../../as/FUNC/outa.casl: 23: AND GR4,GR4 ; 正数の場合 -../../../../as/FUNC/outa.casl: 24: JZE PRT ; ↓ -../../../../as/FUNC/outa.casl: 25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 26: CALL STSTR ; ↓ -../../../../as/FUNC/outa.casl: 27: JUMP PRT ; PRTにジャンプ -../../../../as/FUNC/outa.casl: 28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 29: CALL STSTR ; ↓ -../../../../as/FUNC/outa.casl: 30:PRT LD GR2,LEN ; GR2にLENの値を格納 -../../../../as/FUNC/outa.casl: 31: LAD GR1,STR ; GR1に文字列のアドレスを格納 -../../../../as/FUNC/outa.casl: 32: CALL REV ; 文字列を逆順に並べ替え -../../../../as/FUNC/outa.casl: 33: OUT STR,LEN ; 文字列を出力 -../../../../as/FUNC/outa.casl: 34: RPOP -../../../../as/FUNC/outa.casl: 35: RET -../../../../as/FUNC/outa.casl: 36:STR DS 17 -../../../../as/FUNC/outa.casl: 37:LEN DS 1 -../../../../as/FUNC/outa.casl: 38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' -../../../../as/FUNC/outa.casl: 39: END -../../../../as/FUNC/outa.casl: 40:;; GR1をSTR領域に格納し、LENをインクリメント -../../../../as/FUNC/outa.casl: 41:STSTR START -../../../../as/FUNC/outa.casl: 42: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 43: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 44: LD GR2,LEN ; GR2にLENの値をロード -../../../../as/FUNC/outa.casl: 45: ST GR1,STR,GR2 ; STR+GR2 <- GR1 -../../../../as/FUNC/outa.casl: 46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1 -../../../../as/FUNC/outa.casl: 47: ST GR2,LEN ; LENにGR2を格納 -../../../../as/FUNC/outa.casl: 48: POP GR2 -../../../../as/FUNC/outa.casl: 49: POP GR1 -../../../../as/FUNC/outa.casl: 50: RET -../../../../as/FUNC/outa.casl: 51: END -../../../../as/FUNC/outa.casl: 52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 53:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 54:ODIVL START -../../../../as/FUNC/outa.casl: 55: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 56: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 57: PUSH 0,GR4 -../../../../as/FUNC/outa.casl: 58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ -../../../../as/FUNC/outa.casl: 59: JZE ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 60: ST GR2,ODY ; ODYにGR2の初期値を保存 -../../../../as/FUNC/outa.casl: 61: LAD GR0,0 ; GR0の初期化 -../../../../as/FUNC/outa.casl: 62: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 63: LAD GR4,1 ; GR4の初期化。対象ビットを表す -../../../../as/FUNC/outa.casl: 64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 -../../../../as/FUNC/outa.casl: 65: JPL ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 66: SLL GR4,1 ; GR4を1回左シフト -../../../../as/FUNC/outa.casl: 67: SLL GR2,1 ; GR2を1回左シフト -../../../../as/FUNC/outa.casl: 68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ -../../../../as/FUNC/outa.casl: 69: JUMP ODSL ; ループ終端 -../../../../as/FUNC/outa.casl: 70:ODYOV SRL GR2,1 -../../../../as/FUNC/outa.casl: 71: LAD GR2,#8000,GR2 -../../../../as/FUNC/outa.casl: 72: SRL GR4,1 -../../../../as/FUNC/outa.casl: 73: JUMP ODLPIN -../../../../as/FUNC/outa.casl: 74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト -../../../../as/FUNC/outa.casl: 75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 76: SRL GR2,1 ; GR2を1回右シフト -../../../../as/FUNC/outa.casl: 77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 78: JMI ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ -../../../../as/FUNC/outa.casl: 80: JMI ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 -../../../../as/FUNC/outa.casl: 82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 -../../../../as/FUNC/outa.casl: 83: JUMP ODLOOP ; ループ終端 -../../../../as/FUNC/outa.casl: 84:ODFIN LD GR3,GR1 -../../../../as/FUNC/outa.casl: 85: POP GR4 -../../../../as/FUNC/outa.casl: 86: POP GR2 -../../../../as/FUNC/outa.casl: 87: POP GR1 -../../../../as/FUNC/outa.casl: 88: RET -../../../../as/FUNC/outa.casl: 89:ODY DS 1 -../../../../as/FUNC/outa.casl: 90: END -../../../../as/FUNC/outa.casl: 91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 92:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 93:REV START -../../../../as/FUNC/outa.casl: 94: RPUSH -../../../../as/FUNC/outa.casl: 95: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 97: JZE RNEXT ; ↓ -../../../../as/FUNC/outa.casl: 98: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 -../../../../as/FUNC/outa.casl: 101: PUSH 0,GR5 ; GR5をプッシュ -../../../../as/FUNC/outa.casl: 102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 103: JUMP RPU ; ループ終端 -../../../../as/FUNC/outa.casl: 104:RNEXT LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 106: JZE RFIN ; ↓ -../../../../as/FUNC/outa.casl: 107: POP GR5 ; GR5にポップ -../../../../as/FUNC/outa.casl: 108: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 -../../../../as/FUNC/outa.casl: 111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 112: JUMP RPO ; ループ終端 -../../../../as/FUNC/outa.casl: 113:RFIN RPOP +../../../../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 -../../../../as/FUNC/outa.casl: 116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 117:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 118:OABS START -../../../../as/FUNC/outa.casl: 119: XOR GR1,=#FFFF ; GR1の値を反転 -../../../../as/FUNC/outa.casl: 120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 -../../../../as/FUNC/outa.casl: 121: RET -../../../../as/FUNC/outa.casl: 122: END Label:::: -OUTA.STI ---> #0044 -ODIVL.ODYOV ---> #00E3 -STSTR ---> #00B8 -OUTA.STR ---> #0082 +ODIVL.ODY ---> #00FC COUNT1 ---> #0012 -ODIVL.ODY ---> #0101 -COUNT1.RETURN ---> #0021 -MAIN.MAX ---> #0011 -REV.RNEXT ---> #011F +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 -REV.RFIN ---> #012D -REV ---> #0102 -OUTA.PRT ---> #0062 -OABS ---> #0135 -OUTA.NCHAR ---> #0094 -MAIN.LOOP ---> #0002 -OUTA.STLST ---> #0051 +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 ---> #00C7 -REV.RPO ---> #0121 +ODIVL ---> #00C2 +COUNT1.RETURN ---> #0021 OUTA ---> #0025 -REV.RPU ---> #0112 -MAIN.FIN ---> #0010 -ODIVL.ODSL ---> #00D8 -OUTA.LEN ---> #0093 -ODIVL.ODFIN ---> #00FC -OUTA.ZPRT ---> #005E -ODIVL.ODLOOP ---> #00EB -ODIVL.ODLPIN ---> #00F8 +MAIN.LOOP ---> #0002 +OUTA.PRT ---> #006A +MAIN.MAX ---> #0011 Assemble ../../../../as/FUNC/count1_call.casl (1) ../../../../as/FUNC/count1_call.casl: 1:;; count1.casl(「アセンブラ言語の仕様」プログラム例)を呼び出し、出力結果を表示 @@ -293,14 +285,14 @@ Assemble ../../../../as/FUNC/outa.casl (1) ../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 #0037 #1240 #0038 #0000 -../../../../as/FUNC/outa.casl: 7: ST GR0,LEN ; LENの初期化 - #0039 #1100 - #003A #0093 +../../../../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 #005E + #003D #0064 ../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ #003E #6500 #003F #0044 @@ -309,105 +301,110 @@ Assemble ../../../../as/FUNC/outa.casl (1) #0041 #0001 ../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 #0042 #8000 - #0043 #0135 + #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 #0051 + #0046 #0053 ../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 #0047 #8000 - #0048 #00C7 + #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 #0094 -../../../../as/FUNC/outa.casl: 18: CALL STSTR ; GR1をSTR領域に格納 - #004C #8000 - #004D #00B8 -../../../../as/FUNC/outa.casl: 19: LD GR1,GR0 ; GR0をGR1にコピー - #004E #1410 -../../../../as/FUNC/outa.casl: 20: JUMP STI ; ループ終端 - #004F #6400 - #0050 #0044 -../../../../as/FUNC/outa.casl: 21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #0051 #1011 - #0052 #0094 -../../../../as/FUNC/outa.casl: 22: CALL STSTR ; GR1をSTR領域に格納 - #0053 #8000 - #0054 #00B8 -../../../../as/FUNC/outa.casl: 23: AND GR4,GR4 ; 正数の場合 - #0055 #3444 -../../../../as/FUNC/outa.casl: 24: JZE PRT ; ↓ - #0056 #6300 - #0057 #0062 -../../../../as/FUNC/outa.casl: 25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 - #013A #002D - #0058 #1010 - #0059 #013A -../../../../as/FUNC/outa.casl: 26: CALL STSTR ; ↓ - #005A #8000 - #005B #00B8 -../../../../as/FUNC/outa.casl: 27: JUMP PRT ; PRTにジャンプ - #005C #6400 - #005D #0062 -../../../../as/FUNC/outa.casl: 28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 - #005E #1010 - #005F #0094 -../../../../as/FUNC/outa.casl: 29: CALL STSTR ; ↓ - #0060 #8000 - #0061 #00B8 -../../../../as/FUNC/outa.casl: 30:PRT LD GR2,LEN ; GR2にLENの値を格納 - #0062 #1020 - #0063 #0093 -../../../../as/FUNC/outa.casl: 31: LAD GR1,STR ; GR1に文字列のアドレスを格納 - #0064 #1210 - #0065 #0082 -../../../../as/FUNC/outa.casl: 32: CALL REV ; 文字列を逆順に並べ替え - #0066 #8000 - #0067 #0102 -../../../../as/FUNC/outa.casl: 33: OUT STR,LEN ; 文字列を出力 - #0068 #7001 - #0069 #0000 - #006A #7002 - #006B #0000 - #006C #1210 - #006D #0082 - #006E #1020 - #006F #0093 - #0070 #F000 - #0071 #0002 - #0072 #1210 - #0073 #013B - #013B #000A - #0074 #1220 - #0075 #0001 - #0076 #F000 - #0077 #0002 - #0078 #7120 - #0079 #7110 -../../../../as/FUNC/outa.casl: 34: RPOP - #007A #7170 - #007B #7160 - #007C #7150 - #007D #7140 - #007E #7130 - #007F #7120 - #0080 #7110 -../../../../as/FUNC/outa.casl: 35: RET - #0081 #8100 -../../../../as/FUNC/outa.casl: 36:STR DS 17 - #0082 #0000 - #0083 #0000 - #0084 #0000 - #0085 #0000 - #0086 #0000 - #0087 #0000 - #0088 #0000 - #0089 #0000 - #008A #0000 - #008B #0000 + #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 @@ -415,260 +412,243 @@ Assemble ../../../../as/FUNC/outa.casl (1) #0090 #0000 #0091 #0000 #0092 #0000 -../../../../as/FUNC/outa.casl: 37:LEN DS 1 #0093 #0000 -../../../../as/FUNC/outa.casl: 38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' - #0094 #0030 - #0095 #0031 - #0096 #0032 - #0097 #0033 - #0098 #0034 - #0099 #0035 - #009A #0036 - #009B #0037 - #009C #0038 - #009D #0039 - #009E #0041 - #009F #0042 - #00A0 #0043 - #00A1 #0044 - #00A2 #0045 - #00A3 #0046 - #00A4 #0047 - #00A5 #0048 - #00A6 #0049 - #00A7 #004A - #00A8 #004B - #00A9 #004C - #00AA #004D - #00AB #004E - #00AC #004F - #00AD #0050 - #00AE #0051 - #00AF #0052 - #00B0 #0053 - #00B1 #0054 - #00B2 #0055 - #00B3 #0056 - #00B4 #0057 - #00B5 #0058 - #00B6 #0059 - #00B7 #005A -../../../../as/FUNC/outa.casl: 39: END -../../../../as/FUNC/outa.casl: 40:;; GR1をSTR領域に格納し、LENをインクリメント -../../../../as/FUNC/outa.casl: 41:STSTR START -../../../../as/FUNC/outa.casl: 42: PUSH 0,GR1 - #00B8 #7001 - #00B9 #0000 -../../../../as/FUNC/outa.casl: 43: PUSH 0,GR2 - #00BA #7002 - #00BB #0000 -../../../../as/FUNC/outa.casl: 44: LD GR2,LEN ; GR2にLENの値をロード - #00BC #1020 - #00BD #0093 -../../../../as/FUNC/outa.casl: 45: ST GR1,STR,GR2 ; STR+GR2 <- GR1 - #00BE #1112 - #00BF #0082 -../../../../as/FUNC/outa.casl: 46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1 - #00C0 #1222 - #00C1 #0001 -../../../../as/FUNC/outa.casl: 47: ST GR2,LEN ; LENにGR2を格納 - #00C2 #1120 - #00C3 #0093 -../../../../as/FUNC/outa.casl: 48: POP GR2 - #00C4 #7120 -../../../../as/FUNC/outa.casl: 49: POP GR1 - #00C5 #7110 -../../../../as/FUNC/outa.casl: 50: RET - #00C6 #8100 -../../../../as/FUNC/outa.casl: 51: END -../../../../as/FUNC/outa.casl: 52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 53:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 54:ODIVL START -../../../../as/FUNC/outa.casl: 55: PUSH 0,GR1 - #00C7 #7001 - #00C8 #0000 -../../../../as/FUNC/outa.casl: 56: PUSH 0,GR2 - #00C9 #7002 - #00CA #0000 -../../../../as/FUNC/outa.casl: 57: PUSH 0,GR4 - #00CB #7004 - #00CC #0000 -../../../../as/FUNC/outa.casl: 58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - #00CD #3422 -../../../../as/FUNC/outa.casl: 59: JZE ODFIN ; ↓ - #00CE #6300 - #00CF #00FC -../../../../as/FUNC/outa.casl: 60: ST GR2,ODY ; ODYにGR2の初期値を保存 - #00D0 #1120 - #00D1 #0101 -../../../../as/FUNC/outa.casl: 61: LAD GR0,0 ; GR0の初期化 - #00D2 #1200 - #00D3 #0000 -../../../../as/FUNC/outa.casl: 62: LAD GR3,0 ; GR3の初期化 - #00D4 #1230 - #00D5 #0000 -../../../../as/FUNC/outa.casl: 63: LAD GR4,1 ; GR4の初期化。対象ビットを表す - #00D6 #1240 + #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: 64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - #00D8 #4521 -../../../../as/FUNC/outa.casl: 65: JPL ODLOOP ; ↓ - #00D9 #6500 - #00DA #00EB -../../../../as/FUNC/outa.casl: 66: SLL GR4,1 ; GR4を1回左シフト - #00DB #5240 - #00DC #0001 -../../../../as/FUNC/outa.casl: 67: SLL GR2,1 ; GR2を1回左シフト - #00DD #5220 - #00DE #0001 -../../../../as/FUNC/outa.casl: 68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - #00DF #6600 - #00E0 #00E3 -../../../../as/FUNC/outa.casl: 69: JUMP ODSL ; ループ終端 - #00E1 #6400 - #00E2 #00D8 -../../../../as/FUNC/outa.casl: 70:ODYOV SRL GR2,1 - #00E3 #5320 - #00E4 #0001 -../../../../as/FUNC/outa.casl: 71: LAD GR2,#8000,GR2 - #00E5 #1222 - #00E6 #8000 -../../../../as/FUNC/outa.casl: 72: SRL GR4,1 - #00E7 #5340 - #00E8 #0001 -../../../../as/FUNC/outa.casl: 73: JUMP ODLPIN - #00E9 #6400 - #00EA #00F8 -../../../../as/FUNC/outa.casl: 74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - #00EB #5340 - #00EC #0001 -../../../../as/FUNC/outa.casl: 75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 - #00ED #6300 - #00EE #00FC -../../../../as/FUNC/outa.casl: 76: SRL GR2,1 ; GR2を1回右シフト - #00EF #5320 - #00F0 #0001 -../../../../as/FUNC/outa.casl: 77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - #00F1 #4110 - #00F2 #0101 -../../../../as/FUNC/outa.casl: 78: JMI ODFIN ; ↓ - #00F3 #6100 - #00F4 #00FC -../../../../as/FUNC/outa.casl: 79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - #00F5 #4512 -../../../../as/FUNC/outa.casl: 80: JMI ODLOOP ; ↓ - #00F6 #6100 - #00F7 #00EB -../../../../as/FUNC/outa.casl: 81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 - #00F8 #2712 -../../../../as/FUNC/outa.casl: 82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - #00F9 #2604 -../../../../as/FUNC/outa.casl: 83: JUMP ODLOOP ; ループ終端 - #00FA #6400 - #00FB #00EB -../../../../as/FUNC/outa.casl: 84:ODFIN LD GR3,GR1 - #00FC #1431 -../../../../as/FUNC/outa.casl: 85: POP GR4 - #00FD #7140 -../../../../as/FUNC/outa.casl: 86: POP GR2 - #00FE #7120 -../../../../as/FUNC/outa.casl: 87: POP GR1 - #00FF #7110 -../../../../as/FUNC/outa.casl: 88: RET - #0100 #8100 -../../../../as/FUNC/outa.casl: 89:ODY DS 1 - #0101 #0000 -../../../../as/FUNC/outa.casl: 90: END -../../../../as/FUNC/outa.casl: 91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 92:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 93:REV START -../../../../as/FUNC/outa.casl: 94: RPUSH - #0102 #7001 - #0103 #0000 - #0104 #7002 - #0105 #0000 - #0106 #7003 - #0107 #0000 - #0108 #7004 - #0109 #0000 - #010A #7005 - #010B #0000 - #010C #7006 - #010D #0000 - #010E #7007 - #010F #0000 -../../../../as/FUNC/outa.casl: 95: LAD GR3,0 ; GR3の初期化 - #0110 #1230 - #0111 #0000 -../../../../as/FUNC/outa.casl: 96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #0112 #4532 -../../../../as/FUNC/outa.casl: 97: JZE RNEXT ; ↓ - #0113 #6300 - #0114 #011F -../../../../as/FUNC/outa.casl: 98: LD GR4,GR1 ; GR4にGR1の値をコピー - #0115 #1441 -../../../../as/FUNC/outa.casl: 99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0116 #2643 -../../../../as/FUNC/outa.casl: 100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 - #0117 #1054 - #0118 #0000 -../../../../as/FUNC/outa.casl: 101: PUSH 0,GR5 ; GR5をプッシュ - #0119 #7005 - #011A #0000 -../../../../as/FUNC/outa.casl: 102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #011B #1233 - #011C #0001 -../../../../as/FUNC/outa.casl: 103: JUMP RPU ; ループ終端 - #011D #6400 - #011E #0112 -../../../../as/FUNC/outa.casl: 104:RNEXT LAD GR3,0 ; GR3の初期化 - #011F #1230 - #0120 #0000 -../../../../as/FUNC/outa.casl: 105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #0121 #4532 -../../../../as/FUNC/outa.casl: 106: JZE RFIN ; ↓ - #0122 #6300 - #0123 #012D -../../../../as/FUNC/outa.casl: 107: POP GR5 ; GR5にポップ - #0124 #7150 -../../../../as/FUNC/outa.casl: 108: LD GR4,GR1 ; GR4にGR1の値をコピー - #0125 #1441 -../../../../as/FUNC/outa.casl: 109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0126 #2643 -../../../../as/FUNC/outa.casl: 110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - #0127 #1154 - #0128 #0000 -../../../../as/FUNC/outa.casl: 111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0129 #1233 - #012A #0001 -../../../../as/FUNC/outa.casl: 112: JUMP RPO ; ループ終端 - #012B #6400 - #012C #0121 -../../../../as/FUNC/outa.casl: 113:RFIN RPOP - #012D #7170 - #012E #7160 - #012F #7150 - #0130 #7140 - #0131 #7130 - #0132 #7120 - #0133 #7110 +../../../../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 -../../../../as/FUNC/outa.casl: 116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 117:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 118:OABS START -../../../../as/FUNC/outa.casl: 119: XOR GR1,=#FFFF ; GR1の値を反転 - #013C #FFFF - #0135 #3210 - #0136 #013C -../../../../as/FUNC/outa.casl: 120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - #0137 #1211 - #0138 #0001 -../../../../as/FUNC/outa.casl: 121: RET - #0139 #8100 -../../../../as/FUNC/outa.casl: 122: END 0 1 1 diff --git a/test/integration/casl2/dc_overflow/0.txt b/test/integration/casl2/dc_overflow/0.txt index dc1bb49..bdae877 100644 --- a/test/integration/casl2/dc_overflow/0.txt +++ b/test/integration/casl2/dc_overflow/0.txt @@ -13,10 +13,10 @@ Assemble ../../../../as/CMD/dc_overflow.casl (0) ../../../../as/CMD/dc_overflow.casl: 10: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0007 MAIN.B ---> #0008 MAIN.C ---> #0009 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/dc_overflow.casl (1) diff --git a/test/integration/casl2/dc_spc/0.txt b/test/integration/casl2/dc_spc/0.txt index 308be98..f740398 100644 --- a/test/integration/casl2/dc_spc/0.txt +++ b/test/integration/casl2/dc_spc/0.txt @@ -10,9 +10,9 @@ Assemble ../../../../as/CMD/dc_spc.casl (0) ../../../../as/CMD/dc_spc.casl: 7: END Label:::: -MAIN.BUF ---> #0013 -MAIN ---> #0000 MAIN.LEN ---> #0014 +MAIN ---> #0000 +MAIN.BUF ---> #0013 Assemble ../../../../as/CMD/dc_spc.casl (1) ../../../../as/CMD/dc_spc.casl: 1:;;; DC命令で空白を指定 diff --git a/test/integration/casl2/floatedit/0.txt b/test/integration/casl2/floatedit/0.txt index 80f4c74..1b1dbf7 100644 --- a/test/integration/casl2/floatedit/0.txt +++ b/test/integration/casl2/floatedit/0.txt @@ -67,28 +67,28 @@ Assemble ../../../../as/YAKUWA/floatedit.casl (0) ../../../../as/YAKUWA/floatedit.casl: 64: END Label:::: -EDIT.MSGLNG ---> #00AA EDIT ---> #0000 -EDIT.ZSFLAG ---> #014D -EDIT.INAREA ---> #00AB -EDIT.OTLENG ---> #014C -EDIT.NONDGT ---> #0060 -EDIT.RETRY ---> #0000 -EDIT.BEGIN ---> #002A +EDIT.SPACE ---> #009A EDIT.FINISH ---> #008B EDIT.INLENG ---> #00FB EDIT.SUPPRS ---> #0068 -EDIT.LOOP ---> #0034 EDIT.NOT1ST ---> #005C -EDIT.STORE ---> #006A EDIT.DIGIT0 ---> #009B EDIT.DIGIT9 ---> #009C -EDIT.SPACE ---> #009A -EDIT.MASK ---> #008C EDIT.OTAREA ---> #00FC EDIT.ENDSPR ---> #004E EDIT.ERRMSG ---> #009E +EDIT.MSGLNG ---> #00AA +EDIT.LOOP ---> #0034 +EDIT.ZSFLAG ---> #014D EDIT.TEN ---> #009D +EDIT.INAREA ---> #00AB +EDIT.RETRY ---> #0000 +EDIT.BEGIN ---> #002A +EDIT.OTLENG ---> #014C +EDIT.NONDGT ---> #0060 +EDIT.MASK ---> #008C +EDIT.STORE ---> #006A Assemble ../../../../as/YAKUWA/floatedit.casl (1) ../../../../as/YAKUWA/floatedit.casl: 1:EDIT START diff --git a/test/integration/casl2/hanoi/0.txt b/test/integration/casl2/hanoi/0.txt index 2e3de26..c692a95 100644 --- a/test/integration/casl2/hanoi/0.txt +++ b/test/integration/casl2/hanoi/0.txt @@ -2,215 +2,81 @@ Assemble ../../../../as/FUNC/hanoi.casl (0) ../../../../as/FUNC/hanoi.casl: 1:; ハノイの塔を解くプログラム -../../../../as/FUNC/hanoi.casl: 2:MAIN START -../../../../as/FUNC/hanoi.casl: 3: LD GR0,N -../../../../as/FUNC/hanoi.casl: 4: LD GR1,A -../../../../as/FUNC/hanoi.casl: 5: LD GR2,B -../../../../as/FUNC/hanoi.casl: 6: LD GR3,C -../../../../as/FUNC/hanoi.casl: 7: CALL HANOI -../../../../as/FUNC/hanoi.casl: 8: RET -../../../../as/FUNC/hanoi.casl: 9: -../../../../as/FUNC/hanoi.casl: 10:HANOI CPA GR0,=1 -../../../../as/FUNC/hanoi.casl: 11: JZE DISP -../../../../as/FUNC/hanoi.casl: 12: SUBA GR0,=1 -../../../../as/FUNC/hanoi.casl: 13: PUSH 0,GR2 -../../../../as/FUNC/hanoi.casl: 14: PUSH 0,GR3 -../../../../as/FUNC/hanoi.casl: 15: POP GR2 -../../../../as/FUNC/hanoi.casl: 16: POP GR3 -../../../../as/FUNC/hanoi.casl: 17: CALL HANOI -../../../../as/FUNC/hanoi.casl: 18: PUSH 0,GR2 -../../../../as/FUNC/hanoi.casl: 19: PUSH 0,GR3 -../../../../as/FUNC/hanoi.casl: 20: POP GR2 -../../../../as/FUNC/hanoi.casl: 21: POP GR3 -../../../../as/FUNC/hanoi.casl: 22: CALL DISP -../../../../as/FUNC/hanoi.casl: 23: PUSH 0,GR1 -../../../../as/FUNC/hanoi.casl: 24: PUSH 0,GR2 -../../../../as/FUNC/hanoi.casl: 25: POP GR1 -../../../../as/FUNC/hanoi.casl: 26: POP GR2 -../../../../as/FUNC/hanoi.casl: 27: CALL HANOI -../../../../as/FUNC/hanoi.casl: 28: PUSH 0,GR1 -../../../../as/FUNC/hanoi.casl: 29: PUSH 0,GR2 -../../../../as/FUNC/hanoi.casl: 30: POP GR1 -../../../../as/FUNC/hanoi.casl: 31: POP GR2 -../../../../as/FUNC/hanoi.casl: 32: ADDA GR0,=1 -../../../../as/FUNC/hanoi.casl: 33: RET -../../../../as/FUNC/hanoi.casl: 34: -../../../../as/FUNC/hanoi.casl: 35:DISP ST GR1,MSG1 -../../../../as/FUNC/hanoi.casl: 36: ST GR3,MSG2 -../../../../as/FUNC/hanoi.casl: 37: OUT MSG,LNG -../../../../as/FUNC/hanoi.casl: 38: RET -../../../../as/FUNC/hanoi.casl: 39: -../../../../as/FUNC/hanoi.casl: 40:N DC 3 ;輪の総数 -../../../../as/FUNC/hanoi.casl: 41:LNG DC 11 ;メッセージの長さ -../../../../as/FUNC/hanoi.casl: 42:A DC 'A' -../../../../as/FUNC/hanoi.casl: 43:B DC 'B' -../../../../as/FUNC/hanoi.casl: 44:C DC 'C' -../../../../as/FUNC/hanoi.casl: 45:MSG DC 'from ' -../../../../as/FUNC/hanoi.casl: 46:MSG1 DS 1 -../../../../as/FUNC/hanoi.casl: 47: DC ' to ' -../../../../as/FUNC/hanoi.casl: 48:MSG2 DS 1 -../../../../as/FUNC/hanoi.casl: 49: END +../../../../as/FUNC/hanoi.casl: 2:MAIN START +../../../../as/FUNC/hanoi.casl: 3: LD GR0,N +../../../../as/FUNC/hanoi.casl: 4: LD GR1,A +../../../../as/FUNC/hanoi.casl: 5: LD GR2,B +../../../../as/FUNC/hanoi.casl: 6: LD GR3,C +../../../../as/FUNC/hanoi.casl: 7: CALL HANOI +../../../../as/FUNC/hanoi.casl: 8: RET +../../../../as/FUNC/hanoi.casl: 9:HANOI CPA GR0,=1 +../../../../as/FUNC/hanoi.casl: 10: JZE DISP +../../../../as/FUNC/hanoi.casl: 11: SUBA GR0,=1 +../../../../as/FUNC/hanoi.casl: 12: PUSH 0,GR2 +../../../../as/FUNC/hanoi.casl: 13: PUSH 0,GR3 +../../../../as/FUNC/hanoi.casl: 14: POP GR2 +../../../../as/FUNC/hanoi.casl: 15: POP GR3 +../../../../as/FUNC/hanoi.casl: 16: CALL HANOI +../../../../as/FUNC/hanoi.casl: 17: PUSH 0,GR2 +../../../../as/FUNC/hanoi.casl: 18: PUSH 0,GR3 +../../../../as/FUNC/hanoi.casl: 19: POP GR2 +../../../../as/FUNC/hanoi.casl: 20: POP GR3 +../../../../as/FUNC/hanoi.casl: 21: CALL DISP +../../../../as/FUNC/hanoi.casl: 22: PUSH 0,GR1 +../../../../as/FUNC/hanoi.casl: 23: PUSH 0,GR2 +../../../../as/FUNC/hanoi.casl: 24: POP GR1 +../../../../as/FUNC/hanoi.casl: 25: POP GR2 +../../../../as/FUNC/hanoi.casl: 26: CALL HANOI +../../../../as/FUNC/hanoi.casl: 27: PUSH 0,GR1 +../../../../as/FUNC/hanoi.casl: 28: PUSH 0,GR2 +../../../../as/FUNC/hanoi.casl: 29: POP GR1 +../../../../as/FUNC/hanoi.casl: 30: POP GR2 +../../../../as/FUNC/hanoi.casl: 31: ADDA GR0,=1 +../../../../as/FUNC/hanoi.casl: 32: RET +../../../../as/FUNC/hanoi.casl: 33:DISP ST GR1,MSG1 +../../../../as/FUNC/hanoi.casl: 34: ST GR3,MSG2 +../../../../as/FUNC/hanoi.casl: 35: OUT MSG,LNG +../../../../as/FUNC/hanoi.casl: 36: RET +../../../../as/FUNC/hanoi.casl: 37:N DC 3 ; 輪の総数 +../../../../as/FUNC/hanoi.casl: 38:LNG DC 11 ; メッセージの長さ +../../../../as/FUNC/hanoi.casl: 39:A DC 'A' +../../../../as/FUNC/hanoi.casl: 40:B DC 'B' +../../../../as/FUNC/hanoi.casl: 41:C DC 'C' +../../../../as/FUNC/hanoi.casl: 42:MSG DC 'from ' +../../../../as/FUNC/hanoi.casl: 43:MSG1 DS 1 +../../../../as/FUNC/hanoi.casl: 44: DC ' to ' +../../../../as/FUNC/hanoi.casl: 45:MSG2 DS 1 +../../../../as/FUNC/hanoi.casl: 46: END Label:::: -MAIN.LNG ---> #004A -MAIN.HANOI ---> #000B +MAIN.MSG ---> #004E +MAIN.MSG1 ---> #0053 +MAIN.MSG2 ---> #0058 MAIN.A ---> #004B MAIN.B ---> #004C MAIN.C ---> #004D +MAIN.LNG ---> #004A MAIN.N ---> #0049 -MAIN.MSG ---> #004E -MAIN.DISP ---> #0032 MAIN ---> #0000 -MAIN.MSG1 ---> #0053 -MAIN.MSG2 ---> #0058 +MAIN.DISP ---> #0032 +MAIN.HANOI ---> #000B Assemble ../../../../as/FUNC/hanoi.casl (1) ../../../../as/FUNC/hanoi.casl: 1:; ハノイの塔を解くプログラム -../../../../as/FUNC/hanoi.casl: 2:MAIN START -../../../../as/FUNC/hanoi.casl: 3: LD GR0,N +../../../../as/FUNC/hanoi.casl: 2:MAIN START +../../../../as/FUNC/hanoi.casl: 3: LD GR0,N #0000 #1000 #0001 #0049 -../../../../as/FUNC/hanoi.casl: 4: LD GR1,A +../../../../as/FUNC/hanoi.casl: 4: LD GR1,A #0002 #1010 #0003 #004B -../../../../as/FUNC/hanoi.casl: 5: LD GR2,B +../../../../as/FUNC/hanoi.casl: 5: LD GR2,B #0004 #1020 #0005 #004C -../../../../as/FUNC/hanoi.casl: 6: LD GR3,C +../../../../as/FUNC/hanoi.casl: 6: LD GR3,C #0006 #1030 #0007 #004D -../../../../as/FUNC/hanoi.casl: 7: CALL HANOI - #0008 #8000 - #0009 #000B -../../../../as/FUNC/hanoi.casl: 8: RET - #000A #8100 -../../../../as/FUNC/hanoi.casl: 9: -../../../../as/FUNC/hanoi.casl: 10:HANOI CPA GR0,=1 - #0059 #0001 - #000B #4000 - #000C #0059 -../../../../as/FUNC/hanoi.casl: 11: JZE DISP - #000D #6300 - #000E #0032 -../../../../as/FUNC/hanoi.casl: 12: SUBA GR0,=1 - #005A #0001 - #000F #2100 - #0010 #005A -../../../../as/FUNC/hanoi.casl: 13: PUSH 0,GR2 - #0011 #7002 - #0012 #0000 -../../../../as/FUNC/hanoi.casl: 14: PUSH 0,GR3 - #0013 #7003 - #0014 #0000 -../../../../as/FUNC/hanoi.casl: 15: POP GR2 - #0015 #7120 -../../../../as/FUNC/hanoi.casl: 16: POP GR3 - #0016 #7130 -../../../../as/FUNC/hanoi.casl: 17: CALL HANOI - #0017 #8000 - #0018 #000B -../../../../as/FUNC/hanoi.casl: 18: PUSH 0,GR2 - #0019 #7002 - #001A #0000 -../../../../as/FUNC/hanoi.casl: 19: PUSH 0,GR3 - #001B #7003 - #001C #0000 -../../../../as/FUNC/hanoi.casl: 20: POP GR2 - #001D #7120 -../../../../as/FUNC/hanoi.casl: 21: POP GR3 - #001E #7130 -../../../../as/FUNC/hanoi.casl: 22: CALL DISP - #001F #8000 - #0020 #0032 -../../../../as/FUNC/hanoi.casl: 23: PUSH 0,GR1 - #0021 #7001 - #0022 #0000 -../../../../as/FUNC/hanoi.casl: 24: PUSH 0,GR2 - #0023 #7002 - #0024 #0000 -../../../../as/FUNC/hanoi.casl: 25: POP GR1 - #0025 #7110 -../../../../as/FUNC/hanoi.casl: 26: POP GR2 - #0026 #7120 -../../../../as/FUNC/hanoi.casl: 27: CALL HANOI - #0027 #8000 - #0028 #000B -../../../../as/FUNC/hanoi.casl: 28: PUSH 0,GR1 - #0029 #7001 - #002A #0000 -../../../../as/FUNC/hanoi.casl: 29: PUSH 0,GR2 - #002B #7002 - #002C #0000 -../../../../as/FUNC/hanoi.casl: 30: POP GR1 - #002D #7110 -../../../../as/FUNC/hanoi.casl: 31: POP GR2 - #002E #7120 -../../../../as/FUNC/hanoi.casl: 32: ADDA GR0,=1 - #005B #0001 - #002F #2000 - #0030 #005B -../../../../as/FUNC/hanoi.casl: 33: RET - #0031 #8100 -../../../../as/FUNC/hanoi.casl: 34: -../../../../as/FUNC/hanoi.casl: 35:DISP ST GR1,MSG1 - #0032 #1110 - #0033 #0053 -../../../../as/FUNC/hanoi.casl: 36: ST GR3,MSG2 - #0034 #1130 - #0035 #0058 -../../../../as/FUNC/hanoi.casl: 37: OUT MSG,LNG - #0036 #7001 - #0037 #0000 - #0038 #7002 - #0039 #0000 - #003A #1210 - #003B #004E - #003C #1020 - #003D #004A - #003E #F000 - #003F #0002 - #0040 #1210 - #0041 #005C - #005C #000A - #0042 #1220 - #0043 #0001 - #0044 #F000 - #0045 #0002 - #0046 #7120 - #0047 #7110 -../../../../as/FUNC/hanoi.casl: 38: RET - #0048 #8100 -../../../../as/FUNC/hanoi.casl: 39: -../../../../as/FUNC/hanoi.casl: 40:N DC 3 ;輪の総数 - #0049 #0003 -../../../../as/FUNC/hanoi.casl: 41:LNG DC 11 ;メッセージの長さ - #004A #000B -../../../../as/FUNC/hanoi.casl: 42:A DC 'A' - #004B #0041 -../../../../as/FUNC/hanoi.casl: 43:B DC 'B' - #004C #0042 -../../../../as/FUNC/hanoi.casl: 44:C DC 'C' - #004D #0043 -../../../../as/FUNC/hanoi.casl: 45:MSG DC 'from ' - #004E #0066 - #004F #0072 - #0050 #006F - #0051 #006D - #0052 #0020 -../../../../as/FUNC/hanoi.casl: 46:MSG1 DS 1 - #0053 #0000 -../../../../as/FUNC/hanoi.casl: 47: DC ' to ' - #0054 #0020 - #0055 #0074 - #0056 #006F - #0057 #0020 -../../../../as/FUNC/hanoi.casl: 48:MSG2 DS 1 - #0058 #0000 -../../../../as/FUNC/hanoi.casl: 49: END -from A to C -from A to B -from C to B -from A to C -from B to A -from B to C -from A to C +../../../../as/FUNC/hanoi.casl: 7: CALL HANOI +Assemble error - 103: HANOI: label not found + ../../../../as/FUNC/hanoi.casl:7: CALL HANOI + diff --git a/test/integration/casl2/hello/0.txt b/test/integration/casl2/hello/0.txt index 773aa7d..a6e674e 100644 --- a/test/integration/casl2/hello/0.txt +++ b/test/integration/casl2/hello/0.txt @@ -9,9 +9,9 @@ Assemble ../../../../as/hello.casl (0) ../../../../as/hello.casl: 6: END Label:::: -MAIN.BUF ---> #0013 -MAIN ---> #0000 MAIN.LEN ---> #0020 +MAIN ---> #0000 +MAIN.BUF ---> #0013 Assemble ../../../../as/hello.casl (1) ../../../../as/hello.casl: 1:MAIN START diff --git a/test/integration/casl2/iotest/0.txt b/test/integration/casl2/iotest/0.txt index f480ecd..0b312a7 100644 --- a/test/integration/casl2/iotest/0.txt +++ b/test/integration/casl2/iotest/0.txt @@ -27,13 +27,13 @@ IOTEST.OBUF1 ---> #005B IOTEST.OBUF2 ---> #0070 IOTEST.IOLEN ---> #00C7 IOTEST.OBUF3 ---> #007A -IOTEST.RETURN ---> #005A -IOTEST.IOBUF ---> #0087 IOTEST.LOOP ---> #0012 +IOTEST.IOBUF ---> #0087 +IOTEST ---> #0000 +IOTEST.RETURN ---> #005A IOTEST.OLEN1 ---> #006F IOTEST.OLEN2 ---> #0079 IOTEST.OLEN3 ---> #0086 -IOTEST ---> #0000 Assemble ../../../../as/FUNC/iotest.casl (1) ../../../../as/FUNC/iotest.casl: 1:IOTEST START diff --git a/test/integration/casl2/lad1/0.txt b/test/integration/casl2/lad1/0.txt index 0484f75..39c155d 100644 --- a/test/integration/casl2/lad1/0.txt +++ b/test/integration/casl2/lad1/0.txt @@ -9,8 +9,8 @@ Assemble ../../../../as/CMD/lad1.casl (0) ../../../../as/CMD/lad1.casl: 6: END Label:::: -MAIN.A ---> #0005 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0005 MAIN ---> #0000 Assemble ../../../../as/CMD/lad1.casl (1) diff --git a/test/integration/casl2/ld3/0.txt b/test/integration/casl2/ld3/0.txt index 3fc093c..87ca79c 100644 --- a/test/integration/casl2/ld3/0.txt +++ b/test/integration/casl2/ld3/0.txt @@ -8,8 +8,8 @@ Assemble ../../../../as/CMD/ld3.casl (0) ../../../../as/CMD/ld3.casl: 5: END Label:::: -MAIN.I ---> #0003 MAIN.BEGIN ---> #0000 +MAIN.I ---> #0003 MAIN ---> #0000 Assemble ../../../../as/CMD/ld3.casl (1) diff --git a/test/integration/casl2/ld4/0.txt b/test/integration/casl2/ld4/0.txt index f84c4c6..9aaae64 100644 --- a/test/integration/casl2/ld4/0.txt +++ b/test/integration/casl2/ld4/0.txt @@ -12,9 +12,9 @@ Assemble ../../../../as/CMD/ld4.casl (0) ../../../../as/CMD/ld4.casl: 9: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0006 MAIN.B ---> #0007 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/ld4.casl (1) diff --git a/test/integration/casl2/ld5/0.txt b/test/integration/casl2/ld5/0.txt index 4c840c6..8d0afe1 100644 --- a/test/integration/casl2/ld5/0.txt +++ b/test/integration/casl2/ld5/0.txt @@ -3,9 +3,9 @@ Assemble ../../../../as/CMD/ld5.casl (0) Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0005 MAIN.B ---> #0006 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/ld5.casl (1) diff --git a/test/integration/casl2/ld_loop/0.txt b/test/integration/casl2/ld_loop/0.txt index f1e96dc..2cab303 100644 --- a/test/integration/casl2/ld_loop/0.txt +++ b/test/integration/casl2/ld_loop/0.txt @@ -15,11 +15,11 @@ Assemble ../../../../as/CMD/ld_loop.casl (0) ../../../../as/CMD/ld_loop.casl: 12: END Label:::: -MAIN.MEND ---> #000C MAIN.MLOOP ---> #0002 -MAIN.DATA ---> #000D -MAIN ---> #0000 +MAIN.MEND ---> #000C MAIN.LEN ---> #0010 +MAIN ---> #0000 +MAIN.DATA ---> #000D Assemble ../../../../as/CMD/ld_loop.casl (1) ../../../../as/CMD/ld_loop.casl: 1:;;; ループを使い、連続でGR1にデータを転送する diff --git a/test/integration/casl2/literal_spc/0.txt b/test/integration/casl2/literal_spc/0.txt index 697e0b3..656effb 100644 --- a/test/integration/casl2/literal_spc/0.txt +++ b/test/integration/casl2/literal_spc/0.txt @@ -12,9 +12,9 @@ Assemble ../../../../as/CMD/literal_spc.casl (0) ../../../../as/CMD/literal_spc.casl: 9: END Label:::: -MAIN.BUF ---> #0017 -MAIN ---> #0000 MAIN.LEN ---> #0018 +MAIN ---> #0000 +MAIN.BUF ---> #0017 Assemble ../../../../as/CMD/literal_spc.casl (1) ../../../../as/CMD/literal_spc.casl: 1:; リテラルに「=' '」を指定した場合のテスト diff --git a/test/integration/casl2/literalstr/0.txt b/test/integration/casl2/literalstr/0.txt index 31deed3..8df0e04 100644 --- a/test/integration/casl2/literalstr/0.txt +++ b/test/integration/casl2/literalstr/0.txt @@ -16,10 +16,10 @@ Assemble ../../../../as/CMD/literalstr.casl (0) ../../../../as/CMD/literalstr.casl: 13: END Label:::: -MAIN.LOOP ---> #0004 -MAIN ---> #0000 MAIN.LEND ---> #0012 MAIN.LEN ---> #0013 +MAIN ---> #0000 +MAIN.LOOP ---> #0004 Assemble ../../../../as/CMD/literalstr.casl (1) ../../../../as/CMD/literalstr.casl: 1:MAIN START diff --git a/test/integration/casl2/minim_call/0.txt b/test/integration/casl2/minim_call/0.txt index 541d72b..8ac1f07 100644 --- a/test/integration/casl2/minim_call/0.txt +++ b/test/integration/casl2/minim_call/0.txt @@ -41,7 +41,7 @@ Assemble ../../../../as/FUNC/outa.casl (0) ../../../../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: ST GR0,LEN ; LENの初期化 +../../../../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にジャンプ @@ -52,143 +52,135 @@ Assemble ../../../../as/FUNC/outa.casl (0) ../../../../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: CALL STSTR ; GR1をSTR領域に格納 -../../../../as/FUNC/outa.casl: 19: LD GR1,GR0 ; GR0をGR1にコピー -../../../../as/FUNC/outa.casl: 20: JUMP STI ; ループ終端 -../../../../as/FUNC/outa.casl: 21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 -../../../../as/FUNC/outa.casl: 22: CALL STSTR ; GR1をSTR領域に格納 -../../../../as/FUNC/outa.casl: 23: AND GR4,GR4 ; 正数の場合 -../../../../as/FUNC/outa.casl: 24: JZE PRT ; ↓ -../../../../as/FUNC/outa.casl: 25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 26: CALL STSTR ; ↓ -../../../../as/FUNC/outa.casl: 27: JUMP PRT ; PRTにジャンプ -../../../../as/FUNC/outa.casl: 28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 -../../../../as/FUNC/outa.casl: 29: CALL STSTR ; ↓ -../../../../as/FUNC/outa.casl: 30:PRT LD GR2,LEN ; GR2にLENの値を格納 -../../../../as/FUNC/outa.casl: 31: LAD GR1,STR ; GR1に文字列のアドレスを格納 -../../../../as/FUNC/outa.casl: 32: CALL REV ; 文字列を逆順に並べ替え -../../../../as/FUNC/outa.casl: 33: OUT STR,LEN ; 文字列を出力 -../../../../as/FUNC/outa.casl: 34: RPOP -../../../../as/FUNC/outa.casl: 35: RET -../../../../as/FUNC/outa.casl: 36:STR DS 17 -../../../../as/FUNC/outa.casl: 37:LEN DS 1 -../../../../as/FUNC/outa.casl: 38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' -../../../../as/FUNC/outa.casl: 39: END -../../../../as/FUNC/outa.casl: 40:;; GR1をSTR領域に格納し、LENをインクリメント -../../../../as/FUNC/outa.casl: 41:STSTR START -../../../../as/FUNC/outa.casl: 42: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 43: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 44: LD GR2,LEN ; GR2にLENの値をロード -../../../../as/FUNC/outa.casl: 45: ST GR1,STR,GR2 ; STR+GR2 <- GR1 -../../../../as/FUNC/outa.casl: 46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1 -../../../../as/FUNC/outa.casl: 47: ST GR2,LEN ; LENにGR2を格納 -../../../../as/FUNC/outa.casl: 48: POP GR2 -../../../../as/FUNC/outa.casl: 49: POP GR1 -../../../../as/FUNC/outa.casl: 50: RET -../../../../as/FUNC/outa.casl: 51: END -../../../../as/FUNC/outa.casl: 52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 53:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 54:ODIVL START -../../../../as/FUNC/outa.casl: 55: PUSH 0,GR1 -../../../../as/FUNC/outa.casl: 56: PUSH 0,GR2 -../../../../as/FUNC/outa.casl: 57: PUSH 0,GR4 -../../../../as/FUNC/outa.casl: 58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ -../../../../as/FUNC/outa.casl: 59: JZE ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 60: ST GR2,ODY ; ODYにGR2の初期値を保存 -../../../../as/FUNC/outa.casl: 61: LAD GR0,0 ; GR0の初期化 -../../../../as/FUNC/outa.casl: 62: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 63: LAD GR4,1 ; GR4の初期化。対象ビットを表す -../../../../as/FUNC/outa.casl: 64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 -../../../../as/FUNC/outa.casl: 65: JPL ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 66: SLL GR4,1 ; GR4を1回左シフト -../../../../as/FUNC/outa.casl: 67: SLL GR2,1 ; GR2を1回左シフト -../../../../as/FUNC/outa.casl: 68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ -../../../../as/FUNC/outa.casl: 69: JUMP ODSL ; ループ終端 -../../../../as/FUNC/outa.casl: 70:ODYOV SRL GR2,1 -../../../../as/FUNC/outa.casl: 71: LAD GR2,#8000,GR2 -../../../../as/FUNC/outa.casl: 72: SRL GR4,1 -../../../../as/FUNC/outa.casl: 73: JUMP ODLPIN -../../../../as/FUNC/outa.casl: 74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト -../../../../as/FUNC/outa.casl: 75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 76: SRL GR2,1 ; GR2を1回右シフト -../../../../as/FUNC/outa.casl: 77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 78: JMI ODFIN ; ↓ -../../../../as/FUNC/outa.casl: 79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ -../../../../as/FUNC/outa.casl: 80: JMI ODLOOP ; ↓ -../../../../as/FUNC/outa.casl: 81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 -../../../../as/FUNC/outa.casl: 82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 -../../../../as/FUNC/outa.casl: 83: JUMP ODLOOP ; ループ終端 -../../../../as/FUNC/outa.casl: 84:ODFIN LD GR3,GR1 -../../../../as/FUNC/outa.casl: 85: POP GR4 -../../../../as/FUNC/outa.casl: 86: POP GR2 -../../../../as/FUNC/outa.casl: 87: POP GR1 -../../../../as/FUNC/outa.casl: 88: RET -../../../../as/FUNC/outa.casl: 89:ODY DS 1 -../../../../as/FUNC/outa.casl: 90: END -../../../../as/FUNC/outa.casl: 91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 92:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 93:REV START -../../../../as/FUNC/outa.casl: 94: RPUSH -../../../../as/FUNC/outa.casl: 95: LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 97: JZE RNEXT ; ↓ -../../../../as/FUNC/outa.casl: 98: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 -../../../../as/FUNC/outa.casl: 101: PUSH 0,GR5 ; GR5をプッシュ -../../../../as/FUNC/outa.casl: 102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 103: JUMP RPU ; ループ終端 -../../../../as/FUNC/outa.casl: 104:RNEXT LAD GR3,0 ; GR3の初期化 -../../../../as/FUNC/outa.casl: 105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 -../../../../as/FUNC/outa.casl: 106: JZE RFIN ; ↓ -../../../../as/FUNC/outa.casl: 107: POP GR5 ; GR5にポップ -../../../../as/FUNC/outa.casl: 108: LD GR4,GR1 ; GR4にGR1の値をコピー -../../../../as/FUNC/outa.casl: 109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 -../../../../as/FUNC/outa.casl: 110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 -../../../../as/FUNC/outa.casl: 111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 -../../../../as/FUNC/outa.casl: 112: JUMP RPO ; ループ終端 -../../../../as/FUNC/outa.casl: 113:RFIN RPOP +../../../../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 -../../../../as/FUNC/outa.casl: 116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 117:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 118:OABS START -../../../../as/FUNC/outa.casl: 119: XOR GR1,=#FFFF ; GR1の値を反転 -../../../../as/FUNC/outa.casl: 120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 -../../../../as/FUNC/outa.casl: 121: RET -../../../../as/FUNC/outa.casl: 122: END Label:::: +ODIVL.ODY ---> #0106 +OUTA.LEN ---> #00A7 +ODIVL.ODLOOP ---> #00F0 +ODIVL.ODLPIN ---> #00FD +OUTA.ZPRT ---> #006E OUTA.STI ---> #004E -ODIVL.ODYOV ---> #00ED -STSTR ---> #00C2 -OUTA.STR ---> #008C -ODIVL.ODY ---> #010B -MINIM.MIN ---> #002E +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 -REV.RNEXT ---> #0129 -MAIN.CNT ---> #0011 -REV.RFIN ---> #0137 -REV ---> #010C -OUTA.PRT ---> #006C -OABS ---> #013F -OUTA.NCHAR ---> #009E -MAIN.DATA ---> #000A -OUTA.STLST ---> #005B -MINIM.LRET ---> #002B +MINIM.MIN ---> #002E +REV.RNEXT ---> #0124 +OABS ---> #013A +OUTA.NCHAR ---> #00A8 +ODIVL.ODSL ---> #00DD +OUTA.STLST ---> #005D MAIN ---> #0000 -ODIVL ---> #00D1 -REV.RPO ---> #012B +ODIVL ---> #00CC OUTA ---> #002F MINIM ---> #0012 -REV.RPU ---> #011C -ODIVL.ODSL ---> #00E2 -OUTA.LEN ---> #009D -ODIVL.ODFIN ---> #0106 -OUTA.ZPRT ---> #0068 -ODIVL.ODLOOP ---> #00F5 -ODIVL.ODLPIN ---> #0102 +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 @@ -298,14 +290,14 @@ Assemble ../../../../as/FUNC/outa.casl (1) ../../../../as/FUNC/outa.casl: 6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1 #0041 #1240 #0042 #0000 -../../../../as/FUNC/outa.casl: 7: ST GR0,LEN ; LENの初期化 - #0043 #1100 - #0044 #009D +../../../../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 #0068 + #0047 #006E ../../../../as/FUNC/outa.casl: 10: JPL STI ; GR1が正数の場合、STIにジャンプ #0048 #6500 #0049 #004E @@ -314,105 +306,110 @@ Assemble ../../../../as/FUNC/outa.casl (1) #004B #0001 ../../../../as/FUNC/outa.casl: 12: CALL OABS ; GR1を正数に変換 #004C #8000 - #004D #013F + #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 #005B + #0050 #005D ../../../../as/FUNC/outa.casl: 15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納 #0051 #8000 - #0052 #00D1 + #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 #009E -../../../../as/FUNC/outa.casl: 18: CALL STSTR ; GR1をSTR領域に格納 - #0056 #8000 - #0057 #00C2 -../../../../as/FUNC/outa.casl: 19: LD GR1,GR0 ; GR0をGR1にコピー - #0058 #1410 -../../../../as/FUNC/outa.casl: 20: JUMP STI ; ループ終端 - #0059 #6400 - #005A #004E -../../../../as/FUNC/outa.casl: 21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換 - #005B #1011 - #005C #009E -../../../../as/FUNC/outa.casl: 22: CALL STSTR ; GR1をSTR領域に格納 - #005D #8000 - #005E #00C2 -../../../../as/FUNC/outa.casl: 23: AND GR4,GR4 ; 正数の場合 - #005F #3444 -../../../../as/FUNC/outa.casl: 24: JZE PRT ; ↓ - #0060 #6300 - #0061 #006C -../../../../as/FUNC/outa.casl: 25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納 - #0144 #002D - #0062 #1010 - #0063 #0144 -../../../../as/FUNC/outa.casl: 26: CALL STSTR ; ↓ - #0064 #8000 - #0065 #00C2 -../../../../as/FUNC/outa.casl: 27: JUMP PRT ; PRTにジャンプ - #0066 #6400 - #0067 #006C -../../../../as/FUNC/outa.casl: 28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納 - #0068 #1010 - #0069 #009E -../../../../as/FUNC/outa.casl: 29: CALL STSTR ; ↓ - #006A #8000 - #006B #00C2 -../../../../as/FUNC/outa.casl: 30:PRT LD GR2,LEN ; GR2にLENの値を格納 - #006C #1020 - #006D #009D -../../../../as/FUNC/outa.casl: 31: LAD GR1,STR ; GR1に文字列のアドレスを格納 - #006E #1210 - #006F #008C -../../../../as/FUNC/outa.casl: 32: CALL REV ; 文字列を逆順に並べ替え - #0070 #8000 - #0071 #010C -../../../../as/FUNC/outa.casl: 33: 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 #0145 - #0145 #000A - #007E #1220 - #007F #0001 - #0080 #F000 - #0081 #0002 - #0082 #7120 - #0083 #7110 -../../../../as/FUNC/outa.casl: 34: RPOP - #0084 #7170 - #0085 #7160 - #0086 #7150 - #0087 #7140 - #0088 #7130 - #0089 #7120 - #008A #7110 -../../../../as/FUNC/outa.casl: 35: RET - #008B #8100 -../../../../as/FUNC/outa.casl: 36:STR DS 17 - #008C #0000 - #008D #0000 - #008E #0000 - #008F #0000 - #0090 #0000 - #0091 #0000 - #0092 #0000 - #0093 #0000 - #0094 #0000 - #0095 #0000 + #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 @@ -420,258 +417,241 @@ Assemble ../../../../as/FUNC/outa.casl (1) #009A #0000 #009B #0000 #009C #0000 -../../../../as/FUNC/outa.casl: 37:LEN DS 1 #009D #0000 -../../../../as/FUNC/outa.casl: 38: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: 39: END -../../../../as/FUNC/outa.casl: 40:;; GR1をSTR領域に格納し、LENをインクリメント -../../../../as/FUNC/outa.casl: 41:STSTR START -../../../../as/FUNC/outa.casl: 42: PUSH 0,GR1 - #00C2 #7001 - #00C3 #0000 -../../../../as/FUNC/outa.casl: 43: PUSH 0,GR2 - #00C4 #7002 - #00C5 #0000 -../../../../as/FUNC/outa.casl: 44: LD GR2,LEN ; GR2にLENの値をロード - #00C6 #1020 - #00C7 #009D -../../../../as/FUNC/outa.casl: 45: ST GR1,STR,GR2 ; STR+GR2 <- GR1 - #00C8 #1112 - #00C9 #008C -../../../../as/FUNC/outa.casl: 46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1 - #00CA #1222 - #00CB #0001 -../../../../as/FUNC/outa.casl: 47: ST GR2,LEN ; LENにGR2を格納 - #00CC #1120 - #00CD #009D -../../../../as/FUNC/outa.casl: 48: POP GR2 - #00CE #7120 -../../../../as/FUNC/outa.casl: 49: POP GR1 - #00CF #7110 -../../../../as/FUNC/outa.casl: 50: RET - #00D0 #8100 -../../../../as/FUNC/outa.casl: 51: END -../../../../as/FUNC/outa.casl: 52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する -../../../../as/FUNC/outa.casl: 53:;;; 0〜65535の範囲の数値を扱う -../../../../as/FUNC/outa.casl: 54:ODIVL START -../../../../as/FUNC/outa.casl: 55: PUSH 0,GR1 - #00D1 #7001 - #00D2 #0000 -../../../../as/FUNC/outa.casl: 56: PUSH 0,GR2 - #00D3 #7002 - #00D4 #0000 -../../../../as/FUNC/outa.casl: 57: PUSH 0,GR4 - #00D5 #7004 - #00D6 #0000 -../../../../as/FUNC/outa.casl: 58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ - #00D7 #3422 -../../../../as/FUNC/outa.casl: 59: JZE ODFIN ; ↓ - #00D8 #6300 - #00D9 #0106 -../../../../as/FUNC/outa.casl: 60: ST GR2,ODY ; ODYにGR2の初期値を保存 - #00DA #1120 - #00DB #010B -../../../../as/FUNC/outa.casl: 61: LAD GR0,0 ; GR0の初期化 - #00DC #1200 - #00DD #0000 -../../../../as/FUNC/outa.casl: 62: LAD GR3,0 ; GR3の初期化 - #00DE #1230 - #00DF #0000 -../../../../as/FUNC/outa.casl: 63: LAD GR4,1 ; GR4の初期化。対象ビットを表す - #00E0 #1240 + #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: 64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出 - #00E2 #4521 -../../../../as/FUNC/outa.casl: 65: JPL ODLOOP ; ↓ - #00E3 #6500 - #00E4 #00F5 -../../../../as/FUNC/outa.casl: 66: SLL GR4,1 ; GR4を1回左シフト - #00E5 #5240 - #00E6 #0001 -../../../../as/FUNC/outa.casl: 67: SLL GR2,1 ; GR2を1回左シフト - #00E7 #5220 - #00E8 #0001 -../../../../as/FUNC/outa.casl: 68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ - #00E9 #6600 - #00EA #00ED -../../../../as/FUNC/outa.casl: 69: JUMP ODSL ; ループ終端 - #00EB #6400 - #00EC #00E2 -../../../../as/FUNC/outa.casl: 70:ODYOV SRL GR2,1 - #00ED #5320 - #00EE #0001 -../../../../as/FUNC/outa.casl: 71: LAD GR2,#8000,GR2 - #00EF #1222 - #00F0 #8000 -../../../../as/FUNC/outa.casl: 72: SRL GR4,1 - #00F1 #5340 - #00F2 #0001 -../../../../as/FUNC/outa.casl: 73: JUMP ODLPIN - #00F3 #6400 - #00F4 #0102 -../../../../as/FUNC/outa.casl: 74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト - #00F5 #5340 - #00F6 #0001 -../../../../as/FUNC/outa.casl: 75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出 - #00F7 #6300 - #00F8 #0106 -../../../../as/FUNC/outa.casl: 76: SRL GR2,1 ; GR2を1回右シフト - #00F9 #5320 - #00FA #0001 -../../../../as/FUNC/outa.casl: 77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出 - #00FB #4110 - #00FC #010B -../../../../as/FUNC/outa.casl: 78: JMI ODFIN ; ↓ - #00FD #6100 - #00FE #0106 -../../../../as/FUNC/outa.casl: 79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ - #00FF #4512 -../../../../as/FUNC/outa.casl: 80: JMI ODLOOP ; ↓ - #0100 #6100 - #0101 #00F5 -../../../../as/FUNC/outa.casl: 81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2 - #0102 #2712 -../../../../as/FUNC/outa.casl: 82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4 - #0103 #2604 -../../../../as/FUNC/outa.casl: 83: JUMP ODLOOP ; ループ終端 - #0104 #6400 - #0105 #00F5 -../../../../as/FUNC/outa.casl: 84:ODFIN LD GR3,GR1 - #0106 #1431 -../../../../as/FUNC/outa.casl: 85: POP GR4 - #0107 #7140 -../../../../as/FUNC/outa.casl: 86: POP GR2 - #0108 #7120 -../../../../as/FUNC/outa.casl: 87: POP GR1 - #0109 #7110 -../../../../as/FUNC/outa.casl: 88: RET - #010A #8100 -../../../../as/FUNC/outa.casl: 89:ODY DS 1 - #010B #0000 -../../../../as/FUNC/outa.casl: 90: END -../../../../as/FUNC/outa.casl: 91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える -../../../../as/FUNC/outa.casl: 92:;; 例: 12345 -> 54321、54321- -> -12345 -../../../../as/FUNC/outa.casl: 93:REV START -../../../../as/FUNC/outa.casl: 94: RPUSH - #010C #7001 - #010D #0000 - #010E #7002 - #010F #0000 - #0110 #7003 - #0111 #0000 - #0112 #7004 - #0113 #0000 - #0114 #7005 - #0115 #0000 - #0116 #7006 - #0117 #0000 - #0118 #7007 - #0119 #0000 -../../../../as/FUNC/outa.casl: 95: LAD GR3,0 ; GR3の初期化 - #011A #1230 - #011B #0000 -../../../../as/FUNC/outa.casl: 96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #011C #4532 -../../../../as/FUNC/outa.casl: 97: JZE RNEXT ; ↓ - #011D #6300 - #011E #0129 -../../../../as/FUNC/outa.casl: 98: LD GR4,GR1 ; GR4にGR1の値をコピー - #011F #1441 -../../../../as/FUNC/outa.casl: 99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0120 #2643 -../../../../as/FUNC/outa.casl: 100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納 - #0121 #1054 - #0122 #0000 -../../../../as/FUNC/outa.casl: 101: PUSH 0,GR5 ; GR5をプッシュ - #0123 #7005 - #0124 #0000 -../../../../as/FUNC/outa.casl: 102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0125 #1233 - #0126 #0001 -../../../../as/FUNC/outa.casl: 103: JUMP RPU ; ループ終端 - #0127 #6400 - #0128 #011C -../../../../as/FUNC/outa.casl: 104:RNEXT LAD GR3,0 ; GR3の初期化 - #0129 #1230 - #012A #0000 -../../../../as/FUNC/outa.casl: 105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出 - #012B #4532 -../../../../as/FUNC/outa.casl: 106: JZE RFIN ; ↓ - #012C #6300 - #012D #0137 -../../../../as/FUNC/outa.casl: 107: POP GR5 ; GR5にポップ - #012E #7150 -../../../../as/FUNC/outa.casl: 108: LD GR4,GR1 ; GR4にGR1の値をコピー - #012F #1441 -../../../../as/FUNC/outa.casl: 109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3 - #0130 #2643 -../../../../as/FUNC/outa.casl: 110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納 - #0131 #1154 - #0132 #0000 -../../../../as/FUNC/outa.casl: 111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1 - #0133 #1233 - #0134 #0001 -../../../../as/FUNC/outa.casl: 112: JUMP RPO ; ループ終端 - #0135 #6400 - #0136 #012B -../../../../as/FUNC/outa.casl: 113:RFIN RPOP - #0137 #7170 - #0138 #7160 - #0139 #7150 - #013A #7140 - #013B #7130 - #013C #7120 - #013D #7110 +../../../../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 -../../../../as/FUNC/outa.casl: 116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。 -../../../../as/FUNC/outa.casl: 117:;; 例: -10 -> 10, -20 -> 20 -../../../../as/FUNC/outa.casl: 118:OABS START -../../../../as/FUNC/outa.casl: 119: XOR GR1,=#FFFF ; GR1の値を反転 - #0146 #FFFF - #013F #3210 - #0140 #0146 -../../../../as/FUNC/outa.casl: 120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1 - #0141 #1211 - #0142 #0001 -../../../../as/FUNC/outa.casl: 121: RET - #0143 #8100 -../../../../as/FUNC/outa.casl: 122: END -39 diff --git a/test/integration/casl2/out0/0.txt b/test/integration/casl2/out0/0.txt index 47485d5..be4842d 100644 --- a/test/integration/casl2/out0/0.txt +++ b/test/integration/casl2/out0/0.txt @@ -9,9 +9,9 @@ Assemble ../../../../as/CMD/out0.casl (0) ../../../../as/CMD/out0.casl: 6: END Label:::: -MAIN.BUF ---> #0013 -MAIN ---> #0000 MAIN.LEN ---> #0014 +MAIN ---> #0000 +MAIN.BUF ---> #0013 Assemble ../../../../as/CMD/out0.casl (1) ../../../../as/CMD/out0.casl: 1:MAIN START diff --git a/test/integration/casl2/sra2/0.txt b/test/integration/casl2/sra2/0.txt index 8c97668..78c24e8 100644 --- a/test/integration/casl2/sra2/0.txt +++ b/test/integration/casl2/sra2/0.txt @@ -8,8 +8,8 @@ Assemble ../../../../as/CMD/sra2.casl (0) ../../../../as/CMD/sra2.casl: 5: END Label:::: -SRA2.BEGIN ---> #0000 SRA2 ---> #0000 +SRA2.BEGIN ---> #0000 Assemble ../../../../as/CMD/sra2.casl (1) ../../../../as/CMD/sra2.casl: 1:SRA2 START BEGIN diff --git a/test/integration/casl2/sra4/0.txt b/test/integration/casl2/sra4/0.txt index b350a80..b977c50 100644 --- a/test/integration/casl2/sra4/0.txt +++ b/test/integration/casl2/sra4/0.txt @@ -11,10 +11,10 @@ Assemble ../../../../as/CMD/sra4.casl (0) ../../../../as/CMD/sra4.casl: 8: END Label:::: -SRA4.X ---> #0007 -SRA4.Y ---> #0008 SRA4.BEGIN ---> #0000 SRA4 ---> #0000 +SRA4.X ---> #0007 +SRA4.Y ---> #0008 Assemble ../../../../as/CMD/sra4.casl (1) ../../../../as/CMD/sra4.casl: 1:SRA4 START BEGIN diff --git a/test/integration/casl2/sum_10_sL/0.txt b/test/integration/casl2/sum_10_sL/0.txt index 71cdf34..f0cebb4 100644 --- a/test/integration/casl2/sum_10_sL/0.txt +++ b/test/integration/casl2/sum_10_sL/0.txt @@ -20,9 +20,9 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 diff --git a/test/integration/casl2/sum_10_slA/0.txt b/test/integration/casl2/sum_10_slA/0.txt index 8ccbe24..02ec698 100644 --- a/test/integration/casl2/sum_10_slA/0.txt +++ b/test/integration/casl2/sum_10_slA/0.txt @@ -20,12 +20,12 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 Assemble ../../../../as/FUNC/sum_10.casl (1) ../../../../as/FUNC/sum_10.casl: 1:;;; sum_10.casl diff --git a/test/integration/casl2/sum_10_slaO/0.txt b/test/integration/casl2/sum_10_slaO/0.txt index 3071c58..33f8070 100644 --- a/test/integration/casl2/sum_10_slaO/0.txt +++ b/test/integration/casl2/sum_10_slaO/0.txt @@ -20,12 +20,12 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 Assemble ../../../../as/FUNC/sum_10.casl (1) ../../../../as/FUNC/sum_10.casl: 1:;;; sum_10.casl diff --git a/test/integration/casl2/sum_10_slaOn/0.txt b/test/integration/casl2/sum_10_slaOn/0.txt index e510097..9094e33 100644 --- a/test/integration/casl2/sum_10_slaOn/0.txt +++ b/test/integration/casl2/sum_10_slaOn/0.txt @@ -20,12 +20,12 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 Assemble ../../../../as/FUNC/sum_10.casl (1) ../../../../as/FUNC/sum_10.casl: 1:;;; sum_10.casl diff --git a/test/integration/casl2/sum_10_slaoT/0.txt b/test/integration/casl2/sum_10_slaoT/0.txt index eb1a745..8cbc32a 100644 --- a/test/integration/casl2/sum_10_slaoT/0.txt +++ b/test/integration/casl2/sum_10_slaoT/0.txt @@ -20,12 +20,12 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 Assemble ../../../../as/FUNC/sum_10.casl (1) ../../../../as/FUNC/sum_10.casl: 1:;;; sum_10.casl diff --git a/test/integration/casl2/sum_10_slaot/0.txt b/test/integration/casl2/sum_10_slaot/0.txt index 035df6e..fe4bd8f 100644 --- a/test/integration/casl2/sum_10_slaot/0.txt +++ b/test/integration/casl2/sum_10_slaot/0.txt @@ -20,12 +20,12 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 Assemble ../../../../as/FUNC/sum_10.casl (1) ../../../../as/FUNC/sum_10.casl: 1:;;; sum_10.casl diff --git a/test/integration/casl2/sum_10_slaotd/0.txt b/test/integration/casl2/sum_10_slaotd/0.txt index 6838362..96961ae 100644 --- a/test/integration/casl2/sum_10_slaotd/0.txt +++ b/test/integration/casl2/sum_10_slaotd/0.txt @@ -20,12 +20,12 @@ Assemble ../../../../as/FUNC/sum_10.casl (0) ../../../../as/FUNC/sum_10.casl: 17: END Label:::: -MAIN.FST ---> #0011 -MAIN.LOOP ---> #0006 -MAIN.LST ---> #0012 -MAIN ---> #0000 MAIN.STEP ---> #0013 +MAIN.LST ---> #0012 MAIN.FIN ---> #000F +MAIN ---> #0000 +MAIN.FST ---> #0011 +MAIN.LOOP ---> #0006 Assemble ../../../../as/FUNC/sum_10.casl (1) ../../../../as/FUNC/sum_10.casl: 1:;;; sum_10.casl diff --git a/test/integration/casl2/svc2/0.txt b/test/integration/casl2/svc2/0.txt index fc6a7a4..d49338b 100644 --- a/test/integration/casl2/svc2/0.txt +++ b/test/integration/casl2/svc2/0.txt @@ -15,9 +15,9 @@ Assemble ../../../../as/CMD/svc2.casl (0) ../../../../as/CMD/svc2.casl: 12: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #000C MAIN.D ---> #000B -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/svc2.casl (1) diff --git a/test/integration/casl2/xor0/0.txt b/test/integration/casl2/xor0/0.txt index 6e81f94..7c2a529 100644 --- a/test/integration/casl2/xor0/0.txt +++ b/test/integration/casl2/xor0/0.txt @@ -11,9 +11,9 @@ Assemble ../../../../as/CMD/xor0.casl (0) ../../../../as/CMD/xor0.casl: 8: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0006 MAIN.B ---> #0007 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/xor0.casl (1) diff --git a/test/integration/casl2/xor1/0.txt b/test/integration/casl2/xor1/0.txt index 8eae3b1..fb92e7b 100644 --- a/test/integration/casl2/xor1/0.txt +++ b/test/integration/casl2/xor1/0.txt @@ -10,8 +10,8 @@ Assemble ../../../../as/CMD/xor1.casl (0) ../../../../as/CMD/xor1.casl: 7: END Label:::: -MAIN.A ---> #0007 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0007 MAIN ---> #0000 Assemble ../../../../as/CMD/xor1.casl (1) diff --git a/test/integration/casl2/xor3/0.txt b/test/integration/casl2/xor3/0.txt index 50d5d39..f1e0afe 100644 --- a/test/integration/casl2/xor3/0.txt +++ b/test/integration/casl2/xor3/0.txt @@ -10,8 +10,8 @@ Assemble ../../../../as/CMD/xor3.casl (0) ../../../../as/CMD/xor3.casl: 7: END Label:::: -MAIN.A ---> #0007 MAIN.BEGIN ---> #0000 +MAIN.A ---> #0007 MAIN ---> #0000 Assemble ../../../../as/CMD/xor3.casl (1) diff --git a/test/integration/casl2/xor4/0.txt b/test/integration/casl2/xor4/0.txt index 0e72420..9d68242 100644 --- a/test/integration/casl2/xor4/0.txt +++ b/test/integration/casl2/xor4/0.txt @@ -16,12 +16,12 @@ Assemble ../../../../as/CMD/xor4.casl (0) ../../../../as/CMD/xor4.casl: 13: END Label:::: -MAIN.A ---> #000D MAIN.BEGIN ---> #0000 -MAIN.LOOP ---> #0001 -MAIN ---> #0000 MAIN.FIN ---> #000C MAIN.LEN ---> #0012 +MAIN.A ---> #000D +MAIN ---> #0000 +MAIN.LOOP ---> #0001 Assemble ../../../../as/CMD/xor4.casl (1) ../../../../as/CMD/xor4.casl: 1:;;; XORで、GR1の内容をクリア diff --git a/test/integration/casl2/xor5/0.txt b/test/integration/casl2/xor5/0.txt index 3dc46ec..6ac014c 100644 --- a/test/integration/casl2/xor5/0.txt +++ b/test/integration/casl2/xor5/0.txt @@ -10,9 +10,9 @@ Assemble ../../../../as/CMD/xor5.casl (0) ../../../../as/CMD/xor5.casl: 7: END Label:::: +MAIN.BEGIN ---> #0000 MAIN.A ---> #0005 MAIN.B ---> #0006 -MAIN.BEGIN ---> #0000 MAIN ---> #0000 Assemble ../../../../as/CMD/xor5.casl (1)