CALL

Call Subroutine

Call Subroutine. First, return address (PC+1) is pushed onto the stack. The eleven-bit immediate address is loaded into PC bits <10:0>. The upper bits of the PC are loaded from PCLATH. CALL is a two-cycle instruction.

[the_ad id=”3059″]

Syntax:

[ label ] CALL k

Operation:

(PC)+ 1→ TOS,
k → PC<10:0>,
(PCLATH<4:3>) → PC<12:11>

Operands:

  •  k is from 0 to 2047 (decimal)

Status Affected: None

Example:

Note: SUB1 must have a RETURN statement to pop-out the PC of the caller from the stack.

[the_ad id=”3059″]