📄 ca65-10.html
字号:
<DT><B><CODE>dollar_in_identifiers</CODE></B><DD><P>Accept the dollar sign (`$') as a valid character in identifiers. Theat character is not allowed to start an identifier, even with thisfeature enabled.</P><DT><B><CODE>leading_dot_in_identifiers</CODE></B><DD><P>Accept the dot (`.') as the first character of an identifier. This may beused for example to create macro names that start with a dot emulatingcontrol directives of other assemblers. Note however, that none of thereserved keywords built into the assembler, that starts with a dot, may beoverridden. When using this feature, you may also get into trouble iflater versions of the assembler define new keywords starting with a dot.</P><DT><B><CODE>pc_assignment</CODE></B><DD><P>Allow assignments to the PC symbol (`*' or `$' if <CODE>dollar_is_pc</CODE>is enabled). Such an assignment is handled identical to the <CODE><A HREF="#.ORG">.ORG</A></CODE> command (which is usually not needed, so justremoving the lines with the assignments may also be an option when portingcode written for older assemblers).</P></DL></P><P>It is also possible to specify features on the command line using the<CODE><A HREF="ca65-2.html#option--feature">--feature</A></CODE> command line option.This is useful when translating sources written for older assemblers, whenyou don't want to change the source code.</P><P>As an example, to translate sources written for Andre Fachats xa65assembler, the features</P><P><PRE> labels_without_colons, pc_assignment, loose_char_term </PRE></P><P>may be helpful. They do not make ca65 completely compatible, so you may notbe able to translate the sources without changes, even when enabling thesefeatures. However, I have found several sources that translate withoutproblems when enabling these features on the command line.</P><H2><A NAME=".FOPT"></A> <A NAME="ss10.39">10.39</A> <A HREF="ca65.html#toc10.39"><CODE>.FILEOPT, .FOPT</CODE></A></H2><P>Insert an option string into the object file. There are two forms ofthis command, one specifies the option by a keyword, the secondspecifies it as a number. Since usage of the second one needs knowledgeof the internal encoding, its use is not recommended and I will onlydescribe the first form here.</P><P>The command is followed by one of the keywords</P><P><BLOCKQUOTE><CODE><PRE> author comment compiler </PRE></CODE></BLOCKQUOTE></P><P>a comma and a string. The option is written into the object filetogether with the string value. This is currently unidirectional andthere is no way to actually use these options once they are in theobject file.</P><P>Examples:</P><P><BLOCKQUOTE><CODE><PRE> .fileopt comment, "Code stolen from my brother" .fileopt compiler, "BASIC 2.0" .fopt author, "J. R. User" </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".FORCEIMPORT"></A> <A NAME="ss10.40">10.40</A> <A HREF="ca65.html#toc10.40"><CODE>.FORCEIMPORT</CODE></A></H2><P>Import an absolute symbol from another module. The command is followed by acomma separated list of symbols to import. The command is similar to <CODE><A HREF="#.IMPORT">.IMPORT</A></CODE>, but the import reference is alwayswritten to the generated object file, even if the symbol is never referenced(<CODE><A HREF="#.IMPORT">.IMPORT</A></CODE> will not generate importreferences for unused symbols).</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .forceimport needthisone, needthistoo </PRE></CODE></BLOCKQUOTE></P><P>See: <CODE><A HREF="#.IMPORT">.IMPORT</A></CODE></P><H2><A NAME=".GLOBAL"></A> <A NAME="ss10.41">10.41</A> <A HREF="ca65.html#toc10.41"><CODE>.GLOBAL</CODE></A></H2><P>Declare symbols as global. Must be followed by a comma separated list ofsymbols to declare. Symbols from the list, that are defined somewhere in thesource, are exported, all others are imported. Additional <CODE><A HREF="#.IMPORT">.IMPORT</A></CODE> or <CODE><A HREF="#.EXPORT">.EXPORT</A></CODE> commands for the same symbol are allowed.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .global foo, bar </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".GLOBALZP"></A> <A NAME="ss10.42">10.42</A> <A HREF="ca65.html#toc10.42"><CODE>.GLOBALZP</CODE></A></H2><P>Declare symbols as global. Must be followed by a comma separated list ofsymbols to declare. Symbols from the list, that are defined somewhere in thesource, are exported, all others are imported. Additional <CODE><A HREF="#.IMPORTZP">.IMPORTZP</A></CODE> or <CODE><A HREF="#.EXPORTZP">.EXPORTZP</A></CODE> commands for the same symbol are allowed. The symbolsin the list are explicitly marked as zero page symols.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .globalzp foo, bar </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".I16"></A> <A NAME="ss10.43">10.43</A> <A HREF="ca65.html#toc10.43"><CODE>.I16</CODE></A></H2><P>Valid only in 65816 mode. Switch the index registers to 16 bit.</P><P>Note: This command will not emit any code, it will tell the assembler tocreate 16 bit operands for immediate operands.</P><P>See also the <CODE><A HREF="#.I8">.I8</A></CODE> and <CODE><A HREF="#.SMART">.SMART</A></CODE> commands.</P><H2><A NAME=".I8"></A> <A NAME="ss10.44">10.44</A> <A HREF="ca65.html#toc10.44"><CODE>.I8</CODE></A></H2><P>Valid only in 65816 mode. Switch the index registers to 8 bit.</P><P>Note: This command will not emit any code, it will tell the assembler tocreate 8 bit operands for immediate operands.</P><P>See also the <CODE><A HREF="#.I16">.I16</A></CODE> and <CODE><A HREF="#.SMART">.SMART</A></CODE> commands.</P><H2><A NAME=".IF"></A> <A NAME="ss10.45">10.45</A> <A HREF="ca65.html#toc10.45"><CODE>.IF</CODE></A></H2><P>Conditional assembly: Evalute an expression and switch assembler outputon or off depending on the expression. The expression must be a constantexpression, that is, all operands must be defined.</P><P>A expression value of zero evaluates to FALSE, any other value evaluatesto TRUE.</P><H2><A NAME=".IFBLANK"></A> <A NAME="ss10.46">10.46</A> <A HREF="ca65.html#toc10.46"><CODE>.IFBLANK</CODE></A></H2><P>Conditional assembly: Check if there are any remaining tokens in this line,and evaluate to FALSE if this is the case, and to TRUE otherwise. If thecondition is not true, further lines are not assembled until an <CODE><A HREF="#.ELSE">.ESLE</A></CODE>, <CODE><A HREF="#.ELSEIF">.ELSEIF</A></CODE> or<CODE><A HREF="#.ENDIF">.ENDIF</A></CODE> directive.</P><P>This command is often used to check if a macro parameter was given. Since anempty macro parameter will evaluate to nothing, the condition will evaluateto FALSE if an empty parameter was given.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .macro arg1, arg2 .ifblank arg2 lda #arg1 .else lda #arg2 .endif .endmacro </PRE></CODE></BLOCKQUOTE></P><P>See also: <CODE><A HREF="ca65-9.html#.BLANK">.BLANK</A></CODE></P><H2><A NAME=".IFCONST"></A> <A NAME="ss10.47">10.47</A> <A HREF="ca65.html#toc10.47"><CODE>.IFCONST</CODE></A></H2><P>Conditional assembly: Evaluate an expression and switch assembler outputon or off depending on the constness of the expression.</P><P>A const expression evaluates to to TRUE, a non const expression (onecontaining an imported or currently undefined symbol) evaluates toFALSE.</P><P>See also: <CODE><A HREF="ca65-9.html#.CONST">.CONST</A></CODE></P><H2><A NAME=".IFDEF"></A> <A NAME="ss10.48">10.48</A> <A HREF="ca65.html#toc10.48"><CODE>.IFDEF</CODE></A></H2><P>Conditional assembly: Check if a symbol is defined. Must be followed bya symbol name. The condition is true if the the given symbol is alreadydefined, and false otherwise.</P><P>See also: <CODE><A HREF="#.DEFINED">.DEFINED</A></CODE></P><H2><A NAME=".IFNBLANK"></A> <A NAME="ss10.49">10.49</A> <A HREF="ca65.html#toc10.49"><CODE>.IFNBLANK</CODE></A></H2><P>Conditional assembly: Check if there are any remaining tokens in this line,and evaluate to TRUE if this is the case, and to FALSE otherwise. If thecondition is not true, further lines are not assembled until an <CODE><A HREF="#.ELSE">.ELSE</A></CODE>, <CODE><A HREF="#.ELSEIF">.ELSEIF</A></CODE> or<CODE><A HREF="#.ENDIF">.ENDIF</A></CODE> directive.</P><P>This command is often used to check if a macro parameter was given.Since an empty macro parameter will evaluate to nothing, the conditionwill evaluate to FALSE if an empty parameter was given.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .macro arg1, arg2 lda #arg1 .ifnblank arg2 lda #arg2 .endif .endmacro </PRE></CODE></BLOCKQUOTE></P><P>See also: <CODE><A HREF="ca65-9.html#.BLANK">.BLANK</A></CODE></P><H2><A NAME=".IFNDEF"></A> <A NAME="ss10.50">10.50</A> <A HREF="ca65.html#toc10.50"><CODE>.IFNDEF</CODE></A></H2><P>Conditional assembly: Check if a symbol is defined. Must be followed bya symbol name. The condition is true if the the given symbol is notdefined, and false otherwise.</P><P>See also: <CODE><A HREF="#.DEFINED">.DEFINED</A></CODE></P><H2><A NAME=".IFNREF"></A> <A NAME="ss10.51">10.51</A> <A HREF="ca65.html#toc10.51"><CODE>.IFNREF</CODE></A></H2><P>Conditional assembly: Check if a symbol is referenced. Must be followedby a symbol name. The condition is true if if the the given symbol wasnot referenced before, and false otherwise.</P><P>See also: <CODE><A HREF="ca65-9.html#.REFERENCED">.REFERENCED</A></CODE></P><H2><A NAME=".IFP02"></A> <A NAME="ss10.52">10.52</A> <A HREF="ca65.html#toc10.52"><CODE>.IFP02</CODE></A></H2><P>Conditional assembly: Check if the assembler is currently in 6502 mode(see <CODE><A HREF="#.P02">.P02</A></CODE> command).</P><H2><A NAME=".IFP816"></A> <A NAME="ss10.53">10.53</A> <A HREF="ca65.html#toc10.53"><CODE>.IFP816</CODE></A></H2><P>Conditional assembly: Check if the assembler is currently in 65816 mode(see <CODE><A HREF="#.P816">.P816</A></CODE> command).</P><H2><A NAME=".IFPC02"></A> <A NAME="ss10.54">10.54</A> <A HREF="ca65.html#toc10.54"><CODE>.IFPC02</CODE></A></H2><P>Conditional assembly: Check if the assembler is currently in 65C02 mode(see <CODE><A HREF="#.PC02">.PC02</A></CODE> command).</P><H2><A NAME=".IFPSC02"></A> <A NAME="ss10.55">10.55</A> <A HREF="ca65.html#toc10.55"><CODE>.IFPSC02</CODE></A></H2><P>Conditional assembly: Check if the assembler is currently in 65SC02 mode(see <CODE><A HREF="#.PSC02">.PSC02</A></CODE> command).</P><H2><A NAME=".IFREF"></A> <A NAME="ss10.56">10.56</A> <A HREF="ca65.html#toc10.56"><CODE>.IFREF</CODE></A></H2><P>Conditional assembly: Check if a symbol is referenced. Must be followedby a symbol name. The condition is true if if the the given symbol wasreferenced before, and false otherwise.</P><P>This command may be used to build subroutine libraries in include files(you may use separate object modules for this purpose too).</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .ifref ToHex ; If someone used this subroutine ToHex: tay ; Define subroutine lda HexTab,y rts .endif </PRE></CODE></BLOCKQUOTE></P><P>See also: <CODE><A HREF="ca65-9.html#.REFERENCED">.REFERENCED</A></CODE></P><H2><A NAME=".IMPORT"></A> <A NAME="ss10.57">10.57</A> <A HREF="ca65.html#toc10.57"><CODE>.IMPORT</CODE></A></H2><P>Import a symbol from another module. The command is followed by a commaseparated list of symbols to import, with each one optionally followed byan address specification.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .import foo .import bar: zeropage </PRE></CODE></BLOCKQUOTE></P><P>See: <CODE><A HREF="#.IMPORTZP">.IMPORTZP</A></CODE></P><H2><A NAME=".IMPORTZP"></A> <A NAME="ss10.58">10.58</A> <A HREF="ca65.html#toc10.58"><CODE>.IMPORTZP</CODE></A></H2><P>Import a symbol from another module. The command is followed by a commaseparated list of symbols to import. The symbols are explicitly importedas zero page symbols (that is, symbols with values in byte range).</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .importzp foo, bar </PRE></CODE></BLOCKQUOTE></P><P>See: <CODE><A HREF="#.IMPORT">.IMPORT</A></CODE></P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -