The Compact Memory Model; Cp/M-86 Compact Memory Model - NEC CP/M-86 System Reference Manual

Advanced personal computer
Table of Contents

Advertisement

Command Setup and Execution Under CPIM-86
2-6
The Compact Memory Model
The Compact Memory Model is assumed when code and data groups are present,
along with one or more of the stack, extra, or auxiliary groups. In this case, the CS,
DS, and ES registers are set to the base addresses of their respective areas. Figure
2-3 shows the initial configuration of segment registers in the Compact Model. The
segment register values can be changed during program execution by loading from
the initial values placed in base page by the CCP, thus allowing access to the entire
memory space.
SS:
CCP
SS
+
SP:
CCP Stack
CS:
IP
=
OOOOH
code
DS:
base
page
DS+OI00H:
data
ES:
data
Figure 2-3 CP/M-86 Compact Memory Model
Local stacks are required in programs that make BDOS calls since the BDOS may
change information in the system stack. If the transient program intends to use the
stack group as a stack area, registers SS and SP must be set upon entry. The SS and
SP registers remain set to the CCP area, even if a stack group is defined. Although it
may appear that the SS and SP registers should be set to address the stack group,
there are two reasons this cannot be done. First, the transient program may be using
the stack group as a data area. In that case, the Far Call instruction used by the CCP
to transfer control to the transient program could write over data in the stack area.
Second, the SS register would logically be set to the base of the group, while the SP
register would be set to the offset of the end of the group. However, if the stack
group exceeds 64K, the address range from the base to the end of the group could
exceed a 16-bit offset value.

Advertisement

Table of Contents
loading

Table of Contents