ソースコード表示時の行数表示形式を調整
[YACASL2.git] / test / integration / casl2 / abs_call / 0.txt
1 ../../../../casl2 -sla ../../../../as/FUNC/abs_call.casl ../../../../as/FUNC/abs.casl ../../../../as/FUNC/outa.casl
2
3 Assemble ../../../../as/FUNC/abs_call.casl (0)
4 ../../../../as/FUNC/abs_call.casl:    1:;;; ABSを呼び出す
5 ../../../../as/FUNC/abs_call.casl:    2:;;; casl2 abs_call.casl abs.casl outa.casl
6 ../../../../as/FUNC/abs_call.casl:    3:MAIN    START
7 ../../../../as/FUNC/abs_call.casl:    4:        LAD     GR2,0
8 ../../../../as/FUNC/abs_call.casl:    5:MLOOP   CPA     GR2,MLEN
9 ../../../../as/FUNC/abs_call.casl:    6:        JZE     MFIN
10 ../../../../as/FUNC/abs_call.casl:    7:        LD      GR1,MVAL,GR2
11 ../../../../as/FUNC/abs_call.casl:    8:        CALL    ABS
12 ../../../../as/FUNC/abs_call.casl:    9:        CALL    OUTA
13 ../../../../as/FUNC/abs_call.casl:   10:        LAD     GR2,1,GR2
14 ../../../../as/FUNC/abs_call.casl:   11:        JUMP    MLOOP
15 ../../../../as/FUNC/abs_call.casl:   12:MFIN    RET
16 ../../../../as/FUNC/abs_call.casl:   13:MVAL    DC      12,-12,1,-1,32767,-32767,0,-32768
17 ../../../../as/FUNC/abs_call.casl:   14:MLEN    DC      8
18 ../../../../as/FUNC/abs_call.casl:   15:        END
19
20 Assemble ../../../../as/FUNC/abs.casl (0)
21 ../../../../as/FUNC/abs.casl:    1:;;; GR1を絶対値に変換する
22 ../../../../as/FUNC/abs.casl:    2:ABS     START
23 ../../../../as/FUNC/abs.casl:    3:        AND     GR1,GR1
24 ../../../../as/FUNC/abs.casl:    4:        JPL     ABSFIN
25 ../../../../as/FUNC/abs.casl:    5:        JZE     ABSFIN
26 ../../../../as/FUNC/abs.casl:    6:        XOR     GR1,=#FFFF
27 ../../../../as/FUNC/abs.casl:    7:        LAD     GR1,1,GR1
28 ../../../../as/FUNC/abs.casl:    8:ABSFIN  RET
29 ../../../../as/FUNC/abs.casl:    9:        END
30
31 Assemble ../../../../as/FUNC/outa.casl (0)
32 ../../../../as/FUNC/outa.casl:    1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示
33 ../../../../as/FUNC/outa.casl:    2:OUTA    START
34 ../../../../as/FUNC/outa.casl:    3:        RPUSH
35 ../../../../as/FUNC/outa.casl:    4:        LAD     GR2,10          ; GR2に10進数の「10」を格納。
36 ../../../../as/FUNC/outa.casl:    5:        LAD     GR0,0           ; GR0 <- 0
37 ../../../../as/FUNC/outa.casl:    6:        LAD     GR4,0           ; 負数フラグ。GR1が負数の場合、GR4は1
38 ../../../../as/FUNC/outa.casl:    7:        ST      GR0,LEN         ; LENの初期化
39 ../../../../as/FUNC/outa.casl:    8:        AND     GR1,GR1         ; GR1をテスト
40 ../../../../as/FUNC/outa.casl:    9:        JZE     ZPRT            ; GR1が0の場合、ZPRTにジャンプ
41 ../../../../as/FUNC/outa.casl:   10:        JPL     STI             ; GR1が正数の場合、STIにジャンプ
42 ../../../../as/FUNC/outa.casl:   11:        LAD     GR4,1           ; GR1が負数の場合、GR4をオン
43 ../../../../as/FUNC/outa.casl:   12:        CALL    OABS            ;                  GR1を正数に変換
44 ../../../../as/FUNC/outa.casl:   13:STI     CPL     GR1,GR2         ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出
45 ../../../../as/FUNC/outa.casl:   14:        JMI     STLST           ; ↓
46 ../../../../as/FUNC/outa.casl:   15:        CALL    ODIVL           ; GR1とGR2の、商をGR0、剰余をGR3に格納
47 ../../../../as/FUNC/outa.casl:   16:        LD      GR1,GR3         ; GR1にGR3をコピー
48 ../../../../as/FUNC/outa.casl:   17:        LD      GR1,NCHAR,GR1   ; GR1を文字に変換
49 ../../../../as/FUNC/outa.casl:   18:        CALL    STSTR           ; GR1をSTR領域に格納
50 ../../../../as/FUNC/outa.casl:   19:        LD      GR1,GR0         ; GR0をGR1にコピー
51 ../../../../as/FUNC/outa.casl:   20:        JUMP    STI             ; ループ終端
52 ../../../../as/FUNC/outa.casl:   21:STLST   LD      GR1,NCHAR,GR1   ; GR1を文字に変換
53 ../../../../as/FUNC/outa.casl:   22:        CALL    STSTR           ; GR1をSTR領域に格納
54 ../../../../as/FUNC/outa.casl:   23:        AND     GR4,GR4         ; 正数の場合
55 ../../../../as/FUNC/outa.casl:   24:        JZE     PRT             ; ↓
56 ../../../../as/FUNC/outa.casl:   25:        LD      GR1,='-'        ; 負数の場合、「-」をSTR領域に格納
57 ../../../../as/FUNC/outa.casl:   26:        CALL    STSTR           ; ↓
58 ../../../../as/FUNC/outa.casl:   27:        JUMP    PRT             ; PRTにジャンプ
59 ../../../../as/FUNC/outa.casl:   28:ZPRT    LD      GR1,NCHAR       ; 「0」をSTR領域に格納
60 ../../../../as/FUNC/outa.casl:   29:        CALL    STSTR           ; ↓
61 ../../../../as/FUNC/outa.casl:   30:PRT     LD      GR2,LEN         ; GR2にLENの値を格納
62 ../../../../as/FUNC/outa.casl:   31:        LAD     GR1,STR         ; GR1に文字列のアドレスを格納
63 ../../../../as/FUNC/outa.casl:   32:        CALL    REV             ; 文字列を逆順に並べ替え
64 ../../../../as/FUNC/outa.casl:   33:        OUT     STR,LEN         ; 文字列を出力
65 ../../../../as/FUNC/outa.casl:   34:        RPOP
66 ../../../../as/FUNC/outa.casl:   35:        RET
67 ../../../../as/FUNC/outa.casl:   36:STR     DS      17
68 ../../../../as/FUNC/outa.casl:   37:LEN     DS      1
69 ../../../../as/FUNC/outa.casl:   38:NCHAR   DC      '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
70 ../../../../as/FUNC/outa.casl:   39:        END
71 ../../../../as/FUNC/outa.casl:   40:;; GR1をSTR領域に格納し、LENをインクリメント
72 ../../../../as/FUNC/outa.casl:   41:STSTR   START
73 ../../../../as/FUNC/outa.casl:   42:        PUSH    0,GR1
74 ../../../../as/FUNC/outa.casl:   43:        PUSH    0,GR2
75 ../../../../as/FUNC/outa.casl:   44:        LD      GR2,LEN         ; GR2にLENの値をロード
76 ../../../../as/FUNC/outa.casl:   45:        ST      GR1,STR,GR2     ; STR+GR2 <- GR1
77 ../../../../as/FUNC/outa.casl:   46:        LAD     GR2,1,GR2       ; GR2 <- GR2 + 1
78 ../../../../as/FUNC/outa.casl:   47:        ST      GR2,LEN         ; LENにGR2を格納
79 ../../../../as/FUNC/outa.casl:   48:        POP     GR2
80 ../../../../as/FUNC/outa.casl:   49:        POP     GR1
81 ../../../../as/FUNC/outa.casl:   50:        RET
82 ../../../../as/FUNC/outa.casl:   51:        END
83 ../../../../as/FUNC/outa.casl:   52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する
84 ../../../../as/FUNC/outa.casl:   53:;;; 0〜65535の範囲の数値を扱う
85 ../../../../as/FUNC/outa.casl:   54:ODIVL   START
86 ../../../../as/FUNC/outa.casl:   55:        PUSH    0,GR1
87 ../../../../as/FUNC/outa.casl:   56:        PUSH    0,GR2
88 ../../../../as/FUNC/outa.casl:   57:        PUSH    0,GR4
89 ../../../../as/FUNC/outa.casl:   58:        AND     GR2,GR2         ; GR2が0の場合、ODFINへジャンプ
90 ../../../../as/FUNC/outa.casl:   59:        JZE     ODFIN           ; ↓
91 ../../../../as/FUNC/outa.casl:   60:        ST      GR2,ODY         ; ODYにGR2の初期値を保存
92 ../../../../as/FUNC/outa.casl:   61:        LAD     GR0,0           ; GR0の初期化
93 ../../../../as/FUNC/outa.casl:   62:        LAD     GR3,0           ; GR3の初期化
94 ../../../../as/FUNC/outa.casl:   63:        LAD     GR4,1           ; GR4の初期化。対象ビットを表す
95 ../../../../as/FUNC/outa.casl:   64:ODSL    CPL     GR2,GR1         ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出
96 ../../../../as/FUNC/outa.casl:   65:        JPL     ODLOOP          ; ↓
97 ../../../../as/FUNC/outa.casl:   66:        SLL     GR4,1           ; GR4を1回左シフト
98 ../../../../as/FUNC/outa.casl:   67:        SLL     GR2,1           ; GR2を1回左シフト
99 ../../../../as/FUNC/outa.casl:   68:        JOV     ODYOV           ; オーバーフローの場合は、ODYOVにジャンプ
100 ../../../../as/FUNC/outa.casl:   69:        JUMP    ODSL            ; ループ終端
101 ../../../../as/FUNC/outa.casl:   70:ODYOV   SRL     GR2,1
102 ../../../../as/FUNC/outa.casl:   71:        LAD     GR2,#8000,GR2
103 ../../../../as/FUNC/outa.casl:   72:        SRL     GR4,1
104 ../../../../as/FUNC/outa.casl:   73:        JUMP    ODLPIN
105 ../../../../as/FUNC/outa.casl:   74:ODLOOP  SRL     GR4,1           ; ループ先頭。GR4を1回右シフト
106 ../../../../as/FUNC/outa.casl:   75:        JZE     ODFIN           ; (GR4 = 0)の場合、ループ脱出
107 ../../../../as/FUNC/outa.casl:   76:        SRL     GR2,1           ; GR2を1回右シフト
108 ../../../../as/FUNC/outa.casl:   77:        CPL     GR1,ODY         ; (GR1 < ODY)の場合、ループ脱出
109 ../../../../as/FUNC/outa.casl:   78:        JMI     ODFIN           ; ↓
110 ../../../../as/FUNC/outa.casl:   79:        CPL     GR1,GR2         ; (GR1 < GR2)の場合、ループ先頭へジャンプ
111 ../../../../as/FUNC/outa.casl:   80:        JMI     ODLOOP          ; ↓
112 ../../../../as/FUNC/outa.casl:   81:ODLPIN  SUBL    GR1,GR2         ; GR1 <- GR1 - GR2
113 ../../../../as/FUNC/outa.casl:   82:        ADDL    GR0,GR4         ; GR0 <- GR0 + GR4
114 ../../../../as/FUNC/outa.casl:   83:        JUMP    ODLOOP          ; ループ終端
115 ../../../../as/FUNC/outa.casl:   84:ODFIN   LD      GR3,GR1
116 ../../../../as/FUNC/outa.casl:   85:        POP GR4
117 ../../../../as/FUNC/outa.casl:   86:        POP     GR2
118 ../../../../as/FUNC/outa.casl:   87:        POP     GR1
119 ../../../../as/FUNC/outa.casl:   88:        RET
120 ../../../../as/FUNC/outa.casl:   89:ODY     DS      1        
121 ../../../../as/FUNC/outa.casl:   90:        END
122 ../../../../as/FUNC/outa.casl:   91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える
123 ../../../../as/FUNC/outa.casl:   92:;; 例: 12345 -> 54321、54321- -> -12345
124 ../../../../as/FUNC/outa.casl:   93:REV     START
125 ../../../../as/FUNC/outa.casl:   94:        RPUSH
126 ../../../../as/FUNC/outa.casl:   95:        LAD     GR3,0           ; GR3の初期化
127 ../../../../as/FUNC/outa.casl:   96:RPU     CPL     GR3,GR2         ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
128 ../../../../as/FUNC/outa.casl:   97:        JZE     RNEXT           ; ↓
129 ../../../../as/FUNC/outa.casl:   98:        LD      GR4,GR1         ; GR4にGR1の値をコピー
130 ../../../../as/FUNC/outa.casl:   99:        ADDL    GR4,GR3         ; GR4 <- GR4 + GR3
131 ../../../../as/FUNC/outa.casl:  100:        LD      GR5,0,GR4       ; GR5にアドレスGR4の値を格納
132 ../../../../as/FUNC/outa.casl:  101:        PUSH    0,GR5           ; GR5をプッシュ
133 ../../../../as/FUNC/outa.casl:  102:        LAD     GR3,1,GR3       ; GR3 <- GR3 + 1
134 ../../../../as/FUNC/outa.casl:  103:        JUMP    RPU             ; ループ終端
135 ../../../../as/FUNC/outa.casl:  104:RNEXT   LAD     GR3,0           ; GR3の初期化
136 ../../../../as/FUNC/outa.casl:  105:RPO     CPL     GR3,GR2         ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
137 ../../../../as/FUNC/outa.casl:  106:        JZE     RFIN            ; ↓
138 ../../../../as/FUNC/outa.casl:  107:        POP     GR5             ; GR5にポップ
139 ../../../../as/FUNC/outa.casl:  108:        LD      GR4,GR1         ; GR4にGR1の値をコピー
140 ../../../../as/FUNC/outa.casl:  109:        ADDL    GR4,GR3         ; GR4 <- GR4 + GR3
141 ../../../../as/FUNC/outa.casl:  110:        ST      GR5,0,GR4       ; アドレスGR4にGR5の値を格納
142 ../../../../as/FUNC/outa.casl:  111:        LAD     GR3,1,GR3       ; GR3 <- GR3 + 1
143 ../../../../as/FUNC/outa.casl:  112:        JUMP    RPO             ; ループ終端
144 ../../../../as/FUNC/outa.casl:  113:RFIN    RPOP
145 ../../../../as/FUNC/outa.casl:  114:        RET
146 ../../../../as/FUNC/outa.casl:  115:        END
147 ../../../../as/FUNC/outa.casl:  116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。
148 ../../../../as/FUNC/outa.casl:  117:;; 例: -10 -> 10, -20 -> 20
149 ../../../../as/FUNC/outa.casl:  118:OABS    START
150 ../../../../as/FUNC/outa.casl:  119:        XOR     GR1,=#FFFF      ; GR1の値を反転
151 ../../../../as/FUNC/outa.casl:  120:        LAD     GR1,1,GR1       ; GR1 <- GR1 + 1
152 ../../../../as/FUNC/outa.casl:  121:        RET
153 ../../../../as/FUNC/outa.casl:  122:        END
154
155 Label::::
156 OUTA.STI ---> #0043
157 ODIVL.ODYOV ---> #00E2
158 STSTR ---> #00B7
159 OUTA.STR ---> #0081
160 ODIVL.ODY ---> #0100
161 REV.RNEXT ---> #011E
162 ABS ---> #001A
163 REV.RFIN ---> #012C
164 ABS.ABSFIN ---> #0023
165 MAIN.MLOOP ---> #0002
166 MAIN.MFIN ---> #0010
167 REV ---> #0101
168 MAIN.MLEN ---> #0019
169 OUTA.PRT ---> #0061
170 MAIN.MVAL ---> #0011
171 OABS ---> #0134
172 OUTA.NCHAR ---> #0093
173 OUTA.STLST ---> #0050
174 MAIN ---> #0000
175 ODIVL ---> #00C6
176 REV.RPO ---> #0120
177 OUTA ---> #0024
178 REV.RPU ---> #0111
179 ODIVL.ODSL ---> #00D7
180 OUTA.LEN ---> #0092
181 ODIVL.ODFIN ---> #00FB
182 OUTA.ZPRT ---> #005D
183 ODIVL.ODLOOP ---> #00EA
184 ODIVL.ODLPIN ---> #00F7
185
186 Assemble ../../../../as/FUNC/abs_call.casl (1)
187 ../../../../as/FUNC/abs_call.casl:    1:;;; ABSを呼び出す
188 ../../../../as/FUNC/abs_call.casl:    2:;;; casl2 abs_call.casl abs.casl outa.casl
189 ../../../../as/FUNC/abs_call.casl:    3:MAIN    START
190 ../../../../as/FUNC/abs_call.casl:    4:        LAD     GR2,0
191         #0000   #1220
192         #0001   #0000
193 ../../../../as/FUNC/abs_call.casl:    5:MLOOP   CPA     GR2,MLEN
194         #0002   #4020
195         #0003   #0019
196 ../../../../as/FUNC/abs_call.casl:    6:        JZE     MFIN
197         #0004   #6300
198         #0005   #0010
199 ../../../../as/FUNC/abs_call.casl:    7:        LD      GR1,MVAL,GR2
200         #0006   #1012
201         #0007   #0011
202 ../../../../as/FUNC/abs_call.casl:    8:        CALL    ABS
203         #0008   #8000
204         #0009   #001A
205 ../../../../as/FUNC/abs_call.casl:    9:        CALL    OUTA
206         #000A   #8000
207         #000B   #0024
208 ../../../../as/FUNC/abs_call.casl:   10:        LAD     GR2,1,GR2
209         #000C   #1222
210         #000D   #0001
211 ../../../../as/FUNC/abs_call.casl:   11:        JUMP    MLOOP
212         #000E   #6400
213         #000F   #0002
214 ../../../../as/FUNC/abs_call.casl:   12:MFIN    RET
215         #0010   #8100
216 ../../../../as/FUNC/abs_call.casl:   13:MVAL    DC      12,-12,1,-1,32767,-32767,0,-32768
217         #0011   #000C
218         #0012   #FFF4
219         #0013   #0001
220         #0014   #FFFF
221         #0015   #7FFF
222         #0016   #8001
223         #0017   #0000
224         #0018   #8000
225 ../../../../as/FUNC/abs_call.casl:   14:MLEN    DC      8
226         #0019   #0008
227 ../../../../as/FUNC/abs_call.casl:   15:        END
228
229 Assemble ../../../../as/FUNC/abs.casl (1)
230 ../../../../as/FUNC/abs.casl:    1:;;; GR1を絶対値に変換する
231 ../../../../as/FUNC/abs.casl:    2:ABS     START
232 ../../../../as/FUNC/abs.casl:    3:        AND     GR1,GR1
233         #001A   #3411
234 ../../../../as/FUNC/abs.casl:    4:        JPL     ABSFIN
235         #001B   #6500
236         #001C   #0023
237 ../../../../as/FUNC/abs.casl:    5:        JZE     ABSFIN
238         #001D   #6300
239         #001E   #0023
240 ../../../../as/FUNC/abs.casl:    6:        XOR     GR1,=#FFFF
241         #0139   #FFFF
242         #001F   #3210
243         #0020   #0139
244 ../../../../as/FUNC/abs.casl:    7:        LAD     GR1,1,GR1
245         #0021   #1211
246         #0022   #0001
247 ../../../../as/FUNC/abs.casl:    8:ABSFIN  RET
248         #0023   #8100
249 ../../../../as/FUNC/abs.casl:    9:        END
250
251 Assemble ../../../../as/FUNC/outa.casl (1)
252 ../../../../as/FUNC/outa.casl:    1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示
253 ../../../../as/FUNC/outa.casl:    2:OUTA    START
254 ../../../../as/FUNC/outa.casl:    3:        RPUSH
255         #0024   #7001
256         #0025   #0000
257         #0026   #7002
258         #0027   #0000
259         #0028   #7003
260         #0029   #0000
261         #002A   #7004
262         #002B   #0000
263         #002C   #7005
264         #002D   #0000
265         #002E   #7006
266         #002F   #0000
267         #0030   #7007
268         #0031   #0000
269 ../../../../as/FUNC/outa.casl:    4:        LAD     GR2,10          ; GR2に10進数の「10」を格納。
270         #0032   #1220
271         #0033   #000A
272 ../../../../as/FUNC/outa.casl:    5:        LAD     GR0,0           ; GR0 <- 0
273         #0034   #1200
274         #0035   #0000
275 ../../../../as/FUNC/outa.casl:    6:        LAD     GR4,0           ; 負数フラグ。GR1が負数の場合、GR4は1
276         #0036   #1240
277         #0037   #0000
278 ../../../../as/FUNC/outa.casl:    7:        ST      GR0,LEN         ; LENの初期化
279         #0038   #1100
280         #0039   #0092
281 ../../../../as/FUNC/outa.casl:    8:        AND     GR1,GR1         ; GR1をテスト
282         #003A   #3411
283 ../../../../as/FUNC/outa.casl:    9:        JZE     ZPRT            ; GR1が0の場合、ZPRTにジャンプ
284         #003B   #6300
285         #003C   #005D
286 ../../../../as/FUNC/outa.casl:   10:        JPL     STI             ; GR1が正数の場合、STIにジャンプ
287         #003D   #6500
288         #003E   #0043
289 ../../../../as/FUNC/outa.casl:   11:        LAD     GR4,1           ; GR1が負数の場合、GR4をオン
290         #003F   #1240
291         #0040   #0001
292 ../../../../as/FUNC/outa.casl:   12:        CALL    OABS            ;                  GR1を正数に変換
293         #0041   #8000
294         #0042   #0134
295 ../../../../as/FUNC/outa.casl:   13:STI     CPL     GR1,GR2         ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出
296         #0043   #4512
297 ../../../../as/FUNC/outa.casl:   14:        JMI     STLST           ; ↓
298         #0044   #6100
299         #0045   #0050
300 ../../../../as/FUNC/outa.casl:   15:        CALL    ODIVL           ; GR1とGR2の、商をGR0、剰余をGR3に格納
301         #0046   #8000
302         #0047   #00C6
303 ../../../../as/FUNC/outa.casl:   16:        LD      GR1,GR3         ; GR1にGR3をコピー
304         #0048   #1413
305 ../../../../as/FUNC/outa.casl:   17:        LD      GR1,NCHAR,GR1   ; GR1を文字に変換
306         #0049   #1011
307         #004A   #0093
308 ../../../../as/FUNC/outa.casl:   18:        CALL    STSTR           ; GR1をSTR領域に格納
309         #004B   #8000
310         #004C   #00B7
311 ../../../../as/FUNC/outa.casl:   19:        LD      GR1,GR0         ; GR0をGR1にコピー
312         #004D   #1410
313 ../../../../as/FUNC/outa.casl:   20:        JUMP    STI             ; ループ終端
314         #004E   #6400
315         #004F   #0043
316 ../../../../as/FUNC/outa.casl:   21:STLST   LD      GR1,NCHAR,GR1   ; GR1を文字に変換
317         #0050   #1011
318         #0051   #0093
319 ../../../../as/FUNC/outa.casl:   22:        CALL    STSTR           ; GR1をSTR領域に格納
320         #0052   #8000
321         #0053   #00B7
322 ../../../../as/FUNC/outa.casl:   23:        AND     GR4,GR4         ; 正数の場合
323         #0054   #3444
324 ../../../../as/FUNC/outa.casl:   24:        JZE     PRT             ; ↓
325         #0055   #6300
326         #0056   #0061
327 ../../../../as/FUNC/outa.casl:   25:        LD      GR1,='-'        ; 負数の場合、「-」をSTR領域に格納
328         #013A   #002D
329         #0057   #1010
330         #0058   #013A
331 ../../../../as/FUNC/outa.casl:   26:        CALL    STSTR           ; ↓
332         #0059   #8000
333         #005A   #00B7
334 ../../../../as/FUNC/outa.casl:   27:        JUMP    PRT             ; PRTにジャンプ
335         #005B   #6400
336         #005C   #0061
337 ../../../../as/FUNC/outa.casl:   28:ZPRT    LD      GR1,NCHAR       ; 「0」をSTR領域に格納
338         #005D   #1010
339         #005E   #0093
340 ../../../../as/FUNC/outa.casl:   29:        CALL    STSTR           ; ↓
341         #005F   #8000
342         #0060   #00B7
343 ../../../../as/FUNC/outa.casl:   30:PRT     LD      GR2,LEN         ; GR2にLENの値を格納
344         #0061   #1020
345         #0062   #0092
346 ../../../../as/FUNC/outa.casl:   31:        LAD     GR1,STR         ; GR1に文字列のアドレスを格納
347         #0063   #1210
348         #0064   #0081
349 ../../../../as/FUNC/outa.casl:   32:        CALL    REV             ; 文字列を逆順に並べ替え
350         #0065   #8000
351         #0066   #0101
352 ../../../../as/FUNC/outa.casl:   33:        OUT     STR,LEN         ; 文字列を出力
353         #0067   #7001
354         #0068   #0000
355         #0069   #7002
356         #006A   #0000
357         #006B   #1210
358         #006C   #0081
359         #006D   #1020
360         #006E   #0092
361         #006F   #F000
362         #0070   #0002
363         #0071   #1210
364         #0072   #013B
365         #013B   #000A
366         #0073   #1220
367         #0074   #0001
368         #0075   #F000
369         #0076   #0002
370         #0077   #7120
371         #0078   #7110
372 ../../../../as/FUNC/outa.casl:   34:        RPOP
373         #0079   #7170
374         #007A   #7160
375         #007B   #7150
376         #007C   #7140
377         #007D   #7130
378         #007E   #7120
379         #007F   #7110
380 ../../../../as/FUNC/outa.casl:   35:        RET
381         #0080   #8100
382 ../../../../as/FUNC/outa.casl:   36:STR     DS      17
383         #0081   #0000
384         #0082   #0000
385         #0083   #0000
386         #0084   #0000
387         #0085   #0000
388         #0086   #0000
389         #0087   #0000
390         #0088   #0000
391         #0089   #0000
392         #008A   #0000
393         #008B   #0000
394         #008C   #0000
395         #008D   #0000
396         #008E   #0000
397         #008F   #0000
398         #0090   #0000
399         #0091   #0000
400 ../../../../as/FUNC/outa.casl:   37:LEN     DS      1
401         #0092   #0000
402 ../../../../as/FUNC/outa.casl:   38:NCHAR   DC      '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
403         #0093   #0030
404         #0094   #0031
405         #0095   #0032
406         #0096   #0033
407         #0097   #0034
408         #0098   #0035
409         #0099   #0036
410         #009A   #0037
411         #009B   #0038
412         #009C   #0039
413         #009D   #0041
414         #009E   #0042
415         #009F   #0043
416         #00A0   #0044
417         #00A1   #0045
418         #00A2   #0046
419         #00A3   #0047
420         #00A4   #0048
421         #00A5   #0049
422         #00A6   #004A
423         #00A7   #004B
424         #00A8   #004C
425         #00A9   #004D
426         #00AA   #004E
427         #00AB   #004F
428         #00AC   #0050
429         #00AD   #0051
430         #00AE   #0052
431         #00AF   #0053
432         #00B0   #0054
433         #00B1   #0055
434         #00B2   #0056
435         #00B3   #0057
436         #00B4   #0058
437         #00B5   #0059
438         #00B6   #005A
439 ../../../../as/FUNC/outa.casl:   39:        END
440 ../../../../as/FUNC/outa.casl:   40:;; GR1をSTR領域に格納し、LENをインクリメント
441 ../../../../as/FUNC/outa.casl:   41:STSTR   START
442 ../../../../as/FUNC/outa.casl:   42:        PUSH    0,GR1
443         #00B7   #7001
444         #00B8   #0000
445 ../../../../as/FUNC/outa.casl:   43:        PUSH    0,GR2
446         #00B9   #7002
447         #00BA   #0000
448 ../../../../as/FUNC/outa.casl:   44:        LD      GR2,LEN         ; GR2にLENの値をロード
449         #00BB   #1020
450         #00BC   #0092
451 ../../../../as/FUNC/outa.casl:   45:        ST      GR1,STR,GR2     ; STR+GR2 <- GR1
452         #00BD   #1112
453         #00BE   #0081
454 ../../../../as/FUNC/outa.casl:   46:        LAD     GR2,1,GR2       ; GR2 <- GR2 + 1
455         #00BF   #1222
456         #00C0   #0001
457 ../../../../as/FUNC/outa.casl:   47:        ST      GR2,LEN         ; LENにGR2を格納
458         #00C1   #1120
459         #00C2   #0092
460 ../../../../as/FUNC/outa.casl:   48:        POP     GR2
461         #00C3   #7120
462 ../../../../as/FUNC/outa.casl:   49:        POP     GR1
463         #00C4   #7110
464 ../../../../as/FUNC/outa.casl:   50:        RET
465         #00C5   #8100
466 ../../../../as/FUNC/outa.casl:   51:        END
467 ../../../../as/FUNC/outa.casl:   52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する
468 ../../../../as/FUNC/outa.casl:   53:;;; 0〜65535の範囲の数値を扱う
469 ../../../../as/FUNC/outa.casl:   54:ODIVL   START
470 ../../../../as/FUNC/outa.casl:   55:        PUSH    0,GR1
471         #00C6   #7001
472         #00C7   #0000
473 ../../../../as/FUNC/outa.casl:   56:        PUSH    0,GR2
474         #00C8   #7002
475         #00C9   #0000
476 ../../../../as/FUNC/outa.casl:   57:        PUSH    0,GR4
477         #00CA   #7004
478         #00CB   #0000
479 ../../../../as/FUNC/outa.casl:   58:        AND     GR2,GR2         ; GR2が0の場合、ODFINへジャンプ
480         #00CC   #3422
481 ../../../../as/FUNC/outa.casl:   59:        JZE     ODFIN           ; ↓
482         #00CD   #6300
483         #00CE   #00FB
484 ../../../../as/FUNC/outa.casl:   60:        ST      GR2,ODY         ; ODYにGR2の初期値を保存
485         #00CF   #1120
486         #00D0   #0100
487 ../../../../as/FUNC/outa.casl:   61:        LAD     GR0,0           ; GR0の初期化
488         #00D1   #1200
489         #00D2   #0000
490 ../../../../as/FUNC/outa.casl:   62:        LAD     GR3,0           ; GR3の初期化
491         #00D3   #1230
492         #00D4   #0000
493 ../../../../as/FUNC/outa.casl:   63:        LAD     GR4,1           ; GR4の初期化。対象ビットを表す
494         #00D5   #1240
495         #00D6   #0001
496 ../../../../as/FUNC/outa.casl:   64:ODSL    CPL     GR2,GR1         ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出
497         #00D7   #4521
498 ../../../../as/FUNC/outa.casl:   65:        JPL     ODLOOP          ; ↓
499         #00D8   #6500
500         #00D9   #00EA
501 ../../../../as/FUNC/outa.casl:   66:        SLL     GR4,1           ; GR4を1回左シフト
502         #00DA   #5240
503         #00DB   #0001
504 ../../../../as/FUNC/outa.casl:   67:        SLL     GR2,1           ; GR2を1回左シフト
505         #00DC   #5220
506         #00DD   #0001
507 ../../../../as/FUNC/outa.casl:   68:        JOV     ODYOV           ; オーバーフローの場合は、ODYOVにジャンプ
508         #00DE   #6600
509         #00DF   #00E2
510 ../../../../as/FUNC/outa.casl:   69:        JUMP    ODSL            ; ループ終端
511         #00E0   #6400
512         #00E1   #00D7
513 ../../../../as/FUNC/outa.casl:   70:ODYOV   SRL     GR2,1
514         #00E2   #5320
515         #00E3   #0001
516 ../../../../as/FUNC/outa.casl:   71:        LAD     GR2,#8000,GR2
517         #00E4   #1222
518         #00E5   #8000
519 ../../../../as/FUNC/outa.casl:   72:        SRL     GR4,1
520         #00E6   #5340
521         #00E7   #0001
522 ../../../../as/FUNC/outa.casl:   73:        JUMP    ODLPIN
523         #00E8   #6400
524         #00E9   #00F7
525 ../../../../as/FUNC/outa.casl:   74:ODLOOP  SRL     GR4,1           ; ループ先頭。GR4を1回右シフト
526         #00EA   #5340
527         #00EB   #0001
528 ../../../../as/FUNC/outa.casl:   75:        JZE     ODFIN           ; (GR4 = 0)の場合、ループ脱出
529         #00EC   #6300
530         #00ED   #00FB
531 ../../../../as/FUNC/outa.casl:   76:        SRL     GR2,1           ; GR2を1回右シフト
532         #00EE   #5320
533         #00EF   #0001
534 ../../../../as/FUNC/outa.casl:   77:        CPL     GR1,ODY         ; (GR1 < ODY)の場合、ループ脱出
535         #00F0   #4110
536         #00F1   #0100
537 ../../../../as/FUNC/outa.casl:   78:        JMI     ODFIN           ; ↓
538         #00F2   #6100
539         #00F3   #00FB
540 ../../../../as/FUNC/outa.casl:   79:        CPL     GR1,GR2         ; (GR1 < GR2)の場合、ループ先頭へジャンプ
541         #00F4   #4512
542 ../../../../as/FUNC/outa.casl:   80:        JMI     ODLOOP          ; ↓
543         #00F5   #6100
544         #00F6   #00EA
545 ../../../../as/FUNC/outa.casl:   81:ODLPIN  SUBL    GR1,GR2         ; GR1 <- GR1 - GR2
546         #00F7   #2712
547 ../../../../as/FUNC/outa.casl:   82:        ADDL    GR0,GR4         ; GR0 <- GR0 + GR4
548         #00F8   #2604
549 ../../../../as/FUNC/outa.casl:   83:        JUMP    ODLOOP          ; ループ終端
550         #00F9   #6400
551         #00FA   #00EA
552 ../../../../as/FUNC/outa.casl:   84:ODFIN   LD      GR3,GR1
553         #00FB   #1431
554 ../../../../as/FUNC/outa.casl:   85:        POP GR4
555         #00FC   #7140
556 ../../../../as/FUNC/outa.casl:   86:        POP     GR2
557         #00FD   #7120
558 ../../../../as/FUNC/outa.casl:   87:        POP     GR1
559         #00FE   #7110
560 ../../../../as/FUNC/outa.casl:   88:        RET
561         #00FF   #8100
562 ../../../../as/FUNC/outa.casl:   89:ODY     DS      1        
563         #0100   #0000
564 ../../../../as/FUNC/outa.casl:   90:        END
565 ../../../../as/FUNC/outa.casl:   91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える
566 ../../../../as/FUNC/outa.casl:   92:;; 例: 12345 -> 54321、54321- -> -12345
567 ../../../../as/FUNC/outa.casl:   93:REV     START
568 ../../../../as/FUNC/outa.casl:   94:        RPUSH
569         #0101   #7001
570         #0102   #0000
571         #0103   #7002
572         #0104   #0000
573         #0105   #7003
574         #0106   #0000
575         #0107   #7004
576         #0108   #0000
577         #0109   #7005
578         #010A   #0000
579         #010B   #7006
580         #010C   #0000
581         #010D   #7007
582         #010E   #0000
583 ../../../../as/FUNC/outa.casl:   95:        LAD     GR3,0           ; GR3の初期化
584         #010F   #1230
585         #0110   #0000
586 ../../../../as/FUNC/outa.casl:   96:RPU     CPL     GR3,GR2         ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
587         #0111   #4532
588 ../../../../as/FUNC/outa.casl:   97:        JZE     RNEXT           ; ↓
589         #0112   #6300
590         #0113   #011E
591 ../../../../as/FUNC/outa.casl:   98:        LD      GR4,GR1         ; GR4にGR1の値をコピー
592         #0114   #1441
593 ../../../../as/FUNC/outa.casl:   99:        ADDL    GR4,GR3         ; GR4 <- GR4 + GR3
594         #0115   #2643
595 ../../../../as/FUNC/outa.casl:  100:        LD      GR5,0,GR4       ; GR5にアドレスGR4の値を格納
596         #0116   #1054
597         #0117   #0000
598 ../../../../as/FUNC/outa.casl:  101:        PUSH    0,GR5           ; GR5をプッシュ
599         #0118   #7005
600         #0119   #0000
601 ../../../../as/FUNC/outa.casl:  102:        LAD     GR3,1,GR3       ; GR3 <- GR3 + 1
602         #011A   #1233
603         #011B   #0001
604 ../../../../as/FUNC/outa.casl:  103:        JUMP    RPU             ; ループ終端
605         #011C   #6400
606         #011D   #0111
607 ../../../../as/FUNC/outa.casl:  104:RNEXT   LAD     GR3,0           ; GR3の初期化
608         #011E   #1230
609         #011F   #0000
610 ../../../../as/FUNC/outa.casl:  105:RPO     CPL     GR3,GR2         ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
611         #0120   #4532
612 ../../../../as/FUNC/outa.casl:  106:        JZE     RFIN            ; ↓
613         #0121   #6300
614         #0122   #012C
615 ../../../../as/FUNC/outa.casl:  107:        POP     GR5             ; GR5にポップ
616         #0123   #7150
617 ../../../../as/FUNC/outa.casl:  108:        LD      GR4,GR1         ; GR4にGR1の値をコピー
618         #0124   #1441
619 ../../../../as/FUNC/outa.casl:  109:        ADDL    GR4,GR3         ; GR4 <- GR4 + GR3
620         #0125   #2643
621 ../../../../as/FUNC/outa.casl:  110:        ST      GR5,0,GR4       ; アドレスGR4にGR5の値を格納
622         #0126   #1154
623         #0127   #0000
624 ../../../../as/FUNC/outa.casl:  111:        LAD     GR3,1,GR3       ; GR3 <- GR3 + 1
625         #0128   #1233
626         #0129   #0001
627 ../../../../as/FUNC/outa.casl:  112:        JUMP    RPO             ; ループ終端
628         #012A   #6400
629         #012B   #0120
630 ../../../../as/FUNC/outa.casl:  113:RFIN    RPOP
631         #012C   #7170
632         #012D   #7160
633         #012E   #7150
634         #012F   #7140
635         #0130   #7130
636         #0131   #7120
637         #0132   #7110
638 ../../../../as/FUNC/outa.casl:  114:        RET
639         #0133   #8100
640 ../../../../as/FUNC/outa.casl:  115:        END
641 ../../../../as/FUNC/outa.casl:  116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。
642 ../../../../as/FUNC/outa.casl:  117:;; 例: -10 -> 10, -20 -> 20
643 ../../../../as/FUNC/outa.casl:  118:OABS    START
644 ../../../../as/FUNC/outa.casl:  119:        XOR     GR1,=#FFFF      ; GR1の値を反転
645         #013C   #FFFF
646         #0134   #3210
647         #0135   #013C
648 ../../../../as/FUNC/outa.casl:  120:        LAD     GR1,1,GR1       ; GR1 <- GR1 + 1
649         #0136   #1211
650         #0137   #0001
651 ../../../../as/FUNC/outa.casl:  121:        RET
652         #0138   #8100
653 ../../../../as/FUNC/outa.casl:  122:        END
654 12
655 12
656 1
657 1
658 32767
659 32767
660 0
661 -32768