The Zero Page (or Base Page) is a data structure used in CP/M systems for programs to communicate with the operating system. In 8-bit CP/M versions it is located in the first 256 bytes of memory, hence its name.
The equivalent structure in DOS is the Program Segment Prefix (PSP), a 256-byte (page-sized) structure, which is by default located exactly before offset 0 of the program's load segment, rather than in segment 0. A segment register is initialised to 0x10 less than the code segment, in order to address it.
In 8-bit CP/M, it has the following structure:
More information Offset, Size ...
Offset |
Size |
Contents |
00–02 | Code | Exit program (jumps to the BIOS, and is also used to find BIOS entry points).[1] |
03 | Byte | I/O byte, an optional feature allowing device reassignment in CP/M 2. |
04 | Byte | Current command processor drive (low 4 bits) and user number (high 4 bits). |
05–07 | Code | Jump to CP/M BDOS entry - main system call entry point. This is also the address of the first byte of memory not usable by the program.[1] |
08–3A | Code | 8080 restart/interrupt vectors. |
3B–3F | Bytes | Reserved |
40–4F | Bytes | Reserved for use by the BIOS[2] |
50 | Byte | The drive from which the program was loaded (CP/M 3) |
51–52 | Word | Address of the password for the first FCB (CP/M 3) |
53 | Byte | Length of the password for the first FCB (CP/M 3) |
54–55 | Word | Address of the password for the second FCB (CP/M 3) |
56 | Byte | Length of the password for the second FCB (CP/M 3) |
57–5B | Bytes | Reserved |
5C–6B | | Default FCB 1 |
6C–7F | | Default FCB 2 (overwritten if FCB 1 is opened) |
80 | Byte | Number of characters in command tail. |
81–FF | Bytes | Command tail (everything after the program name). |
Close
In CP/M-86, the structure is:
More information Offset, Size ...
Offset |
Size |
Contents |
00–02 | Bytes | Length of code group in bytes |
03–04 | Word | Segment address of code group |
05 | Byte | 8080 model flag - set if program only has one segment |
06–08 | Bytes | Length of data group in bytes |
09–0A | Word | Segment address of data group |
0B | Byte | Reserved |
0C–11 | | Descriptor for extra group - same format as for data |
12–17 | | Descriptor for stack group |
18–1D | | Descriptor for X1 group |
1E–23 | | Descriptor for X2 group |
24–29 | | Descriptor for X3 group |
2A–2F | | Descriptor for X4 group |
30–4F | Bytes | Reserved |
50 | Byte | The drive from which the program was loaded (CP/M 3) |
51–52 | Word | Address of the password for the first FCB (CP/M 3) |
53 | Byte | Length of the password for the first FCB (CP/M 3) |
54–55 | Word | Address of the password for the second FCB (CP/M 3) |
56 | Byte | Length of the password for the second FCB (CP/M 3) |
57–5B | Bytes | Reserved |
5C–6B | | Default FCB 1 |
6C–7F | | Default FCB 2 (overwritten if FCB 1 is opened) |
80 | Byte | Number of characters in command tail. |
81–FF | Bytes | Command tail (everything after the program name). |
Close