1 ../../../../casl2 -sla ../../../../as/FUNC/abs_call.casl ../../../../as/FUNC/abs.casl ../../../../as/FUNC/outa.casl
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
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
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
157 ODIVL.ODYOV ---> #00E2
164 ABS.ABSFIN ---> #0023
165 MAIN.MLOOP ---> #0002
172 OUTA.NCHAR ---> #0093
173 OUTA.STLST ---> #0050
179 ODIVL.ODSL ---> #00D7
181 ODIVL.ODFIN ---> #00FB
183 ODIVL.ODLOOP ---> #00EA
184 ODIVL.ODLPIN ---> #00F7
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
193 ../../../../as/FUNC/abs_call.casl:5:MLOOP CPA GR2,MLEN
196 ../../../../as/FUNC/abs_call.casl:6: JZE MFIN
199 ../../../../as/FUNC/abs_call.casl:7: LD GR1,MVAL,GR2
202 ../../../../as/FUNC/abs_call.casl:8: CALL ABS
205 ../../../../as/FUNC/abs_call.casl:9: CALL OUTA
208 ../../../../as/FUNC/abs_call.casl:10: LAD GR2,1,GR2
211 ../../../../as/FUNC/abs_call.casl:11: JUMP MLOOP
214 ../../../../as/FUNC/abs_call.casl:12:MFIN RET
216 ../../../../as/FUNC/abs_call.casl:13:MVAL DC 12,-12,1,-1,32767,-32767,0,-32768
225 ../../../../as/FUNC/abs_call.casl:14:MLEN DC 8
227 ../../../../as/FUNC/abs_call.casl:15: END
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
234 ../../../../as/FUNC/abs.casl:4: JPL ABSFIN
237 ../../../../as/FUNC/abs.casl:5: JZE ABSFIN
240 ../../../../as/FUNC/abs.casl:6: XOR GR1,=#FFFF
244 ../../../../as/FUNC/abs.casl:7: LAD GR1,1,GR1
247 ../../../../as/FUNC/abs.casl:8:ABSFIN RET
249 ../../../../as/FUNC/abs.casl:9: END
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
269 ../../../../as/FUNC/outa.casl:4: LAD GR2,10 ; GR2に10進数の「10」を格納。
272 ../../../../as/FUNC/outa.casl:5: LAD GR0,0 ; GR0 <- 0
275 ../../../../as/FUNC/outa.casl:6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1
278 ../../../../as/FUNC/outa.casl:7: ST GR0,LEN ; LENの初期化
281 ../../../../as/FUNC/outa.casl:8: AND GR1,GR1 ; GR1をテスト
283 ../../../../as/FUNC/outa.casl:9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ
286 ../../../../as/FUNC/outa.casl:10: JPL STI ; GR1が正数の場合、STIにジャンプ
289 ../../../../as/FUNC/outa.casl:11: LAD GR4,1 ; GR1が負数の場合、GR4をオン
292 ../../../../as/FUNC/outa.casl:12: CALL OABS ; GR1を正数に変換
295 ../../../../as/FUNC/outa.casl:13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出
297 ../../../../as/FUNC/outa.casl:14: JMI STLST ; ↓
300 ../../../../as/FUNC/outa.casl:15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納
303 ../../../../as/FUNC/outa.casl:16: LD GR1,GR3 ; GR1にGR3をコピー
305 ../../../../as/FUNC/outa.casl:17: LD GR1,NCHAR,GR1 ; GR1を文字に変換
308 ../../../../as/FUNC/outa.casl:18: CALL STSTR ; GR1をSTR領域に格納
311 ../../../../as/FUNC/outa.casl:19: LD GR1,GR0 ; GR0をGR1にコピー
313 ../../../../as/FUNC/outa.casl:20: JUMP STI ; ループ終端
316 ../../../../as/FUNC/outa.casl:21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換
319 ../../../../as/FUNC/outa.casl:22: CALL STSTR ; GR1をSTR領域に格納
322 ../../../../as/FUNC/outa.casl:23: AND GR4,GR4 ; 正数の場合
324 ../../../../as/FUNC/outa.casl:24: JZE PRT ; ↓
327 ../../../../as/FUNC/outa.casl:25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納
331 ../../../../as/FUNC/outa.casl:26: CALL STSTR ; ↓
334 ../../../../as/FUNC/outa.casl:27: JUMP PRT ; PRTにジャンプ
337 ../../../../as/FUNC/outa.casl:28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納
340 ../../../../as/FUNC/outa.casl:29: CALL STSTR ; ↓
343 ../../../../as/FUNC/outa.casl:30:PRT LD GR2,LEN ; GR2にLENの値を格納
346 ../../../../as/FUNC/outa.casl:31: LAD GR1,STR ; GR1に文字列のアドレスを格納
349 ../../../../as/FUNC/outa.casl:32: CALL REV ; 文字列を逆順に並べ替え
352 ../../../../as/FUNC/outa.casl:33: OUT STR,LEN ; 文字列を出力
372 ../../../../as/FUNC/outa.casl:34: RPOP
380 ../../../../as/FUNC/outa.casl:35: RET
382 ../../../../as/FUNC/outa.casl:36:STR DS 17
400 ../../../../as/FUNC/outa.casl:37:LEN DS 1
402 ../../../../as/FUNC/outa.casl:38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
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
445 ../../../../as/FUNC/outa.casl:43: PUSH 0,GR2
448 ../../../../as/FUNC/outa.casl:44: LD GR2,LEN ; GR2にLENの値をロード
451 ../../../../as/FUNC/outa.casl:45: ST GR1,STR,GR2 ; STR+GR2 <- GR1
454 ../../../../as/FUNC/outa.casl:46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1
457 ../../../../as/FUNC/outa.casl:47: ST GR2,LEN ; LENにGR2を格納
460 ../../../../as/FUNC/outa.casl:48: POP GR2
462 ../../../../as/FUNC/outa.casl:49: POP GR1
464 ../../../../as/FUNC/outa.casl:50: RET
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
473 ../../../../as/FUNC/outa.casl:56: PUSH 0,GR2
476 ../../../../as/FUNC/outa.casl:57: PUSH 0,GR4
479 ../../../../as/FUNC/outa.casl:58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ
481 ../../../../as/FUNC/outa.casl:59: JZE ODFIN ; ↓
484 ../../../../as/FUNC/outa.casl:60: ST GR2,ODY ; ODYにGR2の初期値を保存
487 ../../../../as/FUNC/outa.casl:61: LAD GR0,0 ; GR0の初期化
490 ../../../../as/FUNC/outa.casl:62: LAD GR3,0 ; GR3の初期化
493 ../../../../as/FUNC/outa.casl:63: LAD GR4,1 ; GR4の初期化。対象ビットを表す
496 ../../../../as/FUNC/outa.casl:64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出
498 ../../../../as/FUNC/outa.casl:65: JPL ODLOOP ; ↓
501 ../../../../as/FUNC/outa.casl:66: SLL GR4,1 ; GR4を1回左シフト
504 ../../../../as/FUNC/outa.casl:67: SLL GR2,1 ; GR2を1回左シフト
507 ../../../../as/FUNC/outa.casl:68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ
510 ../../../../as/FUNC/outa.casl:69: JUMP ODSL ; ループ終端
513 ../../../../as/FUNC/outa.casl:70:ODYOV SRL GR2,1
516 ../../../../as/FUNC/outa.casl:71: LAD GR2,#8000,GR2
519 ../../../../as/FUNC/outa.casl:72: SRL GR4,1
522 ../../../../as/FUNC/outa.casl:73: JUMP ODLPIN
525 ../../../../as/FUNC/outa.casl:74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト
528 ../../../../as/FUNC/outa.casl:75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出
531 ../../../../as/FUNC/outa.casl:76: SRL GR2,1 ; GR2を1回右シフト
534 ../../../../as/FUNC/outa.casl:77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出
537 ../../../../as/FUNC/outa.casl:78: JMI ODFIN ; ↓
540 ../../../../as/FUNC/outa.casl:79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ
542 ../../../../as/FUNC/outa.casl:80: JMI ODLOOP ; ↓
545 ../../../../as/FUNC/outa.casl:81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2
547 ../../../../as/FUNC/outa.casl:82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4
549 ../../../../as/FUNC/outa.casl:83: JUMP ODLOOP ; ループ終端
552 ../../../../as/FUNC/outa.casl:84:ODFIN LD GR3,GR1
554 ../../../../as/FUNC/outa.casl:85: POP GR4
556 ../../../../as/FUNC/outa.casl:86: POP GR2
558 ../../../../as/FUNC/outa.casl:87: POP GR1
560 ../../../../as/FUNC/outa.casl:88: RET
562 ../../../../as/FUNC/outa.casl:89:ODY DS 1
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
583 ../../../../as/FUNC/outa.casl:95: LAD GR3,0 ; GR3の初期化
586 ../../../../as/FUNC/outa.casl:96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
588 ../../../../as/FUNC/outa.casl:97: JZE RNEXT ; ↓
591 ../../../../as/FUNC/outa.casl:98: LD GR4,GR1 ; GR4にGR1の値をコピー
593 ../../../../as/FUNC/outa.casl:99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3
595 ../../../../as/FUNC/outa.casl:100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納
598 ../../../../as/FUNC/outa.casl:101: PUSH 0,GR5 ; GR5をプッシュ
601 ../../../../as/FUNC/outa.casl:102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1
604 ../../../../as/FUNC/outa.casl:103: JUMP RPU ; ループ終端
607 ../../../../as/FUNC/outa.casl:104:RNEXT LAD GR3,0 ; GR3の初期化
610 ../../../../as/FUNC/outa.casl:105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
612 ../../../../as/FUNC/outa.casl:106: JZE RFIN ; ↓
615 ../../../../as/FUNC/outa.casl:107: POP GR5 ; GR5にポップ
617 ../../../../as/FUNC/outa.casl:108: LD GR4,GR1 ; GR4にGR1の値をコピー
619 ../../../../as/FUNC/outa.casl:109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3
621 ../../../../as/FUNC/outa.casl:110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納
624 ../../../../as/FUNC/outa.casl:111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1
627 ../../../../as/FUNC/outa.casl:112: JUMP RPO ; ループ終端
630 ../../../../as/FUNC/outa.casl:113:RFIN RPOP
638 ../../../../as/FUNC/outa.casl:114: RET
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の値を反転
648 ../../../../as/FUNC/outa.casl:120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1
651 ../../../../as/FUNC/outa.casl:121: RET
653 ../../../../as/FUNC/outa.casl:122: END