Labels

There are three kinds of labels: 'Normal', Local and Anonymous labels.

Labels

Keeps track of address of the next instruction or data followed by it.
A regular label can only be declared once.
Syntax for declaring:
label:
Syntax for using:
Example:
jp label

Local Labels

Local label acts like a global label, but you can declare multiple local labels in your code.
Syntax for declaring:
$label:
label?:
Syntax for using:
Example:
jp $label
jp label?
Note: $label and label? are different local labels. Therefore you cannot declare label? and reference to it as $label or vice versa.

This is valid code:

main:

$main:

	SCOPE
$main:

main?:
		
This is not valid code since you cannot declare normal labels more than once regardless of the scope:
main:

	SCOPE

main:

;This code will assemble with errors.
		

Anonymous Labels

You use these for basic jumping. They cannot have a name hence 'anonymous labels.'
This type of label can be used an arbitrary amount of times in your code.
Syntax for declaring:
$$:
Syntax for using:
Example:
jr $F
jr $B

This is valid code:

$$:
	jr $F	;Jump Forward to the next anonymous label
		
main:
	jr $B	;Jump Backward to the previous anonymous label
$$:
	jp main
		

Example code

Labels

my_byte:
	DB 10h
my_string:
	ASCIZ "Zero terminated string\r\n"
main:
	ld R0,#HIGH(my_string)
	ld R1,#LOW(my_string)
	jp main
		


Please submit corrections, suggestions, and new documentation here: Submit a ticket
← Return to Reference Index
This is not an official Zilog website. Zilog nor 8times8 are liable for any damage done to equipment. Tutorial and reference copyright ©8times8 Creative Commons CC-0 License (public domain.) This reference uses content from Zilog's technical datasheets. Fair use only. Datasheets copyright © 2013 Zilog®, Inc. Z8, Z8 Encore!, Z8 Encore! XP and Z8 Encore! MC are trademarks or registered trademarks of Zilog, Inc. Read Zilog's terms at zilog.com

Website design by Koen van Vliet. Hosted by sourceforge.net