Next Previous Contents

4. 入力フォーマット(Input format)

4.1 アセンブラー記述(Assembler syntax)

アセンブラーは、6502/65816アセンブラーの記述に対応します。
1つの行には(コロンで識別することで)ラベル及び、 ラベルと共にアセンブラのニモニック、マクロ、もしくは制御コマンド (詳細は制御コマンドを参照)を記述できます。
あるいはまた、行には、'='トークンを使う事でシンボルの定義を記述できます。
セミコロンの後は、全てコメント(注釈文)となります(アセンブルを無視します)。

有効な行の例:

        Label:                          ; A label and a comment
                lda     #$20            ; A 6502 instruction plus comment
        L1:     ldx     #$20            ; Same with label
        L2:     .byte   "Hello world"   ; Label plus control command
                mymac   $20             ; Macro expansion
                MySym = 3*L1            ; Symbol definition
        MaSym   = Label                 ; Another symbol

アセンブラーの対応

4.2 65816モード

65816モードでは、公式ニモニックの追加に関していくつかの別名に対応します。

        BGE is an alias for BCS
        BLT is an alias for BCC
        CPA is an alias for CMP
        DEA is an alias for DEC A
        INA is an alias for INC A
        SWA is an alias for XBA
        TAD is an alias for TCD
        TAS is an alias for TCS
        TDA is an alias for TDC
        TSA is an alias for TSC

4.3 6502Xモード

6502Xモードは、標準の6502モードの拡張です。
このモードでは、NMOS 6502 CPUの未定義命令用のニモニックに対応します。
以下の命令はメーカー保証対象外であり、6502の公式なニモニックではありません。
これら非公式命令については、http://oxyron.net/graham/opcodes02.html (英文)で取り上げられています。
Please note that only the ones marked as "stable" are supported. The following table uses information from the mentioned web page, for more information, see there.

訳者注:
ファミコン(NES)のCPU "2A03" で、これらの未定義命令が使えるのかどうかは知りません。
というか、回路屋として言わせて貰えば、メーカーのデータシートに書かれていない命令は使ってはならない命令です。
データシートに書かれていないという事は、メーカーの量産テスト(全数試験)にて試験されてない可能性が大です。
つまり、未定義命令を処理する回路に欠陥・異常があったとしても、量産テストではテストされておらず、市場に出荷されている可能性があります。

4.4 sweet16モード

SWEET 16 is an interpreter for a pseudo 16 bit CPU written by Steve Wozniak for the Apple ][ machines. It is available in the Apple ][ ROM. ca65 can generate code for this pseudo CPU when switched into sweet16 mode. The following is special in sweet16 mode:

Please note that the assembler does neither supply the interpreter needed for SWEET 16 code, nor the zero page locations needed for the SWEET 16 registers, nor does it call the interpreter. All this must be done by your program. Apple ][ programmers do probably know how to use sweet16 mode.

For more information about SWEET 16, see http://www.6502.org/source/interpreters/sweet16.htm.

4.5 数値の記法

文字で記述された数値に関し、アセンブラーは多岐にわたる数値の記法に対応しています。

尚、8進数、浮動小数点には対応していません。

4.6 条件アセンブリ

.IF等の)条件ディレクティブを使用する場合において、 アセンブルされない分岐の中についても有効なアセンブラトークンから構成されるように注意して記述してください。
この理由は、アセンブラーは(.ENDIFのような)終了トークンを常に検出する事が可能であり、 トークン中の入力列からの変換は、アセンブリしない場所でも引き続き行われます。
従い、上述の条件アセンブリディレクティブの結果のとおり、 条件アセンブリアセンブルディレクティブを、(コメント等として使用される)普通のテキストを書く為に使わないで下さい。


Next Previous Contents