A label gives a readable name to a place in assembly code. Use the name as the destination of a jump, branch, or subroutine call, and let the assembler calculate the machine-code address during compilation. This avoids hard-coding addresses and keeps code easier to change. section 4.4.1 section 4.4.4
Define a normal label with alphanumeric characters that do not begin with a number, followed by a colon. Reference it without the colon. Label case does not matter. section 4.4.4
Jumping to named code
`jmp NEWCODE` transfers execution to the instruction immediately after `NEWCODE:`. The label marks the destination without requiring its numeric memory address. section 4.4.4
Choose label scope to keep names manageable:
- Use normal named labels for destinations that need a clear, reusable name. section 4.4.4
- Use `.proc` and `.endproc` to place labels inside a separate procedure scope, preventing clashes with labels in other code. section 4.4.4
- Use cheap local labels beginning with `@` for short loops; they remain valid only until the next normal label. section 4.4.4
- Use unnamed labels with `:` and relative references such as `:-` or `:++` for nearby control flow. section 4.4.4
Branches can also target labels, but their destination must remain within the instruction’s limited forward or backward range. The assembler reports an Out of Range error when a branch cannot reach its label. section 4.4.2
Listing 4.25 Example cheap local label
ClearMemory: #1
lda #$00
ldy #$20
@Loop:
dey
sta Mem,y
bne @Loop
rts
Sub: #2
bne @Loop #3
Inspect how `@Loop` works inside `ClearMemory:` and why it cannot be referenced after the later `Sub:` label starts a new scope. section 4.4.4
Meaningful names can also stand for fixed NES values. Define a register or controller value once, then use its name throughout the program while the assembler substitutes the actual value. section 5.3


