beautypg.com

Maxq610 user’s guide – Maxim Integrated MAXQ610 User Manual

Page 172

background image

14-5

MAXQ610 User’s Guide

{L/S}CALL src

{Long/Short} Call to Subroutine

Description:

Performs a call to the subroutine destination specified by src . The CALL instruction uses an 8-bit
immediate src to perform a relative short call (IP +127/-128 words) . The CALL instruction uses a
16-bit immediate src to perform an absolute long CALL to the specified 16-bit address . The PFX[0]
register is used to supply the high byte of a 16-bit immediate address for the absolute long CALL .
Using the optional ‘L’ prefix (i .e ., LCALL) will result in an absolute long call and use of the PFX[0]
register . Using the optional ‘S’ prefix (i .e ., SCALL) will attempt to generate a relative short call, but
will be flagged by the assembler if the destination is out or range . Specifying an internal register
src (no matter whether 8-bit or 16-bit) always produces an absolute CALL to a 16-bit address, thus
the ‘L’ and ‘S’ prefixes should not be used . The PFX[n] register value is used to supply the high
address byte when an 8-bit register src is specified .

Status Flags:

None

Operation:

@++SP

← IP + 1

PUSH

IP

src

Absolute CALL

IP

← IP + src

Relative CALL

Encoding:

15

0

f011

1101

ssss

ssss

Example(s):

CALL label1

; relative call to label1 (must be within
; IP +127/-128 address range)

CALL label1

; absolute call to label1 = 0120h
; MOVE PFX[0], #01h
; CALL #20h .

CALL DP[0]

; DP[0] holds 16-bit address of subroutine

CALL M0[0]

; assume M0[0] is an 8-bit register
; absolute call to addr16
; high(addr16)=00h (PFX[0])
; low (addr16)=M0[0]

MOVE PFX[0], #22h

;

CALL M0[0]

; assume M0[0] is an 8-bit register
; high(addr16)=22h (PFX[0])
; low (addr16)=M0[0]

LCALL label1

; label=0120h and is relative to this instruction
; absolute call is forced by use of ‘L’ prefix
; MOVE PFX[0], #01h
; CALL #20h

SCALL label1

; relative offset for label1 calculated and used
; if label1 is not relative, assembler will generate an
; error

SCALL #10h

; relative offset of #10h is used directly by the CALL