Keil Logo

ASSUME Assembler Statement

Arguments
ASSUME DPPn: { NOTHING | SYSTEM | group | label | section }
ASSUME NOTHING
Description

The ASSUME statement specifies the run-time contents of data page pointer 0-3 (DPPn). The assembler uses this information to correctly address variables. The ASSUME statement does not initialize the DPP registers. It is used to ensure the assembler consistently addresses data.

The assembler reports an error when an instruction operand is found with no DPP or explicit page override operator. The ASSUME statement provides the required information to generate page override instructions to the assembler prefix.

The ASSUME statement requires a DPP register (DPP0-DPP3) along with an argument.

Argument Description
NOTHING resets prior ASSUME statements for the specified DPP register. The assembler marks the DPP as invalid. To mark all DPP registers as invalid, you may specify ASSUME NOTHING.
SYSTEM specifies that accesses to the SYSTEM area use the specified DPP register. The SYSTEM are includes the Special Function Registers (SFRs) which are located in on-chip memory. SFRs are typically predefined in the assembler and are not defined using normal sections. SFR are accessed using data page pointers, so an associated DPP register is required.
group specifies that references to variables in sections that are members of the group use the specified DPP register.
label specifies that references to label (where label may be a variable) use the specified DPP register.
section specifies that references to variables in section use the specified DPP register.

All ASSUMEs are valid until they are invalidated (using the NOTHING argument) or until a new ASSUME is made.

Data page information may be provided by an explicit page override. For example:

MOV R15, DPP1: V1   ; Use DPP1 to access the V1 variable

Note

  • Explicit page overrides should be avoided since they increase program complexity and create problematic software maintenance issues. For example, if the configuration or location of a section or group changes, every explicit page override must be modified manually. This is not the case if the ASSUME statement is used properly.
Example
                  1 $SEGMENTED
                  2
                  3 GDATA   DGROUP  D100, D200
                  4 GCODE   CGROUP  C100
                  5
                  6 D100    SECTION DATA
0000              7 V1      DSW     1
                  8 D100    ENDS
                  9
                 10 D200    SECTION DATA
0000             11 V2      DSW     1
                 12 D200    ENDS
                 13
                 14 C100    SECTION CODE PUBLIC 'ROM1'
                 15 P100    PROC    NEAR
                 16 ASSUME  DPP2 : D200
0000 E6020000 R  17         MOV     DPP2,#PAG D200 ; Get page of 'D200'
0004 CC00        18         NOP                    ; Pipeline delay
0006 F2FF0000 R  19         MOV     R15,V2         ; DPP2 used to reference V2
                 20
                 21         MOV     P1,P2          ; Move P2 to P1
*** ___________________________________^
*** ERROR #77, LINE #21, MISSING 'DPP' INFORMATION
                 22                                ; Error: No Associated DPP!
                 23 ASSUME  DPP3 : SYSTEM          ; ASSUME for SFR's
000E E6030300    24         MOV     DPP3,#PAG P1   ; Page 3 is the system page
0012 CC00        25         NOP                    ; Pipeline delay
0014 F282C0FF    26         MOV     P1,P2          ; This works now
                 27
                 28 ASSUME  DPP2 : GDATA           ; D100 & D200 now use DPP2
0018 E6020000 R  29         MOV     DPP2,#PAG GDATA
001C CC00        30         NOP
001E F2F10000 R  31         MOV     R1,V1
0022 02F10000 R  32         ADD     R1,V2
0026 F6F10000 R  33         MOV     V2,R1
                 34 P100    ENDP
                 35 C100    ENDS
                 36
                 37         END
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.