ebook img

Programmers CPM Handbook by Andy Johnson-Laird PDF

493 Pages·2009·16.28 MB·English
by  
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 Programmers CPM Handbook by Andy Johnson-Laird

THE PROGRAMMER'S CP/M® HANDBOOK Andy Johnson-Laird Osborne/McGraw-Hill Berkeley, California Published by Osborne/McGraw-Hill 2600Tenth Street Berkeley, California94710 U.S.A. Forinformationontranslations and book distributors outside ofthe U.S.A., please write to Osborne/McGraw-Hillat the above address. CP/M is a registered trademark ofDigital Research, Inc. CP/M-86, MP/M-86, and MP/M II are trademarks of Digital Research, Inc. Z80is a registered trademark ofZilog, Inc. THE PROGRAMMER'S CP/M® HANDBOOK Copyright ©1983 by Osborne/McGraw-Hill. All rights reserved. Printed in the United States of America. ExceptaspermittedundertheCopyrightActof1976,no partofthispublicationmaybe reproducedordistributedinanyformorbyanymeans,orstoredinadatabaseorretrievalsystem, withoutthepriorwrittenpermissionofthepublisher,withtheexceptionthattheprogramlistingsmay beentered,stored,andexecutedinacomputersystem,buttheymaynotbereproducedforpublication. 1234567890DODO89876543 ISBN0-88134-103-7(PaperbackEdition) ISBN0-88134-119-3(HardcoverEdition) MaryBprchers,AcquisitionsEditor RalphBaumgartner,TechnicalEditor SusanSchwartz,CopyEditor JudyWohlfrom,TextDesign YashiOkita,CoverDesign THE PROGRAMMER'S CP/M® HANDBOOK Dedication Several years ago I was told that "Perfection is an English education, an American salary, and a Japanese wife." Accordingly, I wish to thank the members of Staff at Culford School in England, who gave me the English education, the people who work with me at Johnson-Laird Inc. and Control-C Software and our clients, who give me my Americansalary,and Mr.and Mrs. Kitagawa, whogaveme Kay Kitagawa(who not only married me but took overwhere my English grammarleft off). A.J-L. Acknowledgments AlthoughthisbookisnotauthorizedorendorsedbyDigitalResearch,Iwould like to express my thanks to Gary Kildall and Kathy Strutynski of Digital Research, and to Phil Nelson (formerlyofDigital Research, now ofVictorTech nology)fortheirhelpinkeepingmeonthepathtotruthinthisbook. Iwouldalso like to thank Denise Penrose, Marty McNiff, Mary Borchers, and Ralph Baum gartnerat Osborne/McGraw-Hillfor theirapparentlyinexhaustible patience. A.J-L. I Contents 1 Introduction 2 The Structure ofCP/M 5 3 The CP/M File System 17 4 The Console Command Processor (CCP) 45 5 The BASIC Disk Operating System 67 6 The BASIC Input/Output System 147 7 Buildinga New CP/M System 183 8 Writing an Enhanced BIOS 209 9 Dealing with Hardware Errors 295 10 Debugging a New CP/M System 319 11 Additional Utility Programs 371 12 Error Messages 449 A ASCII Character Set 465 B CP/M Command Summary 469 C Summary ofBDOS Calls 479 o Summary ofBIOS Calls 485 Index 487 ix Outline ofContents Notation Example Programs on Diskette Iintroduction ThisbookisasequeltotheOsborneCPjM®UserGuidebyThomHogan.Itis atechnicalbookwrittenmainlyforprogrammerswhorequireathoroughknowl edge ofthe internal structure ofCP/M- how the various pieces ofCP/M work, howtouseCP/Masanoperatingsystem,andfinally,howtoimplementCP/Mon differentcomputersystems. This bookis writtenfor peoplewho HavebeenworkingwithmicrocomputersthatrunDigitalResearch'sCP/M operatingsystem. Understand the internals ofthe microprocessor world- bits, bytes, ports, RAM, ROM, and otherjargonofthe programmer. Know how to write in assembly language for the Intel 8080 or Zilog Z80 Central ProcessingUnit(CPU) chips. Ifyoudon'thavethiskindofbackground,startbygettingpracticalexperience on a system running CP/M and by reading thefollowing books from Osborne/ McGraw-Hill: An Introduction to Microcomputers: Volume 1-Basic Concepts This book describes the fundamental concepts and facts that you need to 1 2 The CP/M Programmer's Handbook know about microprocessors in orderto program them. Ifyou really need basics, there isa Volume0 called The Beginner's Book. 8080Aj8085 Assembly Language Programming Thisbookcoversallaspectsofwritingprogramsin8080assemblylanguage, giving manyexamples. Osborne CPjM® User Guide(2nd Edition) This book introduces the CP/M operating system. Ittells you how to use CP/M as a tool to get things done on a computer. ThebookyouarereadingnowdealsonlywithCP/MVersion2.2forthe8080 or Z80 chips. At the time of writing, new versions of CP/M and MP/M (the multi-user, multi-taskingsuccessorto CP/M)werebecomingavailable. CP/M-86 andMP/M-86fortheIntel8086CPUchipandMP/M-IIforthe8080orZ80chips hadbeenreleased,withCP/M3.0(8080orZ80)inthewings.The8086,although related architecturally to the 8080, is different enough to make it impossible to cover in detail in this book; and while MP/M-II and MP/M-86 are similar to CP/M, they have many aspects that cannot be adequately discussed within the scope ofthis book. Outline of Contents This bookexplains topics as ifyou were startingfrom the top ofa pyramid. Successive"slices"downthepyramidcoverthesamematerialbutgivemoredetail. Thefirst chapterincludesabriefoutlineofthenotationusedinthisbookfor example programs written in Intel 8080 assembly language and in the C pro gramminglanguage. Chapter2deals with the structure ofCP/M, describing its major parts, their positions in memory, and theirfunctions. Chapter3discussesCP/M'sfile systeminasmuchdetailaspossible,givenits proprietarynature. Thedirectoryentry,diskparameterblock,andfile organiza tionaredescribed. Chapter4coverstheConsoleCommandProcessor(CCP),examiningtheway inwhichyouentercommandlines,theCP/McommandsbuiltintotheCCP,how the CCP loads programs, and how ittransferscontrolto these programs. Chapter5beginstheprogrammingsection.Itdealswiththesystemcallsyour programs can make to the high-level part of CP/M, the Basic Disk Operating System(BDOS). Chapters6through10dealwiththeBasicInput/OutputSystem(BIOS).Thisis thepartofCP/Mthatisuniquetoeachcomputersystem.Itisthepartthatyouasa programmerwill write and implementfor your owncomputersystem. Chapter6describes a standard implementation ofthe BIOS. 3 Chapter I: Introduction Chapter 7 describes the mechanism for rebuilding CP/M for a different configuration. Chapter 8tells you how to write anenhanced BIOS. Chapter9takesacloselookathowtohandlehardwareerrors-howtodetect and deal with them, and how to make this task easier for the person using the computer. Chapter 10discussesthe problemsyou mayface whenyoutrytodebugyour BIOScode. Itincludesdebuggingsubroutinesanddescribestechniquesthatwill save you timeand suffering. Chapter11describesseveralutilityprograms,somethatworkwiththefeatures ofthe enhanced BIOS in Chapter 8 and some that will work with all CP/M 2 implementations. Chapter 12concernserrormessagesandsomeodditiesthatyouwilldiscover, sometimespainfully,inCP/M.Messagesareexplainedandsomeprobablecauses for strange resultsaredocumented. The appendixes contain "ready-reference" information and summaries of information that you need at your side when designing, coding, and testing programs to rununderCP/M oryour own BIOS routines. Notation Whenyouprogramyourcomputer,youwillbesittinginfrontofyourterminal interactingwithCP/Mandtheutilityprogramsthatrununderit.Thesectionsthat followdescribethenotationusedtorepresentthedialogthatwillappearonyour terminaland the outputthat will appear onyour printer. Console Dialog This book follows the conventions used in the Osborne Cp/M User Guide, extended slightlyto handle morecomplexdialogs. In this book < name>meanstheASCIIcharacternamedbetweentheanglebrackets,< and>. Forexample,< BEL>istheASCIIBellcharacter,and< HT>isthe ASCII HorizontalTab Character. (Referto Appendix Afor the complete ASCIIcharacterset.) <cr> means to pressthe CARRIAGERETURN key. 123 ora number withouta suffix meansa decimal number. 100Bora numberfollowed by Bmeans a binarynumber. OA5H ora numberfollowed by H means a hexadecimal number. A hexa decimal number starting witha letter is usually shownwith a leading0to avoid confusion.

Description:
2 The CP/M Programmer's Handbook know about microprocessors in order to program them. If you really need basics, there is a Volume 0 called The
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.