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).[1]
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.[1]
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

  1. 1 2 Taylor, Roger; Lemmons, Phil (June 1982). "Upward migration - Part 1: Translators - Using translation programs to move CP/M-86 programs to CP/M and MS-DOS" [Using translation programs to move CP/M programs to CP/M-86 and MS-DOS] (PDF). BYTE. Vol. 7, no. 6. BYTE Publications Inc. pp. 321–322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344 [342, 344]. ISSN 0360-5280. CODEN BYTEDJ. Archived (PDF) from the original on 2020-01-16. Retrieved 2020-01-15. […] Gaining Access to CP/M-86 […] Gaining access to CP/M-86 requires placing the function code in the CL register, placing the byte parameter in the DL register or placing the word parameter in the DX register, placing the data segment in the DS register (the data segment is usually not changed for a converted program), and executing a software interrupt, INT #224. The result is returned in the AL register if it is a byte value; if the result is a word value, it is returned in both the AX and BX registers. Double-word values are returned with the offset in the BX registers and the segment in the ES register. Conversion of programs from CP/M-80 to CP/M-86, then, requires replacing the call to location 5 with the software interrupt INT #224. Another necessary change involves the warm boot. Under CP/M-80, the warm boot may be accessed by a system call with a function code of 0 for a jump to location 0. CP/M-86, however, does not support the jump to location 0. As a result, you must change this program exit in the translated program if the program is to run correctly. Provided that the call to location 5 is replaced with INT #224, that the warm boot change is made, and that the registers are mapped correctly, there should be little problem in getting the translated program to access the CP/M-86 system functions. […] Gaining Access to MS-DOS […] Although MS-DOS has a "preferred" mechanism through a soft-ware interrupt, INT #33, for accessing the system, an additional mechanism is provided for "preexisting" programs that is compatible with CP/M-80 calling conventions, at least for functions in the range of 0-36. As far as system calls within the allowed function range are concerned, the programmer doesn't have to do anything to translated programs to get them to run under MS-DOS other than to correctly map the registers. MS-DOS also supports the warm boot function of CP/M-80. A jump to location 0 under MS-DOS executes a software interrupt, INT #32, which is functionally a program end and the normal way to exit from a program. […] (13 pages)

Further reading


This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.