Samsung KS57C2308 Call Call Procedure, Call Operation, Operand Operation Summary Bytes Cycles

Models: KS57C2308

1 328
Download 328 pages 46.55 Kb
Page 119
Image 119

KS57C2308/P2308/C2316/P2316

SAM47 INSTRUCTION SET

 

 

CALL — Call Procedure

CALL Operation:

dst

Operand

Operation Summary

Bytes

Cycles

 

 

 

 

ADR14

Call direct in page (14-bits)

3

4

 

 

 

 

Description: CALL calls a subroutine located at the destination address. The instruction adds three to the program counter to generate the return address and then pushes the result onto the stack, decreasing the stack pointer by six. The EMB and ERB are also pushed to the stack. Program execution continues with the instruction at this address. The subroutine may therefore begin anywhere in the full 16-Kbyte program memory address space.

Operand

 

 

 

Binary Code

 

 

 

Operation Notation

 

 

 

 

 

 

 

 

 

 

 

 

ADR14

1

1

0

 

1

1

 

0

1

1

[(SP–1) (SP–2)] EMB, ERB

 

 

 

 

 

 

 

 

 

 

 

 

 

0

1

a13

 

a12

a11

 

a10

a9

a8

[(SP–3) (SP–4)] PC7–0

 

 

 

 

 

 

 

 

 

 

 

[(SP–5) (SP–6)] PC13-8

 

 

 

 

 

 

 

 

 

 

 

 

 

a7

a6

a5

 

a4

a3

 

a2

a1

a0

PC13–0 ADR13–0

 

 

 

 

 

 

 

 

 

 

 

(SP) (SP)–6

 

 

 

 

 

 

 

 

 

 

 

 

Example: The stack pointer value is 00H and the label “PLAY” is assigned to program memory location 0E3FH. Executing the instruction

CALL PLAY

at location 0123H will generate the following values:

SP

=

0FAH

0FFH

=

0H

0FEH

=

EMB, ERB

0FDH

=

2H

0FCH

=

6H

0FBH

=

0H

0FAH

=

1H

PC

=

0E3FH

Data is written to stack locations 0FFH–0FAH as follows:

SP – 6 (0FAH)

 

PC11–PC8

 

 

 

 

 

 

 

 

SP – 5 (0FBH)

0

0

PC13

PC12

 

 

 

 

 

 

 

SP – 4 (0FCH)

 

PC3–PC0

 

 

 

 

 

 

 

SP – 3 (0FDH)

 

PC7–PC4

 

 

 

 

 

 

 

 

SP – 2 (0FEH)

0

0

EMB

ERB

 

 

 

 

 

 

 

SP – 1 (0FFH)

0

0

0

0

 

SP (00H)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

5-45

Page 119
Image 119
Samsung KS57C2308 manual Call Call Procedure, Call Operation, Operand Operation Summary Bytes Cycles