user manual

A-59
INSTRUCTION SET REFERENCE
Operation: DJNZ
(PC) (PC) + 2
(Rn) (Rn) – 1
IF (Rn) > 0 or (Rn) < 0
THEN
(PC) (PC) + rel
ECALL <dest>
Function: Extended call
Description: Calls a subroutine located at the specified address. The instruction adds four to the program
counter to generate the address of the next instruction and then pushes the 24-bit result
onto the stack (high byte first), incrementing the stack pointer by three. The 8 bits of the high
word and the 16 bits of the low word of the PC are then loaded, respectively, with the
second, third and fourth bytes of the ECALL instruction. Program execution continues with
the instruction at this address. The subroutine may therefore begin anywhere in the full 16-
Mbyte memory space.
Flags:
Example: The stack pointer contains 07H and the label “SUBRTN” is assigned to program memory
location 123456H. After executing the instruction
ECALL SUBRTN
at location 012345H, SP contains 0AH; on-chip RAM locations 08H, 09H and 0AH contain
01H, 23H and
45H, respectively; and the PC contains 123456H.
Variations
ECALL addr24
Binary Mode Source Mode
Bytes: 54
States: 14 13
Hex Code in: Binary Mode = [A5][Encoding]
Source Mode = [Encoding]
Operation: ECALL
(PC) (PC) + 4
(SP) (SP) + 1
((SP)) (PC.23:16)
(SP) (SP) + 1
((SP)) (PC.15:8)
(SP) (SP) + 1
((SP)) (PC.7:0)
(PC) (addr.23:0)
CY AC OV N Z
—————
[Encoding] 1 0 0 1 1 0 1 0 addr23–
addr16
addr15–addr8 addr7–addr0