|
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 .endlocallocal 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: Labelslabels 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: Labelslabel 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: Labelslabels 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: Labelslabels 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, endifif 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 instructionspseudo instruction can also be used to make sure that a certain Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel 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: Labelslabels to be resolved in pass 1, e.g. for #IF <cond> or for .Pseudo instructions: rept, .rept, endm and .endm 8080 pseudo instructions: REPTrept. 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 .endlocallocal Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel 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 .endlocallocal scope are never valid in pass 1. To solve this problem you can declare this Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labelslabel global using the .global Pseudo instructions 8080 Assembler: 8080 pseudo instructionspseudo instruction.
| |