<--  back   Last regenerated: 2022-04-20 17:31:36 kio

zasm - Z80 Assembler – Version 4.4

Including C Source Files

#local, #endlocal, .local and .endlocal

This defines a Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
local scope for normal label definitions. This way you can safely use 'standard' names for jump targets in included files without worrying about name collissions. You can still push Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels to the global scope though.

Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local contexts can be nested.

#insert: Examples:
#assert: Example:
incbin: Examples:
#assert: Example:
Example: Wrap an included source file to avoid Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label name conflicts.
Note: zasm does this automatically for c files, but not for assembler files:

Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local Assembler directives: #include
Including C Source Files: #include
#include "util/u.asm" Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#endlocal

Define global variables from inside a Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local context:

Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local boo:: ld a,0 ; '::' makes 'boo' global .globl fax fax: ret ; 'fax' is now also global #define bar 4711 ; Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels defined with #define are also 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

Note: used but locally undefined Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels are automatically pushed to the surrounding scope by Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#endlocal and will finally reach the global scope, Assembler directives: #if, #elif, #else, #endif
Pseudo instructions: if, endif
if they were not defined in an intermediate surrounding Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local scope. There they can be picked up and resolved by the #include: #include library
#include: #include library
#include library
directive.

The .globl Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction can also be used to make sure that a certain Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label is global and not accidentially defined in a surrounding Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local scope.

In some cases you need Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
labels to be resolved in pass 1, e.g. for #IF <cond> or for .Pseudo instructions: rept, .rept, endm and .endm
8080 pseudo instructions: REPT
rept
. Then you run into problems when you refer to global labels from within a Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
#local scope: zasm does not know for shure, whether it should use the valid global label, because a Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
local Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label with this name still might be defined after this point of use. Therefore all references to global labels from within a Assembler directives: #local, #endlocal, .local and .endlocal
Pseudo instructions: #local, #endlocal, .local and .endlocal
Including C Source Files: #local, #endlocal, .local and .endlocal
local scope are never valid in pass 1.
To solve this problem you can declare this Pseudo instructions: Label definition
Numeric expressions: Labels
8080 Assembler: Labels
label global using the .global Pseudo instructions
8080 Assembler: 8080 pseudo instructions
pseudo instruction.

Valid HTML   Valid CSS