Zero page (CP/M)

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 structure, which, however, is by default located at offset 0 in the program's load segment (rather than in segment 0) immediately preceding a loaded program.

In 8-bit CP/M, it has the following structure:

Offset Size Contents
00-02CodeExit program (jumps to the BIOS, and is also used to find BIOS entry points).
03ByteI/O byte, an optional feature allowing device reassignment in CP/M 2.
04ByteCurrent command processor drive (low 4 bits) and user number (high 4 bits).
05-07CodeJump 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.
08-3ACode8080 restart/interrupt vectors.
3B-4FBytesReserved
50ByteThe drive from which the program was loaded (CP/M 3)
51-52WordAddress of the password for the first FCB (CP/M 3)
53ByteLength of the password for the first FCB (CP/M 3)
54-55WordAddress of the password for the second FCB (CP/M 3)
56ByteLength of the password for the second FCB (CP/M 3)
57-5BBytesReserved
5C-6BDefault FCB 1
6C-7FDefault FCB 2 (overwritten if FCB 1 is opened)
80ByteNumber of characters in command tail.
81-FFBytesCommand tail (everything after the program name).

In CP/M-86, the structure is:

Offset Size Contents
00-02BytesLength of code group in bytes
03-04WordSegment address of code group
05Byte8080 model flag - set if program only has one segment
06-08BytesLength of data group in bytes
09-0AWordSegment address of data group
0BByteReserved
0C-11Descriptor for extra group - same format as for data
12-17Descriptor for stack group
18-1DDescriptor for X1 group
1E-23Descriptor for X2 group
24-29Descriptor for X3 group
2A-2FDescriptor for X4 group
30-4FBytesReserved
50ByteThe drive from which the program was loaded (CP/M 3)
51-52WordAddress of the password for the first FCB (CP/M 3)
53ByteLength of the password for the first FCB (CP/M 3)
54-55WordAddress of the password for the second FCB (CP/M 3)
56ByteLength of the password for the second FCB (CP/M 3)
57-5BBytesReserved
5C-6BDefault FCB 1
6C-7FDefault FCB 2 (overwritten if FCB 1 is opened)
80ByteNumber of characters in command tail.
81-FFBytesCommand tail (everything after the program name).

See also

References

  • "Tim Olmstead Memorial CP/M library". Archived from the original on 2017-08-20. Retrieved 2017-08-20. - in particular:
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.