User’s Manual
C166S V1 SubSystem
Central Processing Unit
User’s Manual
3-61
V 1.6, 2001-08
3.6.3
The System Stack
A system stack is provided to store return vectors, segment pointers, and processor
status for procedures and interrupt routines.
The internal system stack can also be used to store data temporarily, or pass it between
subroutines or tasks. Instructions are provided to push or pop registers on/from the
system stack. However, in most cases, the register banking scheme provides the best
performance for passing data between multiple tasks.
Note: The system stack allows the storage of words only. Bytes must either be
converted to words or the “unwanted” other byte must be disregarded.
Register SP can be loaded only with even byte addresses (The LSB of SP is
always 0).
The Stack Pointer (SP) addresses the stack within the DPRAM area.
The Stack Pointer Register
The non-bit-addressable Stack Pointer (SP) register is used to point to the Top Of the
System (TOS) stack. The SP register is pre-decremented whenever data is to be pushed
onto the stack, and it is post-incremented whenever data is to be popped from the stack.
Therefore, the system stack grows from higher toward lower memory locations.
Since the Least Significant Bit (LSB) of register SP is tied to 0, and bits 15-12 are tied to
1 by hardware, the SP register can contain values only from F000
H
to FFFE
H
. This
allows access to a physical stack within the DPRAM of the C166S. A virtual stack
(usually bigger) can be implemented via software. This mechanism is supported by
registers STKOV and STKUN (see descriptions below (
Section 3.6.3.1
).
The SP register can be updated via any instruction that is capable of modifying a 16-bit
SFR.
Note: Due to the internal instruction pipeline, a POP or RETurn instruction must not
immediately follow an instruction updating the SP register.
SP
Stack Pointer
SFR(FE12
H
,09
H
)
Reset value: FC00
H
15
14
13
12
11
10
9
8
7
6
5
4
3
2
1
0
1111
SP
0
r
rwh
r
Содержание C166S V1 SubSystem
Страница 10: ...User s Manual C166S V1 SubSystem User s Manual I 6 V 1 6 2001 08...
Страница 16: ...User s Manual C166S V1 SubSystem Introduction User s Manual 1 6 V 1 6 2001 08...
Страница 126: ...User s Manual C166S V1 SubSystem Central Processing Unit User s Manual 3 96 V 1 6 2001 08...
Страница 178: ...User s Manual C166S V1 SubSystem Memory Organization User s Manual 4 52 V 1 6 2001 08...
Страница 206: ...User s Manual C166S V1 SubSystem Instruction Set User s Manual 5 28 V 1 6 2001 08...
Страница 306: ...User s Manual C166S V1 SubSystem Detailed Instruction Set User s Manual 6 100 V 1 6 2001 08...
Страница 362: ...User s Manual C166S V1 SubSystem The External Bus Interface User s Manual 8 40 V 1 6 2001 08...
Страница 452: ...User s Manual C166S V1 SubSystem General Purpose Timer Unit User s Manual 12 44 V 1 6 2001 08...
Страница 454: ...User s Manual C166S V1 SubSystem Instruction Index User s Manual 13 2 V 1 6 2001 08...
Страница 459: ......