CP/M-86™ Operating System System Guide
Total Page:16
File Type:pdf, Size:1020Kb
CP/M-86™ Operating System System Guide Copyright © 1981 Digit al . Research P.O. Box 579 801 Light house Avenue Pacific Grove, CA 93950 (408) 649-3896 TWX 910 360 5001 All Rights Reserved COPYRIGHT Copyright © 1981 by Digital Research. All rights may be r eserv e d . No part of this publication reproduced, transmitted, transcribed, s tored i n a retrieval system, or translated into any language or computer language, in any form or b y a n y means, electronic, mechanical, magnetic, optical, chemical, w rit t e n manual or otherwise, without the prior permission of Digital Research, Post Office Box 579, Pacific Grove, California, 93950. DISCLAIMER Digital Research makes no r e p r e s e n t a t i o ns or warranties with respect to the contents hereof and specifically disclaims any impli ed warranties of merchantability or fitness for a ny p a r t i c u l a r purpose. F u rther, Digital Research reserves the right to revise this publication and to make changes from time to time in the content hereof without obligation of Digital Research to notify any person of such r e v i s i o n o r c h a n ges . TRADEMARKS CP/M, CP/M-86, and CP/NET are registered trademarks of Digital Research. ASM-86, CP/M-80, DDT-86, LINK 80, MP/M, MP/M-86, and TEX are trademarks of Digital Research. Intel is a registered trademark of Intel Corporation. The CP/M-86 0 eratin S stem S stem Guide was prepared using the D igital Research TEX Text Formatter and printed in the United States of America. * ***** * * * * A* * * * * * * * * * * * * * * * * * * * * * First Edition: June 1981 * * S econd Edi t i o n : June 1983 * ***** * * * A** * * * * A* * * * * * * * * * A* * * * Foreword The CP M-86 0 eratin S stem S stem Guide presents the system programming aspects of CP M-86 , a single-user operating system for the Inteltt' 8086 and 8088 16-bit microprocessors. T he di s c u s s i o n assumes that you are familiar with CP/M®, the Digital Research 8 bit operating system. To clarify specific differences with CP/M-86, t his document refers to the 8-bit version of CP/M as CP/M-80™ . Elements common to both systems are simply called CP/M features. The CP/M-86 package also includes the CP M-86 0 eratin S stem User's Guide and t he CP M-86 0 e ratin S stem Pr o r ammer's ~ •• 8086 assembler and interactive debugger. This System Guide presents an o verview of th e C P/M-86 programming interface conventions. It also describes procedures for adapting CP/M-86 to a custom hardware environment. Section 1 gives an overview of CP/M-86 and summarizes its differences with CP/M-80. Section 2 describes the general 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 System 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. Table of Contents CP/M-86 System Overview 1.1 CP/M-86 General Characteristics . 1 1.2 CP/M-80 and CP/M-86 Differences . 3 Command Setup and Execution Under CP/M-86 2.1 CCP Built-in and Transient Commands 78 2.2 Transient Program Execution Models 2.3 The 8080 Memory Model 9 2.4 The Small Memory Model 10 2.5 The Compact Memory Model 11 2.6 Base Page I n i t i al i zat i on 13 2.7 Transient Program Load and Exit 14 Command (CND) File Generation 3.1 Intel Hex File Format 15 3.2 Operatio n o f G ENCMD 16 3.3 Operat i o n o f LMCMD 19 3.4 Command (CMD) Fil e F o r mat 20 Basic Disk Operating System (BDOS) Functions 4.1 BDOS Parameters and Function Codes 23 4.2 Simple BDOS Calls 25 4.3 BDOS File Operations 30 4.4 BDOS Memory Management and Load 48 Basic I/O System (BIOS) Organization 5.1 Organization of the BIOS 55 5.2 The BIOS Jump Vector 56 5.3 Simple Peripheral Devices 57 5.4 BIOS Subroutine Entry Points 60 BIOS Disk Definition Tables 6.1 Disk Parameter Table Format • • • • • • • • • • • 67 • 72 6.2 Table Generation Using GENDEF • • • • • • • • • • • • • • 77 6.3 GRNDEF Output • • • • • • • CP/M-86 Bootstrap and Adaptation Procedures 7.1 The Cold Start Load Operation . 8l 7.2 Organization of CPM.SYS . 84 Appendixes A Blocking and Deblocking Algorithms 87 8 Random Access Sample Program 95 C Listing of the Boot Rom 103 D L D BIOS Lis t i ng 113 E BIOS Listing 121 F C B IOS Lis t i ng 137 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-80 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 (BDOS), and the user-configurable Basic I/O System (BIOS). T h e 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. M emory 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/N-86 does not use absolute locations for system entry or default variables. Th e BDOS entry takes place through a reserved software interrupt, while entry to the BIOS is provided by a new BDOS call. Two variables 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 i s mini mi zed i n C P/ M-86 by mai n t a i n i n g i ni t i al "ba s e p a ge " v a l u e s < such as the default FCB and default command buffer, in the transient p rogram data a r e a . 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 a l lows 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. CP/M-86 System Guide 1.1 CP/N-86 General Characteristics The GENCND (Generate CND) utility replaces the LOAD program of CP/N-89, 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 utility into CND format. Finally, GENDEF (Generate DISKDEF) is erovided as an aid in producing custom disk parameter tables. ASM-86, GENCMD, LNCMD, 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 l - l b e l o w : Table l-l. CP/M-86 Teras Term Meaning Nibble 4-bit half-byte Byte 8 -bit v a l u e Word 1 6-bit v a l u e Double Word 3 2-bit va l u e Paragraph 1 6 cont i g u ous b y t e s Paragraph Boundary An address divisible evenly by 16 ( l o w o r d e r n i bb l e 0) Segment tJp to 64K contiguous bytes Segment Register One of CS , DS , ES , o r 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.