home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / cpminfo / cpmnotes.pqn / CPMNOTES.PRN
Encoding:
Text File  |  1985-02-10  |  12.5 KB  |  385 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                 A BRIEF OUTLINE OF CP/M AND CP/M COMMANDS
  8.  
  9.                               Eli Freedman
  10.                                ABC Br, IBD
  11.  
  12.     These  notes are necessarily sketchy.   Not every CP/M utility is 
  13.     mentioned; of those that are, not every ramification is covered.
  14.  
  15.     CP/M  stands  for Control Program for Microcomputers.   It  is  a 
  16.     collection of computer programs for the Intel 8080 and the  Zilog 
  17.     Z80  chips.   CP/M  handles  all of the sometimes  intricate  and 
  18.     always tedious details of input/output (I/O),  including communi-
  19.     cation among processor,  disks,  console,  and printer, including 
  20.     disk-file maintenance.
  21.  
  22.     For the North Star Advantage,  CP/M is furnished on a 5-1/4  inch 
  23.     floppy  disk where the system occupies the first 3 tracks;  these 
  24.     are called the system tracks.   When you press the red button  on 
  25.     the back of an Advantage and then the RETURN key, the CP/M system 
  26.     is loaded into the computer.   This operation is called "booting" 
  27.     the computer;  note that it is not done with the foot!   When the 
  28.     computer  is booted,  CP/M loads itself into the computer's  core 
  29.     memory.   It  occupies approximately 6000 (decimal) bytes at  (or 
  30.     near)  the  top of the memory,  and also the first 256  (decimal) 
  31.     bytes starting at 0.
  32.  
  33.     There are two kinds of "booting":
  34.  
  35.           Alternate       How                   
  36.     Name    Name       Accomplished                  Why
  37.     ----- --------    -------------        --------------------------
  38.     cold    hard     turn machine on        start-up
  39.                      press red button       resume after crash
  40.                      special program
  41.  
  42.     warm    soft     press ^C               read disk directory
  43.  
  44.     After  booting,  the  screen displays A>,  meaning that  you  are 
  45.     "logged  in" on drive A.   If you type B:,  the screen shows  B>, 
  46.     meaning that the logged drive is now B.   WordStar and many other 
  47.     programs require that you know which drive is the logged one.  
  48.  
  49.     The  principal  components  of CP/M are  the  Basic  Input/Output 
  50.     System (BIOS),  the Basic Disk Operating System (BDOS),  and  the 
  51.     Console Command Processor (CCP).   These programs are all located 
  52.     in  the  "high memory" part of CP/M.   The largest amount of  the 
  53.     computer's  random-access  memory lies between the two  parts  of 
  54.     CP/M and is referred to as the Transient Program Area (TPA).  All 
  55.     of the TPA is available to the user;  some CP/M programs also use 
  56.     it. 
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.                                     1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.     CP/M  has two kinds of commands,  built-in  and  transient.   The 
  72.     built-in commands (ERA, TYPE, SAVE, REN, and DIR) are in the CCP, 
  73.     and do not change anything in the TPA.  Also, they do not show up 
  74.     in the directory listing of the disk.   The transient commands do 
  75.     show  up in the directory (unless you go to the extra trouble  of 
  76.     hiding them--it can be done) and they are loaded into the TPA for 
  77.     execution.
  78.  
  79.     FILE NAMES.  Almost all CP/M commands work on file names.  A file 
  80.     name  is 1 to 8 letters or numbers,  plus an optional  extension, 
  81.     which  is a period and 1 to 3 letters or numbers.   Some  special 
  82.     characters  can  be  used in file names.   The drive  letter  may 
  83.     appear in front of the name,  followed by a colon.   If the drive 
  84.     letter  is not used explicitly,  the logged drive is  assumed  by 
  85.     default.
  86.  
  87.     Examples: MYFILE.EXT    URFILE     B:afile.for      A:CPNOTES.TXT
  88.  
  89.     Note   that  A:MYFILE  is  different  from  B:MYFILE;   likewise, 
  90.     MYFILE.TXT is not the same as MYFILE.BAK.
  91.  
  92.     Certain extensions have special meanings:
  93.  
  94.                  .FOR  A FORTRAN source file.
  95.                  .BAS  A BASIC language file.
  96.                  .REL  Relocatable code produced by various 
  97.     compilers.
  98.                  .ASM  Assembly language source file.
  99.                  .HEX  The output from certain assemblers.
  100.                  .PRN  A print listing produced by some compilers.
  101.                  .COM  A command file (executable program).
  102.                  .SUB  A SUBMIT file (similar to a CCL procedure).
  103.                  .BAK  A backup file; produced by WordStar and some 
  104.     other programs.
  105.                  .MAC  A file for the Microsoft M80 macro assembler.
  106.  
  107.     These uses are required in most cases.   For example:  the Micro-
  108.     soft  FORTRAN compiler will not compile a program without a  .FOR 
  109.     extension; you cannot execute a program that does not have a .COM 
  110.     extension.  I recommend that you use extensions only to designate 
  111.     the  kind of file;  don't rely on the extension alone (except for 
  112.  
  113.     WILD-CARD  DESIGNATORS.   In many cases one wants to refer  to  a 
  114.     class of files,  not just one.   This is done with the "wild-card 
  115.     designators,"  * and ?.   The ?  matches any letter;  the * means 
  116.     "any."
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.                                     2
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.     Examples:
  136.  
  137.               *.FOR means any file with the extension FOR.
  138.  
  139.               AB??????.* means any file whose name starts with AB and 
  140.     has any extension.
  141.  
  142.               AB??????.TXT  means any file whose name starts with  AB 
  143.     and has extension TXT.
  144.  
  145.     SOME  SPECIAL  CONTROL CODES.   Control codes  are  generated  by 
  146.     holding  down  the key marked CNTRL (or CONTROL)  while  pressing 
  147.     another.   In  text,  the up arrow,  ^,  is used to designate the 
  148.     CNTRL key.  In CP/M, certain control codes have special meanings:
  149.  
  150.                  ^C   Interrupt a command or program (may not  always 
  151.     work);  perform  a "soft boot" (read the directory on  each  disk 
  152.     drive).
  153.  
  154.                  ^S  Stop/start the screen display.
  155.  
  156.                  ^P  Start/stop the printer; when "on", any text that 
  157.     appears on the screen will also be printed.   
  158.                  
  159.                  ^X  Erase command line, return to col. 1
  160.  
  161.     BUILT-IN COMMANDS.
  162.  
  163.               DIR [A:URFILE.EXT]
  164.     Display the directory for a file or a disk.  
  165.  
  166.     Examples: DIR 
  167.     Shows the directory for the logged disk.
  168.  
  169.               DIR B:  
  170.     Shows the directory for disk B no matter which disk is the logged 
  171.     one.
  172.  
  173.               DIR A:*.COM
  174.     Shows  the  directory for all files on the disk on drive  A  that 
  175.     have the extension COM.
  176.  
  177.               DIR B:MYFILE.*
  178.     Shows  the directory for all files on drive B that have the  name 
  179.     MYFILE, no matter what their extension is.
  180.  
  181.               REN NEWFILE.EX2=OLDFILE.EXT1
  182.     Rename a file. The old file name is replaced by the new file name 
  183.     in the directory; the contents of the file are not disturbed.
  184.  
  185.               ERA FILENAME
  186.     Erase  the name of the file from the directory.   The contents of 
  187.     the  file  are not disturbed,  and can be  retrieved  by  special 
  188.     programs. 
  189.  
  190.  
  191.                                     3
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.     Examples: ERA B:*.BAK
  200.     Erases on all files on drive B with the extension BAK.
  201.  
  202.               ERA A:MYFILE.TXT
  203.     Erases only MYFILE.TXT on drive A.
  204.  
  205.               ERA *.*
  206.     Careful!  This command will erase on files on the logged disk.
  207.  
  208.     SOME CP/M TRANSIENT PROGRAMS
  209.  
  210.     All  programs that run under CP/M have the extension  .COM.   The 
  211.     program  is  executed by typing the name without  the  extension.  
  212.     Generally  either lower- or upper-case letters may be  used,  but 
  213.     there are exceptions (e.g., in FORMAT).
  214.  
  215.               STAT
  216.  
  217.     Display  size and attributes of a file or files or a disk;  also, 
  218.     change  the  designations of I/O units.   STAT by  itself  merely 
  219.     tells  you how much space is left on the logged drive.   STAT  B: 
  220.     tells you how much space is left on the disk on drive B:.
  221.  
  222.     STAT  A:*.* tells you the name of every file on the disk  now  on 
  223.     drive  A:,  and its attributes.  There are two  attributes:  R/W, 
  224.     meaning both reading and writing are permitted;  and R/O, meaning 
  225.     the file is read-only.
  226.  
  227.     STAT  B:*.COM gives this information for every .COM file on drive 
  228.     B:.   STAT also permits you to change device assignments; see the 
  229.     references.
  230.  
  231.                  COPY
  232.     Copy  the contents of one disk onto another  entirely,  including 
  233.     the system tracks.   COPY is self-guiding;  just type the command 
  234.     and follow the instructions.  Note that COPY refers to the drives 
  235.     by number, not by letter.  
  236.  
  237.                  FORMAT
  238.     A new disk cannot be used until it has been formatted.   For CP/M 
  239.     systems,  this  means that all of the tracks are filled with  the 
  240.     format character (E5 HEX).  This is accomplished by typing FORMAT 
  241.     and then following the directions that appear.   A disk does  not 
  242.     have  to  be formatted if the very next thing you do to it is  to 
  243.     COPY something onto it,  since this automatically initializes the 
  244.     disk.
  245.  
  246.                  PIP
  247.     Copy one or more files to other files;  the new files do not have 
  248.     to be on the same drive, but they may be.
  249.  
  250.  
  251.  
  252.  
  253.  
  254.  
  255.                                     4
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.     Examples:  PIP B:NEWFILE.EX2 = A:OLDFILE.EX1
  264.                PIP NEWFILE = B:OLDFILE
  265.                PIP  A:*.* = B:*.*  Copies every file from B:  to  A:; 
  266.     the  names  remain  the same,  except for  the  change  in  drive 
  267.     designation.
  268.  
  269.                PIP  B:=A:*.FOR  Copies every FORTRAN file on drive A: 
  270.     onto drive B:
  271.  
  272.     PIP  can be invoked alone;  it then responds *.   You  then  name 
  273.     files two by two (i.e., new and old) for copying.  Terminate with 
  274.     a CR.
  275.  
  276.                SUBMIT FILE.SUB PAR1 PAR2 PAR3 ...
  277.  
  278.     A  great  program that permits you to operate in almost  a  batch 
  279.     mode.  The quantities PARi replace dummy arguments.  You build up 
  280.     a  sequence  of CP/M commands in a file whose extension  must  be 
  281.     you place the dummy arguments,  $1,  $2,  etc.   When the file is 
  282.     then  submmitted,  CP/M  will make the substitutions,  print  the 
  283.     command, and then execute it.
  284.  
  285.     Example: Suppose you create a file TEST.SUB whose contents are
  286.                  
  287.                PIP $1:$2.TXT=B:$3.TXT
  288.     Then you type
  289.                SUBMIT TEST A GOOD BAD
  290.  
  291.     The screen will show the complete command
  292.  
  293.                PIP A:GOOD.TXT=B:BAD.TXT
  294.  
  295.     and then the program will execute.
  296.  
  297.                SAVE n FILENAME
  298.     This  command transfers n*256 bytes from memory starting  at  256 
  299.     (decimal)  to the named file on disk.   It is used after  working 
  300.     with  DDT (see references).   Also,  some communication  packages 
  301.     (e.g.,  CMOD)  transfer  data from an external computer  to  your 
  302.     computer's memory; SAVE is then used to store the data on a disk.
  303.  
  304.                SYSGEN
  305.  
  306.     It is very convenient to be able to boot your computer from every 
  307.     disk you use.  This means that every disk must have a CP/M system 
  308.     on it.   (I also recommend that every disk have PIP,  FORMAT, and 
  309.     COPY on it.)  
  310.  
  311.     There are two ways in which you can put a CP/M saystem on a disk.  
  312.     You  can  use  COPY,  which copies everything from  one  disk  to 
  313.     another,  track for track.  This method has the disadvantage that 
  314.     you then have to remove all of the files that were also copied.
  315.  
  316.  
  317.  
  318.  
  319.                                     5
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                              SOME REFERENCES
  328.  
  329.     In my opinion, the best reference on CP/M is:
  330.      
  331.     Rodnay Zaks, "The CP/M Handbook," Sybex; 1980.
  332.  
  333.     J.  N.  Fernandez & R.  Ashley, "Using CP/M," John Wiley; 1980 is 
  334.     written   in   a  "programmed  learning"  style  that   I   found 
  335.     infuriating.  It  is  a  good  self-teaching  text,  but  a  poor 
  336.     reference book.
  337.  
  338.     CP/M  is  a product of Digital Research.   This company  supplies 
  339.     Manuals  with  the system when you buy it.   They  have  a  well-
  340.     deserved reputation for denseness and incomprehensibility.  
  341.  
  342.     An interesting book is
  343.  
  344.     Jack D.  Dennon, "CP/M Revealed," Hayden; 1982.  It gives some of 
  345.     the details of how CP/M does its stuff.
  346.  
  347.                              ACKNOWLEDGMENT
  348.  
  349.     Many  thanks  to George E.  Keller for invaluable assistance  and 
  350.     advice.
  351.  
  352.  
  353.  
  354.  
  355.  
  356.  
  357.  
  358.  
  359.  
  360.  
  361.  
  362.  
  363.  
  364.  
  365.  
  366.  
  367.  
  368.  
  369.  
  370.  
  371.  
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.                                                   version  2.01/9-I-84
  381.  
  382.  
  383.                                     6
  384.  
  385.