<--  back   Last regenerated: 2017-09-30 18:46:12 kio

zasm - Z80 Assembler – Version 4.1

Pseudo instructions

Commands for command line options

The following instructions must all occur befor the first org or segment definition and they do the same as the similar named Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line option. You may put these pseudo ops at the start of your assembler source to eliminate the need to pass the Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line options every time you assemble it.

--ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_

Related Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line option, Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction and predefined label

IXCB is used here as a mnenonic for the prefix IX or IY plus prefix 0xCB instructions like 'rr', 'bit', 'Pseudo instructions: defl, set and '='
Labels: SET
set' and 'res'. These are allowed for those opcodes which use the '(hl)' register only. But people have found out what they do when you use one of the other, regular registers: They may additionally copy the result into the selected register or they may, Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if you use register 'h' or 'l', access the upper or lower byte of the index register.

What a CPU does depends on it's hardware. Original Zilog Command Line Options: --z80
Pseudo instructions: .z80, .z180 and .8080
Targets: #target Z80
Z80 CPUs should behave as for --Command Line Options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_

Commands for command line options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_
ixcbr2. Others allow the access to the index register halves, some just behave as for '(hl)' for all other registers as well and some, like the Command Line Options: --z180
Pseudo instructions: .z80, .z180 and .8080
Z180, even trap all illegal instruction.

Option --Command Line Options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_

Commands for command line options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_
ixcbr2 enables the 'second register target' opcodes like

    Pseudo instructions: defl, set and '='
Labels: SET
set 0,(ix+0),b

and option --Command Line Options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_

Commands for command line options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_
ixcbxh enables the 'index register halves' opcodes like

    Pseudo instructions: defl, set and '='
Labels: SET
set 0,xh

Obviously they are mutually exclusive.

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If option --Command Line Options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_

Commands for command line options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_
ixcbr2 is selected, then the Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label _ixcbr2_ is defined and can be tested with 'defined(_ixcbr2_)' in Expressions
8080 Assembler: Expressions
expressions.

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If option --Command Line Options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_

Commands for command line options: --ixcbxh, .ixcbxh, _ixcbxh_
--ixcbr2, .ixcbr2, _ixcbr2_
ixcbxh is selected, then the Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label _ixcbr2_ is defined and can be tested with 'defined(_ixcbxh_)' in Expressions
8080 Assembler: Expressions
expressions.

--dotnames, .dotnames, _dotnames_

Related Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line option, Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction and predefined label

Allow Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names to start with a dot.

First dots were not allowed in Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names. Then some assemblers prepended a dot to the Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instructions to easily distinguish them from normal instructions and Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names, so they could start at any column of a source line. Having seen that, some people immediately developed the need to start their Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names with a dot as well…

Normally, without this option, only Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instructions like '.Pseudo instructions: defs, ds, .ds, .block, .blkb and data
8080 pseudo instructions: DS
ds' or '.org' can start with a dot. Then they may be written in any column of a source line regardless of the '--reqcolon' setting.

With this setting the limitations described at '--reqcolons' also applies to Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instructions starting with a dot because the dot no longer makes them special and implicitely a non-label.

The following #insert: Examples:
#assert: Example:
incbin: Examples:
example is only valid source with --Command Line Options: --dotnames, .dotnames, _dotnames_
Commands for command line options: --dotnames, .dotnames, _dotnames_
Label definition: --dotnames
dotnames and --reqcolon:

.org    0               ; starts in column 0 => requires --reqcolon
    .Pseudo instructions: defs, ds, .ds, .block, .blkb and data
8080 pseudo instructions: DS
ds 0x66 ; one of the original dot named Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instructions jp .nmi_handler ; requires --Command Line Options: --dotnames, .dotnames, _dotnames_
Commands for command line options: --dotnames, .dotnames, _dotnames_
Label definition: --dotnames
dotname

Of course you could clean up your source as well…

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If option --Command Line Options: --dotnames, .dotnames, _dotnames_
Commands for command line options: --dotnames, .dotnames, _dotnames_
Label definition: --dotnames
dotnames is selected, then the Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label _dotnames_ is defined and can be tested with 'defined(_dotnames_)' in Expressions
8080 Assembler: Expressions
expressions.

--reqcolon, .reqcolon, _reqcolon_

Related Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line option, Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction and predefined label

Select syntax variant where colons ':' are required after Types of labels: Program labels
Types of labels: Program labels
program label definitions.

Normally colons are not required and the assembler decides whether a name is a label definition or something else by the position where it starts: Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names must start in column 1 and instructions must be preceded by some space.

This example must not be compiled with --reqcolon or --Command Line Options: --dotnames, .dotnames, _dotnames_
Commands for command line options: --dotnames, .dotnames, _dotnames_
Label definition: --dotnames
dotnames:

.org 0                  ; due to the dot this Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction is allowed in column 1 foo Pseudo instructions: equ
Types of labels: Named values
Labels: EQU
equ 0xF00 ; label definition bar: and a ; Types of labels: Program labels
Types of labels: Program labels
program label def and a instruction jp foo ; instruction shelf Pseudo instructions: defb, db, .db and .byte
8080 pseudo instructions: DB
db 0 ; Types of labels: Program labels
Types of labels: Program labels
program label def and a Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction

But some source files don't obey this widely accepted rule and put instructions in column 1 or – actually seen – start label definitions indented with some tabs.

As long as only Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instructions starting with a dot are put in column 1 and option --Command Line Options: --dotnames, .dotnames, _dotnames_
Commands for command line options: --dotnames, .dotnames, _dotnames_
Label definition: --dotnames
dotnames is not required, this is no problem. In all other cases you need this option --reqcolon and, of course, then colons are required after Types of labels: Program labels
Types of labels: Program labels
program label definitions, but still not after other label definitions with 'Pseudo instructions: equ
Types of labels: Named values
Labels: EQU
equ' and the like:

This #insert: Examples:
#assert: Example:
incbin: Examples:
example must be compiled with --reqcolon:

; funny indented:
org 0                       ; 'org' would be recognized as a Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label without --reqcolon foo Pseudo instructions: equ
Types of labels: Named values
Labels: EQU
equ 0xF00 ; label definition bar: and a ; Types of labels: Program labels
Types of labels: Program labels
program label def and a instruction jp foo ; instruction shelf: ; Types of labels: Program labels
Types of labels: Program labels
program label definition .Pseudo instructions: defb, db, .db and .byte
8080 pseudo instructions: DB
db 0 ; a Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If option --reqcolon is selected, then the Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label _reqcolon_ is defined and can be tested with 'defined(_reqcolon_)' in Expressions
8080 Assembler: Expressions
expressions.

--casefold, .casefold, _casefold_

Related Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line option, Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction and predefined label

Tell the assembler that Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names are case insensitive and that the source does not distinguish between uppercase and lowercase writing of Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names.

Note: instruction and register names are always case insensitive.

This option is implied by '--asm8080'.

Normally Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label names are case sensitive or people just tend to just write them allways the same.

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If option --Command Line Options: --casefold, .casefold, _casefold_
Commands for command line options: --casefold, .casefold, _casefold_
Label definition: --casefold
casefold is selected, then the Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label _casefold_ is defined and can be tested with 'defined(_casefold_)' in Expressions
8080 Assembler: Expressions
expressions.

--flatops, .flatops, _flatops_

Related Differences from v3 to v4: Command line options
Command Line Options
Command Line Options: Command line options
command line option, Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction and predefined label

Evaluate Expressions
8080 Assembler: Expressions
expressions strictly from left to right, disobeying any operator precedence.

Old assemblers sometimes didn't know about operator precedence and were designed this way for simplicity.

Use this option Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if error messages about byte values or offsets out of range are reported by zasm and these Expressions
8080 Assembler: Expressions
expressions make more sense when evaluated this way.

Normal operator precedence in zasm is:

unary ! ~ + –  ▶︎  >> <<  ▶︎  & | ^  ▶︎  * / %  ▶︎  + –  ▶︎  > >= etc.  ▶︎  && ||  ▶︎  ?:

Note that this is not the precedence as defined for C. B-). The hierarchy of operators in c is very bad.

Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
If option --Command Line Options: --flatops, .flatops, _flatops_
Commands for command line options: --flatops, .flatops, _flatops_
flatops is selected, then the Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label _flatops_ is defined and can be tested with 'defined(_flatops_)' in Expressions
8080 Assembler: Expressions
expressions.

Valid HTML   Valid CSS