English
Language : 

45111 Datasheet, PDF (69/184 Pages) List of Unclassifed Manufacturers – 14-DAY MONEY BACK GUARANTEE
7 The SASM Assembler
loop_count
index
EQU 10
EQU $08
defines the symbol loop_count to be equal to the number 10, and the symbol index to be equal to the
hexadecimal number 08. During assembly, everywhere the symbol loop_count appears in the code, the
number 10 will be used. Similarly, the hexadecimal number 08 will be used in place of the symbol index
during assembly.
Symbols are a great way to define names for registers and constants that would otherwise appear in
many places of a program as just non-descriptive numbers. Assembly code that makes ample use of
symbols is easier to read and debug and requires fewer comments.
The = directive also assigns values to symbols, but unlike EQU, can reassign values to those symbols.
This directive is useful in macros or repeat blocks to create assemble-time variables.
For example:
Count
ORG
REPT
ENDR
=0
$20
5
DW Count + 1 * 2
Count = Count + 3
stores the values 2, 8, 14, 20 and 26 in memory locations $20 through $24 at assemble-time.
7.6 Labels
Labels are descriptive names that are given to sections of code. Similar to symbol names, label names
can consist of up to 32 alphanumeric and underscore (_) characters and must start with a letter or
underscore. SASM expects labels to begin at column 1 of the program line, unless the Local Labels Must
Start In Col. 1 checkbox is unchecked in the Configure dialog. Labels are used to direct code execution to
specific routines, and are defined simply by specifying the label name before the routine. For example:
Main
mov index, #15
jmp main
defines the label Main to point at the first line of code. Later in the program (the second line in this
example) to continue execution back at the first line, the jump command is used with the argument
Main. This is usually read as, “jump to Main.”
There are three types of labels: global, local, and macro. A global label is one that is unique for the entire
length of the code. No two global labels can exist with the same name. A local label is one that is unique
for only a portion of the code and must begin with a colon (:). A local label can have the same name as
one or more other local labels in a program but they must be separated by at least one global or macro
SX-Key/Blitz Development System Manual 2.0 • Parallax, Inc. • Page 69