CP/M Plus (CP/M (R) Version 3) Operating System Programmers Guide
COPYRIGHT Copyright 01983 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. DISCLAIMER DIGITAL RESEARCH INC.
Foreword 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.
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 Me'mory 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.
Table of Contents (continued) 2.3.13 BDOS Error Handling 2.4 Page Zero Initialization 2-28 2-34 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 4-1 4-5 4-10 4-20 4-21 4-22 Appendixes A System Control Block A-1 B PRL File Generation B. 1 PRL Format B.
Table of Contents (continued) Tables 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.
Table of Contents (continued) Figures 1-1. 1-2. 1-3. 1-4. 1-5. 1-6. 1-7. 1-8. Nonbanked System Memory Organization Banked System Memory Organization Banked Memory with Bank 1 in Context I CP/M 3 Logical Memory Organization System Components and Regions in Logical Memory System Modules and Regions in Logical Memory Disk Organization RSX File Format 2-1. XFCB Format 2-2. Directory Label Format 2-3.
Section 1 Introduction to CP/M 3 This section introduces you to the general features of CP/M 3 with an emphasis on how CP/M 3 organizes your computer's memory. The section begins by describing the general memory organization of banked and nonbanked systems and defines the programming environment they have in common. It then shows how CP/M 3 defines memory space into standard regions for operating system modules and executing programs.
1.1 Baked/Nonbanked Organization CP/M 3 Programmer's Guide 1.1 Banked and Nonbanked Memory Organization The memory organization for a nonbanked CP/M 3 system is very simple, as shown in Figure 1-1. Figure 1-1. Nonbanked System Memory Organization In the nonbanked organization, physical memory consists of a single, contiguous region addressable from OOOOH up to a maximum of OFFFFH (64K-1).
1.1 Baked/Nonbanked Organization CP/M 3 Programmer's Guide To expand memory capacity beyond the 64K address space of an 8-bit microprocessor, CP/M 3 supports bank-switched memory in a special version called the banked system. In the banked version, the operating system is divided into two modules: the resident portion and the banked portion. The resident portion resides in common memory; the banked portion resides just below the top of banked memory in Bank 0.
1.1 Baked/Nonbanked Organization CP/M 3 Programmer's Guide Figure 1-3. Banked Memory with Bank 1 in Context From a transient programs perspective, Bank 1 is always in context. The operating system can switch to Bank 0 or other banks when performing operating system functions without affecting.the execution of the transient program. Any bank-switching performed by the operating system is completely transparent to the calling program.
1.1 Baked/Nonbanked Organization CP/M 3 Programmer's Guide The banked version of CP/M 3 requires a minimum of two banks, Bank 0 and Bank 1, and can support up to 16 banks of memory. Bank numbers are generally arbitrary with the following exceptions: Bank 0 is the system bank and is in context when CP/M 3 is started. Bank 1 is the transient program bank, and must be contiguous from location zero to the top of banked memory. This requirement does not apply to the other banks.
1.2 System Components CP/M 3 Programmer's Guide Figure 1-5. System Components and Regions in Logical Memory The Basic Input/Output System, BIOS, is a hardware-dependent module that defines the low-level interface to a particular computer system. It contains the device-driving routines necessary for peripheral device I/O. The Basic Disk Operating System, BDOS, is the hardware-independent module that is the logical nucleus of CP/M 3.
1.2 System Components CP/M 3 Programmer's Guide The Transient Program Area, TPA, is the region of memory where transient programs execute. The CCP also executes in this region. The Console Command Processor, CCP, is not an operating system module, but is a system program that presents a human-oriented interface to CP/M 3 for the user. The Page Zero region is not an operating system module either, but functions primarily as an interface to the BDOS module from the CCP and transient programs.
1.3 Component Interaction CP/M 3 Programmer's Guide 1.3.2 Applications and the BDOS Transient programs and the CCP access CP/M 3 facilities by making BDOS function calls. BDOS functions can create, delete, open, and close disk files, read or write to opened files, retrieve input from the console, send output to the console or list device, and perform a wide range of other services described in Section 3,"BDOS Functions.
1.3 Component Interaction CP/M 3 Programmer's Guide 1.3.3 Applications and RSXs A Resident System Extension is a temporary additional operating system module. An RSX can extend or modify one or more operating system functions selectively. As with a standard BDOS function, a transient program accesses an RSX function through a numbered function call. At any one time there might be zero, one, or multiple RSXs active in memory.
1.3 Component Interaction CP/M 3 Programmer's Guide Figure 1-6. System Modules and Regions in Logical Memory First note that all memory regions in CP/M 3 are page-aligned. This means that regions and operating system modules must begin on a page boundary. A page is defined as 256 bytes, so a page boundary always begins at an address where the loworder byte is zero. The term High Memory in Figure 1-6 denotes the high address of a CP/M 3 system.
1.4 Region Boundaries CP/M 3 Programmer's Guide The size of the BDOS region differs for the banked and nonbanked versions of CP/M 3. In the banked version, the resident BDOS size is 6 pages, 1.5K. In the nonbanked system, the BDOS size ranges from 31 pages, 7.75K, to 33 pages, 8.25K, depending on system generation options and BIOS requirements. RSXs are page aligned modules that are stacked in memory below LOADER_base in memory.
1.4 Region Boundaries CP/M 3 Programmer's Guide Figure 1-7. Disk Organization In Figure 1-7, the first N tracks are the system tracks. System tracks are required only on the disk used by CP/M 3 during system cold start or warm start. The contents of this region are described in Section 1.6.1. All normal CP/M 3 disk access is directed to the data tracks which CP/M 3 uses for file storage. The data tracks are divided into two regions: a directory area and a data area.
1.5 Disk Organization CP/M 3 Programmer's Guide The directory identifies each file with an eight-character filename and a threecharacter filetype. Together, these fields must be unique for each file. Files with the same filename and filetype can reside in different user directories on the same drive without conflict. Under the banked version of CP/M 3, a file can be assigned an eight-character password to protect the file from unauthorized access.
1.6 System Operation CP/M 3 Programmer's Guide 1.6.1 Cold Start Operation The cold start procedure is typically executed immediately after the computer is turned on. The cold start brings CP/M 3 into memory and gives it control of the computer's resources. Cold start is a four-stage procedure. In the first stage, a hardware feature, or ROM-based software associated with system reset, loads a small program, called the Cold Boot Loader, into memory from the system tracks of drive A (see figure 1-6).
1.6 System Operation CP/M 3 Programmer's Guide The fourth and final stage in the cold start procedure is performed by the BIOS Cold Start function, Function 0. The entry point to this function is located at BIOS -base as described in Section 1.4. The BIOS Cold Start function begins by performing any remaining hardware initialization, and initializing Page Zero.
1.6 System Operation CP/M 3 Programmer's Guide 1.6.2 CCP Operation The Console Command Processor provides the user access to CP/M 3 facilities when transient programs are not running. It also reads the user's command lines, differentiates between built-in commands and transient commands, and executes the commands accordingly. This section describes the responsibilities and capabilities of the CCP in some detail.
1.6 System Operation CP/M 3 Programmer's Guide The second command form the CCP accepts is the standard CP/M command line. A standard CP/M command line consists of a command keyword followed by an optional command tail. The command keyword and the command tall can be typed in any combination of upper-case and lower-case letters; the CCP converts all letters n the command line to upper-case.
1.6 System Operation CP/M 3 Programmer's Guide The command field must identify either a built-in command, a transient program, or a submit file. For example, USER is the keyword that identifies the built-in command that changes the current user number. The CP/M 3 CCP displays the user number in the system prompt when the user number is non-zero. The following example illustrates changing the user number from zero to 15. B>USER 15 15B> The following table summarizes the built-in commands. Table 1-1.
1.6 System Operation CP/M 3 Programmer's Guide All command keywords that do not identify built-in commands identify either a transient program file or a submit file. If the CCP identifies a command keyword as a transient program, the transient program file is loaded into the TPA from disk and executed. If it recognizes a submit file, the CCP reconstructs the command line into the following form: SUBMIT and attempts to load and execute the SUBMIT utility.
1.6 System Operation CP/M 3 Programmer's Guide If the command field is preceded by a drive specification id:), the CCP attempts to open the command or submit file on the specified drive. Otherwise, the CCP attempts to open the file on the drives specified in the drive chain. The drive chain specifies up to four drives that are to be referenced in sequence for CCP open operations of command and submit files.
1.6 System Operation CP/M 3 Programmer's Guide 4.
1.6 System Operation CP/M 3 Programmer's Guide When a transient program terminates execution, the BIOS warm start routine reloads the CCP into memory. When the CCP receives control, it tests to see if RSXs are resident in memory. If not, it relocates the LOADER module below the BDOS module at the top of the TPA region of memory. Otherwise, it skips this step because the LOADER module is already resident. The CCP execution cycle then repeats.
1.6 System Operation CP/M 3 Programmer's Guide A transient program can terminate execution in one of three ways: by jumping to location 0000H, by making a BDOS System Reset call, or by making a BDOS Chain To Program call. The first two methods are equivalent; they pass control to the BIOS warm start entry point, which then loads the CCP into the TPA, and the CCP prompts for the next command.
1.6 System Operation CP/M 3 Programmer's Guide A Resident System Extension (RSX) is a special type of program that can be attached to the operating system to modify or extend the functionality of the BDOS. RSX modules intercept BDOS functions and either perform them, translate them into other BDOS functions, or pass them through untouched. The BDOS executes nonintercepted functions in the standard manner.
1.6 System Operation CP/M 3 Programmer's Guide Figure 1-8. RSX File Format RSX files begin with a one page PRL header that specifies the total size of the RSX prefix and code sections. The PRL bit map is a string of bits identifying those bytes in the RSX prefix and code sections that require relocation. The PRL format is described in detail in Appendix B. Note that the PRL header and bit map are removed when an RSX is loaded into memory. They are only used by the LOADER module to load the RSX.
1.6 System Operation CP/M 3 Programmer's Guide When the CCP gains control after a system warm start, it removes any RSXs in memory that have the Remove flag set to OFFH. All other RSXs remain active in memory. Setting an RSX's Remove flag to OFFH indicates that the RSX is not active and it can be removed. Note that if an RSX marked for removal is not the lowest active RSX in memory, it still occupies memory after removal.
1.6 System Operation CP/M 3 Programmer's Guide When the SUBMIT utility begins execution, it opens and reads the file specified by and creates a temporary submit file of type $$$ on the system's temporary file drive. GENCPM initializes the temporary file drive to the CCP's current default drive. The SETDEF utility can set the temporary file drive to a specific drive.
1.7 System Control Block CP/M 3 Programmer's Guide However, use caution when you access the SCB through Function 49 for two reasons. First, the SCB is a CP/M 3 data structure. Digital Research's multi-user operating system, MP/M, does not support BDOS Function 49. Programs that access the SCB can run only on CP/M 3. Secondly, the SCB contains critical system parameters that reflect the current state of the operating system.
Section 2 The BDOS System Interface This section describes the operating system services available to a transient program through the BDOS module of CP/M 3. The section begins by defining how a transient program calls BDOS functions, then discusses serial I/O for console, list and auxiliary devices, the file system, and Page Zero initialization. 2.1 BDOS Calling Conventions CP/M 3 uses a standard convention for BDOS function calls.
2.1 BDOS Calling Conventions CP/M 3 Programmer's Guide The following example illustrates how a transient program calls a BDOS function. This program reads characters continuously until it encounters an asterisk. Then it termmates execution by returning to the system.
2.2 BDOS Serial Device I/O CP/M 3 Programmer's Guide Read a character from CONIN: Read a character buffer from CONIN: Write a character to CONOUT: Write a string of characters to CONOUT: Write a block of characters to CONOUT: Read a character from AUXIN: Write a character to AUXOUT: Write a character to LST: Write a block of characters to LST: Interrogate CONIN:, AUXIN:, AUXOUT: ready CP/M 3 cannot run unless CONIN: and CONOUT: are assigned to a physical console.
2.2 BDOS Serial Device I/O CP/M 3 Programmer's Guide The basic I/O functions also monitor the console to stop and start console output scroll at the user's request. To provide this support, the console output functions make internal status checks for an input character before writing a character to the output device. The console input and console status functions also check the input character. If the user types a CTRL-S, these functions make an additional Blos console input call.
2.2 BDOS Serial Device I/O CP/M 3 Programmer's Guide Function 10 also filters input for certain control characters. If the user types a CTRL-C as the first character in the line, Function 10 terminates the calling program by branching to the BIOS warm start entry point. A CTRL-C in any other position is simply echoed at the console. Function 10 also watches for a CTRL-P keystroke, and if it finds one at any position in the command line, it toggles the printer echo switch.
2.2 BDOS Serial Device I/O CP/M 3 Programmer's Guide bit 3 : This bit disables all CTRL-C intercept action in the BDOS. This mode is useful for programs that must control their own termination. bits 8 and 9 : The BDOS does not use these bits, but reserves them for the CP/M 3 GET RSX that performs console input redirection from a file. With one exception, these bits determine how the GET RSX responds to a program console status request (Function 6, Function 11, or direct BIOS).
2.3 BDOS File System CP/M 3 Programmer's Guide Transient programs depend on the BDOS file system to create, update, and maintain disk files. This section describes the capabilities of the BDOS file system in detail. You must understand the general features of CP/M 3 described in Section 1 before you can use the detail presented in this section. The remaining introductory paragraphs define the four categories of BDOS file functions.
2.3 BDOS File System CP/M 3 Programmer's Guide BDOS directory functions operate on existing file entries in a drive's directory. This category includes functions to search for one or more files, delete one or more files, truncate a file, rename a file, set file attributes, assign a password to a file, and compute the size of a file. The search and delete functions are the only BDOS functions that support ambiguous file references.
2.
2.3 BDOS File System CP/M 3 Programmer's Guide The drive specifier field specifies the drive where the file is located. The filename and type fields identify the file. The password field specifies the password if a file is password protected. -ne drive, type, and password fields are optional, and the delimiters :.; are required only when specifying their associated field.
2.3 BDOS File System CP/M 3 Programmer's Guide Function 152 also excludes all control characters from the file fields, and translates all lower-case letters to upper-case. Avoid using parentheses and the backslash character, \, in the filename and filetype fields because they are commonly used delimiters. Use asterisk and question mark characters, * and ?, only to make an ambiguous file reference.
2.3 BDOS File System CP/M 3 Programmer's Guide Table 2-2 displays the relationship between data block size and drive capacity. Table 2-2. Logical Drive Capacity Data Block Size 1K 2K 4K 8K 16K Maximum Drive Capacity 256 Kilobytes 64 Megabytes 128 Megabytes 256 Megabytes 512 Megabytes Logical drives are divided into two regions: a directory area and a data area. The directory area contains from one to sixteen blocks located at the beginning of the drive. The actual number is set in the BIOS.
2.3 BDOS File System CP/M 3 Programmer's Guide Source files under CP/M 3 are treated as a sequence of ASCII characters, where each line of the source file is followed by a carriage return line-feed sequence, ODH followed by OAH. Thus a single 128-byte record could contain several lines of source text. The end of an ASCII file is denoted by a CTRL-Z character, 1AH, or a real end of file, returned by the BDOS read operation. CTRL-Z characters embedded within machine code files such as COM files are ignored.
2.3 BDOS File System where dr CP/M 3 Programmer's Guide drive code (O - 16) 0 = > use default drive for file 1 = > auto disk select drive A, 2 = > auto disk select drive B, 16 = > auto disk select drive P. fl ... f8 contain the filename in ASCII upper-case, with high bit = 0. f1'..., f8' denote the highorder bit of these positions, and are file attribute bits. tl,t2,t3 contain the filetype in ASCII upper-case, with high bit = 0.
2.3 BDOS File System CP/M 3 Programmer's Guide d0 ... dn filled-in by CP/M 3, reserved for system use cr current record to read or write in a sequential file operation, normally set to zero by the calling program when a file is opened or created r0,,rl,r2 optional random record number in the range 0-262,143 (O - 3FFFFH). r0,rl,r2 constitute a 18 bit value with low byte rO, middle byte rl, and high byte r2.
2.3 BDOS File System CP/M 3 Programmer's Guide The BDOS updates the memory copy of the FCB during file processing to maintain the current position within the file. During file write operations, the BDOS updates the memory copy of the FCB to record the allocation of data to the file, and at the termination of file processing, the Close File function permanently records this information on disk.
2.3 BDOS File System CP/M 3 Programmer's Guide t2': System attribute - This attribute, if set, identifies the file as a CP/M 3 system file. System files are not usually displayed by the CP/M 3 DIR command. In addition, user-zero system files can be accessed on a read-only basis from other user numbers. t3': Archive attribute - This attribute is designed for user written archive programs. When an archive program copies a file to backup storage, it sets the archive attribute of the copied files.
2.3 BDOS File System CP/M 3 Programmer's Guide 2.3.5 User Number Conventions The CP/M 3 User facility divides each drive directory into sixteen logically independent directories, designated as user 0 through user 15. Physically, all user directories share the directory area of a drive. In most other aspects, however, they are independent. For example, files with the same name can exist on different user numbers of the same drive with no conflict.
2.3 BDOS File System CP/M 3 Programmer's Guide 2.3.6 Directory Labels and XFCBs The BDOS file system includes two special types of FCBS: the XFCB and the Directory Label. The XFCB is an extended FCB that optionally can be associated with a file in the directory. If present, it contains the file's password. Note that password protected files and XFCBs are supported only in the banked version of CP/M 3. The format of the XFCB follows. Figure 2-1.
2.3 BDOS File System CP/M 3 Programmer's Guide An XFCB can be created only on a drive that has a directory label, and only if the directory label has activated password protection. For drives in this state, an XFCB can be created for a file in two ways: by the BDOS Make function or by the BDOS Write File XFCB function. The BDOS Make function creates an XFCB if the calling program requests that a password be assigned to the created file.
2.3 BDOS File System CP/M 3 Programmer's Guide Only one Directory Label can exist in a drive's directory. The Directory Label name and type fields are not used to search for a Directory Label; they can be used to identify a disk. A Directory Label can be created, or its fields can be updated by BDOS function 100, Set Directory Label. This function can also assign a Directory Label a password.
2.3 BDOS File System CP/M 3 Programmer's Guide Table 2-4. Password Protection Modes Password Access level allowed wben the Password Mode is not supplied. 1. Read The file cannot be read. 2. Write The file can be read, but not modified. 3. Delete The file can be modified, but not deleted. If a file is password protected in Read mode, the password must be supplied to open the file. A file protected in Write mode cannot be written to without the password.
2.3 BDOS File System CP/M 3 Programmer's Guide File passwords are eight bytes in length. They are maintained in the XFCB Directory Label in encrypted form. To make a BDOS function call for a file that requires a password, a program must place the password in the first eight bytes of the current DMA, or specify it with the BDOS function, Set Default Password, prior to making the function call. Note: the BDOS keeps an assigned default password value until it is replaced with a new assigned value. 2.3.
2.3 BDOS File System CP/M 3 Programmer's Guide Table 2-6. SFCB Subfields Format Offset in Bytes I SFCB Subfield Contents 0-3 4-7 8 9 Create or Access Date and Time Stamp field Update Date and Time Stamp field Password mode field Reserved An SFCB subfield contains valid information only if its corresponding FCB in the directory record is an extent zero FCB. This FCB is a file's first directory entry. For password protected files, the SFCB subfield also contains the password mode of the file.
2.3 BDOS File System CP/M 3 Programmer's Guide The BDOS file system uses the CP/M 3 system date and time when it records a date and time stamp. This value is maintained in a field in the System Control Block (SCB). On CP/M 3 systems that support a hardware clock, the BIOS module directly updates the SCB system date and time field. Otherwise, date and time stamps record the last initialized value for the system date and time. The CP/M 3 DATE utility can be used to set the system date and time. 2.3.
2.3 BDOS File System CP/M 3 Programmer's Guide Note: the CCP automatically discards all pending physical data buffers when it receives control following a system warm start. However, the BDOS file system automatically makes a Flush Buffers call in the Close File function. Thus, it is sufficient to close a file to ensure that all pending physical buffers for that file are written to the disk. 2.3.10 Multi-Sector I/O CP/M 3 can read or write multiple 128-byte records in a single BDOS function call.
2.3 BDOS File System CP/M 3 Programmer's Guide 2.3.11 Disk Reset and Removable Media The BDOS functions, Disk Reset (function 13) and Reset Drive (function 37) allow a program to control when a disk's directory is to be reinitialized for file operations. This process of initializing a disk's directory is called logging-in the drive. When CP/M 3 is cold started, all drives are in the reset state. Subsequently, as drives are referenced, they are automatically logged-in by the file system.
2.3 BDOS File System CP/M 3 Programmer's Guide 2.3.12 File Byte Counts Although the logical record size of CP/M 3 is restricted to 128 bytes, CP/M 3 does provide a mechanism to store and retrieve a byte count for a file. This facility can identify the last byte of the last record of a file. The BDOS Compute File Size function returns the random record number, plus 1, of the last record of a file. The BDOS Set File Attributes function can set a file's byte count.
2.3 BDOS File System CP/M 3 Programmer's Guide The BDOS Error Mode, which can exist in three states, determines how the file system handles physical and extended errors. In the default state, the BDOS displays the error message, and terminates the calling program, method 2. In return error mode, the BDOS returns control to the calling program with the error identified in registers A, H, and L, method 1.
2.3 BDOS File System CP/M 3 Programmer's Guide The Read-Only File error is returned when a program attempts to write to a file that is marked with the Read-Only attribute. It is also returned to a program that attempts to write to a system file opened under user zero from a nonzero user number. In addition, this error is returned when a program attempts to write to a file password protected in Write mode if the program does not supply the correct password.
2.3 BDOS File System CP/M 3 Programmer's Guide The Error Code definitions for register A are shown in Table 2-7. Code 00 255 01 02 03 04 05 06 09 10 Table 2-7.
2.3 BDOS File System 2.3 BDOS File System CP/M 3 Programmer's Guide CP/M 3 Programmer's Guide The following BDOS functions return a Directory Code in register A: 15. Open File 16. Close File 17. Search For First 18. Search For Next 19. Delete File 22. Make File 23. Rename File 30. Set File Attributes 35. Compute File Size 99. Truncate File * 100. Set Directory Label 102. Read File Date Stamps and Password Mode ** 103. Write File XFCB * ** - This function is supported in the DIRLBL.
2.3 BDOS File System CP/M 3 Programmer's Guide If the Set BDOS Error Mode function is used to place the BDOS in return error mode, the following functions return an Error Flag on physical errors: 14. Select Disk 46. Get Disk Free Space 48. Flush Buffers 98. Free Blocks 101. Return Directory Label Data The Error Flag definition for register A is shown in Table 2-9. Table 2-9.
2.3 BDOS File System CP/M 3 Programmer's Guide 2.3 BDOS File System CP/M 3 Programmer's Guide Table 2-10. BDOS Physical and Extended Errors Code Meaning 00 01 02 03 - 04 07 08 09 - no error, or not a register H error Disk I/O error Read-Only Disk Read-Only File or File Opened under user zero from another user number or file password protected in write mode and correct password not specified.
2.4 Page Zero Initialization Location From TO 0000H - 0002H CP/M 3 Programmer's Guide Table 2-11. Page Zero Areas Contents Contains a jump instruction to the BIOS warm start entry point at BIOS - base + 3. The address at location OOOIH can also be used to make direct BIOS calls to the BIOS console status, console input, console output, and list output primitive functions.
2.4 Page Zero Initialization CP/M 3 Programmer's Guide Table 2-11. (continued) Location From TO 005 6H Contents Contains the length of the password field for the second cornmand-tail operand. The CCP also sets this field to zero if no password for the second command tail is specified. 0057H - 005BH (Not currently used - reserved) 005CH - 007BH Default File Control Block, FCB, area 1 initialized by the CCP from the first command-tail operand of the command line, if it exists.
2.4 Page Zero Initialization CP/M 3 Programmer's Guide The CCP initializes Page Zero prior to initiating a transient program. The fields at 0050H and above are initialized from the command line invoking the transient program. The command line format was described in detail in Section 1.6.2.
2.4 Page Zero Initialization CP/M 3 Programmer's Guide The default DMA address for transient programs is 0080H. The CCP also initializes this area to contain the command tall of the command line. The first position contains the number of characters in the command line, followed by the command line characters. The character following the last command tail character is set to binary zero. The command line characters are preceded by a leading blank and are translated to ASCII upper-case.
Section 3 BDOS Function Calls This section describes each CP/M 3 system function, including the parameters a program must pass when calling the function, and the values the function returns to the program. The functions are arranged numerically for easy reference. You should be familiar with the BDOS calling conventions and other concepts presented in Section., before referencing this section.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 1: CONSOLE INPUT Entry Parameters: Register C: 01H Returned Value: Register A: ASCII Character The Console Input function reads the next character from the logical console, CONIN:, to register A. Graphic characters, along with carriage return, line-feed, and backspace, CTRL-H, are echoed to the console. Tab characters, CTR-L-1, are expanded in columns of 8 characters. CTRL-S, CTRL-Q, and CTRL-P are normally intercepted as described below.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 2: CONSOLE OUTPUT Entry Parameters: Registers C: 02H E: ASCII Character The Console Output function sends the ASCII character from register E to the logical console device, CONOUT:. When the Console Mode is in the default state (see Section 2.2.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 3: AUXILIARY INPUT Entry Parameters: Register C: 03H Returned Value: Register A: ASCII Character The Auxiliary Input function reads the next character from the logical auxiliary input device, AUXIN:, into register A. Control does not return to the calling program 'I the character is read.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 4: AUXILIARY OUTPUT Entry Parameters: Registers C: 04H E: ASCII Character The Auxiliary Output function sends the ASCII character from register E to the logical auxiliary output device, AUXOUT:.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 5: LIST OUTPUT Entry Parameters: Registers C: 05H E: ASCII Character The List Output function sends the ASCII character in register E to the logical list device, LST:.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 6: DIRECT CONSOLE I/0 Entry Parameters: Registers C: 06H E: 0FFH (input/status) or 0FEH (status) or 0FDH (input) or char (output) Returned Value: Register A: char or status (no value) CP/M 3 supports direct I/O to the logical console, CONIN:, for those specialized applications where unadorned console input and output is required. Use Direct Console I/O carefully because it bypasses all the normal control character functions.
BDOS Function Calls CP/M 3 Programmers Guide 3 BDOS Calls: Function 6 CP/M 3 Programmer's Guide Table 3-1. Function 6 Entry Parameters Register E value Meaning OFFH Console input/status command returns an input character; if no character is ready, a value of zero is returned. OFEH Console status command (On return, register A contains 00 if no character is ready; otherwise it contains FFH.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 7: AUXILIARY INPUT STATUS Entry Parameters: Register C: 07H Returned Value: Register A: Auxiliary Input Status The Auxiliary Input Status function returns the value OFFH in register A if a character is ready for input from the logical auxiliary input device, AUXIN:. If no character is ready for input, the value OOH is returned.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 8: AUXILIARY OUTPUT STATUS Entry Parameters: Register C: 08H Returned Value: Register A: Auxiliary Output Status The Auxiliary Output Status function returns the value OFFH in register A if the logical auxiliary output device, AUXOUT:, is ready to accept a character for output. If the device is not ready for output, the value OOH is returned.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 9: PRINT STRING Entry Parameters: Registers C: 09H DE: String Address The Print String function sends the character string addressed by register pair DE to the logical console, CONOUT:, until it encounters a delimiter in the string. Usually the delimiter is a dollar sign, $, but it can be changed to any other value by Function 110, Get/Set Output Delimiter. If the Console Mode is in the default state (see Section 2.2.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 10: READ CONSOLE BUFFER Entry Parameters: Registers C: 0AH DE: Buffer Address Returned Value: Console Characters in Buffer The Read Console Buffer function reads a line of edited console input from the logical console, CONIN:, to a buffer that register pair DE addresses. It terminates input and returns to the calling program when it encounters a return, CTRL-M, or a line feed, CTRL-J, character.
BDOS Function Calls CP/M 3 Programmers Guide When a program calls Function 10 with an initialized buffer, Function 10 operates as if the user had typed in the string. When Function 10 encounters the binary zero terminator, it accepts input from the console. At this point, the user can edit the initialized string or accept it as it is by pressing the RETURN key.
BDOS Function Calls CP/M 3 Programmers Guide The banked version of CP/M 3 expands upon the editing provided in the nonbanked version. The functionality of the two versions is similar when the cursor is positioned at the end of the line. However, in the banked version, the user can move the cursor anywhere in the current line, insert characters, delete characters, and perform other editing functions.
BDOS Function Calls Character CTRL-J CP/M 3 Programmers Guide Table 3-3. (continued) Edit Control Function (Line-feed) terminates input; the cursor can be positioned anywhere in the line; the entire input line is accepted; sets the previous line buffer to the input line. CTRL-K Deletes all characters to the right of the cursor along with the character at the cursor.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 11: GET CONSOLE STATUS Entry Parameters: Register C: OBH Returned Value: Register A: Console Status The Get Console Status function checks to see if a character has been typed at the logical console, CONIN:. If the Console Mode is in the default state (see Section 2.2.1), Function 11 returns the value 01H in register A when a character is ready. If a character is not ready, it returns a value of 00H.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 12: RETURN VERSION NUMBER Entry Parameters: Register C: 0CH Returned Value: Register HL: Version Number The Return Version Number function provides information that allows version independent programming. It returns a two-byte value in register pair HL: H contains OOH for CP/M and L contains 31H, the BDOS file system version number. Function 12 is useful for writing applications programs that must run on multiple versions of CP/M and MP/M.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 13: RESET DISK SYSTEM Entry Parameters: Register C: ODH The Reset Disk System function restores the file system to a reset state where all the disk drives are set to read-write (see Functions 28 and 29), the default disk is set to drive A, and the default DMA address is reset to 0080H. This function can be used, for example, by an application program that requires disk changes during operation.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 14: SELECT DISK Entry Parameters: Registers C: 0EH Returned Value: E: Selected Disk Registers A: Error Flag H: Physical Error The Select Disk function designates the disk drive named in register E as the default disk for subsequent BDOS file operations. Register E is set to 0 for drive A, 1 for drive B, and so on through 15 for drive P in a full 16-drive system.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 15: OPEN FILE Entry Parameters: Registers C: OFH DE: FCB Address Returned Value: Registers A: Directory Code H: Physical or Extended Error The Open File function activates the FCB for a file that exists in the disk directory under the currently active user number or user zero.
BDOS Function Calls CP/M 3 Programmers Guide If the open operation is successful, the user's FCB is activated for read and write operations. The relevant directory information is copied from the matching directory FCB into bytes d0 through dn of the FCB. If the file is opened under user zero when the current user number is not zero, interface attribute f8' is set to one in the user's FCB.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 16: CLOSE FILE Entry Parameters: Registers C: 10H DE: FCB Address Returned Value: Registers A: Directory Code H: Physical or Extended Error The Close File function performs the inverse of the Open File function. The calling program passes the address of an FCB in register pair DE. The referenced FCB must have been previously activated by a successful Open or Make function call (see Functions 15 and 22).
BDOS Function Calls CP/M 3 Programmers Guide Upon return, the close function returns a directory code in register A with the value 00H if the close was successful,, or FFH, 255 Decimal, if the file was not found. Register H is set to zero in both of these cases. If a physical or extended error is encountered, the close function performs different actions depending on the BDOS error mode (see Function 45).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 17: SEARCH FOR FIRST Entry Parameters: Registers C: 11H DE: FCB Address Returned Value: Registers A: Directory Code H: Physical Error The Search For First function scans the directory for a match with the FCB addressed by register pair DE. Two types of searches can be performed.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, the Search function returns a Directory Code in register A with the value 0 to 3 if the search is successful, or OFFH, 255 Decimal, if a matching directory entry is not found. Register H is set to zero in both of these cases. For successful searches, the current DMA is also filled with the directory record containing the matching entry, and the relative starting position is A * 32 (that is, rotate the A register left 5 bits, or ADD A five times).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 18: SEARCH FOR NEXT Entry Parameters: Register C: 12H Returned Value: Registers A: Directory Code H: Physical Error The Search For Next function is identical to the Search For First function, except that the directory scan continues from the last entry that was matched. Function 18 returns a Directory code in register A, analogous to Function 17.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 19: DELETE FILE Entry Parameters: Registers C: 13H DE: FCB Address Returned Value: Registers A: Directory Code H: Extended or Physical Error The Delete File function removes files or XFCBs that match the FCB addressed in register pair DE. The filename and filetype can contain ambiguous references, that is, question marks 'in bytes fl through t3, but the dr byte cannot be ambiguous, as it can in the Search and Search Next functions.
BDOS Function Calls CP/M 3 Programmers Guide In nonbanked systems, file passwords and XFCBs are not supported. Thus, if the Delete function is called with interface attribute f5' set to true, the Delete function performs no action but returns with register A set to zero. Upon return, the Delete function returns a Directory Code in register A with the value 0 if the delete is successful, or OFFH, 255 Decimal, if no file that matches the referenced FCB is found.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 20: READ SEQUENTIAL Entry Parameters: Registers C: 14H DE: FCB Address Returned Value: Registers A: Error Code H: Physical Error The Read Sequential function reads the next 1 to 128 128-byte records from a file into memory beginning at the current DMA address. The BDOS Multi-Sector Count (see Function 44) determines the number of records to be read. The default is one record.
BDOS Function Calls CP/M 3 Programmers Guide Error Code 01 is returned if no data exists at the next record position of the file. Usually, the no data situation is encountered at the end of a file. However, it can also occur if an attempt is made to read a data block that has not been previously written, or an extent which has not been created. These situations are usually restricted to files created or appended with the BDOS random write functions (see Functions 34 and 40).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 21: WRITE SEQUENTIAL Entry Parameters: Registers C: 15H DE: FCB Address Returned Value: Registers A: Error Code H: Physical Error The Write Sequential function writes 1 to 128 128-byte data records, beginning at the current DMA address into the file named by the FCB addressed in register pair DE. The BDOS Multi-Sector Count (see Function 44) determines the number of 128 byte records that are written. The default is one record.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, the Write Sequential function sets register A to zero if the write operation is successful.
BDOS Function Calls CP/M 3 Programmers Guide Error Code 255 is returned if a physical error is encountered and the BDOS error mode is Return Error mode, or Return and Display Error mode (see Function 45). If the error mode is the default mode, a message identifying the physical error is displayed at the console, and the calling program is terminated.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 22: MAKE FILE Entry Parameters: Registers C: 16H DE: FCB Address Returned Value: Registers A: Directory Code H: Physical or Extended Error The Make File function creates a new directory entry for a file under the current user number. It also creates an XFCB for the file if the referenced drive has a directory label that enables password protection on the drive, and the calling program assigns a password to the file.
BDOS Function Calls CP/M 3 Programmers Guide If the Make function is successful, it activates the referenced FCB for file operations by opening the FCB, and initializes both the directory entry and the referenced FCB to an empty file. It also initializes all file attributes to zero.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 23: RENAME FILE Entry Parameters: Registers C: 17H DE: FCB Address Returned Value-. Registers A: Directory Code H: Physical or Extended Error The Rename function uses the FCB, addressed by register pair DE, to change all directory entries of the file specified by the filename in the first 16 bytes of the FCB to the filename in the second 16 bytes.
BDOS Function Calls CP/M 3 Programmers Guide CP/M 3 Programmer's Guide 3 BDOS Calls: Function 23 Upon return, the Rename function returns a Directory Code in register A with the value 0 if the rename is successful, or 0FFH, 255 Decimal, if the file named by the first filename in the FCB is not found. Register H is set to zero in both of these cases. If a physical or extended error is encountered, the Rename function performs different actions depending on the BDOS error mode (see Function 45).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 24: RETURN LOGIN VECTOR Entry Parameters: Register C: 18H Returned Value: Register HL: Login Vector Function 24 returns the login vector in register pair HL. The login vector is a 16bit value with the least significant bit of L corresponding to drive A, and the highorder bit of H corresponding to the 16th drive, labelled P. A 0 bit indicates that the drive is not on-line, while a 1 bit indicates the drive is active.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 25: RETURN CURRENT DISK Entry Parameters: Register C: 19H Returned Value: Register A: Current Disk Function 25 returns the currently selected default disk number in register A. The disk numbers range from 0 through 15 corresponding to drives A through P.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 26: SET DMA ADDRESS Entry Parameters: Registers C: 1AH DE: DMA Address DMA is an acronym for Direct Memory Address, which is often used in connection with disk controllers that directly access the memory of the computer to transfer data to and from the disk subsystem. Under CP/M 3, the current DMA is usually defined as the buffer in memory where a record resides before a disk write, and after a disk read operation.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 27: GET ADDR(ALLOC) Entry Parameters: Register C: 1BH Returned Value: Register HL: ALLOC Address CP/M 3 maintains an allocation vector in main memory for each active disk drive. Some programs use the information provided by the allocation vector to determine the amount of free data space on a drive. Note, however, that the allocation information might be inaccurate if the drive has been marked Read-Only.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 28: WRITE PROTECT DISK Entry Parameters: Register C: 1CH The Write Protect Disk function provides temporary write protection for the currently selected disk by marking the drive as Read-Only, No program can write to a disk that is in the Read-Only state. A drive reset operation must be performed for a Read-Only drive to restore it to the Read-Write state (see Functions 13 and 37).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 29: GET READ-ONLY VECTOR Entry Parameters: Register C: lDH Returned Value: Register HL: R/O Vector Value Function 29 returns a bit vector in register pair HL that indicates which drives have the temporary Read-Only bit set. The Read-Only bit can be set only by a BDOS Write Protect Disk call. The format of the bit vector is analogous to that of the login vector returned by Function 24.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 30: SET FILE ATTRIBUTES Entry Parameters: Registers C: 1EH DE: FCB Address Returned Value: Registers A: Directory Code H: Physical or Extended error By calling the Set File Attributes function, a program can modify a file's attributes and set its last record byte count. Other BDOS functions can be called to interrogate these file parameters, but only Function 30 can change them.
BDOS Function Calls CP/M 3 Programmers Guide File attributes tl', t2', and t3' are defined by CP/M 3. (They are described in Section 2.3.4.) Attributes fl' through f4' are not presently used, but can be useful for application programs, because they are not involved in the matching program used by the BDOS during Open File and Close File operations. Indicators f5' through f8' are reserved for use as interface attributes.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 31: GET ADDR(DPB PARMS) Entry Parameters: Register C: 1FH Returned Value: Register HL: DPB Address Function 31 returns in register pair HL the address of the BIOS-resident Disk Parameter Block, DPB, for the currently selected drive. (Refer to the CP/M Plus (CP/M Version 3) Operating System System Guide for the format of the DPB). The calling program can use this address to extract the disk parameter values.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 32: SET/GET USER CODE Entry Parameters: Registers C: 20H Returned Value: E: OFFH (get) or User Code (set) Register A: Current Code or (no value) A program can change, or interrogate the currently active user number by calling Function 32. If register E = OFFH, then the value of the current user number is returned in register A, where the value is in the range of 0 to 15.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 33: READ RANDOM Entry Parameters: Registers C: 21H DE: FCB Address Returned Value: Registers A: Error Code H: Physical Error The Read Random function is similar to the Read Sequential function except that the read operation takes place at a particular random record number, selected by the 24-bit value constructed from the three byte, rO, rl, r2, field beginning at position 33 of the FCB.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, the Read Random function sets register A to zero if the read operation was successful. Otherwise, register A contains one of the following error codes: 01 Reading unwritten data (end-of-file) 03 Cannot close current extent 04 Seek to unwritten extent 06 Random record number out of range 10 Media change occurred 255 Physical Error : refer to register H Error Code 01 is returned if no data exists at the next record position of the file.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 34: WRITE RANDOM Entry Parameters: Registers C: 22H DE: FCB Address Returned Value: Registers A: Error Code H: Physical Error The Write Random function is analogous to the Read Random function, except that data is written to the disk from the current DMA address. If the disk extent or data block where the data is to be written is not already allocated, the BDOS automatically performs the allocation before the write operation continues.
BDOS Function Calls CP/M 3 Programmers Guide If the BDOS Multi-Sector Count is greater than one (see Function 44), the Write Random function reads multiple consecutive records into memory beginning at the current DMA. The rO, rl, and r2 field of the FCB is automatically incremented to write each record. However, the FCB's random record number is restored to the first record's value when it returns to the calling program.
BDOS Function Calls CP/M 3 Programmers Guide Error Code 255 is returned if a physical error is encountered and the BDOS error mode is one of the return modes (see Function 45). If the error mode is the default mode, a message identifying the physical error is displayed at the console, and the calling program is terminated.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 35: COMPUTE FILE SIZE Entry Parameters: Registers C: 23H DE: FCB Address Returned Value: Registers A: Error Flag H: Physical or Extended error Random Record Field Set The Compute File Size function determines the virtual file size, which is, in effect, the address of the record immediately following the end of the file. The virtual size of a file corresponds to the physical size if the file is written sequentially.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, Function 35 returns a zero in register A if the file specified by the referenced FCB is found, or an OFFH in register A if the file is not found. Register H is set to zero in both of these cases. If a physical error is encountered, Function 35 performs different actions depending on the BDOS error mode (see Function 45).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 36: SET RANDOM RECORD Entry Parameters: Registers C: 24H DE: FCB Address Returned Value: Random Record Field Set The Set Random Record function returns the random record number of the next record to be accessed from a file that has been read or written sequentially to a particular point. This value is returned in the random record field, bytes rO, rl, and r2, of the FCB addressed by the register pair DE.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 37: RESET DRIVE Entry Parameters: Registers C: 25H DE: Drive Vector Returned Value: Register A: 00H The Reset Drive function programmatically restores specified drives to the reset state. A reset drive is not logged-in and is in Read-Write status.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 38: ACCESS DRIVE Entry Parameters: Register C: 26H This is an MP/M function that is not supported under CP/M 3. If called, the file system returns a zero In register A indicating that the access request is successful.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 39: FREE DRIVE Entry Parameters: Register C: 27H This is an MP/M function that is not supported under CP/M 3. If called, the file system returns a zero In register A indicating that the free request is successful.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 40: WRITE RANDOM WITH ZERO FILL Entry Parameters: Registers C: 28H DE: FCB address Returned Value: Registers A: Error Code H: Physical Error The Write Random With Zero Fill function is identical to the Write Random function (Function 34) with the exception that a previously unallocated data block is filled with zeros before the record is written.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 41: TEST AND WRITE RECORD Entry Parameters: Registers C: 29H DE: FCB Address Returned Value: Registers A: Error Code H: Physical Error The Test and Write Record function is an MP/M 11" function that is not supported under CP/M 3. If called, Function 41 returns with register A set to OFFH and register H set to zero.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 42: LOCK RECORD Entry Parameters: Registers C: 2AH DE: FCB Address Returned Value: Register A: 00H The Lock Record function is an MP/M II function that is supported under CP/M 3 only to provide compatibility between CP/M 3 and MP/M. It is intended for use in situations where more than one running program has Read-Write access to a common file.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 43: UNLOCK RECORD Entry Parameters: Registers C: 2BH DE: FCB Address Returned Value: Register A: 00H The Unlock Record function is an MP/M II function that is supported under CP/M 3 only to provide compatibility between CP/M 3 and MP/M. It is intended for use in situations where more than one running program has Read-Write access to a common file.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 44: SET MULTI-SECTOR COUNT Entry Parameters: Registers C: 2CH E: Number of Sectors Returned Value: Register A: Return Code The Set Multi-Sector Count function provides logical record blocking under CP/M 3. It enables a program to read and write from 1 to 128 records of 128 bytes at a time during subsequent BDOS Read and Write functions. Function 44 sets the Multi-Sector Count value for the calling program to the value passed in register E.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 45: SET BDOS ERROR MODE Entry Parameters: Registers C: 2DH E: BDOS Error Mode Returned Value: None Function 45 sets the BDOS error mode for the calling program to the mode specified in register E. If register E is set to OFFH, 255 decimal, the error mode is set to Return Error mode. If register E is set to OFEH, 254 decimal, the error mode is set to Return and Display mode.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 46: GET DISK FREE SPACE Entry Parameters: Registers C: 2EH E: Drive Returned Value: Registers A: H: First 3 bytes of current DMA buffer Error Flag Physical Error The Get Disk Free Space function determines the number of free sectors, 128 byte records, on the specified drive. The calling program passes the drive number in register E, with 0 for drive A, 1 for B, and so on, through 15 for drive P in a full 16drive system.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, register A is set to zero if the function is successful.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 47: CHAIN TO PROGRAM Entry Parameters: Registers C: 2FH E: Chain Flag The Chain To Program function provides a means of chaining from one program to the next without operator intervention. The calling program must place a command line terminated by a null byte, OOH, in the default DMA buffer.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 48: FLUSH BUFFERS Entry Parameters: Registers C: 30H Returned Value: E: Purge Flag Registers A: Error Flag H: Physical Error The Flush Buffers function forces the write of any write-pending records contained in internal blocking/deblocking buffers. If register E is set to OFFH, this function also purges all active data buffers.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 49: GET / SET SYSTEM CONTROLBLOCK Entry Parameters: Registers C: 31H DE: SCB PB Address Returned Value: Registers A: Returned Byte HL: Returned Word Function 49 allows access to parameters located in the CP/M 3 System Control Block (SCB). The SCB is a 100-byte data structure residing within the BDOS that contains flags and data used by the BDOS, CCP and other system components. Note that Function 49 is a CP/M 3 specific function.
BDOS Function Calls CP/M 3 Programmers Guide Use caution when you set SCB fields. Some of these parameters reflect the current state of the operating system. If they are set to invalid values, software errors can result. In general, do not use Function 49 to set a system parameter if another BDOS function can achieve the same result. For example, Function 49 can be called to update the Current DMA Address field within the SCB.
BDOS Function Calls CP/M 3 Programmers Guide Table 3-4.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 50: DIRECT BIOS CALLS Entry Parameters: Registers C: 32H DE: BIOS PB Address Returned Value: BIOS RETURN Function 50 provides a direct BIOS call through the BDOS to the BIOS. The calling program passes the address of a data structure called the BIOS Parameter Block (BIOSPB) in register pair DE.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 59: LOAD OVERLAY Entry Parameters: Registers C: 3BH DE: FCB Address Returned Value: Registers A: Error Code H: Physical Error Only transient programs with an RSX header can use the Load Overlay function because BDOS Function 59 is supported by the LOADER module. The calling program must have a header to force the LOADER to remain resident after the program is loaded (see Section 1.3). Function 59 loads either an absolute or relocatable module.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 60: CALL RESIDENT SYSTEM EXTENSION Entry Parameters: Registers C: 3CH DE: RSX PB Address Returned Value: Registers A: Error Code H: Physical Error Function 60 is a special BDOS function that you use when you call Resident System Extensions. The RSX subfunction is specified in a structure called the RSX Parameter Block, defined as follows: RSXPB: db FUNC db NUMPARMS dw PARMETER1 dw PARMETER2 ...
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 98: FREE BLOCKS Entry Parameters: Register C: 62H Returned Value: Registers A: Error Flag H: Physical Error The Free Blocks function scans all the currently logged-in drives, and for each drive returns to free space all temporarily-allocated data blocks. A temporarily-allocated data block is a block that has been allocated to a file by a BDOS write operation but has not been permanently recorded in the directory by a BDOS close operation.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 99: TRUNCATE FILE Entry Parameters: Registers C: 63H DE: FCB Address Returned Value: Registers A: Directory Code H: Extended or Physical Error The Truncate File function sets the last record of a file to the random record number contained in the referenced FCB.
BDOS Function Calls CP/M 3 Programmers Guide Function 99 also requires that the random record number field of the referenced FCB specify a value less than the current file size. In addition, if the file is sparse, the random record field must specify a record in a region of the file where data exists.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 100: SET DIRECTORY LABEL Entry Parameters: Registers C: 64H DE: FCB Address Returned Value: Registers A: Directory Code H: Physical or Extended Error The Set Directory Label function creates a directory label, or updates the existing directory label for the specified drive. The calling program passes in register pair DE the address of an FCB containing the name, type, and extent fields to be assigned to the directory label.
BDOS Function Calls CP/M 3 Programmers Guide Function 100 also requires that the referenced directory contain SFCBs to activate date and time stamping on the drive. If an attempt is made to activate date and time stamping when no SFCBs exist, Function 100 returns an error code of OFFH in register A and performs no action. The CP/M 3 INITDIR utility initializes a directory for date and time stamping by placing an SFCB record in every fourth entry of the directory.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 101: RETURN DIRECTORY LABEL DATA Entry Parameters: Registers C: 65H E: Drive Returned Value: Registers A: Directory Label Data Byte H: Physical Error The Return Directory Label Data function returns the data byte of the directory label for the specified drive. The calling program passes the drive number in register E with 0 for drive A, 1 for drive B, and so on through 15 for drive P in a full sixteen drive system.
BDOS Function Calls BDOS FUNCTION 102: CP/M 3 Programmers Guide READ FILE DATE STAMPS AND PASSWORD MODE Entry Parameters: Registers C: 66H DE: FCB Address Returned Value: Registers A: Directory Code H: Physical Error Function 102 returns the date and time stamp information and password mode for the specified file in byte 12 and bytes 24 through 32 of the specified FCB.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, Function 102 returns a Directory Code in register A with the value zero if the function is successful, or OFFH, 255 decimal, if the specified file is not found. Register H is set to zero in both of these cases. If a physical or extended error is encountered, Function 102 performs different actions depending on the BDOS error mode (see Function 45).
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 103: WRITE FILE XFCB Entry Parameters: Registers C: 67H DE: FCB Address Returned Value: Registers A: Directory Code H: Physical Error Ile Write File XFCB function creates a new XFCB or updates the existing XFCB for the specified file. The calling program passes in register pair DE the address of an FCB in which the drive, name, type, and extent fields have been defined.
BDOS Function Calls CP/M 3 Programmers Guide Upon return, Function 103 returns a Directory Code in register A with the value zero if the XFCB create or update is successful, or OFFH, 255 decimal, if no directory label exists on the specified drive, or the file named in the FCB is not found, or no space exists in the directory to create an XFCB. Function 103 also returns with OFFH in register A if passwords are not enabled by the referenced directory's label.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 104: SET DATE AND TIME Entry Parameters: Registers C: 68H DE: DAT Address Returned Value: none The Set Date and Time function sets the system internal date and time. The calling program passes the address of a 4-byte structure containing the date and time specification in the register pair DE.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 105: GET DATE AND TIME Entry Parameters: Registers C: 69H DE: DAT Address Returned Value: Register A: seconds DAT set The Get Date and Time function obtains the system internal date and time. The calling program passes in register pair DE, the address of a 4-byte data structure which receives the date and time values. The format of the date and time, DAT, data structure is the same as the format described in Function 104.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 106: SET DEFAULT PASSWORD Entry Parameters: Registers C: 6AH DE: Password Address Returned Value: none The Set Default Password function allows a program to specify a password value before a file protected by the password is accessed. When the file system accesses a password-protected file, it checks the current DMA, and the default password for the correct value. If either value matches the file's password, full access to the file is allowed.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 107: RETURN SERIAL NUMBER Entry Parameters: Registers C: 6BH DE: Serial Number Field Returned Value: Serial number field set Function 107 returns the CP/M 3 serial number to the 6-byte field addressed by register pair DE.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 108: GET/SET PROGRAM RETURN CODE Entry Parameters: Registers C: 6CH DE: 0FFFFH (Get) or Program Return Code (Set) Returned Value: Register HL: Program Return Code or (no value) CP/M 3 allows programs to set a return code before terminating. This provides a mechanism for programs to pass an error code or value to a following job step in batch environments.
BDOS Function Calls Code CP/M 3 Programmers Guide Table 3-5. Program Return Codes Meaning 0000 - FEFF Successful return FF00 - FFFE Unsuccessful return 0000 The CCP initializes the Program Return Code to zero unless the program is loaded as the result of program chain. FF80 - FFFC Reserved FFFD The program is terminated because of a fatal BDOS error. FFFE The program is terminated by the BDOS because the user typed a CTRL-C.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 109: GET/SET CONSOLE MODE Entry Parameters: Registers C: 6DH DE: OFFFFH (Get) or Console Mode (Set) Returned Value: Register HL: Console Mode or (no value) A program can set or interrogate the Console Mode by calling Function 109. If register pair DE = OFFFFH, then the current Console Mode is returned in register HL. Otherwise, Function 109 sets the Console Mode to the value contained in register pair DE.
BDOS Function Calls CP/M 3 Programmers Guide bits 8,9 -Console status mode for RSXs that perform console input redirection from a file. These bits determine how the RSX responds to console status requests. bit 8 = 03 bit 9 = 0 - conditional status bit 8 = 01 bit 9 = 1 - false status bit 8 = 1, bit 9 = 0 - true status bit 8 = 11 bit 9 = 1 - bypass redirection Note that the Console Mode bits are numbered from right to left.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 110: GET/SET OUTPUT DELIMITER Entry Parameters: Registers C: 6EH DE: OFFFFH (Get) or E: Output Delimiter (Set) Returned Value: Register A: Output Delimiter or (no value) A program can set or interrogate the current Output Delimiter by calling Function 110. If register pair DE = 0FFFFH, then the current Output Delimiter is returned in register A. Otherwise, Function 110 sets the Output Delimiter to the value contained in register E.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION111: PRINT BLOCK Entry Parameters: Registers C: 6FH DE: CCB Address Returned Value: none The Print Block function sends the character string located by the Character Control Block, CCB, addressed in register pair DE, to the logical console, CONOUT:. If the Console Mode is in the default state (see Section 2.2.1), Function 111 expands tab characters, CTRL-I, in columns of eight characters.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 112: LIST BLOCK Entry Parameters: Registers C: 70H DE: CCB Address Returned Value: none The List Block function sends the character string located by the Character Control Block, CCB, addressed in register pair DE, to the logical list device, LST.-.
BDOS Function Calls CP/M 3 Programmers Guide BDOS FUNCTION 152: PARSE FILENAME Entry Parameters: Registers C: 98H DE: PFCB Address Returned Value: Register HL: Return code Parsed file control block The Parse Filename function parses an ASCII file specification and prepares a File Control Block, FCB. The calling program passes the address of a data structure called the Parse Filename Control Block, PFCB, in register pair DE.
BDOS Function Calls CP/M 3 Programmers Guide The Parse Filename function parses the first file specification it finds in the input string. The function first eliminates leading blanks and tabs. The function then assumes that the file specification ends on the first delimiter it encounters that is out of context with the specific field it is parsing. For instance, if it finds a colon, and it is not the second character of the file specification, the colon delimits the entire file specification.
BDOS Function Calls Location CP/M 3 Programmers Guide Table 3-6. FCB Format Contents byte 0 The drive field is set to the specified drive. If the drive is not specified, the default drive code is used. 0 = default, 1 = A, 2 = B. byte 1-8 The name is set to the specified filename. All letters are converted to upper-case. If the name is not eight characters long, the remaining bytes in the filename field are padded with blanks.
BDOS Function Calls CP/M 3 Programmers Guide If an error occurs, Function 152 returns an 0FFFFH in register pair HL. On a successful parse, the Parse Filename function checks the next item in the input string. It skips over trailing blanks and tabs and looks at the next character. If the character is a null or carriage return, it returns a 0 indicating the end of the input string. If the character is a delimiter, it returns the address of the delimiter.
Section 4 Programming Examples The programs presented in this section illustrate how to use the BDOS functions described in the previous section. The examples show how to copy a file, how to dump a file, how to create or access a random access file, and how to write an RSX program. 4.1 A Sample File-To-File Copy Program The following program illustrates simple file operations. You can create the program source file, COPY.ASM, using ED or another editor, and then assemble COPY.ASM using MAC.
4.1 A Sample Copy Program CP/M 3 Programmer's Guide ; sample file-to-file copy program ; at the ccp level , the command ; copy a:x.y b:u.v ; copies the file named x.y from drive ; a to a file named u.v on drive b.
4.
4.
4.2 A Sample File Dump Utility CP/M 3 Programmer's Guide 4.2 A Sample File Dump Utility The following dump program reads an input file specified in the CCP command line, and then displays the content of each record in hexadecimal format at the console.
4.
4.
4.
4.2 A Sample File Dump Utility ; 01c1 af 01c2 327c00 0lc5 115c00 01c8 0e0f 0lca cd0500 ; CP/M 3 Programmer's Guide open the file for input xra a ;zero to accum sta fcbcr ;clear current rec0rd lxi d,fcb mvi c,openf call bdos 255 in accum if open error 0lcd c9ret diskr: ;read disk file record 0lce e5d5c5 Push h! Push d! Push b 0ldI 115c00 lxi d,fcb 01d4 0e14 mvi c,readf 01d6 cd0500 call bdos 01d9 c1d1e1 Pop b! Pop d! Pop h 0ldc c9 ret ; fixed message area 0ldd 46494c0 signon: db 'file dumP version 2.
4.3 A Sample Random Access Program CP/M 3 Programmer's Guide 4.3 A Sample Random Access Program This example is an extensive but complete example of random access operation. The following program reads or writes random records upon command from the terminal. When the program has been created, assembled, and placed into a file labeled RANDOM.COM, the CCP level command A>RANDOM X.DAT can start the test program. In this case, the RANDOM program looks for a file X.
4.3 A Sample Random Access Program CP/M 3 Programmer's Guide The program begins with an initialization section where the input file is opened or created, followed by a continuous loop at the label ready where the individual commands are interpreted. The program uses the default file control block at 005CH and the default buffer at 0080H in all disk operations. The utility subroutines that follow contain the principal input line processor, called readc.
4.3 A Sample Random Access Program CP/M 3 Programmer's Guide ;************************************ ;* * ;* load SP, Set-up file for random access * ;* * ;************************************ 0100 313703 lxi sp,stack ; version3.1? 0103 0E0c mvi c,version 0105 cD0500 call bdos 0108 FE20 cp 31h ;version 3.
4.
4.
4.
4.
4.
4.
4.
4.3 A Sample Random Access Program CP/M 3 Programmer's Guide Instead of reading a number, the QUERY program reads an alphanumeric string which is a particular key to find in the NAMES.DAT data base. Because the LASTNAME.KEY list is sorted, you can find a particular entry quickly by performing a binary search, similar to looking up a name in the telephone directory.
4.4 Construction of an RSX Program CP/M 3 Programmer's Guide 4.4.1 The RSX Prefix The first 27 bytes of an RSX program contain a standard data structure called the RSX prefix. The RSX prefix has the following format: serial: db start:.
4.4 Construction of an RSX Program CP/M 3 Programmer's Guide The prev: field contains the address of the preceding RSX in memory or location 5 if the RSX is the first RSX in the chain. The remove: field controls whether the RSX is removed from memory by the next call to the LOADER module via BDOS function 59. If the remove: flag is OFFH, the LOADER removes the RSX from memory. Note that the CCP always calls the LOADER module during a warm start operation.
Construction of an RSX Program CP/M 3 Programmer's Guide ; CALLVERS program 0005 = bdos equ 5 ; entrY point for BDOS 000B = prtstr equ B ; print string funCtion 000C = vers equ 12 ; get version function 000D = cr equ 0dh ; carriage return 000A = lf equ 0ah ; line feed 0100 org l00h 0100 1605 mvi d,5 ; Perform 5 times 0102 DS loop: push d ; save counter 0103 0E0B mvi c,Prtstr 0105 111e01 lxi d,call$msg ; Print call message oioe CD0500 call bdos 0l0B 0E0C mvi c,vers 0l0D CD0500 call bdos ; try to get versio
Construction of an RSX Program CP/M 3 Programmer's Guide ftest: 001B 001C 001E 0021 0024 0027 0028 002B 002E 0030 0033 0036 0039 003A 003D 003E 0054 0056 0076 79 mov FE0C cpi CA2400 Jz C30500 Jmp begin: 210000 lxi 39 dad 225400 shld 317600 lxi 0E05 mvi 113E00 lxi CD0900 call 2A5400 lhld F9 sphl 213100 lxi C9 ret test$msg: 0D0A2A2A2A db ret$stack: 0000 dw ds loc$stack : end ; is this function 12? a,c 12 begin ; next ; Yes - intercept some other function h,0 sp ; save stack ret$stack sp,loc$stack c,ps
Construction of an RSX Program CP/M 3 Programmer's Guide You can prepare the above programs for execution as follows: 1. Assemble the CALLVERS program using MAC as follows: MAC CALLVERS 2. Generate a COM file for CALLVERS with HEXCOM: HEXCOM CALLVERS 3. Assemble the RSX program ECHOVERS using RMAC: RMAC ECHOYERS 4. Generate a PRL file using the LINK command: LINK ECHOVERS [OPI S. Rename the PRL file to an RSX file: RENAME ECHOVERS*RSX=ECHOVERS.PRL 6.
Appenix A System Control Block The System Control Block (SCB) is a CP/M 3 data structure located in the BDOS. CP/M 3 uses this region primarily for communication between the BDOS and the BIOS. However, it is also available for communication between application programs, RSXS, and the BDOS. Note that programs that access the System Control Block are not version independent. They can run only on CP/M 3.
Appendix A System Control Block CP/M 3 Programmer's Guide Table A-1. (continued) Offset RW/RO Definition 1A RW Console Width. This byte contains the number of columns, characters per line, on your console relative to zero. Most systems default this value to 79. You can set this default value by using the GENCPM or the DEVICE utility. The console width value is used by the banked version of CP/M 3 in BDOS function 10, CP/M 3's console editing input function.
Appendix A System Control Block CP/M 3 Programmer's Guide Table A-1. (continued) Offset RW/RO Definition 22 - 23 RW CONIN Redirection Flag. 24 - 25 RW CONOUT Redirection Flag. 26 - 27 RW AUXIN Redirection Flag. 28 - 29 RW AUXOUT Redirection Flag. 2A - 2B RW LSTOUT Redirection Flag. 2C RW Page Mode. If this byte is set to zero, some CP/M 3 utilities and CCP built-in commands display one page of data at a time; you display the next page by pressing any key.
Appendix A System Control Block Offset RW/RO CP/M 3 Programmer's Guide +Table A-1. (continued) Definition 35 - 36 RO Reserved for system use. 37 RW Output delimiter character. The default output delimiter character is $, but you can change this value by using the BDOS Function 110, Get/Set Output Delimiter. 38 RW List Output Flag. If this byte is set to 0, console output is not echoed to the list device. If this byte is set to 1 console output is echoed to the list device.
Appendix A System Control Block CP/M 3 Programmer's Guide Table A-1. (continued) Offset RW/RO Defint.tion 4B RW BDOS Error Mode. This field is set by BDOS Function 45, Set BDOS Error Mode. If this byte is set to OFFH, the system returns to the current program without displaying any error messages. If it is set to OFEH, the system displays error messages before returning to the current program. Otherwise, the system terminates the program and displays error messages.
Appendix A System Control Block Offset CP/M 3 Programmer's Guide Table A-1. (continued) Definition RW/RO 57 RO BDOS Flags. Bit 7 applies to banked systems only. If bit 7 is set, then the system displays expanded error messages. The second error line displays the function number and FCB information. (See Section 2.3.13). Bit 6 applies only to nonbanked systems. If bit 6 is set, it indicates that GENCPM has specified single allocation vectors for the system.
Appendix B PRL File Generation B. 1 PRL Format A Page Relocatable Program has an origin offset of 100H bytes that is stored on disk as a file of type PRL. The format is shown in Table B-1. Table B-1.
Appendix B PRL Generation CP/M 3 Programmer's Guide B.2 Generating a PRL The preferred technique for generating a PRL file is to use the CP/M LINK-80", which can generate a PRL file from a REL relocatable object file. This technique is described in the Programmer's Utilities Guide for The CPIM Family of Operating Systems. A sample link command is shown below.
Appendix C SPR Generation System Page Relocatable, SPR, files are similar in format to PRL files except that SPR files have an origin offset of 0000H (see Appendix B). SPR Files are provided as part of the standard CP/M 3 System: the resident and banked portions of the banked BDOS, named RESBDOS3.SPR and BNKBDOS3.SPR, and the nonbanked BDOS,, named BDOS3.SPR. The customized BIOS must also be generated in SPR format before GENCPM can create a CP/M 3 system. The BIOS SPR file is named BNKBIOS3.
Appendix D ASCII and Hexadecimal Conversions This appendix contains tables of the ASCII symbols, including their binary, decimal, and hexadecimal Conversions. Symbol ACK BEL BS CAN CR DC DEL DLE EM ENQ EOT ESC ETB ETX FF Table D-1.
Appendix D : ASCII and HEX Conversions Binary 0000000 0000001 0000010 0000011 0000100 0000101 0000110 0000111 0001000 0001001 0001010 0001011 0001100 0001101 0001110 0001111 0010000 0010001 0010010 0010011 0010100 0010101 0010110 0010111 0011000 0011001 0011010 0011011 0011100 0011101 0011110 0011111 0100000 0100001 0100010 0100011 0100100 Decimal 000 001 002 003 004 005 006 007 008 009 010 011 012 013 014 015 016 017 018 019 020 021 022 023 024 025 026 027 028 029 030 031 032 033 034 035 036 CP/M 3 Progr
Appendix D : ASCII and HEX Conversions CP/M 3 Programmer's Guide Table D-2.
Appendix D : ASCII and HEX Conversions Binary 1001010 1001011 1001100 1001101 1001110 1001111 1010000 1010001 1010010 1010011 1010100 1010101 1010110 1010111 1011000 1011001 1011010 1011011 1011100 1011101 1011110 1011111 1100000 1100001 1100010 1100011 1100100 1100101 1100110 Decimal 074 075 076 077 078 079 080 081 082 083 084 085 086 087 088 089 090 091 092 093 094 095 096 097 098 099 100 101 102 CP/M 3 Programmer's Guide Table D-2.
Appendix D : ASCII and HEX Conversions Binary 1100111 1101000 1101001 1101010 1101011 1101100 1101101 1101110 1101111 1110000 1110001 1110010 1110011 1110100 1110101 1110110 1110111 1111000 1111001 1111010 1111011 1111100 1111101 1111110 1111111 Decimal 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 CP/M 3 Programmer's Guide Table D-2.
Appendix E BDOS Function Summary Table E-1.
Appendix E : BDOS Function Summary CP/M 3 Programmer's Guide Table E-1.
Appendix E : BDOS Function Summary CP/M 3 Programmer's Guide Table E-1. (continued) Function I Function Name Input Parameters Returned Values 98 Free Blocks none A = Err Flag 99 Truncate File DE = .FCB A = Dir Code 100 Set Directory Label DE = .FCB A = Dir Code 101 Return Directory E = Drive A = Dir label data byte Label Data 102 Read File Date Stamps DE = .FCB A = Dir Code and Password Mode 103 Write File XFCB DE = .FCB A = Dir Code 104 Set Date and Time DE = .DAT A = 00H 105 Get Date and Time DE = .
Index ? in filename error, 2-30 $$$ filetype, 1-27 A absolute module, 3-73 access date and time stamp, 3-21 stamp types, 2-24 ACCESS DRIVE, 3-57 address, maximumm, 1-5 allocation vector, 2-27 , 3-41 , 3- 75 ambiguous file reference, 1-13, 2-16, 3-24, 3-27 archive attribute, 2-17 ASCII character file, 1-18 ASM , 2-11 assembler source, 2-11 associated command files, 1-18 asterisk, 1-13, 2-11 attribute bits, 2-16 attributes set file, 2-22 automatic submit, 1-19 Auxiliary Input, 3-4 Auxiliary Input Status, 3-9
Index system, 1-3 version requirements, 1-5 bank-switching, 1-4 bank-switched memory, 1-1, 1-3 BAS, 2-11 base address, 1-21 base extent, 3-48, 3-50 basic console I/O, 2 -3 calling program, 2-15 return to, 2-28 carriage return, 2-13, 3-2 CCB, 3-94, 3-95 CCP description 1-7, 1-8, 1-11, 1-13 location, 1-6, 1-15 operation, 1-16 to 1-28 user number, 2-18 CCP.
Index parsing, 1-17 common memory, 1-3, 1-5 base address, 3-71 region, 1-3 common region, 1-3 size, 1-5 compatibility, 1-22, 1-28 compatibility between CP/M 3 and MP/M, 3-61, 3-62 Compute File Size, 2-28, 3-53 conditional command, 1-23 conditional status, 2-6 configured memory size, 1-7 CONIN, 1-7, 2-2, 2-3, 3-2,, 3-16 CONOUT, 2-2, 2-3, 3-3 console, block output, 2-3 characteristics, 1-27 column position, 3-70 I/O functions, 2-3 CTRL-F, 3-14 CTRL-G, 2-4, 3-14 CTRL-H, 3-2, 3-13, 3-14 backspace, 3-13 CTRL-I,
Index 2-23, 2-25, 3-35, 3-81, 3-85 DATE utility, 2-25 default disk, 1-15, 3-19 DMA buffer, 2-35 drive, 1-16, 1-28 FCB, 2-37 mode, 3-64 output delimiter, 3-93 password, 2-23, 3-87 Default Error Mode, 3-64 Delete File, 2-17, 2-22, 3- 27 delimiter, 1-17, 2-10, 3-11, 3-93 file specification, 3- 97 DEVICE utility, 2-2 differences: banked and nonbanked, 1-2 DIR, 1-18 DIR.
Index extended, 2-29, 2-34 file exists, 2-30 flag, 2-33 handling, 2-28 invalid drive, 2-29 messages, 2-29, 2-30 mode, 2-29, 3-64, 3-71 physical, 2-28, 2-29, 2-34 program code, 3-89 read-only, 2-30 return code, 3-70 extend operating system functions, 1-9, 1-23 extended error codes, 2-29, 2-30, 2-34, extended FCB, 2-19 extent 0, 3-48, 3-50 extent field format, 3-83 extent number, 2-14 F false status, 2-6 FCB, 3-20 default, 2-36, 2-37 extent number field, 3-35 format, 2-18, 3-98 length, 2-13 parsed, 1-21 rando
Index 28: 29: Write Protect Disk, 3-42 Get Read-Only Vector, 3-43 30: Set File Attributes, 3-44 31: Get ADDR(DPB PARMS), 3-46 3 2 : Set/Get User Code, 3-47 3 3: Read Random, 3-48 34: Write Random, 3-50 3 5: Compute File Size, 3-53 36: Set Random Record, 3- 55 3 7: Reset Drive, 3-56 38: Access Drive, 3-57 39: Free Drive, 3-58 40: Write Random with Zero Fill, 3- 59 41: Test and Write Record, 3-60 42: Lock Record, 3-61 43- Unlock Record, 3-62 44: Set Multi-Sector Count, 3-63 45: Set BDOS Error Mode, 3-64 46:
Index 106: 107: 108: 109: 110: 111: Set Default Password, 3-87 Return Serial Number, 3-88 Get/set Program Return Code, 3-89 Get/Set Console Mode, 3-91 Get/Set Output Delimiter, 3-93 Print Block, 3-94 internal date and time, 3-85 Invalid Drive error, 2-29 invalid function calls, 2-1 J jump instructions, 1-25 K key fields, 3-55 L length, 1-21, 2-23 line editing, 2-4 line feed, 2-13, 3-2 LINK-80 , B-2 List Block, 3-95 list device, 2-4, 3-2 List Output, 3-6 LOADER base, 1-9, 1-11 LOADER module, 1-6, 1-9, 1-11
Index auxiliary output device, 2-2 AUXIN, 2-2 AUXOLJT, 2-2 CONIN, 2-2 CONOUT, 2-2 console input device, 2-2 console output device, 2-2 device names, 2-2 drive, 1-11, 2-11, 2-12 list device, 3-6 list output device, 2-2 LST, 2-2 memory organization, 1-5 record size, 2-25 LST, 2-4, 2-6 LST:, 3-2, 3-6, 3-95 multi-user operating system, 1-19, 1-28 multiple file reference, 1-13 N next record, 3-55 nibble, 1-28 nonbanked memory organization, 1-2 nonbanked systems, 1-1 nonsupported function number, 2-1 null byte,
Index SCB, 3-69 parameter substitutions, 1-27 parse, procedure, 1-19 parsed FCB, 1-21 Parse Filename, 3-96 Partial Close, 2-17, 3-22 password, 1-17, 1-20, 2-21, 3-83, assign, 2-17 default, 2-23, 3-87 field, 2-9, 2-10, 2-35 length, 2-23, 2-35, 2-36 mode, 3-81 protection, 1-13, 2-22, 3-33 , 3-34, 3-87 support, 1-1 testing, 2-22 Password Protection Modes, 2-22 permanent close operation, 3-22 physical drive, 1-11 error, 2-29, 3-33 error codes, 2-34, 3-19, 3-21 , 3-25 file size, 3-53 memory, 1-2 record size, 2-2
Index restoring values, 2-1 saving values, 2-1 REL, 2-11 Relocatable Module, 2-11, 3-73 relocation, B-1 remove flag, 1-26 last character, 3-13 RSX, 1-26 RENAME, 1-18 Rename File, 3-36 Reset Disk System, 1-22, 3-18 Reset Drive, 2-27, 3-18, 3-56 resident operating system module, 1-3 resident portion, 1-3 Resident System Extension See RSX Resident System Extension program, 4-20 Return Current Disk, 3-39 Directory Label, 2-21 Directory Label Data, 2- 33 , 3-80 Error Mode, 3-64 Login Vector, 3-38 Serial Number,
Index RSX Parameter Block, 3-74 rub/del, 3-13 SPR, 2-11 standard CP/M command line, 1-17 standard delete, 3-27 standard search, 3-24 start scroll, 3-2 stop scroll, 3-2 subfields, 2-24 SUB filetype, 1-19 submit command line, 1-26 file, 1-15, 1-18, 1-20, 1-26 SUBMIT, 1-19 RSX, 1-27 utility, 1-13, 1-26 successful function, 2- 32 SYM, 2-11 SYS, 2-11 SYS attribute, 1-18 Sys. Page Reloc.
Index System File, 2-11 System Reset, 3-1 T tab characters, 3-2 tab expansion, 2-3, 2-5 temporarily allocated data block, 3-75 temporary file, 2-11 file drive, 1-27, 3-71 submit file, 1-27 terminate program execution, 1-8, 1-22 VALUE parameter, 3-69 version-independent programming, 3-17 version number, 3-70 virtual file size, 3-53 W warm start, 1-11, 1-15, 1-22, 1-25, 3-1 wildcard characters, 1-13 write data record, 3-31 Wr ite File XFCB, 2-22, 3-83 Protect Disk, 3-42, 3-43 Random, 2-30, 3-50 Random with
Index