Intel 8XC196MC Microscope & Magnifier User Manual


 
8XC196MC, MD, MH USER’S MANUAL
3-10
To use these registers effectively, you must have some overall strategy for allocating them. The
C programming language adopts a simple, effective strategy. It allocates the eight bytes beginning
at address 1CH as temporary storage and treats the remaining area in the register file as a segment
of memory that is allocated as required.
NOTE
Using any SFR as a base or index register for indirect or indexed operations
can cause unpredictable results because external events can change the
contents of SFRs. Also, because some SFRs are cleared when read, consider
the implications of using an SFR as an operand in a read-modify-write
instruction (e.g., XORB).
3.4.2 Addressing 32-bit Operands
The 32-bit operands (DOUBLE-WORDs and LONG-INTEGERs) are formed by two adjacent
16-bit words in memory. The least-significant word of a DOUBLE-WORD is always in the lower
address, even when the data is in the stack (which means that the most-significant word must be
pushed into the stack first). The address of a 32-bit operand is that of its least-significant byte.
The hardware supports the 32-bit data types as operands in shift operations, as dividends of 32-
by-16 divide operations, and as products of 16-by-16 multiply operations. For these operations,
the 32-bit operand must reside in the lower register file and must be aligned at an address that is
evenly divisible by four.
3.4.3 Linking Subroutines
Parameters are passed to subroutines via the stack. Parameters are pushed into the stack from the
rightmost parameter to the left. The 8-bit parameters are pushed into the stack with the high-order
byte undefined. The 32-bit parameters are pushed into the stack as two 16-bit values; the most-
significant half of the parameter is pushed into the stack first. As an example, consider the fol-
lowing procedure:
void example_procedure (char param1, long param2, int param3);
When this procedure executes at run-time, the stack will contain the parameters in the following
order:
param3
low word of param2
high word of param2
undefined;param1
return address Stack Pointer