📄 ca65-10.html
字号:
The command must be followed by a '+' or '-' character to switch theoption on or off respectively.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .debuginfo + ; Generate debug info </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".DEFINE"></A> <A NAME="ss10.18">10.18</A> <A HREF="ca65.html#toc10.18"><CODE>.DEFINE</CODE></A></H2><P>Start a define style macro definition. The command is followed by anidentifier (the macro name) and optionally by a list of formal argumentsin braces.See section <A HREF="ca65-11.html#macros">Macros</A>.</P><H2><A NAME=".DEFINED"></A> <A NAME="ss10.19">10.19</A> <A HREF="ca65.html#toc10.19"><CODE>.DEF, .DEFINED</CODE></A></H2><P>Builtin function. The function expects an identifier as argument in braces.The argument is evaluated, and the function yields "true" if the identifieris a symbol that is already defined somewhere in the source file up to thecurrent position. Otherwise the function yields false. As an example, the<CODE><A HREF="#.IFDEF">.IFDEF</A></CODE> statement may be replaced by</P><P><BLOCKQUOTE><CODE><PRE> .if .defined(a) </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".DESTRUCTOR"></A> <A NAME="ss10.20">10.20</A> <A HREF="ca65.html#toc10.20"><CODE>.DESTRUCTOR</CODE></A></H2><P>Export a symbol and mark it as a module destructor. This may be usedtogether with the linker to build a table of destructor subroutines thatare called by the startup code.</P><P>Note: The linker has a feature to build a table of marked routines, but itis your code that must call these routines, so just declaring a symbol asconstructor does nothing by itself.</P><P>A destructor is always exported as an absolute (16 bit) symbol. You don'tneed to use an additional <CODE>.export</CODE> statement, this is implied by<CODE>.destructor</CODE>. It may have an optional priority that is separated by acomma. Higher numerical values mean a higher priority. If no priority isgiven, the default priority of 7 is used. Be careful when assigningpriorities to your own module destructors so they won't interfere with theones in the cc65 library.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .destructor ModuleDone .destructor ModDone, 16 </PRE></CODE></BLOCKQUOTE></P><P>See the <CODE><A HREF="#.CONDES">.CONDES</A></CODE> and <CODE><A HREF="#.CONSTRUCTOR">.CONSTRUCTOR</A></CODE> commands and the separatesection <A HREF="ca65-14.html#condes">Module constructors/destructors</A> explainingthe feature in more detail.</P><H2><A NAME=".DWORD"></A> <A NAME="ss10.21">10.21</A> <A HREF="ca65.html#toc10.21"><CODE>.DWORD</CODE></A></H2><P>Define dword sized data (4 bytes) Must be followed by a sequence ofexpressions.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .dword $12344512, $12FA489 </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".ELSE"></A> <A NAME="ss10.22">10.22</A> <A HREF="ca65.html#toc10.22"><CODE>.ELSE</CODE></A></H2><P>Conditional assembly: Reverse the current condition.</P><H2><A NAME=".ELSEIF"></A> <A NAME="ss10.23">10.23</A> <A HREF="ca65.html#toc10.23"><CODE>.ELSEIF</CODE></A></H2><P>Conditional assembly: Reverse current condition and test a new one.</P><H2><A NAME=".END"></A> <A NAME="ss10.24">10.24</A> <A HREF="ca65.html#toc10.24"><CODE>.END</CODE></A></H2><P>Forced end of assembly. Assembly stops at this point, even if the commandis read from an include file.</P><H2><A NAME=".ENDENUM"></A> <A NAME="ss10.25">10.25</A> <A HREF="ca65.html#toc10.25"><CODE>.ENDENUM</CODE></A></H2><P>End a <CODE><A HREF="#.ENUM">.ENUM</A></CODE> declaration.</P><H2><A NAME=".ENDIF"></A> <A NAME="ss10.26">10.26</A> <A HREF="ca65.html#toc10.26"><CODE>.ENDIF</CODE></A></H2><P>Conditional assembly: Close a <CODE><A HREF="#.IF">.IF...</A></CODE> or<CODE><A HREF="#.ELSE">.ELSE</A></CODE> branch.</P><H2><A NAME=".ENDMACRO"></A> <A NAME="ss10.27">10.27</A> <A HREF="ca65.html#toc10.27"><CODE>.ENDMAC, .ENDMACRO</CODE></A></H2><P>End of macro definition (see section <A HREF="ca65-11.html#macros">Macros</A>).</P><H2><A NAME=".ENDPROC"></A> <A NAME="ss10.28">10.28</A> <A HREF="ca65.html#toc10.28"><CODE>.ENDPROC</CODE></A></H2><P>End of local lexical level (see <CODE><A HREF="#.PROC">.PROC</A></CODE>).</P><H2><A NAME=".ENDREPEAT"></A> <A NAME="ss10.29">10.29</A> <A HREF="ca65.html#toc10.29"><CODE>.ENDREP, .ENDREPEAT</CODE></A></H2><P>End a <CODE><A HREF="#.REPEAT">.REPEAT</A></CODE> block.</P><H2><A NAME=".ENDSCOPE"></A> <A NAME="ss10.30">10.30</A> <A HREF="ca65.html#toc10.30"><CODE>.ENDSCOPE</CODE></A></H2><P>End of local lexical level (see <CODE><A HREF="#.SCOPE">.SCOPE</A></CODE>).</P><H2><A NAME=".ENDSTRUCT"></A> <A NAME="ss10.31">10.31</A> <A HREF="ca65.html#toc10.31"><CODE>.ENDSTRUCT</CODE></A></H2><P>Ends a struct definition. See the <CODE><A HREF="#.STRUCT">.STRUCT</A></CODE>command and the separate section named <A HREF="ca65-13.html#structs">"Structs and unions"</A>.</P><H2><A NAME=".ENUM"></A> <A NAME="ss10.32">10.32</A> <A HREF="ca65.html#toc10.32"><CODE>.ENUM</CODE></A></H2><P>Start an enumeration. This directive is very similar to the C <CODE>enum</CODE>keyword. If a name is given, a new scope is created for the enumeration,otherwise the enumeration members are placed in the enclosing scope.</P><P>In the enumeration body, symbols are declared. The first symbol has a valueof zero, and each following symbol will get the value of the preceeding plusone. This behaviour may be overriden by an explicit assignment. Two symbolsmay have the same value.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .enum errorcodes no_error file_error parse_error .endenum </PRE></CODE></BLOCKQUOTE></P><P>Above example will create a new scope named <CODE>errorcodes</CODE> with threesymbols in it that get the values 0, 1 and 2 respectively. Another wayto write this would have been:</P><P><BLOCKQUOTE><CODE><PRE> .scope errorcodes no_error = 0 file_error = 1 parse_error = 2 .endscope </PRE></CODE></BLOCKQUOTE></P><P>Please note that explicit scoping must be used to access the identifiers:</P><P><BLOCKQUOTE><CODE><PRE> .word errorcodes::no_error </PRE></CODE></BLOCKQUOTE></P><P>A more complex example:</P><P><BLOCKQUOTE><CODE><PRE> .enum EUNKNOWN = -1 EOK EFILE EBUSY EAGAIN EWOULDBLOCK = EAGAIN .endenum </PRE></CODE></BLOCKQUOTE></P><P>In this example, the enumeration does not have a name, which means that themembers will be visible in the enclosing scope and can be used in this scopewithout explicit scoping. The first member (<CODE>EUNKNOWN</CODE>) has the value -1.The value for the following members is incremented by one, so <CODE>EOK</CODE> wouldbe zero and so on. <CODE>EWOULDBLOCK</CODE> is an alias for <CODE>EGAIN</CODE>, so it has anoverride for the value using an already defined symbol.</P><H2><A NAME=".ERROR"></A> <A NAME="ss10.33">10.33</A> <A HREF="ca65.html#toc10.33"><CODE>.ERROR</CODE></A></H2><P>Force an assembly error. The assembler will output an error messagepreceeded by "User error" and will <EM>not</EM> produce an object file.</P><P>This command may be used to check for initial conditions that must beset before assembling a source file.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .if foo = 1 ... .elseif bar = 1 ... .else .error "Must define foo or bar!" .endif </PRE></CODE></BLOCKQUOTE></P><P>See also the <CODE><A HREF="#.WARNING">.WARNING</A></CODE> and <CODE><A HREF="#.OUT">.OUT</A></CODE> directives.</P><H2><A NAME=".EXITMACRO"></A> <A NAME="ss10.34">10.34</A> <A HREF="ca65.html#toc10.34"><CODE>.EXITMAC, .EXITMACRO</CODE></A></H2><P>Abort a macro expansion immidiately. This command is often useful inrecursive macros. See separate section <A HREF="ca65-11.html#macros">Macros</A>.</P><H2><A NAME=".EXPORT"></A> <A NAME="ss10.35">10.35</A> <A HREF="ca65.html#toc10.35"><CODE>.EXPORT</CODE></A></H2><P>Make symbols accessible from other modules. Must be followed by a commaseparated list of symbols to export, with each one optionally followed byan address specification. The default is to export the symbol with theaddress size it actually has. The assembler will issue a warning, if thesymbol is exported with an address size smaller than the actual addresssize.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .export foo .export bar: far </PRE></CODE></BLOCKQUOTE></P><P>See: <CODE><A HREF="#.EXPORTZP">.EXPORTZP</A></CODE></P><H2><A NAME=".EXPORTZP"></A> <A NAME="ss10.36">10.36</A> <A HREF="ca65.html#toc10.36"><CODE>.EXPORTZP</CODE></A></H2><P>Make symbols accessible from other modules. Must be followed by a commaseparated list of symbols to export. The exported symbols are explicitlymarked as zero page symols.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .exportzp foo, bar </PRE></CODE></BLOCKQUOTE></P><P>See: <CODE><A HREF="#.EXPORT">.EXPORT</A></CODE></P><H2><A NAME=".FARADDR"></A> <A NAME="ss10.37">10.37</A> <A HREF="ca65.html#toc10.37"><CODE>.FARADDR</CODE></A></H2><P>Define far (24 bit) address data. The command must be followed by asequence of (not necessarily constant) expressions.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .faraddr DrawCircle, DrawRectangle, DrawHexagon </PRE></CODE></BLOCKQUOTE></P><P>See: <CODE><A HREF="#.ADDR">.ADDR</A></CODE></P><H2><A NAME=".FEATURE"></A> <A NAME="ss10.38">10.38</A> <A HREF="ca65.html#toc10.38"><CODE>.FEATURE</CODE></A></H2><P>This directive may be used to enable one or more compatibility featuresof the assembler. While the use of <CODE>.FEATURE</CODE> should be avoided whenpossible, it may be useful when porting sources written for otherassemblers. There is no way to switch a feature off, once you haveenabled it, so using</P><P><BLOCKQUOTE><CODE><PRE> .FEATURE xxx </PRE></CODE></BLOCKQUOTE></P><P>will enable the feature until end of assembly is reached.</P><P>The following features are available:</P><P><DL><DT><B><CODE>dollar_is_pc</CODE></B><DD><P>The dollar sign may be used as an alias for the star (`*'), whichgives the value of the current PC in expressions.Note: Assignment to the pseudo variable is not allowed.</P><DT><B><CODE>labels_without_colons</CODE></B><DD><P>Allow labels without a trailing colon. These labels are only accepted,if they start at the beginning of a line (no leading white space).</P><DT><B><CODE>loose_string_term</CODE></B><DD><P>Accept single quotes as well as double quotes as terminators for stringconstants.</P><DT><B><CODE>loose_char_term</CODE></B><DD><P>Accept single quotes as well as double quotes as terminators for charconstants.</P><DT><B><CODE>at_in_identifiers</CODE></B><DD><P>Accept the at character (`@') as a valid character in identifiers. Theat character is not allowed to start an identifier, even with thisfeature enabled.</P>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -