アセンブラーは、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
アセンブラーの対応
.P02
コマンドの記述後)、全ての 6502 ニモニック。.PSC02
コマンドの記述後)、全ての 65SC02 ニモニック。.PC02
コマンドの記述後)、全ての 65C02 ニモニック。.P816
コマンドの記述後)、全ての 65618 ニモニック。.SUNPLUS
コマンドの記述後)、全ての SunPlus ニモニック。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
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.
ALR: A:=(A and #{imm})/2;
ANC: A:=A and #{imm};
Generates opcode $0B.ARR: A:=(A and #{imm})/2;
AXS: X:=A and X-#{imm};
DCP: {adr}:={adr}-1; A-{adr};
ISC: {adr}:={adr}+1; A:=A-{adr};
LAS: A,X,S:={adr} and S;
LAX: A,X:={adr};
RLA: {adr}:={adr}rol; A:=A and {adr};
RRA: {adr}:={adr}ror; A:=A adc {adr};
SAX: {adr}:=A and X;
SLO: {adr}:={adr}*2; A:=A or {adr};
SRE: {adr}:={adr}/2; A:=A xor {adr};
訳者注:
ファミコン(NES)のCPU "2A03" で、これらの未定義命令が使えるのかどうかは知りません。
というか、回路屋として言わせて貰えば、メーカーのデータシートに書かれていない命令は使ってはならない命令です。
データシートに書かれていないという事は、メーカーの量産テスト(全数試験)にて試験されてない可能性が大です。
つまり、未定義命令を処理する回路に欠陥・異常があったとしても、量産テストではテストされておらず、市場に出荷されている可能性があります。
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:
.LOCALCHAR
コマンド.
R0
.. R15
. In sweet16 mode,
these identifiers are reserved words.
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.
文字で記述された数値に関し、アセンブラーは多岐にわたる数値の記法に対応しています。
(.IF
等の)条件ディレクティブを使用する場合において、
アセンブルされない分岐の中についても有効なアセンブラトークンから構成されるように注意して記述してください。
この理由は、アセンブラーは(.ENDIF
のような)終了トークンを常に検出する事が可能であり、
トークン中の入力列からの変換は、アセンブリしない場所でも引き続き行われます。
従い、上述の条件アセンブリディレクティブの結果のとおり、
条件アセンブリアセンブルディレクティブを、(コメント等として使用される)普通のテキストを書く為に使わないで下さい。