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

# zasm - Z80 Assembler – Version 4.4

# Pseudo instructions

[<prev] [next>]

| ### .globl
        .globl
For the sake of sdcc: Declare the named Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label to be global. The Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label is either defined in the current 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 after this declaration or it is referenced there. Undefined global labels can be picked up later by the '#include: #include library #include: #include library#include library' assembler directive. ##### Define a global label
    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 foo
            ...
    foo:    nop
            ...
    Assembler directives: #local, #endlocal, .local and .endlocal
    Pseudo instructions: #local, #endlocal, .local and .endlocal
    Including C Source Files: #local, #endlocal, .local and .endlocal#endlocal
The same effect can be achieved by putting two colons after the label definition:
    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
            ...
    Assembler directives: #local, #endlocal, .local and .endlocal
    Pseudo instructions: #local, #endlocal, .local and .endlocal
    Including C Source Files: #local, #endlocal, .local and .endlocal#endlocal
##### Refer to a global label
    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 foo
            ...
            jp  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
Unless you have a nested 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, this is identically to:
    Assembler directives: #local, #endlocal, .local and .endlocal
    Pseudo instructions: #local, #endlocal, .local and .endlocal
    Including C Source Files: #local, #endlocal, .local and .endlocal#local
            ...
            jp  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
In almost all cases the .globl declaration is superfluous. zasm automatically adds the Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label to the list of undefined 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 labels and pushes it at each Assembler directives: #local, #endlocal, .local and .endlocal Pseudo instructions: #local, #endlocal, .local and .endlocal Including C Source Files: #local, #endlocal, .local and .endlocal#endlocal to the outer context until it finds a context where it is defined – finally the global context where it can be picked up by the '#include: #include library #include: #include library#include library' assembler directive Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif if it is still undefined then. Actually all references to symbols in system libraries as included by the c compiler are handled this way, without the need to define them all ahead. .globl is useful in nested 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 where the same name might be defined in an outer but not the global context. .globl may also be useful Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif if you want to redefine a redefinable Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label. 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 it is impossible to redefine a Pseudo instructions: Label definition Numeric expressions: Labels 8080 Assembler: Labels label, because this would define a new 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 instead, except Assembler directives: #if, #elif, #else, #endif Pseudo instructions: if, endif if you define it .globl.
    foo     defl    0
            ...
    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  foo
    foo     defl    1
            ...
    Assembler directives: #local, #endlocal, .local and .endlocal
    Pseudo instructions: #local, #endlocal, .local and .endlocal
    Including C Source Files: #local, #endlocal, .local and .endlocal#endlocal

[<prev] [top] [next>]