CP/M-86 Operating System Are Not Included in the MRT
Total Page:16
File Type:pdf, Size:1020Kb
CP/M-86'" , OPERATING SYSTEM SYSTEM GUIDE CPIM-86™ System Guide Copyr ight © 1981 Digital Research P.O. Box 579 801 Lighthouse Avenue Pacific Grove, CA ·93950 (408) 649-3896 TfRX 910 360 50 0 1 All Rights Reserved COPYRIGHT Copyright © 1981 by Digital Research. All riqhts reserved. No part of this publication may be reproduced, transmitted, transcribed, stored in a retrieval system, or translated into any lanquage or computer 1anguaqe, i.n any form or by any means, electronic, mechanical, magnetic, optical, chemical, manual or otherwise, without the prior written permission of Digital ~esearch, Post Office Box 57Q, Pacific Grove, California, 93950. This manual is, however, tutorial in nature. ~hus, t he reader is granted permiss ion to include the example programs, ei_ther in whole or in part, in his own programs. DISCLAIMER Dig ita 1 Re sea r c h ma k e s nor e pre sen tat i () n s 0 r warranties with respect to the contents hereof and specifically disclai.ms any implied warranties of merchan tabi 1 i ty or f i tnes s for any part icular purpose. Fur ther, Dig i tal Research reserves the right to revise this publication and to make changes f rom time to time in the content hereof wi thout obligation of Digital Research to notify any person of such revision or changes. TRADEMARKS CP/M is a registered trademark of Digital Research. ASM-86, CP/M-86, CP/M-80, CP/NET, DDT-86, LINK-80, MP/M, and TEX-80 are trademarks of Digital Research. The "CP/M-86 System Guide" was prepared usinq the Digi tal Research TEX-80™ Text Formatter and pr inted in the United States of America by Commercial Press/ Monterey. ********************************* * . Second Printing: June 1981 * ********************************* Foreword The CP/M-86 System Guide presents the system programming aspects of CP/~-86TM, a single-user o~eratinq system for the Intel 8086 and 8088 l6-bit microprocessors. The discussion assumes the reader is familiar with CP/M the Digital Research 8-bit operatinq system. To clarify specific differences with CP/M-86, this document refers to the 8-bft version of CP/M as CP/M-80™. Elements common to both systems are simply called CP/M features. CP/M-80 and CP/M-86 are equivalent at the user interface level and thus the Digital Research documents: • An Introduction to CP/M Features and Facilities • ED: A Context Bditor for the CP/M Disk System • CP/M 2 User~s Guide are shipped with the CP/M-86 package. Also included is the CP/M-86 Programmer~s Guide, which describes ASM-86'rM and DDT-86T]\~, Diqital Research~s 8086 assembler and interactive debugger. Thi s System Gu ide presen ts an overv i e,~ of the CP /M-86 progr amming inter f ace conventions. It also descr ibes procedures for adapting CP/M-86 to a custom hardt.vare enviornment. This information parallels that presented in the CP/M 2 Interface G~ide and the CP/M 2 Alteration G~ide. Section 1 gives an overview of CP/M-86 and summarizes its differences with CP/M-80. Section 2 describes the qeneral execution environment while Section 3 tells how to generate command files. Sections 4 and 5 respectively define the programming interfaces to the Basic Disk Operating Svstem and the Basic Input/Output System. Section 6 discusses alteration of the BIOS to support custom disk configurations, and Section 7 describes the loading operation and the organization of the CP/M-86 system file. iii Table of Contents 1 CP!M-86 System Overview 1.1 CP/M-86 ~eneral Charact~ristics . 1 1.2 CP/M-SO an-i r.P/M-R6 Differences ••. 3 2 Command Setup and Execution Under CP/M-86 2.1 CCP Built-in and ~ransient Comman~s • 7 2.2 ~ransient Proqra~ Execution Models •.••• 8 2.3 The R080 ~emory Mo~el • • • • •. •••• 9 2.4 The Small Memory Model • . • • • . • • 10 2.5 The Compact Memory Model • . • . • • • • 11 2.6 Base Page Initialization ••• • • • 13 2.7 ~ransient Program Load and Exit . 14 3 Command (CMD) File Generation 3.1 Intel Hex Fi1.e Format. • • . •• ..•..• 15 3.2 Operation of GENCMD • . • • . • . • • 16 3.3 Operation of LMCMD • • • . • • • • • • . • • •• 19 3.4 Command u~~n) File Format. • • • • . • . • • •• 20 4 Basic Disk Operating System (BDOS) Functions 4.1 BOOS Parameters and Function Codes •••••• 23 4.2 Simple BOOS Calls ..•..••••. •••. 25 4.3 Bnos File Operations • . • . • • • • . • • •• 30 4.4 BDOS Memory Manaqement and Load •..•...•• 48 5 Basic I/O System (BIOS) Organization 5.1 Organiz~tion of the BIOS • • • 55 5.2 The BIOS Jump Vector 56 5.3 Simple Peripheral Devices 57 5.4 BIOS Subroutine Entry Points • • • • • 60 6 BIOS Disk Definition Tables 6.1 Disk Parameter Table Format • 67 6.2 Table Generation Using GENDEF 72 6.3 G~NDEF Output • • • • • • • . 77 7 CP/M-86 Bootstrap and Adaptation Procedures 7.1 The Cold Start Load Ooeration 81 7.2 Organization of CPM.SYS 84 v Appendixes A Blocking and Deblockinq Algorithms 87 B Random Acc~ss Sample Program 95 C Listing of the Boot Rom 103 D LDBIOS Listing . 113 E BIOS Listing 121 F CSIOS Listing . 137 vi Section 1 CP/M-86 System Overview 1.1 CP/M-86 General Characteristics CP/M-86 contains all facilities of CP/M-80 with additional features to account for increased processor address space of up to a megabyte (1,048,576) of main memory. Further, CP/M-86 maintains file compatibility with all previous versions of CP/M. The file structure of version 2 of CP/M is used, allowing as many as sixteen drives with up to eight megabytes on each drive. Thus, CP/M-SO and CP/M-86 systems may exchange files without modifying the file format. CP/M-86 resides in the file CPM.SYS, which is loaded into memory by a cold start loader during system initialization. The cold start loader resides on the first two tracks of the system disk. CPM.SYS contains three program modules: the Console Command Processor (CCP), the Basic Disk Operating System (BOOS), and the user-conf igurable Basic I/O System (BIOS). The CCP and BDOS portions occupy approximately 10K bytes, while the size of the BIOS varies with the implementation. The operating system executes in any portion of memory above the reserved interrupt locations, while the remainder of the address space is partitioned into as many as eight non-contiguous regions, as defined in a BIOS table. Unlike CP/M-80, the CCP area cannot be used as a data area subsequent to transient program load: all CP!M-86 modules remain in memory at all times, and are not reloaded at a warm start. Similar to CP/M-80, CP/M-86 loads and executes memory image files from disk. Memory image files are preceded by a "header record," defined in this document, which provides information required for proper program loading and execution~ Memory image files under CP/M-86 are identified by a "CMD" file type. Unlike CP/M-80, CP/M-86 does not use absolute locations for system entry or default variables. The BDOS entry takes place through a reserved software interrupt, while entry to the BIOS is provided by a new BOOS call. Two var iables maintained in low memory under CP/M-80, the default disk number and I/O Byte, are placed in the CCP and BIOS, respectively. Dependence upon absolute addresses is minimized in CP/M-86 by maintaining initial "base page" values, such as the default FeB and default command buffer, in the transient program data area. utility programs such as ED, PIP, STAT and SUBMIT operate in the same manner under CP/M-86 and CP/M-80. In its operation, DDT-86 resembles DDT supplied with CP/M-80. It allows interactive debugging of 8086 and 8088 machine code. Similarly, ASM-86 allows assembly language programming and development for the 8086 and 8088 using Intel-like mnemonics. All Information Presented Here is Proprietary to Digital Research CP/M-86 System Guide 1.1 CP/M-86 General Characteristics The GENCMD (Generate CMD) utility replaces the LOAD program of CP/M-80, and converts the hex files produced by ASM-86 or Intel utilities into memory image format suitable for execution under CP/M-86. Further, the LDCOPY (Loader Copy) program replaces SYSGEN, and is used to copy the cold start loader from a system disk for replication. In addition, a variation of GENCMD, called LMCMD, converts output from the Intel LOC86 utili ty into CMD format. Finally, GENDEF (Generate DISKDEF) is J>rovided as an aid in producing custom disk parameter tables. ASM-86, GENCMD, LMCMD, and GENDEF are also supplied in "COM" file format for cross-development under CP/M-80. Several terms used throughout this manual are defined in Table 1-1 below: Table 1-1. CP/M-86 Terms Term I Meaning ~ibble 4-bit half-byte Byte 8-bit value Word l6-bit value Double Word 32-bit value Paragraph 16 contiguous bytes Paragraph Boundary An address divisible evenly by 16 (low order nibble 0) Segment t~ to 64K contiguous bytes Segment Register One of CS, DS, ES, or SS Offset 16-bit displacement from a segment register Group A segment-register-relative relocatable program unit Address The effective memory address derived from the composition of a segment register value with an offset value A group consists of segments that are loaded into memory as a single unit.