1 ../../../../casl2 -sla ../../../../as/FUNC/count1_call.casl ../../../../as/FUNC/count1.casl ../../../../as/FUNC/outa.casl
3 Assemble ../../../../as/FUNC/count1_call.casl (0)
4 ../../../../as/FUNC/count1_call.casl:1:;; count1.casl(「アセンブラ言語の仕様」プログラム例)を呼び出し、出力結果を表示
5 ../../../../as/FUNC/count1_call.casl:2:;; 使い方: casl2 count1_call.casl count1.casl outa.casl
6 ../../../../as/FUNC/count1_call.casl:3:MAIN START
7 ../../../../as/FUNC/count1_call.casl:4: LAD GR2,0
8 ../../../../as/FUNC/count1_call.casl:5:LOOP CPA GR2,MAX ; ループ開始。GR2がMAXの値になったらループ脱出
9 ../../../../as/FUNC/count1_call.casl:6: JZE FIN ; ↓
10 ../../../../as/FUNC/count1_call.casl:7: LD GR1,GR2 ; GR1にVALの値をロード
11 ../../../../as/FUNC/count1_call.casl:8: CALL COUNT1 ; COUNT1を呼び出す。出力はGR0に格納
12 ../../../../as/FUNC/count1_call.casl:9: LD GR1,GR0 ; GR1にGR0の値をコピー
13 ../../../../as/FUNC/count1_call.casl:10: CALL OUTA ; OUTAを呼び出す
14 ../../../../as/FUNC/count1_call.casl:11: LAD GR2,1,GR2 ; GR2 <= GR2 + 1
15 ../../../../as/FUNC/count1_call.casl:12: JUMP LOOP ; ループ終端
16 ../../../../as/FUNC/count1_call.casl:13:FIN RET
17 ../../../../as/FUNC/count1_call.casl:14:MAX DC 256
18 ../../../../as/FUNC/count1_call.casl:15: END
20 Assemble ../../../../as/FUNC/count1.casl (0)
21 ../../../../as/FUNC/count1.casl:1:COUNT1 START
22 ../../../../as/FUNC/count1.casl:2:; 入力 GR1:検索する語
23 ../../../../as/FUNC/count1.casl:3:; 処理 GR1中の'1'のビットの個数を求める
24 ../../../../as/FUNC/count1.casl:4:; 出力 GR0:GR1中の'1'のビットの個数
25 ../../../../as/FUNC/count1.casl:5: PUSH 0,GR1
26 ../../../../as/FUNC/count1.casl:6: PUSH 0,GR2
27 ../../../../as/FUNC/count1.casl:7: SUBA GR2,GR2
28 ../../../../as/FUNC/count1.casl:8: AND GR1,GR1
29 ../../../../as/FUNC/count1.casl:9: JZE RETURN
30 ../../../../as/FUNC/count1.casl:10:MORE LAD GR2,1,GR2
31 ../../../../as/FUNC/count1.casl:11: LAD GR0,-1,GR1
32 ../../../../as/FUNC/count1.casl:12: AND GR1,GR0
33 ../../../../as/FUNC/count1.casl:13: JNZ MORE
34 ../../../../as/FUNC/count1.casl:14:RETURN LD GR0,GR2
35 ../../../../as/FUNC/count1.casl:15: POP GR2
36 ../../../../as/FUNC/count1.casl:16: POP GR1
37 ../../../../as/FUNC/count1.casl:17: RET
38 ../../../../as/FUNC/count1.casl:18: END
40 Assemble ../../../../as/FUNC/outa.casl (0)
41 ../../../../as/FUNC/outa.casl:1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示
42 ../../../../as/FUNC/outa.casl:2:OUTA START
43 ../../../../as/FUNC/outa.casl:3: RPUSH
44 ../../../../as/FUNC/outa.casl:4: LAD GR2,10 ; GR2に10進数の「10」を格納。
45 ../../../../as/FUNC/outa.casl:5: LAD GR0,0 ; GR0 <- 0
46 ../../../../as/FUNC/outa.casl:6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1
47 ../../../../as/FUNC/outa.casl:7: ST GR0,LEN ; LENの初期化
48 ../../../../as/FUNC/outa.casl:8: AND GR1,GR1 ; GR1をテスト
49 ../../../../as/FUNC/outa.casl:9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ
50 ../../../../as/FUNC/outa.casl:10: JPL STI ; GR1が正数の場合、STIにジャンプ
51 ../../../../as/FUNC/outa.casl:11: LAD GR4,1 ; GR1が負数の場合、GR4をオン
52 ../../../../as/FUNC/outa.casl:12: CALL OABS ; GR1を正数に変換
53 ../../../../as/FUNC/outa.casl:13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出
54 ../../../../as/FUNC/outa.casl:14: JMI STLST ; ↓
55 ../../../../as/FUNC/outa.casl:15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納
56 ../../../../as/FUNC/outa.casl:16: LD GR1,GR3 ; GR1にGR3をコピー
57 ../../../../as/FUNC/outa.casl:17: LD GR1,NCHAR,GR1 ; GR1を文字に変換
58 ../../../../as/FUNC/outa.casl:18: CALL STSTR ; GR1をSTR領域に格納
59 ../../../../as/FUNC/outa.casl:19: LD GR1,GR0 ; GR0をGR1にコピー
60 ../../../../as/FUNC/outa.casl:20: JUMP STI ; ループ終端
61 ../../../../as/FUNC/outa.casl:21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換
62 ../../../../as/FUNC/outa.casl:22: CALL STSTR ; GR1をSTR領域に格納
63 ../../../../as/FUNC/outa.casl:23: AND GR4,GR4 ; 正数の場合
64 ../../../../as/FUNC/outa.casl:24: JZE PRT ; ↓
65 ../../../../as/FUNC/outa.casl:25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納
66 ../../../../as/FUNC/outa.casl:26: CALL STSTR ; ↓
67 ../../../../as/FUNC/outa.casl:27: JUMP PRT ; PRTにジャンプ
68 ../../../../as/FUNC/outa.casl:28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納
69 ../../../../as/FUNC/outa.casl:29: CALL STSTR ; ↓
70 ../../../../as/FUNC/outa.casl:30:PRT LD GR2,LEN ; GR2にLENの値を格納
71 ../../../../as/FUNC/outa.casl:31: LAD GR1,STR ; GR1に文字列のアドレスを格納
72 ../../../../as/FUNC/outa.casl:32: CALL REV ; 文字列を逆順に並べ替え
73 ../../../../as/FUNC/outa.casl:33: OUT STR,LEN ; 文字列を出力
74 ../../../../as/FUNC/outa.casl:34: RPOP
75 ../../../../as/FUNC/outa.casl:35: RET
76 ../../../../as/FUNC/outa.casl:36:STR DS 17
77 ../../../../as/FUNC/outa.casl:37:LEN DS 1
78 ../../../../as/FUNC/outa.casl:38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
79 ../../../../as/FUNC/outa.casl:39: END
80 ../../../../as/FUNC/outa.casl:40:;; GR1をSTR領域に格納し、LENをインクリメント
81 ../../../../as/FUNC/outa.casl:41:STSTR START
82 ../../../../as/FUNC/outa.casl:42: PUSH 0,GR1
83 ../../../../as/FUNC/outa.casl:43: PUSH 0,GR2
84 ../../../../as/FUNC/outa.casl:44: LD GR2,LEN ; GR2にLENの値をロード
85 ../../../../as/FUNC/outa.casl:45: ST GR1,STR,GR2 ; STR+GR2 <- GR1
86 ../../../../as/FUNC/outa.casl:46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1
87 ../../../../as/FUNC/outa.casl:47: ST GR2,LEN ; LENにGR2を格納
88 ../../../../as/FUNC/outa.casl:48: POP GR2
89 ../../../../as/FUNC/outa.casl:49: POP GR1
90 ../../../../as/FUNC/outa.casl:50: RET
91 ../../../../as/FUNC/outa.casl:51: END
92 ../../../../as/FUNC/outa.casl:52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する
93 ../../../../as/FUNC/outa.casl:53:;;; 0〜65535の範囲の数値を扱う
94 ../../../../as/FUNC/outa.casl:54:ODIVL START
95 ../../../../as/FUNC/outa.casl:55: PUSH 0,GR1
96 ../../../../as/FUNC/outa.casl:56: PUSH 0,GR2
97 ../../../../as/FUNC/outa.casl:57: PUSH 0,GR4
98 ../../../../as/FUNC/outa.casl:58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ
99 ../../../../as/FUNC/outa.casl:59: JZE ODFIN ; ↓
100 ../../../../as/FUNC/outa.casl:60: ST GR2,ODY ; ODYにGR2の初期値を保存
101 ../../../../as/FUNC/outa.casl:61: LAD GR0,0 ; GR0の初期化
102 ../../../../as/FUNC/outa.casl:62: LAD GR3,0 ; GR3の初期化
103 ../../../../as/FUNC/outa.casl:63: LAD GR4,1 ; GR4の初期化。対象ビットを表す
104 ../../../../as/FUNC/outa.casl:64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出
105 ../../../../as/FUNC/outa.casl:65: JPL ODLOOP ; ↓
106 ../../../../as/FUNC/outa.casl:66: SLL GR4,1 ; GR4を1回左シフト
107 ../../../../as/FUNC/outa.casl:67: SLL GR2,1 ; GR2を1回左シフト
108 ../../../../as/FUNC/outa.casl:68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ
109 ../../../../as/FUNC/outa.casl:69: JUMP ODSL ; ループ終端
110 ../../../../as/FUNC/outa.casl:70:ODYOV SRL GR2,1
111 ../../../../as/FUNC/outa.casl:71: LAD GR2,#8000,GR2
112 ../../../../as/FUNC/outa.casl:72: SRL GR4,1
113 ../../../../as/FUNC/outa.casl:73: JUMP ODLPIN
114 ../../../../as/FUNC/outa.casl:74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト
115 ../../../../as/FUNC/outa.casl:75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出
116 ../../../../as/FUNC/outa.casl:76: SRL GR2,1 ; GR2を1回右シフト
117 ../../../../as/FUNC/outa.casl:77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出
118 ../../../../as/FUNC/outa.casl:78: JMI ODFIN ; ↓
119 ../../../../as/FUNC/outa.casl:79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ
120 ../../../../as/FUNC/outa.casl:80: JMI ODLOOP ; ↓
121 ../../../../as/FUNC/outa.casl:81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2
122 ../../../../as/FUNC/outa.casl:82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4
123 ../../../../as/FUNC/outa.casl:83: JUMP ODLOOP ; ループ終端
124 ../../../../as/FUNC/outa.casl:84:ODFIN LD GR3,GR1
125 ../../../../as/FUNC/outa.casl:85: POP GR4
126 ../../../../as/FUNC/outa.casl:86: POP GR2
127 ../../../../as/FUNC/outa.casl:87: POP GR1
128 ../../../../as/FUNC/outa.casl:88: RET
129 ../../../../as/FUNC/outa.casl:89:ODY DS 1
130 ../../../../as/FUNC/outa.casl:90: END
131 ../../../../as/FUNC/outa.casl:91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える
132 ../../../../as/FUNC/outa.casl:92:;; 例: 12345 -> 54321、54321- -> -12345
133 ../../../../as/FUNC/outa.casl:93:REV START
134 ../../../../as/FUNC/outa.casl:94: RPUSH
135 ../../../../as/FUNC/outa.casl:95: LAD GR3,0 ; GR3の初期化
136 ../../../../as/FUNC/outa.casl:96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
137 ../../../../as/FUNC/outa.casl:97: JZE RNEXT ; ↓
138 ../../../../as/FUNC/outa.casl:98: LD GR4,GR1 ; GR4にGR1の値をコピー
139 ../../../../as/FUNC/outa.casl:99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3
140 ../../../../as/FUNC/outa.casl:100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納
141 ../../../../as/FUNC/outa.casl:101: PUSH 0,GR5 ; GR5をプッシュ
142 ../../../../as/FUNC/outa.casl:102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1
143 ../../../../as/FUNC/outa.casl:103: JUMP RPU ; ループ終端
144 ../../../../as/FUNC/outa.casl:104:RNEXT LAD GR3,0 ; GR3の初期化
145 ../../../../as/FUNC/outa.casl:105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
146 ../../../../as/FUNC/outa.casl:106: JZE RFIN ; ↓
147 ../../../../as/FUNC/outa.casl:107: POP GR5 ; GR5にポップ
148 ../../../../as/FUNC/outa.casl:108: LD GR4,GR1 ; GR4にGR1の値をコピー
149 ../../../../as/FUNC/outa.casl:109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3
150 ../../../../as/FUNC/outa.casl:110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納
151 ../../../../as/FUNC/outa.casl:111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1
152 ../../../../as/FUNC/outa.casl:112: JUMP RPO ; ループ終端
153 ../../../../as/FUNC/outa.casl:113:RFIN RPOP
154 ../../../../as/FUNC/outa.casl:114: RET
155 ../../../../as/FUNC/outa.casl:115: END
156 ../../../../as/FUNC/outa.casl:116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。
157 ../../../../as/FUNC/outa.casl:117:;; 例: -10 -> 10, -20 -> 20
158 ../../../../as/FUNC/outa.casl:118:OABS START
159 ../../../../as/FUNC/outa.casl:119: XOR GR1,=#FFFF ; GR1の値を反転
160 ../../../../as/FUNC/outa.casl:120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1
161 ../../../../as/FUNC/outa.casl:121: RET
162 ../../../../as/FUNC/outa.casl:122: END
166 ODIVL.ODYOV ---> #00E3
171 COUNT1.RETURN ---> #0021
174 COUNT1.MORE ---> #001A
179 OUTA.NCHAR ---> #0094
181 OUTA.STLST ---> #0051
188 ODIVL.ODSL ---> #00D8
190 ODIVL.ODFIN ---> #00FC
192 ODIVL.ODLOOP ---> #00EB
193 ODIVL.ODLPIN ---> #00F8
195 Assemble ../../../../as/FUNC/count1_call.casl (1)
196 ../../../../as/FUNC/count1_call.casl:1:;; count1.casl(「アセンブラ言語の仕様」プログラム例)を呼び出し、出力結果を表示
197 ../../../../as/FUNC/count1_call.casl:2:;; 使い方: casl2 count1_call.casl count1.casl outa.casl
198 ../../../../as/FUNC/count1_call.casl:3:MAIN START
199 ../../../../as/FUNC/count1_call.casl:4: LAD GR2,0
202 ../../../../as/FUNC/count1_call.casl:5:LOOP CPA GR2,MAX ; ループ開始。GR2がMAXの値になったらループ脱出
205 ../../../../as/FUNC/count1_call.casl:6: JZE FIN ; ↓
208 ../../../../as/FUNC/count1_call.casl:7: LD GR1,GR2 ; GR1にVALの値をロード
210 ../../../../as/FUNC/count1_call.casl:8: CALL COUNT1 ; COUNT1を呼び出す。出力はGR0に格納
213 ../../../../as/FUNC/count1_call.casl:9: LD GR1,GR0 ; GR1にGR0の値をコピー
215 ../../../../as/FUNC/count1_call.casl:10: CALL OUTA ; OUTAを呼び出す
218 ../../../../as/FUNC/count1_call.casl:11: LAD GR2,1,GR2 ; GR2 <= GR2 + 1
221 ../../../../as/FUNC/count1_call.casl:12: JUMP LOOP ; ループ終端
224 ../../../../as/FUNC/count1_call.casl:13:FIN RET
226 ../../../../as/FUNC/count1_call.casl:14:MAX DC 256
228 ../../../../as/FUNC/count1_call.casl:15: END
230 Assemble ../../../../as/FUNC/count1.casl (1)
231 ../../../../as/FUNC/count1.casl:1:COUNT1 START
232 ../../../../as/FUNC/count1.casl:2:; 入力 GR1:検索する語
233 ../../../../as/FUNC/count1.casl:3:; 処理 GR1中の'1'のビットの個数を求める
234 ../../../../as/FUNC/count1.casl:4:; 出力 GR0:GR1中の'1'のビットの個数
235 ../../../../as/FUNC/count1.casl:5: PUSH 0,GR1
238 ../../../../as/FUNC/count1.casl:6: PUSH 0,GR2
241 ../../../../as/FUNC/count1.casl:7: SUBA GR2,GR2
243 ../../../../as/FUNC/count1.casl:8: AND GR1,GR1
245 ../../../../as/FUNC/count1.casl:9: JZE RETURN
248 ../../../../as/FUNC/count1.casl:10:MORE LAD GR2,1,GR2
251 ../../../../as/FUNC/count1.casl:11: LAD GR0,-1,GR1
254 ../../../../as/FUNC/count1.casl:12: AND GR1,GR0
256 ../../../../as/FUNC/count1.casl:13: JNZ MORE
259 ../../../../as/FUNC/count1.casl:14:RETURN LD GR0,GR2
261 ../../../../as/FUNC/count1.casl:15: POP GR2
263 ../../../../as/FUNC/count1.casl:16: POP GR1
265 ../../../../as/FUNC/count1.casl:17: RET
267 ../../../../as/FUNC/count1.casl:18: END
269 Assemble ../../../../as/FUNC/outa.casl (1)
270 ../../../../as/FUNC/outa.casl:1:;;; GR1に格納された値を、10進数の整数値(-32768〜32767)として表示
271 ../../../../as/FUNC/outa.casl:2:OUTA START
272 ../../../../as/FUNC/outa.casl:3: RPUSH
287 ../../../../as/FUNC/outa.casl:4: LAD GR2,10 ; GR2に10進数の「10」を格納。
290 ../../../../as/FUNC/outa.casl:5: LAD GR0,0 ; GR0 <- 0
293 ../../../../as/FUNC/outa.casl:6: LAD GR4,0 ; 負数フラグ。GR1が負数の場合、GR4は1
296 ../../../../as/FUNC/outa.casl:7: ST GR0,LEN ; LENの初期化
299 ../../../../as/FUNC/outa.casl:8: AND GR1,GR1 ; GR1をテスト
301 ../../../../as/FUNC/outa.casl:9: JZE ZPRT ; GR1が0の場合、ZPRTにジャンプ
304 ../../../../as/FUNC/outa.casl:10: JPL STI ; GR1が正数の場合、STIにジャンプ
307 ../../../../as/FUNC/outa.casl:11: LAD GR4,1 ; GR1が負数の場合、GR4をオン
310 ../../../../as/FUNC/outa.casl:12: CALL OABS ; GR1を正数に変換
313 ../../../../as/FUNC/outa.casl:13:STI CPL GR1,GR2 ; ループ先頭。(GR1 < GR2)の場合は、ループ脱出
315 ../../../../as/FUNC/outa.casl:14: JMI STLST ; ↓
318 ../../../../as/FUNC/outa.casl:15: CALL ODIVL ; GR1とGR2の、商をGR0、剰余をGR3に格納
321 ../../../../as/FUNC/outa.casl:16: LD GR1,GR3 ; GR1にGR3をコピー
323 ../../../../as/FUNC/outa.casl:17: LD GR1,NCHAR,GR1 ; GR1を文字に変換
326 ../../../../as/FUNC/outa.casl:18: CALL STSTR ; GR1をSTR領域に格納
329 ../../../../as/FUNC/outa.casl:19: LD GR1,GR0 ; GR0をGR1にコピー
331 ../../../../as/FUNC/outa.casl:20: JUMP STI ; ループ終端
334 ../../../../as/FUNC/outa.casl:21:STLST LD GR1,NCHAR,GR1 ; GR1を文字に変換
337 ../../../../as/FUNC/outa.casl:22: CALL STSTR ; GR1をSTR領域に格納
340 ../../../../as/FUNC/outa.casl:23: AND GR4,GR4 ; 正数の場合
342 ../../../../as/FUNC/outa.casl:24: JZE PRT ; ↓
345 ../../../../as/FUNC/outa.casl:25: LD GR1,='-' ; 負数の場合、「-」をSTR領域に格納
349 ../../../../as/FUNC/outa.casl:26: CALL STSTR ; ↓
352 ../../../../as/FUNC/outa.casl:27: JUMP PRT ; PRTにジャンプ
355 ../../../../as/FUNC/outa.casl:28:ZPRT LD GR1,NCHAR ; 「0」をSTR領域に格納
358 ../../../../as/FUNC/outa.casl:29: CALL STSTR ; ↓
361 ../../../../as/FUNC/outa.casl:30:PRT LD GR2,LEN ; GR2にLENの値を格納
364 ../../../../as/FUNC/outa.casl:31: LAD GR1,STR ; GR1に文字列のアドレスを格納
367 ../../../../as/FUNC/outa.casl:32: CALL REV ; 文字列を逆順に並べ替え
370 ../../../../as/FUNC/outa.casl:33: OUT STR,LEN ; 文字列を出力
390 ../../../../as/FUNC/outa.casl:34: RPOP
398 ../../../../as/FUNC/outa.casl:35: RET
400 ../../../../as/FUNC/outa.casl:36:STR DS 17
418 ../../../../as/FUNC/outa.casl:37:LEN DS 1
420 ../../../../as/FUNC/outa.casl:38:NCHAR DC '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ'
457 ../../../../as/FUNC/outa.casl:39: END
458 ../../../../as/FUNC/outa.casl:40:;; GR1をSTR領域に格納し、LENをインクリメント
459 ../../../../as/FUNC/outa.casl:41:STSTR START
460 ../../../../as/FUNC/outa.casl:42: PUSH 0,GR1
463 ../../../../as/FUNC/outa.casl:43: PUSH 0,GR2
466 ../../../../as/FUNC/outa.casl:44: LD GR2,LEN ; GR2にLENの値をロード
469 ../../../../as/FUNC/outa.casl:45: ST GR1,STR,GR2 ; STR+GR2 <- GR1
472 ../../../../as/FUNC/outa.casl:46: LAD GR2,1,GR2 ; GR2 <- GR2 + 1
475 ../../../../as/FUNC/outa.casl:47: ST GR2,LEN ; LENにGR2を格納
478 ../../../../as/FUNC/outa.casl:48: POP GR2
480 ../../../../as/FUNC/outa.casl:49: POP GR1
482 ../../../../as/FUNC/outa.casl:50: RET
484 ../../../../as/FUNC/outa.casl:51: END
485 ../../../../as/FUNC/outa.casl:52:;;; GR1の値とGR2の値の、商をGR0、剰余をGR3に格納する
486 ../../../../as/FUNC/outa.casl:53:;;; 0〜65535の範囲の数値を扱う
487 ../../../../as/FUNC/outa.casl:54:ODIVL START
488 ../../../../as/FUNC/outa.casl:55: PUSH 0,GR1
491 ../../../../as/FUNC/outa.casl:56: PUSH 0,GR2
494 ../../../../as/FUNC/outa.casl:57: PUSH 0,GR4
497 ../../../../as/FUNC/outa.casl:58: AND GR2,GR2 ; GR2が0の場合、ODFINへジャンプ
499 ../../../../as/FUNC/outa.casl:59: JZE ODFIN ; ↓
502 ../../../../as/FUNC/outa.casl:60: ST GR2,ODY ; ODYにGR2の初期値を保存
505 ../../../../as/FUNC/outa.casl:61: LAD GR0,0 ; GR0の初期化
508 ../../../../as/FUNC/outa.casl:62: LAD GR3,0 ; GR3の初期化
511 ../../../../as/FUNC/outa.casl:63: LAD GR4,1 ; GR4の初期化。対象ビットを表す
514 ../../../../as/FUNC/outa.casl:64:ODSL CPL GR2,GR1 ; ループ先頭。(GR2 > GR1)の場合、ODLOOPへループ脱出
516 ../../../../as/FUNC/outa.casl:65: JPL ODLOOP ; ↓
519 ../../../../as/FUNC/outa.casl:66: SLL GR4,1 ; GR4を1回左シフト
522 ../../../../as/FUNC/outa.casl:67: SLL GR2,1 ; GR2を1回左シフト
525 ../../../../as/FUNC/outa.casl:68: JOV ODYOV ; オーバーフローの場合は、ODYOVにジャンプ
528 ../../../../as/FUNC/outa.casl:69: JUMP ODSL ; ループ終端
531 ../../../../as/FUNC/outa.casl:70:ODYOV SRL GR2,1
534 ../../../../as/FUNC/outa.casl:71: LAD GR2,#8000,GR2
537 ../../../../as/FUNC/outa.casl:72: SRL GR4,1
540 ../../../../as/FUNC/outa.casl:73: JUMP ODLPIN
543 ../../../../as/FUNC/outa.casl:74:ODLOOP SRL GR4,1 ; ループ先頭。GR4を1回右シフト
546 ../../../../as/FUNC/outa.casl:75: JZE ODFIN ; (GR4 = 0)の場合、ループ脱出
549 ../../../../as/FUNC/outa.casl:76: SRL GR2,1 ; GR2を1回右シフト
552 ../../../../as/FUNC/outa.casl:77: CPL GR1,ODY ; (GR1 < ODY)の場合、ループ脱出
555 ../../../../as/FUNC/outa.casl:78: JMI ODFIN ; ↓
558 ../../../../as/FUNC/outa.casl:79: CPL GR1,GR2 ; (GR1 < GR2)の場合、ループ先頭へジャンプ
560 ../../../../as/FUNC/outa.casl:80: JMI ODLOOP ; ↓
563 ../../../../as/FUNC/outa.casl:81:ODLPIN SUBL GR1,GR2 ; GR1 <- GR1 - GR2
565 ../../../../as/FUNC/outa.casl:82: ADDL GR0,GR4 ; GR0 <- GR0 + GR4
567 ../../../../as/FUNC/outa.casl:83: JUMP ODLOOP ; ループ終端
570 ../../../../as/FUNC/outa.casl:84:ODFIN LD GR3,GR1
572 ../../../../as/FUNC/outa.casl:85: POP GR4
574 ../../../../as/FUNC/outa.casl:86: POP GR2
576 ../../../../as/FUNC/outa.casl:87: POP GR1
578 ../../../../as/FUNC/outa.casl:88: RET
580 ../../../../as/FUNC/outa.casl:89:ODY DS 1
582 ../../../../as/FUNC/outa.casl:90: END
583 ../../../../as/FUNC/outa.casl:91:;; アドレスがGR1、長さがGR2の文字列を逆順に並べ替える
584 ../../../../as/FUNC/outa.casl:92:;; 例: 12345 -> 54321、54321- -> -12345
585 ../../../../as/FUNC/outa.casl:93:REV START
586 ../../../../as/FUNC/outa.casl:94: RPUSH
601 ../../../../as/FUNC/outa.casl:95: LAD GR3,0 ; GR3の初期化
604 ../../../../as/FUNC/outa.casl:96:RPU CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
606 ../../../../as/FUNC/outa.casl:97: JZE RNEXT ; ↓
609 ../../../../as/FUNC/outa.casl:98: LD GR4,GR1 ; GR4にGR1の値をコピー
611 ../../../../as/FUNC/outa.casl:99: ADDL GR4,GR3 ; GR4 <- GR4 + GR3
613 ../../../../as/FUNC/outa.casl:100: LD GR5,0,GR4 ; GR5にアドレスGR4の値を格納
616 ../../../../as/FUNC/outa.casl:101: PUSH 0,GR5 ; GR5をプッシュ
619 ../../../../as/FUNC/outa.casl:102: LAD GR3,1,GR3 ; GR3 <- GR3 + 1
622 ../../../../as/FUNC/outa.casl:103: JUMP RPU ; ループ終端
625 ../../../../as/FUNC/outa.casl:104:RNEXT LAD GR3,0 ; GR3の初期化
628 ../../../../as/FUNC/outa.casl:105:RPO CPL GR3,GR2 ; ループ先頭。(GR3 = GR2)の場合、ループ脱出
630 ../../../../as/FUNC/outa.casl:106: JZE RFIN ; ↓
633 ../../../../as/FUNC/outa.casl:107: POP GR5 ; GR5にポップ
635 ../../../../as/FUNC/outa.casl:108: LD GR4,GR1 ; GR4にGR1の値をコピー
637 ../../../../as/FUNC/outa.casl:109: ADDL GR4,GR3 ; GR4 <- GR4 + GR3
639 ../../../../as/FUNC/outa.casl:110: ST GR5,0,GR4 ; アドレスGR4にGR5の値を格納
642 ../../../../as/FUNC/outa.casl:111: LAD GR3,1,GR3 ; GR3 <- GR3 + 1
645 ../../../../as/FUNC/outa.casl:112: JUMP RPO ; ループ終端
648 ../../../../as/FUNC/outa.casl:113:RFIN RPOP
656 ../../../../as/FUNC/outa.casl:114: RET
658 ../../../../as/FUNC/outa.casl:115: END
659 ../../../../as/FUNC/outa.casl:116:;; GR1の値を絶対値に変換する。GR1にはマイナスの数値が格納されていると想定。
660 ../../../../as/FUNC/outa.casl:117:;; 例: -10 -> 10, -20 -> 20
661 ../../../../as/FUNC/outa.casl:118:OABS START
662 ../../../../as/FUNC/outa.casl:119: XOR GR1,=#FFFF ; GR1の値を反転
666 ../../../../as/FUNC/outa.casl:120: LAD GR1,1,GR1 ; GR1 <- GR1 + 1
669 ../../../../as/FUNC/outa.casl:121: RET
671 ../../../../as/FUNC/outa.casl:122: END