ebook img

Using CP/M PDF

129 Pages·1985·9.423 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Using CP/M

Using CP/M Peter Gosling M MACMILLAN © Peter Gosling 1985 All rights reserved. No reproduction, copy or transmission ofthis publication may be made without written permission. No paragraph ofthis publication may be reproduced, copied or transmitted save with written permission or in accordance with the provisions ofthe Copyright Act 1956 (as amended). Any person who does any unauthorised act in relation to this publication may be liable to criminal prosecution and civil claims for damages. First published 1985 Published by MACMILLAN EDUCATION LTD Houndmills, Basingstoke, Hampshire RG212XS and London Companies and representatives throughout the world British Library Cataloguing in Publication Data Gosling, Peter Using CP/M. 1. CP/M (Computer operating system) 2. Microcomputers I. Title 001.64'25 QA76.6 ISBN 978-0-333-38403-9 ISBN 978-1-349-07676-5 (eBook) DOI 10.1007/978-1-349-07676-5 Contents Preface iv 1 What is CP/M? 1 2 Formatting a New Disk 5 3 CP/M Resident Commands 9 4 PIP, the Peripheral Interchange Program 14 5 The STAT Command 21 6 ED, the CP/M Line Editor 29 7 using MBASIC 42 8 Using a Compiler 58 9 ASM, the CP/M Assembler and DDT 69 10 CP/M Plus (CP/M Version 3.1) 86 11 CP/M-86 102 12 MP/M 107 13 Concurrent CP/M 111 14 CP/NET 114 Appendix A: ASCII Character Codes 119 Appendix B: CP/M Console Editing Commands 120 Appendix C: CP/M Packages 121 Index 123 Preface This book i s intended t o give newcomers to the CP/M operating system an insight into its capabilities and method of use. So many microcomputers now use this operating system that there i s a need for a simple yet comprehensive guide to the many commands and functions offered. Manuals supplied with computer systems are notoriously difficult to follow even by the specialist, l et alone the newcomer. This book aims at being as general and non-specific as possible, since there are many microcomputers on the market that consist of extras added onto the main core of CP/M. It is to cover this common core that this book has been writ ten. The author would like to thank in particular Digital Research (UK) Ltd for a mass of very useful information and permission to reproduce certain diagrams in the text. Help was also very gratefully received from MidIand Micro Services and BurghIey Computers of Stamford, and Stamford College for Further Education. The addresses of Digital Research and the CP/M Users Group for the UK are given in Appendix C. PETER GOSLING CP/M and CP/NET are registered trademarks of Digital Research. CP/NOS, MP/M II and CP/M Plus are trademarks of Digital Research. Zilog and ZaD are trademarks of ZILOG Inc. 1 What CP/M? IS CP/M stands for "Control Program for Microcomputers", or "Control Program and Monitor"; no-one now seems quite certain exactly which of these is correct. It is an operating system for the range of microcomputers that have a Zilog Z80 - or look-alike - microchip as their central processor. The first CP/M operating system saw the light of day in the early 1970s and was written by Dr Gary Kildall who was one of the scientists behind the early development of software for the Intel 8080 microprocessor. As a multiplicity of disk drives (all of different sizes and recording formats) came onto the market, it rapidly became apparent that there was going to be no future in designing a different operating system for each set of peripherals attached to the computer. This gave rise to the concept that gives CP/M its great f 1exibi1i ty and portabi1i ty. The operating system consists of three parts. These are called the BIOS, the Basic Input and Output System, the BOOS, the Basic Disk Operating System and the CCP which is the Console Command Processor. The BIOS is the only part of CP/M that is dependent on the hardware. It is the non-proprietary part of the operating system and can be modified by a microcomputer manufacturer in order to cope with his particular arrangement of disk drives, console VDU and printers. A source listing of BIOS code is available from Digital Research Inc. The BOOS is a fixed, invariant and proprietary piece of software which control s all the disk drives. It is quite independent of the hardware being used. The CCP is the software, also invariant and proprietary, which translates the commands issued by the user at the console keyboard into code ready for the microprocessor to execute. When CP/M is loaded into memory it is stored in 2 Using CP/M segments with the BIOS at the highest par t of memory, the BOOS just below it and the CCP below that. The bulk of the remainder of memory is left for use by programs and is called the TPA, the Transient Program Area. This is the extent of memory that is addressable by a running program. The amount of memory used up by the BIOS depends on the hardware configuration and typically would be around 3K bytes. BOOS, which is always of constant size, occupies 3.5K bytes. This is because, whatever the disk format in use, CP/M always handles disk reading and writing in 128 byte blocks on up to sixteen disk drives. The actual physical transfer of data between disk and RAM is dealt with by the BIOS. High Memory BIOS (up to 3K bytes) BOOS (3.5K bytes) CCP (2K bytes) Transient Program Area OlOOH 256 bytes reserved OOOOH Low Memory What is CP/M? 3 Below the BIOS and BOOS lies the CCP and the TPA, and right at the bottom of memory is a 256 byte block holding the system parameters. It is through these that the program being run communicates with the resident CP/M utilities. This means that when a disk write operation is initiated by your program the actual writing is handed over to the BOOS and then to the BIOS to execute the transfer of data. Incidentally, since 256 in hexadecimal is 100 this is the lowest address in the TPA and is the starting address of many programs. A typical memory map for CP/M is shown. Part of CP/M, as can be seen from the memory map, is always "resident" in memory. There are other "transient" parts of the operating system which are loaded f rom disk as required. These commands are described in chapter 3. When you switch on your microcomputer, the first operation is to load CP/M into memory. This is called "bootstrapping" or the system "booting" for short. Sometimes this is initiated by pressing certain keys on the console keyboard, sometimes it happens automatically as soon as the system disk is inserted and the drive door is closed. You can tell when the loading is complete when some sort of "commercial" appears on the screen followed by the familiar CP/M A> prompt. This tells us that the CCP is in operation and that it is ready to respond to a command line. If for some reason you need to restart your CP/M system after having switched on the system, you can perform a so-called "warm boot". This is often necessary after an error has occurred and this error has been indicated by one of CP/M's notorious error messages. A warm boot is usually effected by pressing CONTROL-C (that is, the CONTROL and C keys) What this does is to reload the BOOS and CCP into memory and place the computer into command mode. A common CP/M error message is Orive=nn,Track=nn,Sector=nn:Error=nn Bdos error on X:bad sector which indicates a hardware prob1em of some sort. CONTROL-C will reboot the system and you can try again. 4 Using CP/M If you press RETURN, the error is ignored and you are returned to the CCP. The drive number, track number, sector number and error code are all in hexadecimal. All the error codes prefixed uy a 1 indicate that a sector cannot be found. Codes prefixed by a 2 indicate that a sector cannot be read. A 3 prefix tells us that there is an error in verifying what is on the sector. Finally a code prefixed with a 4 indicates a formatting error. Another i s Bdos err on X:R/O which tells us that the drive specified i s designated read/only. Again CONTROL-C will return you to the CCP. 2 Formatting a New Disk Before using any new disks on a CP/M system, or any computer system for that matter, these disks have to be "formatted". Formatting disks is the operation of preparing them to have data recorded on them and it is very similar to the operation of ruling lines to provide blank columns in a ledger. Because every computer system seems to have a different way of laying out its disks, they cannot be supplied ready formatted by the manufacturers. It is perhaps worth while at this stage, before going into how disks are formatted, to describe the layout of the disks used by typical microcomputer systems. At present there are three kinds of disk storage available: these are on 5-1/4 inch diameter floppy disks, 8 inch diameter floppy disks and the so-called "Winchester" or hard disks. Each of the disk systems stores data magnetically on a series of concentric tracks. The smallest disks can store data on one or both sides and on either 40 or 80 tracks. The larger floppy disks can also be single or double sided and usually store their data on 77 concentric tracks. To add to the confusion, the data storage can be either at double or single density; this refers to the amount of data that can be packed into each track and is decided by the disk manufacturer. In other words it is a measure of the "magnetisability" of the magnetic substance that coats the plastic base of which the disk is made. The Winchester drives consist of more than one aluminium disk, coated with magnetic material, mounted on a common spindle and hermetically sealed into a box. Each track of a disk is made up of a series of "sectors" which can store a specified number of bytes, or characters. In some cases the number of bytes per sector and indeed the number of sectors per track can be determined by the user although in general they are decided by the manufacturer of the computer system. If 5

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.