Make your own free website on

CP/M Plus (CP/M® Version 3) Operating System Programmer's Guide


Copyright ©1983 Digital Research Inc. All rights reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any language or computer language, in any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise, without the prior written permission of Digital Research Inc., 60 Garden Court, Box DRI, Monterey, California 93942.


DIGITAL RESEARCH INC. MAKES NO REPRESENTATIONS OR WARRANTIES WITH RESPECT TO THE CONTENTS HEREOF AND SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE. Further, Digital Research Inc. reserves the right to revise this publication and to make changes from time to time in the content hereof without any person of such revision or changes.


From time to time changes are made in the filenames and in the files actually included on the distribution disk. This manual should not be construed as a representation or warranty that such files or facilities exist on the distribution disk or as part of the materials and programs distributed. Most distribution disks include a "README.DOC" file. This file explains variations from the manual which do constitute modification of the manual and the items included therewith. Be sure to read this file before using the software.


CP/M and Digital Research and its logo are registered trademarks of Digital Research Inc. ASM, CP/M Plus, LINK-80, MAC, MP/M, MP/M II, and RMAC are trademarks of Digital Research Inc. Intel is a registered trademark of Intel Corporation.

The CP/M Plus (CP/M Version 3) Operating System Programmer's Guide was printed in the United States of America.
First Edition: January 1983
Second Edition: April 1983


CP/M® 3 is a microcomputer operating system designed for the Intel 8080, Intel 8085, or other compatible microprocessor. To run CP/M 3, your computer must have an ASCII console, which includes a keyboard and screen, or another display device, from one to sixteen disk drives and a minimum of 32K of memory space. To support additional memory beyond the 64K addressing limit of the processors listed above, CP/M 3 can also support bank-switched memory. The minimum memory requirement for a banked system is 96K.

This manual describes the programming environment of CP/M 3, and is written for experienced programmers who are writing application software in the CP/M 3 environment. It assumes you are familiar with the system features and utilities described in the CP/M Plus (CP/M Version 3) Operating System User's Guide and the Programmer's Utilities Guide for the CP/M Family of Operating Systems. It also assumes that your CP/M 3 system has been customized for your computer's hardware and is executing as described in the CP/M Plus (CP/M Version 3) Operating System User's Guide. If you need to customize your system, please refer to the CP/M Plus (CP/M Version 3) Operating System System Guide.

Section 1 of this manual describes the components of the operating system, where they reside in memory, and how they work together to provide a standard operating environment for application programs. Section 2 describes how an application program can call on CP/M 3 to perform serial input and output and manage disk files. Section 3 provides a detailed description of each operating system function. Section 4 presents example programs.

The CP/M Plus (CP/M Version 3) Operating System Programmer's Guide contains five appendixes. Appendix A describes the CP/M 3 System Control Block, and defines its fields. Appendix B supplies the format for the Page Relocatable Program. Appendix C tells you how to generate System Page Relocatable files. Appendix D lists the ASCII Symbol Table, and Appendix E summarizes BDOS functions.

Table of Contents

1 Introduction to CP/M 3
1.1 Banked and Nonbanked Memory Organization
1.2 System Components
1.3 System Component Interaction and Communication
1.3.1 The BDOS and BIOS
1.3.2 Applications and the BDOS
1.3.3 Applications and RSXs
1.4 Memory Region Boundaries
1.5 Disk and Drive Organization and Requirements
1.6 System Operation
1.6.1 Cold Start Operation
1.6.2 CCP Operation
1.6.3 Transient Program Operation
1.6.4 Resident System Extension Operation
1.6.5 SUBMIT Operation
1.7 System Control Block

2 The BDOS System Interface
2.1 BDOS Calling Conventions
2.2 BDOS Serial Device I/O
2.2.1 BDOS Console I/O
2.2.2 Other Serial I/O
2.3 BDOS File System
2.3.1 File Naming Conventions
2.3.2 Disk and File Organization
2.3.3 File Control Block Definition
2.3.4 File Attributes
2.3.5 User Number Conventions
2.3.6 Directory Labels and XFCBs
2.3.7 File Passwords
2.3.8 File Date and Time Stamps
2.3.9 Record Blocking and Deblocking
2.3.10 Multi-Sector I/O
2.3.11 Disk Reset and Removable Media
2.3.12 File Byte Counts
2.3.13 BDOS Error Handling
2.4 Page Zero Initialization

3 BDOS Function Calls

4 Programming Examples
4.1 A Sample File-To-File Copy Program
4.2 A Sample File Dump Utility
4.3 A Sample Random Access Program
4.4 Construction of an RSX Program
4.4.1 The RSX Prefix
4.4.2 Example of RSX Use


A System Control Block

B PRL File Generation
B.1 PRL Format
B.2 Generating a PRL

C SPR Generation

D ASCII and Hexadecimal Conversions

E BDOS Function Summary


1-1. CP/M 3 Built-in Commands
2-1. Valid Filename Delimiters
2-2. Logical Drive Capacity
2-3. BDOS Interface Attributes
2-4. Password Protection Modes
2-5. BDOS Functions That Test for Password
2-6. SFCB Subfields Format
2-7. Register A BDOS Error Codes
2-8. BDOS Directory Codes
2-9. BDOS Error Flags
2-10. BDOS Physical and Extended Errors
2-11. Page Zero Areas
3-1. Function 6 Entry Parameters
3-2. Edit Control Characters (Nonbanked CP/M 3)
3-3. Edit Control Characters (Banked CP/M 3)
3-4. System Control Block
3-5. Program Return Codes
3-6. FCB Format
A-1. SCB Fields and Definitions
B-1. PRL File Format
D-1. ASCII Symbols
D-2. ASCII Conversion Table
E-1. BDOS Function Summary

1-1. Nonbanked System Memory Organization
1-2. Banked System Memory Organization
1-3. Banked Memory with Bank 1 in Context
1-4. CP/M 3 Logical Memory Organization
1-5. System Components and Regions in Logical Memory
1-6. System Modules and Regions in Logical Memory
1-7. Disk Organization
1-8. RSX File Format
2-1. XFCB Format
2-2. Directory Label Format
2-3. Directory Record with SFCB

End of Section 0

Continue in...
Top of this document
Section 1

page URL: