INSTRUCTION SET
S3C8248/C8245/P8245/C8247/C8249/P8249
6-26
CALL
—
Call Procedure
CALL
dst
Operation:
SP
←
SP – 1
@SP
←
PCL
SP
←
SP –1
@SP
←
PCH
PC
←
dst
The current contents of the program counter are pushed onto the top of the stack. The program
counter value used is the address of the first instruction following the CALL instruction. The
specified destination address is then loaded into the program counter and points to the first
instruction of a procedure. At the end of the procedure the return instruction (RET) can be used
to return to the original program flow. RET pops the top of the stack back into the program
counter.
Flags:
No flags are affected.
Format:
Bytes
Cycles
Opcode
(Hex)
Addr Mode
dst
opc
dst
3
14
F6
DA
opc
dst
2
12
F4
IRR
opc
dst
2
14
D4
IA
Examples:
Given: R0 = 35H, R1 = 21H, PC = 1A47H, and SP = 0002H:
CALL
3521H
→
SP = 0000H
(Memory locations 0000H = 1AH, 0001H = 4AH, where
4AH is the address that follows the instruction.)
CALL
@RR0
→
SP = 0000H (0000H = 1AH, 0001H = 49H)
CALL
#40H
→
SP = 0000H (0000H = 1AH, 0001H = 49H)
In the first example, if the program counter value is 1A47H and the stack pointer contains the
value 0002H, the statement "CALL 3521H" pushes the current PC value onto the top of the
stack. The stack pointer now points to memory location 0000H. The PC is then loaded with the
value 3521H, the address of the first instruction in the program sequence to be executed.
If the contents of the program counter and stack pointer are the same as in the first example, the
statement "CALL @RR0" produces the same result except that the 49H is stored in stack
location 0001H (because the two-byte instruction format was used). The PC is then loaded with
the value 3521H, the address of the first instruction in the program sequence to be executed.
Assuming that the contents of the program counter and stack pointer are the same as in the first
example, if program address 0040H contains 35H and program address 0041H contains 21H, the
statement "CALL #40H" produces the same result as in the second example.
Содержание S3C8248
Страница 31: ...ADDRESS SPACES S3C8248 C8245 P8245 C8247 C8249 P8249 2 20 NOTES ...
Страница 107: ...INTERRUPT STRUCTURE S3C8248 C8245 P8245 C8247 C8249 P8249 5 18 NOTES ...
Страница 195: ...INSTRUCTION SET S3C8248 C8245 P8245 C8247 C8249 P8249 6 88 NOTES ...
Страница 221: ...I O PORTS S3C8248 C8245 P8245 C8247 C8249 P8249 9 16 NOTES ...
Страница 245: ...16 BIT TIMER 0 1 S3C8248 C8245 P8245 C8247 C8249 P8249 12 10 NOTES ...
Страница 249: ...WATCH TIMER S3C8248 C8245 P8245 C8247 C8249 P8249 13 4 NOTES ...
Страница 267: ...A D CONVERTER S3C8248 C8245 P8245 C8247 C8249 P8249 15 6 NOTES ...
Страница 299: ...S3P8245 P8249 OTP S3C8248 C8245 P8245 C8247 C8249 P8249 21 8 NOTES ...
Страница 307: ......
Страница 309: ......
Страница 311: ......
Страница 313: ......
Страница 315: ...BOOK SPINE TEXT SAMSUNG Logo S3C8248 C8245 P8245 C8247 C8249 P8249 Microcontrollers User s Manual Rev 3 March 2002 ...