[!Ill DIGITAL RESEARCH™ CP/M® OPERATING SYSTEM
Total Page:16
File Type:pdf, Size:1020Kb
OPERATING SYSTEM MANUAL [!ill DIGITAL RESEARCH™ CP/M® OPERATING SYSTEM MANUAL [!ill DIGITAL RESEARCH™ P.o. Box 579 Pacific Grove, California 93950 COPYRIGHT Copyright © 1976, 1977, 1978, 1979, and 1982 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. 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 publica tion 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 is a registered trademark of Digital Research. MP/M, MAC, and SID are trade marks of Digital Research. Z-80 is a trademark of Zilog, Inc. First Printing: July 1982 CONTENTS • CP/M FEATURES AND FACiLITIES......................... 1 1.1 Introduction .................................................. 1 1.2 Functional Description ......................................... 3 1.2.1 General Command Structure. ... .. .. .. 3 1.2.2 File References ........................................ 3 1.3 Switching Disks............................................... 5 1.4 Built-in Commands.. .. .. .. ............................... 6 1.4.1 ERA.................................................. 6 1.4.2 DIR.................................................. 6 1.4.3 REN.................................................. 7 1.4.4 SAVE... 8 1.4.5 TYPE... 8 1.4.6 USER ...'. 8 1.5 Line Editing and Output Control ............................... 9 1.6 Transient Commands ........................'.................. 9 1.6.1 STAT ............................................ '..... 10 1.6.1 ASM. .. 15 1.6.3 LOAD .......................... '. 16 1.6.4 PIP... 17 1.6.5 ED.................................................... 23 1.6.6 SYSGEN .............................................. 24 1.6.7 SUBMIT ........................................'. 25 1.6.8 DUMP ................ '. 27 1.6.9 MOVCPM. .. 27 1.7 BOOS Error Messages .......................................... 29 1.8 Operation of CP/M on the MDS ................................ 30 2 ED ........ ......... ............................ .................... 33 2.1 Introduction to ED ............................................. 33 2.1.1 ED Operation .......................................... 33 2.1.2 Text Transfer Functions ................................ 35 2.1.3 Memory Buffer Organization ........................... 35 2.1.4 Line Numbers and ED Start Up ......................... 36 2.1.5 Memory Buffer Operation .............................. 37 2.1.6 Command Strings ...................................... 38 2.1.7 Text Search and Alteration ............................. 39 2.1.8 Source Libraries ........................................ 42 2.1.9 Repetitive Command Execution ......................... 42 2.2 ED Error Conditions ........................................... 43 2.3 Control Characters and Commands ............................. 44 ALL INFORMATION PRESENTED HERE IS PROPRIETARY TO DIGITAL RESEARCH 3 CP/M ASSEMBLER .......... ................................. 47 3.1 Introduction ................................................... 47 3.2 Program Format ................................... :........... 48 3.3 Forming the Operand .. '.' . 49 3.3.1 Labels ........•................................. ~ . 50 3.3.2 Numeric Constants ..................................... 50 3.3.3 Reserved Words. • . .. .. .. .. .. .. .. .. .. 50 3.3.4 String Constants ....................................... 51 3.3.5 Arithmetic and Logical Operators ....................... 52 3.3.6 Precedence of Operators ................................ 52 3.4 Assembler Directives ........................................... 53 3.4.1 The ORG Directive .................................... 54 3.4.2 The END Directive ..................................... 54 3.4.3 The EQU Directive ................ ~ . 55 3.4.4 The SET Directive ..................................... 55 3.4.5 The IF and ENDIF Directives ............................ 56 3.4.6 The DB Directive ...................................... 57 3.4.7 The OW Directive ...................................... 57 3.4.8 The OS Directive ...................................... 57 3.5 Operation Codes .......•....................................... 58 3.5.1 Jumps, Calls, and Returns ............................... 58 3.5.2 Immediate Operand Instructions. .. .. .. 59 3.5.3 Increment and Decrement Instructions ................... 60 3.5.4 Data Movement Instructions ............................ 60 , . 3.5.5 Arithmetic Logic Unit Operations ....................... 61 3.5.6 Control Instructions .................................... 62 3.6 Error Messages ................................................ 62 3.7 A Sample Session .............................................. 63 4 CP/M DYNAMIC DEBUGGING TOOL ...... ............... 69 4.1 Introduction ................................................. ~ . 69 4.2 DDT Commands ............................................... 71 , 4.2.1 The A (Assembly) Command............................ 71 4.2.2 The 0 (Display) Command .............................. 72 4.2.3 The F (Fill) Command .................................. 72 4.2.4 The G (Go) Command.................................. 72 4.2.5 The I (Input) Command ................................. 73 4.2.6 The L (List) Command. 74 4.2.7 The M (Move) Command ............................... 74 4.2.8 The R (Read) Command ................................ 74 4.2.9 The S (Set) Command .................................. 75 4.2.10 The T (Trace) Command .............................. 75 4.2.11 The U (Untrace) Command ............................ 76 4.2.12 The X (Examine) Command............................ 76 4.3 Implementation Notes .......................................... 77 4.4 An Example .................' . 78 5 CP /M 2 SYSTEM INTERFACE................................. 89 5.1 , Introduction ................................................... 89 5.2 Operating System Call Conventions ............................. 91 5.3 A Sample File-to-File Copy Program ............................. 110 5.4 A Sample File Dump Utility ..................................... 113 5.5 A Sample Random Access Program ........... .................... 117 5.6 System Function Summary...................................... 124 ALL INFORMATION PRESENTED HERE IS PROPRIETARY TO DIGITAL RESfARCH 6 CP/M ALTERATION............................................ 127 6.1 Introduction ................................................... 127 6.2 First Level System Regeneration ...... ~. 128 6.3 Second Level System Generation ........... ~ .. 131 6.4 Sample GETSYS and PUTSYS Pr"ogram .......................... 134 6.5 Diskette Organization .......................................... 136 6.6 The BIOS Entry Points ......................................... 137 6.7 A Sample BIOS ................................................ 143 6.8 A Sample Cold Start Loader. 143 6.9 Reserved Loca tions in Page Zero ................................ 144 6.10 Disk Parameter Tables. .. .. .. .. 145 6.11 The DISKDEF Macro Library ................................... 148 6.12 Sector Blocking and Deblocking ................................. 152 APPENDIXES A The MDS Basic I/O System (BIOS) ............................. 153 B A Skeletal CBIOS ............................................. 175 C A Skeletal GETSYS/PUTSYS Program ~ ......................... 187 o The MDS-800 Cold Start Loader for CP/M 2 ................... 191 E A Skeletal Cold Start Loader ................................... 197 F CP/M Disk Definition Library .................................. 201 G Blocking and Deblocking Algorithms ........................... 209 H Glossary ...................... "................................ 219 I CP/M Messages ............................................... 235 INDEX ................................................................ 245 FIGURES 2.1 Overall ED Operation ............................................... 34 2.2 Memory Buffer Organization ........................................ 34 2.3 Logical Organization of Memory Buffer .............................. 36 ALL INFORMATION PRESENTED HERE IS PROPRIETARY TO DIGITAL RESEARCH 1 CP 1M Features and Facilities 1.1 Introduction CP/M is a monitor control program for microcomputer system development that uses floppy disks or Winchester hard disks for backup storage. Using a computer system based upon Intel's BOBO microcomputer, CP/M provides a general environment for program construction, storage, and editing, along with assembly and program check-out facilities. An important feature of CP/M is that it can be easily altered to execute with any computer configuration that uses an Intel BOBO (or Zilog Z-BO) Central Processing Unit and has at least 20K bytes of main memory with up to 16 diskette drives. A detailed discussion of the modifications required for any particular hardware environment is given in Chapter 6. Although the standard Digital Research version operates on a single-density Intel MDS BOO, several