Keil Logo

Expressions Example

EXTRN CODE (CLAB)                 ; entry in CODE space
EXTRN DATA (DVAR)                 ; variable in DATA space

MSK     EQU   0F0H                ; define a symbol to replace 0xF0
VALUE   EQU   MSK - 1             ; another constant symbolic value

?PR?FOO SEGMENT CODE
        RSEG  ?PR?FOO

ENTRY:  MOV  A,#40H               ; load register with constant
        MOV  R5,#VALUE            ; load constant symbolic value
        MOV  R3,#(0x20 AND MASK)  ; examples for calculations
        MOV  R7,#LOW (VALUE + 20H)
        MOV  R6,#1 OR (MSK SHL 4)

        MOV  R0,DVAR+20           ; load content from address DVAR+20
        MOV  R1,#LOW (CLAB+10)    ; load low byte of address CLAB+10
;
        MOV  R5,80H               ; load DATA addr. 80H (= SFR P0) to R5
        SETB 20H.2                ; set bit at 20H.2 (short address)

        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.