Ret And Rets Instructions; Stack Considerations For Call Instructions - Epson 6200A Core Cpu Manual

Core cpu cmos 4-bit single chip microcomputer
Table of Contents

Advertisement

The difference between CALL and CALZ is shown in Figure 2.1.7.2.
Bank 0
Bank 0
Page 3
CALZ
Bank 0
Page 1
Bank 0
Page 0
Step 0
Step 1
Step 254
Step 255

2.1.8 RET and RETS instructions

The RET instruction causes a return from a subroutine to the address immediately following the address
from where that subroutine was called. The RETS instruction causes a return to the address following this
address. Proper use of RET and RETS allows simple conditional exits subroutines back to the main routine.
See Figure 2.1.8.1.

2.1.9 Stack considerations for call instructions

When a subroutine is called, the return address is loaded into the stack and retrieved when control is
returned to the calling program. Nesting allows efficient usage of the stack area.
As the stack area resides in the data memory, care should be taken to ensure that the stack area is not
corrupted by other data.
S1C6200/6200A CORE CPU MANUAL
Bank 0
Page 15
Bank 0
Page 14
Step 0
Step 1
PSET
CALL
Step 254
Step 255
CALL and CALZ
cannot go
between banks
Fig. 2.1.7.2 The difference between CALL and CALZ instructions
Bank 0
Page 10
Program memory
DDD....................
RET
RETS
Fig. 2.1.8.1 Difference between RET and RETS instructions
CALL with PSET
can go anywhere
within a bank
Bank 1
Page 3
Bank 1
Page 1
Bank 1
Page 0
Step 0
Step 1
Step 254
Step 255
Bank 0
Page 0
Program memory
PSET
0AH
CALL
DDD
LD
A,0
LD
B,0
EPSON
2 MEMORY AND OPERATIONS
Bank 1
Page 15
Bank 1
Bank 1
Page 14
Step 0
Step 1
CALL
Step 254
Step 255
CALZ
CALL without PSET
can go anywhere
in a page
CALZ can only go to page 0
of the current bank
7

Advertisement

Table of Contents
loading

This manual is also suitable for:

S1c6200S1c6200a

Table of Contents