CALL

 

CALL        addr8                Call subroutine ('5x)


Words:        1        Cycles:        2                Affects:        none

 

'5x Operation:        The next instruction address is pushed onto the stack and addr8 is moved to the program counter  bits 0-7(PC ). The 9th bit of the program counter will always be cleared. Therefore, calls are only allowed to the first half of any 512-word page. The CALL instruction can be anywhere, but the address being called MUST be an 8bit address. If the device you are targeting has more than 512 words of code space, you will need to load the page pre-select bits ( status 5,6) to the proper value before executing the CALL.  See LCALL , LSET for '5x devices.

 

Coding:        CALL                addr8

 

 

CALL        addr11                Call subroutine ('xx)


Words:        1        Cycles:        2                Affects:        none

 

'xx Operation:        The next instruction address is pushed onto the stack and addr11 is moved to the program counter  bits 0-10 (PC ). The upper bits (11,12) of the program counter will be loaded from PCLATH (3,4).  Therefore, it is up to the user to pre-load PCLATH with the correct values BEFORE a CALL is initiated. This can be done easily by using the  LSET instruction  (for 'xx devices )  before CALL,  or simply using the LCALL instruction ( in place of CALL ),  which will set the PCLATH bits for you.  If your program appears to 'jump' to the wrong code page when executing a call, your PCLATH bits are probably incorrect.

 

Coding:        CALL                addr11