+
+@subsection プログラム終了時の値を表示
+
+@command{grep}と@command{tail}を組み合わせれば、プログラム終了時の値を表示できます。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 -t addl.casl | grep 'GR1:' | tail -1}
+#0004: GR1: 4 = #0004 = 0000000000000100
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 -t sum_10.casl | grep 'GR0:' | tail -1}
+#0010: GR0: 55 = #0037 = 0000000000110111 = '7'
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@subsection プログラムのステップ数を表示
+
+@command{grep}と@command{wc}を組み合わせれば、プログラムのステップ数を表示できます。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 -t hello.casl | grep 'GR1:' | wc -l}
+11
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 -t addl.casl | grep 'GR1:' | wc -l}
+3
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@file{sum_10.casl}はプログラム内にループがあるため、ステップ数が大きくなります。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 -t sum_10.casl | grep 'GR0:' | wc -l}
+54
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@section アセンブルと実行を別に行う
+
+@command{casl2}に@option{-O}@file{ファイル名}を指定すると、オブジェクトファイルを作成できます。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 -Ohello.o hello.casl}
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+作成されたオブジェクトファイルの内容は、@command{od}を使って確認できます。テキストファイルではないため、@command{cat}などでは確認できません。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{od -t x2 hello.o}
+0000000 7001 0000 7002 0000 1210 0013 1220 0020
+0000020 f000 0002 1210 0021 1220 0022 f000 0002
+0000040 7120 7110 8100 0048 0065 006c 006c 006f
+0000060 002c 0020 0057 006f 0072 006c 0064 0021
+0000100 000d 000a 0001
+0000106
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+オブジェクトファイルの実行には、@command{comet2}を使います。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{comet2 hello.o}
+Hello, World!
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@section 1語の解析
+
+CASL IIでは、1語(16ビット)を単位としてデータが処理されます。
+@command{dumpword}は、指定した1語を10進数、16進数、2進数で表示します。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{dumpword 72}
+ 72: 72 = #0048 = 0000000001001000 = 'H'
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+マイナスの数は、次のように指定します。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{dumpword -- -72}
+ -72: -72 = #FFB8 = 1111111110111000
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+16進数は、次のように指定します。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{dumpword '#0048'}
+ #0048: 72 = #0048 = 0000000001001000 = 'H'
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@section CASL2ライブラリの使用
+
+YACASL2の@file{as/casl2lib}ディレクトリには、CASL IIで記述されたライブラリファイルが格納されています。
+
+このフォルダには、たとえば次のようなプログラムが含まれています。
+
+@table @option
+@item OUTL
+@file{outl.casl}。GR1に格納された値を、0〜65535の数値として出力します。
+
+@item OUTA
+@file{outa.casl}。GR1に格納された値を、-32767〜32767の数値として出力します。
+
+@item MULL
+@file{mull.casl}。GR1とGR2に格納された値を0〜65535の整数と見なし、積をGR3に格納します。
+
+@item DIVL
+@file{divl.casl}。GR1とGR2に格納された値を0〜65535の整数と見なし、商をGR3、剰余をGR0に格納します。
+@end table
+
+@subsection 数値を出力する
+
+3と1の和を求める@file{addl.casl}で演算結果を出力するには、まず@file{addl.casl}を編集します。CASL IIの@command{CALL}命令で@command{OUTL}を副プログラムとして呼び出すようにします。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{cat addl_outl.casl}
+MAIN START
+ LD GR1,A
+ ADDL GR1,B
+ @strong{CALL OUTL}
+ RET
+A DC 3
+B DC 1
+ END
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+変更したら@command{casl2}を、複数のファイルを指定して実行します。
+
+@iftex
+@cartouche
+@end iftex
+@example
+$ @command{casl2 addl_outl.casl ~/yacasl2/as/casl2lib/outl.casl}
+4
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@node YACASL2コマンドマニュアル,CASL2LIBマニュアル,YACASL2の使い方,TOP
+@chapter YACASL2コマンドマニュアル
+
+@cindex YACASL2コマンドマニュアル
+
+YACASL2のコマンドとオプションについて解説します。
+
+@menu
+* casl2::
+* comet2::
+* dumpword::
+@end menu
+
+@node casl2
+@section @command{casl2}
+
+@pindex casl2
+@cindex casl2
+
+@command{casl2}は、引数として指定されたCASLファイルをアセンブルし、仮想マシンCOMET II上で実行します。CASLファイルは、アセンブラ言語CASL IIで記述されたテキストファイルです。引数が指定されない場合は、エラーメッセージを表示して終了します。
+
+@example
+$ @command{casl2 hello.casl}
+@end example
+
+副プログラムを呼び出す場合は、複数のCASLファイルを指定することもできます。
+
+@example
+$ @command{casl2 addl_outl.casl ~/yacasl2/as/casl2lib/outl.casl}
+@end example
+
+@unnumberedsubsec オプション
+
+@command{casl2}は、次のオプションを指定できます。
+
+@table @option
+@item -s
+@itemx --source
+CASLファイルの内容を表示します。
+
+@item -l
+@itemx --label
+ラベルの一覧を表示し、ほかの作業を続行します。
+
+@item -L
+@itemx --labelonly
+ラベルの一覧を表示して終了します。
+
+@item -a
+@itemx --assembledetail
+アセンブル詳細結果を表示し、ほかの作業を続行します。
+
+@item -A
+@itemx --show-all
+アセンブル詳細結果を表示して終了します。
+
+@item -o<OBJECTFILE>
+@itemx --assembleout
+アセンブル結果をオブジェクトファイル@file{<OBJECTFILE>}に出力し、ほかの作業を続行します。出力されたオブジェクトファイルは、@command{comet2}で実行できます。オブジェクトファイルを指定しない場合、出力先は@file{a.o}です。オブジェクトファイルは1つだけ指定できます。
+
+@item -O<OBJECTFILE>
+@itemx --assembleoutonly
+アセンブル結果をオブジェクトファイル@file{<OBJECTFILE>}に出力し、終了します。出力されたオブジェクトファイルは、@command{comet2}で実行できます。オブジェクトファイルを指定しない場合、出力先は@file{a.o}です。オブジェクトファイルは1つだけ指定できます。
+
+@item -t
+@itemx --trace
+@itemx --tracearithmetic
+実行時のレジスタをトレースします。レジスタには、GR0〜GR7という8個の汎用レジスタと、SP(スタックポインタ)、PR(プログラムレジスタ)、FR(フラグレジスタ)があります。レジストリの内容は、-32,768〜32,767の範囲の整数、#0000〜#FFFFの範囲の16進数、2進数で表示されます。文字の組に該当する場合は、「 = 」のうしろに文字が表示されます。-32768〜32767の範囲の整数を表示するので、算術演算の結果を確認する場合に使えます。
+
+@item -T
+@itemx --tracelogical
+@option{-t}と同じく、実行時のレジスタをトレースします。@option{-t}と異なり0〜65,535の範囲の整数を表示するので、論理演算の結果を確認する場合に使えます。
+
+@item -d
+@itemx --dump
+メモリの内容をすべて表示します。
+
+@item -M <MEMORYSIZE>
+@itemx --memorysize <MEMORYSIZE>
+アセンブルおよび実行時のメモリサイズ@option{<MEMORYSIZE>}を0〜65,535の範囲で指定します。指定しない場合、メモリサイズは512です。
+
+@item -C <CLOCKS>
+@itemx --clocks <CLOCKS>
+実行時のクロック周波数@option{<CLOCKS>}を0より大きい整数で指定します。指定しない場合、クロック周波数は5000000です。
+
+@item -h
+@itemx --help
+@command{casl2}の使用方法を表示して終了します。
+@end table
+
+@node comet2
+@section @command{comet2}
+
+@pindex comet2
+@cindex comet2
+
+@command{comet2}は、引数として指定されたオブジェクトファイルを仮想マシンCOMET II上で実行します。オブジェクトファイルは、@command{casl}に@option{-o}または@option{-O}を指定して出力します。
+
+@example
+$ @command{comet2 hello.o}
+@end example
+
+引数で指定できるオブジェクトファイルは1つだけです。引数が指定されない場合は、エラーメッセージを表示して終了します。複数の引数を指定した場合、2番目以降の引数は無視されます。
+
+@unnumberedsubsec オプション
+
+@command{comet2}は、次のオプションを指定できます。
+
+@table @option
+
+@item -t
+@itemx --trace
+@itemx --tracearithmetic
+実行時のレジスタをトレースします。レジスタには、GR0〜GR7という8個の汎用レジスタと、SP(スタックポインタ)、PR(プログラムレジスタ)、FR(フラグレジスタ)があります。レジストリの内容は、-32,768〜32,767の範囲の整数、#0000〜#FFFFの範囲の16進数、2進数で表示されます。文字の組に該当する場合は、「 = 」のうしろに文字が表示されます。-32768〜32767の範囲の整数が表示されるので、算術演算の結果を確認する場合に使えます。
+
+@item -T
+@itemx --tracelogical
+@option{-t}と同じく、実行時のレジスタをトレースします。@option{-t}と異なり0〜65,535の範囲の整数を表示するので、論理演算の結果を確認する場合に使えます。
+
+@item -d
+@itemx --dump
+メモリの内容をすべて表示します。
+
+@item -M <MEMORYSIZE>
+@itemx --memorysize <MEMORYSIZE>
+実行時のメモリサイズ@option{<MEMORYSIZE>}を0〜65,535の範囲で指定します。指定しない場合、メモリサイズは512です。
+
+@item -C <CLOCKS>
+@itemx --clocks <CLOCKS>
+実行時のクロック周波数@option{<CLOCKS>}を0より大きい整数で指定します。指定しない場合、クロック周波数は5,000,000です。
+
+@item -h
+@itemx --help
+@command{comet2}の使用方法を表示して終了します。
+@end table
+
+@node dumpword
+@section @command{dumpword}
+
+@pindex dumpword
+@cindex dumpword
+
+@command{dumpword}は、引数として指定された数値を、整数、#0000〜#FFFFの範囲の16進数、2進数で表示します。文字の組に該当する場合は、「 = 」のうしろに文字が表示されます。引数は、10進数または先頭に「#」の付いた16進数で指定します。表示される整数は、オプションにより-32,768〜32,767または0〜65,535の範囲です。オプションなしの場合は、-32,768〜32,767です。
+
+@example
+$ @command{dumpword 10}
+@end example
+
+引数で指定できる1つだけです。引数が指定されない場合は、使い方を表示して終了します。複数の引数を指定した場合、2番目以降の引数は無視されます。
+
+@unnumberedsubsec オプション
+
+@command{dumpword}は、次のオプションを指定できます。
+
+@table @option
+
+@item -a
+@itemx --arithmetic
+出力される整数の範囲を-32,768〜32,767にします。オプションなしの場合と同じです。
+
+@item -l
+@itemx --logical
+出力される整数の範囲を0〜65,535にします。
+
+@item -h
+@itemx --help
+@command{dumpword}の使用方法を表示して終了します。
+@end table
+
+@node CASL2LIBマニュアル,,YACASL2コマンドマニュアル,TOP
+@chapter CASL2LIBマニュアル
+
+@menu
+* ABS::
+* ADDL32::
+* DIVA::
+* DIVL::
+* INL::
+* L2STR::
+* MAX::
+* MINIM::
+* MULA::
+* MULL::
+* OUTA::
+* OUTB::
+* OUTD_Q15::
+* OUTL::
+* REV::
+* STR2L::
+@end menu
+
+@node ABS
+@section @command{ABS} - @file{abs.casl}
+入力された整数を絶対値に変換して出力
+
+@unnumberedsubsec 入力
+@table @var
+
+@item GR1
+-32768〜32767の整数
+@end table
+
+@unnumberedsubsec 出力
+@table @var
+
+@item GR1
+入力された整数の絶対値
+
+@item OF
+入力されたGR1が-32768の場合、1
+
+@item SF
+入力されたGR1が負数(-32767〜-1)の場合、1
+@end table
+
+@unnumberedsubsec 依存する副プログラム
+なし
+
+@unnumberedsubsec 使用例
+@iftex
+@cartouche
+@end iftex
+@example
+@verbatiminclude ../as/casl2lib/test/abs/abs.casl
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@iftex
+@cartouche
+@end iftex
+@example
+@verbatiminclude ../as/casl2lib/test/abs/0.txt
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@node ADDL32
+@section @command{ADDL32} - @file{addl32.casl}
+32ビットの値を、連続する2語の領域に格納
+
+@unnumberedsubsec 入力
+@table @var
+@item GR1
+32ビット値1の先頭アドレス
+
+@item GR2
+32ビット値2の先頭アドレス
+@end table
+
+@unnumberedsubsec 出力
+@table @var
+@item GR0
+和の先頭アドレス
+
+@item OF
+上位アドレスでオーバーフローした場合、1
+
+@item SF
+和が負数(-32767〜-1)の場合、1
+
+@item ZF
+和が0の場合、1
+@end table
+
+@unnumberedsubsec 使用例
+@iftex
+@cartouche
+@end iftex
+@example
+@verbatiminclude ../as/casl2lib/test/addl32/addl32_1.casl
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@iftex
+@cartouche
+@end iftex
+@example
+4
+9
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@unnumberedsubsec 依存する副プログラム
+なし
+
+@node DIVA
+@section @command{DIVA} -@file{diva.casl}
+-32,767〜32,767の範囲にある整数の割算(筆算方式)を行う
+
+@unnumberedsubsec 入力
+@table @var
+@item GR1
+被除数
+
+@item GR2
+除数
+@end table
+
+@unnumberedsubsec 出力
+@table @var
+@item GR0
+商
+
+@item GR3
+剰余
+
+@item OF
+除数が0の場合、1
+
+@item SF
+商が負数(-32767〜-1)の場合、1
+
+@item ZF
+商が0の場合、1
+@end table
+
+@unnumberedsubsec 依存する副プログラム
+@itemize
+@item @command{DIVL}
+@end itemize
+
+@c @unnumberedsubsec 使用例
+@c @iftex
+@c @cartouche
+@c @end iftex
+@c @example
+@c @verbatiminclude ../as/casl2lib/test/diva/diva.casl
+@c @end example
+@c @iftex
+@c @end cartouche
+@c @end iftex
+
+@c @iftex
+@c @cartouche
+@c @end iftex
+@c @example
+@c @verbatiminclude ../as/casl2lib/test/diva/0.txt
+@c @end example
+@c @iftex
+@c @end cartouche
+@c @end iftex
+
+@node DIVL
+@section @command{DIVL} - @file{divl.casl}
+0〜65,535の範囲にある整数の割算(筆算方式)を行う
+
+@unnumberedsubsec 入力
+@table @var
+@item GR1
+被除数
+
+@item GR2
+除数
+@end table
+
+@unnumberedsubsec 出力
+@table @var
+@item GR0
+商
+
+@item GR3
+剰余
+
+@item OF
+除数が0の場合、1
+
+@item SF
+商が32,768〜65535の場合、1
+
+@item ZF
+商が0の場合、1
+@end table
+
+@unnumberedsubsec 依存する副プログラム
+なし
+
+@unnumberedsubsec 使用例
+@iftex
+@cartouche
+@end iftex
+@example
+@verbatiminclude ../as/casl2lib/test/divl/divl0/divl0.casl
+@end example
+@iftex
+@end cartouche
+@end iftex
+
+@node INL
+@section @command{INL} - @file{inl.casl}
+
+@node L2STR
+@section @command{L2STR} - @file{l2str.casl}
+
+@node MAX
+@section @command{MAX} - @file{max.casl}
+
+@node MINIM
+@section @command{MINIM} - @file{minim.casl}
+
+@node MULA
+@section @command{MULA} - @file{mula.casl}
+
+@node MULL
+@section @command{MULL} - @file{mull.casl}
+
+@node OUTA
+@section @command{OUTA} - @file{outa.casl}
+
+@node OUTB
+@section @command{OUTB} - @file{outb.casl}
+
+@node OUTD_Q15
+@section @command{OUTD_Q15} - @file{outd_q15.casl}
+
+@node OUTL
+@section @command{OUTL} - @file{outl.casl}
+
+@node REV
+@section @command{REV} - @file{rev.casl}
+
+@node STR2L
+@section @command{STR2L} - @file{str2l.casl}
+