DIGITAL RESEARCH TM CP/M Operating System Manual CP/M Features and Facilities the CP/M Editor
Total Page:16
File Type:pdf, Size:1020Kb
CP/M Features and Facilities The CP/M Editor DIGITAL RESEARCH TM CP/M Operating System Manual COPYRIGHT Copyright C 1976, 1977, 1978, 1979, 1982, and 1983 by Digital Research. 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, Post Office Box 579, Pacific Grove, California 93950. This manual is, however, tutorial in nature. Thus, the reader is granted permission to include the example programs, either in whole or in part, in his own programs. DISCLAIMER Digital Research makes no representations or warranties with respect to the contents hereof and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. Further, Digital Research 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 revision or changes. TRADEMARKS CP/M and CP/NET are registered trademarks of Digital Research. ASM, DESPOOL, DDT, LINK-80, MAC, MP/M, PL/1-80 and SID are trademarks of Digital Research. Intel is a registered trademark of Intel Corporation. TI Silent 700 is a trademark of Texas Instruments Incorporated. Zilog and Z80 are registered trademarks of Zilog, Inc. The CP/M Operating System Manual was printed in the United States of America. First Edition: 1976 Second Edition: July 1982 Third Edition: September 1983 Table of Contents 1 CP/M Features and Facilities 1.1 Introduction 1-1 1.2 Functional . Description .......................... 1-3 1.2.1 ....General Command Structure ............. 1-3 1.2.2 ....File References ........................ 1-4 1.3 Switching . Disks ................................ 1-7 1.4 Built-in . Commands ............................ 1-7 1.4.1 ....ERA ................................. 1-8 1.4.2 ....DIR .................................. 1-9 1.4.3 ....REN ................................ 1-10 1.4.4 ....SAVE ............................... 1-11 1.4.5 ....TYPE ............................... 1-11 1.4.6 ....USER ............................... 1-12 1.5 Line Editing and Output Control 1-12 1.6 Transient Commands 1-14 1.6.1 STAT .......................................I -15 1.6.2 ASM ........................................1-22 1.6.3 LOAD .......................................1-24 1.6.4 PIP ..........................................1-25 1.6.5 ED ..........................................1-35 1.6.6 SYSGEN ....................................1-37 1.6.7 SUBMIT .....................................1-39 1.6.8 DUMP ......................................1-41 1.6.9 MOVCPM ...................................1-42 1.7 BDOS Error Messages ............................... 1-44 1.8 Operation of CP/M on the MDS ....................... 1-46 2 ED 2.1 Introduction to ED ................................... 2-1 2.1.1 ED Operation ............................... 2-1 2.1.2 Text Transfer Functions ....................... 2-3 2.1.3 Mei-norv Buffer Organization .................. 2-4 2.1.4 Line numbers and ED Start Up ................. 2-5 2.1.5 Metnorv Buffer Operation ..................... 2-7 2.1.6 Command Strings ............................ 2-8 Table of Contents (continued) 2.1.7 Text Search and Alteration .......... 2-11 2.1.8 Source Libraries ................... 2-15 2.1.9 Repetitive Command Execution ...... 2-17 2.2 ED Error Conditions ....................... 2-18 2.3 Control Characters and Commands 2-19 3 CP/M Assembler 3.1 Introduction ...................................... 3-1 3.2 Program Format ................................... 3-3 3.3 Forming the Operand ............................... 3-4 3.3.1 Labels ................................... 3-5 3.3.2 Numeric Constants ......................... 3-5 3.3.3 Reserved Words ........................... 3-6 3.3.4 String Constants ........................... 3-7 3.3.5 Arithmetic and Logical Operators ............. 3-7 3.3.6 Precedence of Operators ..................... 3-9 3.4 Assembler Directives .............................. 3-10 3.4.1 The ORG Directive ........................ 3-11 3.4.2 The END Directive ........................ 3-11 3.4.3 The EQU Directive ........................ 3-12 3.4.4 The SET Directive ........................ 3-13 3.4.5 The IF and ENDIF Directive ................ 3-13 3.4.6 The DB Directive ......................... 3-15 3.4.7 The DW Directive ......................... 3-15 3.4.8 The DS Directive ......................... 3-16 3.5 Operation Codes ................................. 3-16 3.5.1 Jumps, Calls, and Returns .................. 3-17 3.5.2 Immediate Operand Instructions ............. 3-19 3.5.3 Increment and Decrement Instructions ........ 3-20 3.5.4 Data Movement Instructions ................ 3-21 3.5.5 Arithmetic Logic Unit Operations ............ 3-22 3.5.6 Control Instuctions ........................ 3-24 3.6 Error Messages ................................... 3-24 3.7 A Sample Session ................................ 3-26 Table of Contents (continued) 4 CP/M Dynamic Debugging Tool 4.1 Introduction 4-1 4.2 DDT Commands 4-4 4.2.1 The A (Assembly) Command 4-4 4.2.2 The D (Display) Command ................... 4-5 4.2.3 The F (Fill) Command ....................... 4-5 4.2.4 The G (Go) Command ....................... 4-6 4.2.5 The I (Input) Command ...................... 4-7 4.2.6 The L (List) Command ....................... 4-7 4.2.7 The M (Move) Command ..................... 4-8 4.2.8 The R (Read) Command ...................... 4-8 4.2.9 The S (Set) Command ........................ 4-9 4.2.10 The T (Trace) Command ..................... 4-9 4.2.11 The U (Untrace) Command .................. 4-10 4.2.12 The X (Examine) Command ................. 4-10 4.3 Implementation Notes 4-11 4.4 A Sample Program 4-12 · CP/M 2 System Interface 5.1 Introduction ...................................... 5-1 5.2 Operating Svstem Call Conventions .................. 5-4 5.3 A Sample Flie-to-File Copy Program ................. 5-36 5.4 A Sample File Dump Utility ........................ 5-40 5.5 A Sample Random Access Program .................. 5-46 5.6 System Function Summary ......................... 5-54 6 CP/M Alteration 6.1 Introduction ...................................... 6-1 6.2 First-level System Regeneration ...................... 6-3 6.3 Second-level System Generation ..................... 6-6 6.4 Sample GETSYS and PUTSYS Program ............. 6-11 6.5 Disk Organization ................................ 6-13 6.6 The BIOS Entry Points ............................ 6-15 6.7 A Sample BIOS .................................. 6-25 6.8 A Sample Cold Start Loader ........................ 6-25 Table of Contents (continued) 6.9 Reserved Locations in Page Zero .......................6-26 6.10 Disk Parameter Tables ................................6-28 6.11 The DISKDEF Macro Library ..........................6-34 6.12 Sector Blocking and Deblocking ........................6-39 Appendixes A The MDS Basic 1/0 System (BIOS) ........................ A-1 B A Skeletal CBIOS ...................................... B-1 C A Skeletal GETSYS/PUTSYS Program .................... C-1 D The MDS-800 Cold Start Loader for CP/M 2 ................ D-1 E A Skeletal Cold Start Loader ............................. E-1 F CP/M Disk Definition Library .............................F-I G Blocking and Deblocking Algorithms ...................... G-1 H Glossary .............................................. H-1 I CP/M Messages ........................................ 1-1 Tables 1-1 Line-editing Control Characters ............................1-12 1-2 CP/M Transient Commands ...............................1-14 1-3 Physical Devices ........................................1-17 1-4 PIP Parameters ..........................................1-31 2-1 ED Text Transfer Commands ...............................2-3 2-2 Editing Commands .......................................2-8 2-3 Line-editing Controls ......................................2-9 2-4 Error Message Symbols ...................................2-18 2-5 ED Control Characters ...................................2-19 2-6 ED Commands ..........................................2-20 3-1 Reserved Characters ......................................3-6 3-2 Arithmetic and Logical Operations ..........................3-7 3-3 Assembler Directives .....................................3-10 3-4 Jumps, Calls, and Returns .................................3-17 3-5 Immediate Operand Instructions ............................3-19 3-6 Increment and Decrement Instructions .......................3-20 Table of Contents (continued) 3-7 Data Movement Instructions .............................3-21 1-1 Arithmetic Logic Unit Operations .........................3-22 3-9 Error Codes ...........................................3-24 3-10 Error Messages ........................................3-25 4-1 Line-editing Controls ....................................4-2 4-2 DDT Comniatids ........................................4-2 4-3 CPU Registers .........................................4-11 5-1 CP/M Filetypes .........................................5-7 5-2 File Control Block Fields .................................5-9 5 -3 Edit Control Characters .................................5-16 6-1 Standard Memory Size Values .............................6-3 6-2 Common Values for CP/M