ca65-3.html
来自「cc65 的编译器文档」· HTML 代码 · 共 132 行
HTML
132 行
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><HTML><HEAD> <META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20"> <TITLE>ca65 Users Guide: Input format</TITLE> <LINK HREF="ca65-4.html" REL=next> <LINK HREF="ca65-2.html" REL=previous> <LINK HREF="ca65.html#toc3" REL=contents></HEAD><BODY><A HREF="ca65-4.html">Next</A><A HREF="ca65-2.html">Previous</A><A HREF="ca65.html#toc3">Contents</A><HR><H2><A NAME="s3">3.</A> <A HREF="ca65.html#toc3">Input format</A></H2><H2><A NAME="ss3.1">3.1</A> <A HREF="ca65.html#toc3.1">Assembler syntax</A></H2><P>The assembler accepts the standard 6502/65816 assembler syntax. One line maycontain a label (which is identified by a colon), and, in addition to thelabel, an assembler mnemonic, a macro, or a control command (see section <A HREF="ca65-10.html#control-commands">Control Commands</A> for supported controlcommands). Alternatively, the line may contain a symbol definition using the'=' token. Everything after a semicolon is handled as a comment (that is, itis ignored).</P><P>Here are some examples for valid input lines:</P><P><BLOCKQUOTE><CODE><PRE> 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</PRE></CODE></BLOCKQUOTE></P><P>The assembler accepts</P><P><UL><LI>all valid 6502 mnemonics when in 6502 mode (the default or after the<CODE><A HREF="ca65-10.html#.P02">.P02</A></CODE> command was given).</LI><LI>all valid 65SC02 mnemonics when in 65SC02 mode (after the<CODE><A HREF="ca65-10.html#.PSC02">.PSC02</A></CODE> command was given).</LI><LI>all valid 65C02 mnemonics when in 65C02 mode (after the<CODE><A HREF="ca65-10.html#.PC02">.PC02</A></CODE> command was given).</LI><LI>all valid 65618 mnemonics when in 65816 mode (after the<CODE><A HREF="ca65-10.html#.P816">.P816</A></CODE> command was given).</LI><LI>all valid SunPlus mnemonics when in SunPlus mode (after the<CODE><A HREF="ca65-10.html#.SUNPLUS">.SUNPLUS</A></CODE> command was given).</LI></UL></P><H2><A NAME="ss3.2">3.2</A> <A HREF="ca65.html#toc3.2">65816 mode</A></H2><P>In 65816 mode several aliases are accepted in addition to the officialmnemonics:</P><P><BLOCKQUOTE><CODE><PRE> 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</PRE></CODE></BLOCKQUOTE></P><P>Evaluation of banked expressions in 65816 mode differs slightly from theofficial syntax:</P><P>Instead of accepting a 24 bit address (something that is difficult forthe assembler to determine and would have required one more special.import command), the bank and the absolute address in that bank areseparated by a dot:</P><P><BLOCKQUOTE><CODE><PRE> jsl 3.$1234 ; Call subroutine at $1234 in bank 3</PRE></CODE></BLOCKQUOTE></P><H2><A NAME="ss3.3">3.3</A> <A HREF="ca65.html#toc3.3">Number format</A></H2><P>For literal values, the assembler accepts the widely used number formats:A preceeding '$' denotes a hex value, a preceeding '%' denotes abinary value, and a bare number is interpeted as a decimal. There arecurrently no octal values and no floats.</P><H2><A NAME="ss3.4">3.4</A> <A HREF="ca65.html#toc3.4">Conditional assembly</A></H2><P>Please note that when using the conditional directives (<CODE>.IF</CODE> and friends),the input must consist of valid assembler tokens, even in <CODE>.IF</CODE> branchesthat are not assembled. The reason for this behaviour is that the assemblermust still be able to detect the ending tokens (like <CODE>.ENDIF</CODE>), soconversion of the input stream into tokens still takes place. As a consequenceconditional assembly directives may <B>not</B> be used to prevent normal text(used as a comment or similar) from being assembled. </P><HR><A HREF="ca65-4.html">Next</A><A HREF="ca65-2.html">Previous</A><A HREF="ca65.html#toc3">Contents</A></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?