Zero page (CP/M)
From Wikipedia, the free encyclopedia
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 MS-DOS is the Program Segment Prefix.
In 8-bit CP/M, it has the following structure:
Offset Size Contents -------------------------------------------------------------------- 00-02 Code Exit program (jumps to the BIOS, and is also used to find BIOS entry points). 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. 08-3A Code 8080 restart/interrupt vectors. 3B-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).
In CP/M-86, the structure is:
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).
[edit] References
Tim Olmstead Memorial CP/M library - in particular, the CP/M 3 Programmers' Manual and the CP/M-86 System Guide.