Keil Logo

SOF Assembler Operator

Arguments
SOF operand


Description

The SOF (Segment Offset) operator returns the 16-bit offset of operand from the base address of the 64K segment in which it is defined. SOF may not be applied to group names.

The primary use for the SOF operator is loading the peripheral event controller (PEC) source and destination addresses. The PEC unit works with linear addresses and does not use DPP register for memory access. Therefore, the SOF operator must be used to obtain linear addresses.

The operand must be the name of a variable, section, special function register (SFR), or register bank. If SOF is used on system names (SFRs), the result is the absolute offset relative to segment 0.

See Also

BOF, POF

Example
                  1    D100    SECTION DATA
0000              2      V1    DSW     20
0028 0000 R       3      V2    DW      SOF V1        ; segment offset of V1
002A 0000 R       4      V3    DW      PAG V1        ; page offset of V1
                  5    D100    ENDS
                  6
                  7    DSTP7   EQU     0FDFEh
                  8
                  9    C100    SECTION CODE
                 10    P100    PROC    NEAR
0000 E6F80000 R  11            MOV     R8,#SOF V1    ; segment offset
0004 F6F8FEFD    12            MOV     DSTP7,R8      ; destination for PECC7
0008 E6F50000 R  13            MOV     R5,#SOF P100  ; SOF of parent procedure
                 14    P100    ENDP
                 15    C100    ENDS
                 16            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.