ca65-8.html
来自「cc65 的编译器文档」· HTML 代码 · 共 130 行
HTML
130 行
<!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: Pseudo variables</TITLE> <LINK HREF="ca65-9.html" REL=next> <LINK HREF="ca65-7.html" REL=previous> <LINK HREF="ca65.html#toc8" REL=contents></HEAD><BODY><A HREF="ca65-9.html">Next</A><A HREF="ca65-7.html">Previous</A><A HREF="ca65.html#toc8">Contents</A><HR><H2><A NAME="pseudo-variables"></A> <A NAME="s8">8.</A> <A HREF="ca65.html#toc8">Pseudo variables</A></H2><P>Pseudo variables are readable in all cases, and in some special cases alsowritable.</P><H2><A NAME="ss8.1">8.1</A> <A HREF="ca65.html#toc8.1"><CODE>*</CODE></A></H2><P>Reading this pseudo variable will return the program counter at the startof the current input line.</P><P>Assignment to this variable is possible when <CODE><A HREF="ca65-10.html#.FEATURE">.FEATURE pc_assignment</A></CODE> is used. Note: You should not useassignments to <CODE>*</CODE>, use <CODE><A HREF="ca65-10.html#.ORG">.ORG</A></CODE> instead.</P><H2><A NAME=".CPU"></A> <A NAME="ss8.2">8.2</A> <A HREF="ca65.html#toc8.2"><CODE>.CPU</CODE></A></H2><P>Reading this pseudo variable will give a constant integer value thattells which CPU is currently enabled. It can also tell which instructionset the CPU is able to translate. The value read from the pseudo variableshould be further examined by using one of the constants defined by the"cpu" macro package (see <CODE><A HREF="ca65-10.html#.MACPACK">.MACPACK</A></CODE>).</P><P>It may be used to replace the .IFPxx pseudo instructions or to constructeven more complex expressions.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .macpack cpu .if (.cpu .bitand CPU_ISET_65816) phx phy .else txa pha tya pha .endif </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".PARAMCOUNT"></A> <A NAME="ss8.3">8.3</A> <A HREF="ca65.html#toc8.3"><CODE>.PARAMCOUNT</CODE></A></H2><P>This builtin pseudo variable is only available in macros. It is replaced bythe actual number of parameters that were given in the macro invocation.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .macro foo arg1, arg2, arg3 .if .paramcount <> 3 .error "Too few parameters for macro foo" .endif ... .endmacro </PRE></CODE></BLOCKQUOTE></P><P>See section <A HREF="ca65-11.html#macros">Macros</A>.</P><H2><A NAME=".TIME"></A> <A NAME="ss8.4">8.4</A> <A HREF="ca65.html#toc8.4"><CODE>.TIME</CODE></A></H2><P>Reading this pseudo variable will give a constant integer value thatrepresents the current time in POSIX standard (as seconds since theEpoch).</P><P>It may be used to encode the time of translation somewhere in the createdcode.</P><P>Example:</P><P><BLOCKQUOTE><CODE><PRE> .dword .time ; Place time here </PRE></CODE></BLOCKQUOTE></P><H2><A NAME=".VERSION"></A> <A NAME="ss8.5">8.5</A> <A HREF="ca65.html#toc8.5"><CODE>.VERSION</CODE></A></H2><P>Reading this pseudo variable will give the assembler version according tothe following formula:</P><P>VER_MAJOR*$100 + VER_MINOR*$10 + VER_PATCH</P><P>It may be used to encode the assembler version or check the assembler forspecial features not available with older versions.</P><P>Example:</P><P>Version 2.11.1 of the assembler will return $2B1 as numerical constant whenreading the pseudo variable <CODE>.VERSION</CODE>.</P><HR><A HREF="ca65-9.html">Next</A><A HREF="ca65-7.html">Previous</A><A HREF="ca65.html#toc8">Contents</A></BODY></HTML>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?