Question: How do I use the LDX instruction ? Answer: LDX is not an actual machine instruction, but rather it is a special instruction understood by the assembler to be a special type of Load for extended addresses. To load/store an extended address (for example, of function f), the compiler will emit the following:
LDX #_f,16,A
OR #_f,A,A
DST A,*dst
The LDX will load the upper 8 bits of the 24-bit address of _f, and shift it into the upper part of accumlator A. The lower 16 bits of the address is then loaded into the accumulator via the OR instruction. Note that the shift operand on the LDX must be 16. If for some reason you want the upper address bits to be in the _lower_ part of accumulator A, you must perform a subsequent right shift on A. |
| Device: TMS320C5xx Category: Applications / Examples Detail: Examples |
Title: LDX instruction Source: Case from the TMS320 Hotline Date: 4/30/98 GenId: a2 |