<name>[:][:] [<instruction>]
<name>[:][:] Pseudo instructions: equ Types of labels: Named values Labels: EQUequ <value>
<name>[:][:] = <value>
<name>[:][:] Pseudo instructions: defl, set and '=' Labels: SETset <value>
<name>[:][:] defl <value>
#define <name> <value>
Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: LabelsLabel names may be of any length. Upper or lower case is distinguished. The Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel name may be followed by one or two colons ':'.
Normally, label definitions must start in column 1 and instructions must be indented with some spaces. The assembler decides based on the starting column of a name whether it is a label definition or an instruction.
Any name which starts in column 1 and is not an assembler directive (which always starts with a hash '#') or a comment (which always starts with a semicolon ';') is treated as a label definition.
unless --Command Line Options: --dotnames, .dotnames Commands for command line options: --dotnames, .dotnames Label definition: --dotnamesdotnames is also Pseudo instructions: defl, set and '=' Labels: SETset, Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instructions starting with a dot are also recognized in column 1.
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf the source is assembled with Differences from v3 to v4: Command line options Command Line Options Command Line Options: Command line optionscommand line option '--reqcolon', then one colon is required after the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel name. This allows label definitions to start in any column, either in column 1 as usual or indented with some spaces and tabs, and it allows instructions to start in column 1. The assembler decides based on the existance or absence of a colon whether it is a label definition or an instruction. Note: even with --reqcolon no colon is required after Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabels defined with 'Pseudo instructions: equ Types of labels: Named values Labels: EQUequ' and similar.
Recommendation: Start label definitions in column 1, indent instructions with one or two tabs and put a colon after label definitions.
Normally Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names cannot start with a dot. Names starting with a dot were introduced by some assemblers to easily distinguish betwen Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names, instructions and assembler Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instructions, so these could be written in column 1 Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifif the programmer desired so. Having seen that, some people immediately developed the need to start their Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names with a dot as well…
Recommendation: Don't start Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names with a dot.
Normally Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names are case sensitive or people just tend to just write them allways in the same way.
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf an older source does not distinguish between uppercase and lowercase writing of Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel names, then you can use this option to tell zasm to ignore upper and lower case as well.
Note: instruction and register names are always case insensitive.
This option is implied by --asm8080.
Recommendation: Don't use this option unless required.
<name>[:][:] [<instruction>]
Types of labels: Program labels Types of labels: Program labelsProgram labels basically are what we just talked about: A name put in front of an instruction to give the current code position a name so that it can be used in a later call or jp statement.
foo: jp _bar
This defines a Types of labels: Program labels Types of labels: Program labelsprogram label named 'foo' and the instruction jumps to a Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel named '_bar' which is likely a Types of labels: Program labels Types of labels: Program labelsprogram label as well.
The address of the current instruction can also be referenced as '$', so in some easy cases you don't need to define a Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel.
Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf you request that your list file includes accumulated cpu cycles, then the counter is reset at every Types of labels: Program labels Types of labels: Program labelsprogram label definition.
<name>[:][:] Pseudo instructions: equ Types of labels: Named values Labels: EQUequ <value>
<name>[:][:] = <value>
#define <name> <value>
Frequently you start your source with a bunch of definitions for constant values, like printing control codes or port addresses. These definitions require the keyword 'Pseudo instructions: equ Types of labels: Named values Labels: EQUequ' after the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel, in exchange a colon after the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel name is never required, even with --reqcolon, but may be present.
foo Pseudo instructions: equ Types of labels: Named values Labels: EQUequ 255 -1
bar Pseudo instructions: equ Types of labels: Named values Labels: EQUequ 255 -2
shelf = 0xffff
#define foobar foo & bar
Most assemblers require keyword 'Pseudo instructions: equ Types of labels: Named values Labels: EQUequ', some use '='. The use of 'Pseudo instructions: equ Types of labels: Named values Labels: EQUequ' is recommended.
Additionally zasm supports the use of the c preprocessor-style definition using '#define'.
<name>[:][:] Pseudo instructions: defl, set and '=' Labels: SETset <value>
<name>[:][:] defl <value>
Especially for use in Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacros it is possible to define Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabels which can be redefined to another value. These definitions require the keyword 'Pseudo instructions: defl, set and '=' Labels: SETset' or 'defl' after the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel, in exchange a colon after the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel name is never required, even with --reqcolon, but may be present. Note: don't confuse the 'Pseudo instructions: defl, set and '=' Labels: SETset' Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instruction with the Command Line Options: --z80 Pseudo instructions: .z80, .z180 and .8080 Targets: #target Z80Z80's 'Pseudo instructions: defl, set and '=' Labels: SETset' instruction!
This defines a Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro which counts the occurances of something: Note: the final count is only valid after the last use of this Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro in your source!
foo Pseudo instructions: defl, set and '=' Labels: SETset 0
Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro COUNT
foo Pseudo instructions: defl, set and '=' Labels: SETset foo+1
Pseudo instructions: macro, .macro, endm and .endm Pseudo instructions: rept, .rept, endm and .endmendm
Use of a redefinable Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel in place of a Types of labels: Program labels Types of labels: Program labelsprogram label: Note: forward jumping can't be implemented this way!
Pseudo instructions: macro, .macro, endm and .endm 8080 pseudo instructions: MACROmacro WAIT &N
ld b,&N
foo defl $
call wait_1ms
djnz foo
Pseudo instructions: macro, .macro, endm and .endm Pseudo instructions: rept, .rept, endm and .endmendm
The value is valid from the position where it was defined to the position where it is redefined or the Pseudo instructions: end, .end 8080 pseudo instructions: ENDend of the source. References to this Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel before it's first definition are illegal!
Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: LabelsLabels are defined in the current 'scope', which is either the default global scope or, after Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#local, a Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocallocal scope.
Normally Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabels defined after Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#local are only known in the Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocallocal scope:
Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#local
foo: nop
...
jr foo
Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#endlocal
You can also define global labels inside a Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocallocal scope: Just put two colons '::' after the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel name or use the Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instruction '.globl':
Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#local
.globl bar
foo:: nop ; global
...
bar: nop ; global
...
shelf:: Pseudo instructions: equ Types of labels: Named values Labels: EQUequ foo+1 ; global
Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#endlocal
zasm supports the 'recyclable' Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabels used by sdcc:
foo::
...
123$: nop
jp 123$
jp 199$
199$: nop
...
bar::
...
123$: nop
...
The name of a reusable label is only valid in the range between two normal Types of labels: Program labels Types of labels: Program labelsprogram labels. The naming scheme is a little but unlucky. Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endifIf you put a dollar sign '$' after a number it becomes a Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel name. :-/
|