Next Previous Contents

9. Pseudo variables

Pseudo variables are readable in all cases, and in some special cases also writable.

9.1 *

Reading this pseudo variable will return the program counter at the start of the current input line.

Assignment to this variable is possible when .FEATURE pc_assignment is used. Note: You should not use assignments to *, use .ORG instead.

9.2 .CPU

Reading this pseudo variable will give a constant integer value that tells which CPU is currently enabled. It can also tell which instruction set the CPU is able to translate. The value read from the pseudo variable should be further examined by using one of the constants defined by the "cpu" macro package (see .MACPACK).

It may be used to replace the .IFPxx pseudo instructions or to construct even more complex expressions.

Example:

        .macpack        cpu
        .if     (.cpu .bitand CPU_ISET_65816)
                phx
                phy
        .else
                txa
                pha
                tya
                pha
        .endif
  

9.3 .PARAMCOUNT

This builtin pseudo variable is only available in macros. It is replaced by the actual number of parameters that were given in the macro invocation.

Example:

        .macro  foo     arg1, arg2, arg3
        .if     .paramcount <> 3
        .error  "Too few parameters for macro foo"
        .endif
        ...
        .endmacro
  

See section Macros.

9.4 .TIME

Reading this pseudo variable will give a constant integer value that represents the current time in POSIX standard (as seconds since the Epoch).

It may be used to encode the time of translation somewhere in the created code.

Example:

        .dword  .time   ; Place time here
  

9.5 .VERSION

Reading this pseudo variable will give the assembler version according to the following formula:

VER_MAJOR*$100 + VER_MINOR*$10 + VER_PATCH

It may be used to encode the assembler version or check the assembler for special features not available with older versions.

Example:

Version 2.11.1 of the assembler will return $2B1 as numerical constant when reading the pseudo variable .VERSION.


Next Previous Contents