A166 User's Guide

REGDEF Assembler Statement

Arguments
<[>name<]> REGDEF range <[>, ...<]>
Description

All sixteen of the XC16x/C16x/ST10 General Purpose Registers (GPRs) are mapped to on-chip RAM. This allows register context switching by setting the Context Pointer (CP) Register to point to a new register bank (which may be created using the REGDEF statement).

The REGDEF statement creates a register bank with an optional name and a range of registers used.

The range may be specified as:

Rm <[>-Rn<]> <[>, ...<]>

Where

Rmis the starting register (R0-R15).
Rnis the ending register (R0-R15) which must be greater than Rm.

The linker processes register banks as data sections located in internal RAM (0FA00h-0FDFFh).

Note

  • REGDEF has been implemented for compatiblity with other XC16x/C16x/ST10 development tools. When you create new applications you should use REGBANK instead.
See Also

REGBANK

Example
                      1  $SEGMENTED
                      2
                      3          BANK1   REGDEF R0-R15
                      4
--------              5  C100    SECTION CODE PUBLIC 'ROM1'
                      6  INIT    PROC    FAR
                      7  ASSUME  DPP3:   SYSTEM
00000000 E6030300     8          MOV     DPP3,#PAG CP
00000004 CC00         9          NOP
00000006 C608???? R  10          SCXT    CP,#BANK1   ; Switch context pointer
0000000A CC00        11          NOP                 ; Pipeline delay
0000000C E6FF3412    12          MOV     R15,#1234H  ; Access to GPR's now valid
00000010 DB00        13          RET
                     14  INIT    ENDP
--------             15  C100    ENDS
                     16
                     17  END