3-9
PROGRAMMING CONSIDERATIONS
3.3 ASSEMBLY LANGUAGE ADDRESSING MODE SELECTIONS
The assembly language simplifies the choice of addressing modes. Use these features wherever
possible.
3.3.1 Direct Addressing
The assembly language chooses between direct and zero-indexed addressing depending on the
memory location of the operand. Simply refer to the operand by its symbolic name. If the operand
is in the lower register file, the assembly language chooses a direct reference. If the operand is
elsewhere in memory, it chooses a zero-indexed reference.
3.3.2 Indexed Addressing
The assembly language chooses between short-indexed and long-indexed addressing depending
on the value of the index expression. If the value can be expressed in eight bits, the assembly lan-
guage chooses a short-indexed reference. If the value is greater than eight bits, it chooses a long-
indexed reference.
3.4 SOFTWARE STANDARDS AND CONVENTIONS
For a software project of any size, it is a good idea to develop the program in modules and to es-
tablish standards that control communication between the modules. These standards vary with the
needs of the final application. However, all standards must include some mechanism for passing
parameters to procedures and returning results from procedures. We recommend that you use the
conventions adopted by the C programming language for procedure linkage. These standards are
usable for both the assembly language and C programming environments, and they offer compat-
ibility between these environments.
3.4.1 Using Registers
The 256-byte lower register file contains the CPU special-function registers and the stack pointer.
The remainder of the lower register file and all of the upper register file is available for your use.
Peripheral special-function registers (SFRs) and memory-mapped SFRs reside in higher memory.
The peripheral SFRs can be windowed into the lower register file for direct access. Memory-
mapped SFRs cannot be windowed; you must use indirect or indexed addressing to access them.
All SFRs can be operated on as BYTEs or WORDs, unless otherwise specified. See “Special-
function Registers (SFRs)” on page 4-4 and “Register File” on page 4-9 for more information.