home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpminfo / cpmplus.txt < prev    next >
Text File  |  1994-07-13  |  45KB  |  746 lines

  1.                                     CPM-PLUS
  2.                                     ========
  3.  
  4.                                 Robert B Davies,
  5.                  16 Gloucester Street, Wellington, New Zealand.
  6.  
  7.  
  8.           CP/M PLUS (alias CP/M 3) is Digital Research's latest
  9.           update of their operating system for systems based on 8080
  10.           or Z80 microprocessors. I purchased a copy during a recent
  11.           trip to the USA and now have it running. Here are my
  12.           thoughts on it after trying it for a few months.
  13.  
  14.  
  15.                                OPERATING SYSTEMS
  16.                                --------- -------
  17.  
  18. First, I need to make a few comments on what an operating system is required to
  19. do. It is a program that provides the interface between a user's program and the
  20. computer's peripherals such as the disks, keyboard, display etc. In particular,
  21. it builds and organizes the disk directories, reads and writes files on disk,
  22. loads programs as requested by the user, regains control after the user's
  23. program has finished, as well as loading itself from disk when the machine is
  24. turned on.
  25.  
  26. A diagram of the set-up for CP/M is given in figure 1. The heart of the system
  27. is the machine independent part called the BDOS. The machine dependent part, the
  28. BIOS must be written by the computer manufacturer or owner and supplies a
  29. more-or-less machine independent interface for the BDOS. It is this splitting of
  30. CP/M into the BDOS and BIOS that enables it to be readily adaptable to the large
  31. variety of machines on which it runs. The BDOS provides the interface with what
  32. ever program (the transient program) is currently in core and translates its
  33. complex file and input/output commands into sequences of simple commands for the
  34. BIOS.  The CCP (console command processor) is a program that is automatically
  35. loaded when the machine is turned on or when user programs exit and is
  36. responsible for monitoring the keyboard, loading new programs when requested or,
  37. in the case of CP/M 2, processing the commands DIR, ERA, USER, REM, SAVE, TYPE.
  38. The cold boot loader is automatically loaded when the machine is turned on and
  39. is responsible for loading the BIOS and BDOS and then the CCP. The compilers,
  40. interpreters and applications programs are supplied by other organizations or at
  41. least separately from CP/M. However one does get a whole range of 'utilities'
  42. with CP/M including an editor, assembler, a program for copying files and these
  43. are usually regarded as part of CP/M although they are separate from the
  44. BDOS/BIOS and may be replaced by the user's own utilities.
  45.  
  46.  
  47.  
  48.  +-----------+     +-----------+     +-----------+     +-----------+
  49.  |           |     |           |     |           |     |           |
  50.  | Power-on  |     |   Disks   |     | Display,  |     |   Other   | Hardware
  51.  |  jump     |  +->|           |     | keyboard  |     |peripherals|
  52.  |           |  |  |           |     |           |     |           |
  53.  +-----------+  |  +-----------+     +-----------+     +-----------+
  54.        |        |        ^                 ^                 ^
  55.        |        |        |                 |                 |
  56.        |        |        |                 |                 |
  57.        |        |        v                 v                 v
  58.        |        |     +-----------------------------------------+
  59.        |        |     |                                         |   Machine
  60.        |        |     |    Basic Input Output System (BIOS)     |   dependent
  61.        v        |     |                                         |   software
  62.  +-----------+  |     +-----------------------------------------+
  63.  |           |  |          ^                        ^
  64.  | cold-boot |<-+          | data                   | jump
  65.  |  loader   |             | buffers                | vector
  66.  |           |             v                        |
  67.  +-----------+        +-----------------------------------------+
  68.        |              |                                         |
  69.        +------------->|                                         |   Machine
  70.                       |   Basic Disk Operating System (BDOS)    |   independent
  71.                       |                                         |   software
  72.                       |                                         |
  73.                       |                                         |
  74.                       |                                         |
  75.                       +-----------------------------------------+
  76.                          ^            ^            ^
  77.                          | data       | BDOS       | locations
  78.                          | buffers    | commands   | 0-256
  79.                          v            |            v
  80.       __________________________________________________________
  81.      /              |              |              |             \
  82.  +-------+      +-------+      +-------+      +-------+      +-------+
  83.  |       |      |       |      |       |      |       |      |applic-|
  84.  |  CCP  |      |util-  |      |comp-  |      | basic |      | ation | transient
  85.  |       |      |  ities|      |  ilers|      |inter- |      |pro-   | programs
  86.  |       |      |       |      |       |      | preter|      | grams |
  87.  +-------+      +-------+      +-------+      +-------+      +-------+
  88.                                                   ^
  89.                                                   |
  90.                                                   v
  91.                                               +-------+
  92.                                               |       |
  93.                                               | basic |
  94.                                               |program|
  95.                                               |       |
  96.                                               +-------+
  97.  
  98.                         Figure 1: CP/M operating system.
  99.  
  100.  
  101.  
  102.                           WHY A NEW VERSION IS NEEDED
  103.                           --- - --- ------- -- ------
  104.  
  105. CP/M, version 2, was released in 1979. At that time a micro-computer with 64K
  106. bytes of memory (ie 64 x 1024 x 8 bits of memory) would have been considered
  107. large and most micro-computers would have less. Similarly a floppy disk drive
  108. with 1 megabyte of storage (ie 1024 x 1024 x 8 bits) was again a lot of memory.
  109. Thus the fact that an 8080 or Z80 micro-processor can address only 64K of memory
  110. without complex bank-switching mechanisms wasn't really a problem. Similarly,
  111. CP/M 2's restriction that individual files could have a maximum length of 8
  112. megabytes or a disk capacity also of 8 megabytes was no real problem. Further
  113. most micro-computer users were enthusiasts who were able and willing to deal
  114. with a system that was somewhat awkward to use in places and didn't have very
  115. high expectations for 'user friendliness' (or for good documentation). The fact
  116. that it worked at all, and, in fact, works reasonably well, was enough to keep
  117. most users very happy.
  118.  
  119. CP/M based microcomputers have turned out to be most successful and an enormous
  120. amount of software is now available from a large number of software writers. It
  121. includes compilers for most of the major computer languages, numerous editors
  122. and text processing programs, data-base programs, spread-sheet programs
  123. (visicalc clones) and apparently every conceivable business program.
  124.  
  125. However, in 1983, limitations of CP/M 2 are becoming very apparent. Because of
  126. the success of the micro-computer, users are becoming less sophisticated. They
  127. want answers fast and don't want to have to fight with the operating system or
  128. learn to interpret weird error messages. With the advent of the 64K bit memory
  129. chip, the price of memory has dropped by a factor of 3 or 4 ( not corrected for
  130. inflation or devaluation) and it is hard to imagine purchasing a machine for
  131. professional use with less than 64K of memory. At the same time hard disk units
  132. with more than 8 megabytes of memory are available at an almost affordable
  133. price. The Z80 or 8080 based machines are, of course, suffering from heavy
  134. competition from machines like the IBM personal which are based on more advanced
  135. chips. Eventually, the 8 bit machines will be completely eclipsed by these
  136. advanced machines, at least for the professional user. However, at present,
  137. because of the huge amount of software available for 8 bit computers, many
  138. manufacturers are still producing these machines. Nevertheless, in order to
  139. compete with the 16 bit machines with their much improved address range, one
  140. wants to be able to use every trick to increase the memory available to an 8 bit
  141. machine.
  142.  
  143. Putting all this together, any upgraded version of CP/M for 8 bit machines
  144. should
  145.  
  146.   (i) be much more 'user-friendly'
  147.   (ii) have proper documentation
  148.   (iii) give the user access to more memory
  149.   (iv) allow longer files and larger capacity disks
  150.   (v) run programs that were written for CP/M 2
  151.   (vi) be implementable on a wide variety of Z80 or 8080 based machines
  152.   (vii) be flexible enough to allow manufacturers to add extra features
  153.   (viii) be ready now.
  154.  
  155.  
  156.                                    CP/M PLUS
  157.                                    ---- ----
  158.  
  159. First, the name. It seems to be called CP/M PLUS. However, once inside the
  160. covers of the documentation, it's CP/M 3. The term CP/M 80 seems to be a generic
  161. term referring to the family of CP/Ms for Z80s or 8080s.
  162.  
  163. I ordered a 'raw' version, that is, not configured to any particular system. It
  164. came on two eight inch floppy disks and was accompanied by 3kg of documentation.
  165. The disks contain the files required to generate the BDOS, an example BIOS, a
  166. large HELP file, and numerous utilities including 2 assemblers, a debugging
  167. program, an editor, a linker, a library program as well as those required for
  168. routine file manipulation. 
  169.  
  170. The documentation came in two ring-binder files and consists of 5 modules: the
  171. User's Guide, Programmer's Guide, System Guide, Programmer's Utilities Guide and
  172. Symbolic Instruction Debugger Reference Manual. There is also a pocket guide to
  173. the Symbolic Instruction Debugger. The documentation is well presented and of a
  174. high standard. I recognize some parts as being lifted from the old CP/M 2
  175. documentation but its largely new and a complete contrast to Digital Research's
  176. documentation for CP/M 2. It is impossible for me to be sure how new users would
  177. get on, but my guess they would handle the User's Guide with a little outside
  178. help. The rest is for programmers only and, apart from a few minor gaps, is fine
  179. for them. Incidentally, why do they call it a User's Guide - surely they expect
  180. more than one person to use it. In addition there is an extensive HELP file on
  181. disk which covers the same material as the User's Guide. I discuss this later.
  182.  
  183.  
  184.                           BANKED AND UNBANKED VERSIONS
  185.                           ------ --- -------- --------
  186.  
  187. CP/M 3 comes in two versions. The unbanked version is a slightly cut down
  188. version which is loaded into a single bank of memory - that is it can utilize a
  189. maximum of 64K bytes of memory - and requires the same hardware facilities as
  190. CP/M 2. Because is offers more facilities than CP/M 2 it occupies more core,
  191. about 13K instead of the 6 or 7K that CP/M requires (on my system) and hence
  192. less space is available for the user's programs.
  193.  
  194. The banked version uses 2 or more banks (blocks of 64K bytes) of memory. One of
  195. these is used for storing one's program and about 4K of CP/M. The rest of CP/M
  196. resides on one of the other banks of memory and any remaining memory is used for
  197. disk and directory buffers. I will describe these buffers in the next section.
  198. Thus about 60K of memory is available for the user's program and a substantially
  199. larger than usual area is available for CP/M.
  200.  
  201. To run banked CP/M 3 one must of course have a computer with at least two banks
  202. of memory and the necessary hardware for selecting the bank to be accessed. In
  203. addition, to permit communication between banks one must have about 4K of
  204. memory, at the top of the memory range, which is accessed independently of which
  205. memory block is currently selected. This is known as common memory. My CPU board
  206. (model CB2 produced by SSM) purchased in 1980 has 4K of memory which doesn't
  207. know anything about bank select and which is accessed in preference to external
  208. memory and so very easily provided me with the common memory facility. I don't
  209. know whether this was just luck or whether the board's manufacturers predicted
  210. the appearance of CP/M 3.
  211.  
  212. My system currently has two 64k blocks of memory and one 16K one and a memory
  213. mapped disk drive. I have sketched out a map of its memory allocations in figure
  214. 2. Note that a copy of the CCP is stored in memory so that it can be loaded
  215. almost instantly without accessing the disk at each warm boot.
  216.  
  217.  
  218.    64K                          +---------+
  219.                                 |    A    |  4K of common memory - accessible
  220.                                 +---------+  from all banks
  221.  
  222.    60K         +---------+      +---------+
  223.                | used by |      |         |
  224.                |   disk  |      |         |           A: used by CP/M
  225.                |---------|      |         |           B: disk buffer area
  226.                |         |      |         |
  227.                |    A    |      |available|
  228.                |         |      |   for   |
  229.                |         |      |transient|
  230.                |---------|      | program |
  231.                |         |      |         |
  232.                |         |      |         |
  233.                |    B    |      |         |      +---------+
  234.                |         |      |         |      |    B    |
  235.                |         |      |         |      |---------|
  236.                |         |      |         |      |   CCP   |
  237.    0K          +---------+      +====A====+      +---------+
  238.  
  239.                   bank 0           bank 1           bank 2
  240.  
  241.                       Figure 2. Memory layout for CP/M 3.
  242.  
  243.  
  244.                              BLOCKED DISK TRANSFER
  245.                              ------- ---- --------
  246.  
  247. CP/M programs usually expect to transfer data to and from disks in records of
  248. 128 bytes. However the disks themselves frequently work more efficiently if
  249. larger blocks, say 1024 bytes, are used. If one wants to read a file
  250. sequentially, that is, starting at the beginning and then reading it in order,
  251. there is no problem. The operating system reads the first 1024 byte block into a
  252. buffer and passes each of the first eight 128 byte records across to the program
  253. as they are required. Then the second block is loaded and the process continues.
  254. Writing is similarly straight forward. The problem arises when a program is
  255. reading from and/or writing to several files. Usually there is only one buffer
  256. area for the blocks so if, for example, a program wants to read a 128 byte
  257. record from one file and then write a 128 byte record to another, the original
  258. 1024 byte block read into the buffer by the initial read will be destroyed by
  259. the write operation and will have to be reloaded when the second record is
  260. required to be read. In the worst situation each record read will require a disk
  261. operation as opposed to one every 1024/128 = 8 record reads and each write will
  262. require both a read and a write operation. Similar considerations will apply
  263. when one is randomly accessing files - that is reading or writing records in an
  264. order that is not sequential. The resulting disk operations are likely to be
  265. very slow and subject the disk drive and floppy disks to unnecessary wear.
  266.  
  267. The obvious solution is to use several buffers so each file being read or
  268. written can have its own buffer. This is what CP/M 3 does, with the buffers
  269. being stored in the extra memory banks so that they don't reduce the space
  270. available to programs. To see what difference this makes in practice, I carried
  271. out a series of time trials with CP/M 2, the unbanked version of CP/M 3 with
  272. only one buffer block and the banked version with a large number of blocks
  273. available. The results are given in table 1. The first example was with ratfor,
  274. a program which reads a file containing a program written in ratfor ("rational
  275. fortran") and translates it to regular fortran. Thus one file is read and
  276. another is written. The program makes little attempt to block the input and
  277. output. The second example is a regular fortran compile with one file being read
  278. and two written. In this case the material does tend to be read and written in
  279. chunks so less rereading and rewriting of the buffers might be expected than in
  280. the ratfor example. Minor differences in the timings are probably not
  281. significant since the timings depend to an extent on the way the files are
  282. placed on the disk and this varies from run to run.
  283.  
  284. Since no blocking is required for the disk using 128 byte blocks (a standard
  285. single density disk), CP/M 3 does not use its blocking-deblocking code and the
  286. timings for the two versions of CP/M 3 are the same. For the disk using 1024
  287. byte records, CP/M 2 and the unbanked (or more accurately the single buffer)
  288. version of CP/M 3 perform about as well as for the disk with 128 byte records
  289. for the ratfor example and somewhat better for the fortran compile. However
  290. gains are made for both examples when the banked version of CP/M 3 is used. In
  291. fact, for the ratfor example the difference in disk activity was quite dramatic,
  292. almost continuous disk activity was replaced by just an occasional access when
  293. the banked version of CP/M 3 was used. The final set of tests was with a virtual
  294. disk - that is RAM memory being used to simulate a disk. 'Disk' transfer times
  295. are negligible and all 3 operating systems work equally well. I think the
  296. increase in speed with CP/M 3 is well worth having but it is not nearly as large
  297. as some people would have us believe.
  298.  
  299. A similar system applies to the disk directories. Directory information for each
  300. file occupies 32 bytes so multiple buffer deblocking is also used for them. One
  301. can also configure CP/M 3 to use more efficient methods of scanning the
  302. directories to find a requested file. I can imagine such techniques would be
  303. important for high capacity hard disk but cannot detect any difference with my 1
  304. megabyte floppy disks.
  305.  
  306. Note that CP/M 3 does not use the buffers when it does not have to, for example
  307. when the disk itself uses 128 byte records or when whole blocks can be loaded
  308. directly into memory, say when loading a program. CP/M 3 does not appear to make
  309. a cponsistent effort to minimize disk operations with random access files beyond
  310. the simple buffering I have just described and so, for normal use, there is no
  311. sense in allocating vast amounts of memory to the disk buffers.
  312.  
  313.  
  314.                   Operating         Disk      Timing (seconds)
  315.                    System
  316.                                                Ratfor    F80
  317.  
  318.             CP/M 3  banked   \    128 byte       93       81
  319.             CP/M 3  unbanked /
  320.  
  321.             CP/M 2                1K byte        94       67
  322.  
  323.             CP/M 3  unbanked      1K byte        94       63
  324.  
  325.             CP/M 3  banked        1K byte        72       51
  326.  
  327.             CP/M 2           \
  328.             CP/M 3  unbanked      Semidisk       61       30
  329.             CP/M 3  banked   /
  330.  
  331.                      Table 1: Timings for disk operations.
  332.  
  333.  
  334.                                OTHER IMPROVEMENTS
  335.                                ----- ------------
  336.  
  337. We have now covered the best known features of CP/M 3. This section covers the
  338. numerous minor differences which, when put together, really make the difference.
  339.  
  340. BDOS commands:
  341.    The BDOS commands are the commands that the transient program can direct to
  342. the BDOS part of the operating system. The include the commands for reading and
  343. writing to and from the current console and the auxiliary device (formerly the
  344. tape punch/reader), reading and writing to and from files, opening and closing
  345. files, setting options and finding the state of the system. CP/M 2.2 has 38 of
  346. these, CP/M 3 has 63. The extra ones are for file manipulation, implementing the
  347. extra facilities of CP/M 3 and include nice ones such as those for generating an
  348. FCB (file control block) from a file name and chaining to another program and a
  349. nasty one for returning CP/M 3's serial number. Apart from functions 7 and 8,
  350. access IO-byte, and 27, get disk allocation vector, all CP/M 2.2 BDOS functions
  351. work in CP/M 3.
  352.  
  353. Maximum disk and file length:
  354.    These have been increased from 8 megabytes each to 32 and 512 megabytes
  355. respectively. Since a disk on my system can hold a maximum of just over 1
  356. megabyte, I haven't tested this.
  357.  
  358. User numbers:
  359.    As in CP/M 2 files can be assigned to any of 16 user numbers. User numbers
  360. are the poor man's version of the subdirectories used on some larger computers.
  361. Suppose, for example, the CP/M command "USER 9" has been entered. Then any file
  362. generated will be tagged as belonging to user 9 and under CP/M 2 only files so
  363. tagged will be accessible and these will be the only files whose names will be
  364. listed by a call to DIR. This provides a convenient way for several users (ie
  365. people) to use one disk without running into conflict over file names or losing
  366. their files amongst those of the other users in a directory listing. Similarly,
  367. it is also useful for separating the files of several different projects for a
  368. single user. Naturally users of floppy disks will tend to have a disk for each
  369. project or user so user numbers are not very important but for hard disk users I
  370. imagine that user numbers are essential.
  371.  
  372. The problem in CP/M 2 was that programs would normally access only files tagged
  373. with the currently assigned user number so that, in particular, the standard
  374. utilities such as PIP, STAT, ED etc had to be stored separately under each user
  375. number being used with a consequent waste of space. Worse still, to get them
  376. there one would normally user the 'copy from another user area' option of PIP.
  377. But one first had to get PIP to that user area from the default user number,
  378. user 0. To do this one first loaded PIP with the debugging program DDT, exited,
  379. entered the USER command to get to the desired user area, and then used SAVE to
  380. save PIP in the appropriate user area. SAVE, however, wants to know the length
  381. of the file to be saved. In fact, DDT has printed this out - in hex. But SAVE
  382. wants to know it in a decimal number of 256 byte blocks. Its easy to work out,
  383. but the whole procedure is awkward and not for the non-computer person.
  384.  
  385. In CP/M 3, if the system can't find a file in the current user area it will look
  386. under the system files under user 0 (files can be tagged 'system' and will not
  387. show up under a normal directory listing, but they are still there and can be
  388. accessed and manipulated), so the duplication of utility routines and adhoc
  389. methods of initially copying PIP are avoided. In addition if the current user
  390. number is not equal to zero, it is printed out with the system prompt, so one is
  391. reminded what user number one is working under. 
  392.  
  393. Command line editing (banked version only):
  394.    A line being entered can be edited without having to delete back to the
  395. character to be edited. In addition, the last line entered can be recovered,
  396. edited and entered again, so that a line rejected by a program because of syntax
  397. errors need not be retyped. A grumble about this facility is that the editing
  398. keys have been fixed by Digital Research and may not agree with the
  399. corresponding keys used by one favourite editor. Also, one's display unit must
  400. backspace without deleting on receiving control-H.
  401.  
  402. One now has the option to make the delete key backspace and delete rather than
  403. echo as it does with CP/M 2. Another command line facility enables one to enter
  404. several commands on one line.
  405.  
  406. Disk change:
  407.    CP/M 3 attempts to detect a floppy disk change so that it is not absolutely
  408. necessary to do a control-C when changing a disk. If the floppy disk drive sets
  409. a flag when the drive door is open then a disk change will always be detected.
  410. Otherwise, the directory is sumchecked every time a new program is begun and the
  411. sumcheck compared with the previous time this was done. In this situation a disk
  412. change will not always be detected and it is probably advisable to enter a
  413. control-C, particularly if the next program involves disk writes.
  414.  
  415. Temporary disk:
  416.    Several programs such as editors, SUBMIT described in the next paragraph,
  417. want to generate temporary files to be deleted when they finish executing. The
  418. current default disk is often not the appropriate disk for these files. CP/M 3
  419. allows one to designate a particular drive as the default drive for these files.
  420.  
  421. Submit:
  422.    SUBMIT is another CP/M 2 command that appears in CP/M 3 in a much cleaner
  423. form. XSUB is now automatically included in submit (did you ever figure out the
  424. rules governing XSUB?). Suppose you frequently wish to enter the same set of
  425. commands or a single rather complex command, possibly with some unknown
  426. parameters. Then you make a file containing these commands with $1, $2, ...
  427. replacing the items you might wish to vary from run to run. Now you can SUBMIT
  428. this file, if necessary specifying the unknown the variable parameters, and they
  429. will be executed without further intervention. Data to be read by the programs
  430. from the terminal or alternatively from the submit file if each such line is
  431. preceded by the symbol <.
  432.  
  433. At power-up the the system will look for a file PROFILE.SUB and submit this
  434. file, if present. This provides a simple way for setting the directory search
  435. order (see below) or displaying a logo when the machine is turned on.
  436.  
  437. Submit files can, themselves, include submit statements, but each level eats up
  438. a little more memory - see the section on RSX's below. As in CP/M 2 SUBMIT
  439. writes a file to disk containing the submit commands. However, this disk, is the
  440. temporary disk, I have just described, and if this is a virtual disk much of the
  441. grinding of the disk drive associated with SUBMIT in CP/M 2 can be avoided.
  442. Programs can now return a 'return code' which can be used to indicate whether a
  443. program performed correctly. SUBMIT files can now contain conditional lines
  444. which are executed only if the preceding program returned a successful code.
  445.  
  446. However the extra features of SUBMIT tend to make one think "wouldn't it be nice
  447. if it also did this" and I wouldn't be surprised if improved versions appeared.
  448.  
  449. Directory search:
  450.    Often the files one is working on will be on the drive designated as the
  451. default drive. However the utilities and compilers will be on another drive.
  452. CP/M 3 allows one to specify a list of up to four drives through which the CCP
  453. will search for a program to be executed. Note that this will not work for the
  454. (data) files which the program is to access. These must be on the default drive
  455. or have their drive names specified.
  456.  
  457. In CP/M 2, to call a program, one simply enters the name of the program with the
  458. standard suffix, .COM, omitted. In contrast, one can configure CP/M 3 so that if
  459. a command is entered, the CCP attaches the suffix .SUB and attempts to find and
  460. submit the resulting file and failing this will try the suffix .COM and attempt
  461. to find and execute the resulting file. Since many of my programs are driven
  462. from files to be submitted, this is how I have CP/M configured on my machine.
  463. Alternatively, one can give .COM files precedence, or one can follow the same
  464. protocol as CP/M 2.
  465.  
  466. Disk errors:
  467.    In CP/M 2 if a disk read error is detected a cryptic error message is
  468. returned and the program exits with the loss of any data in core. This can be
  469. the source of many tears if one is in, for example, a word processing program
  470. and is just saving one's latest best-seller after many hours of work. Of course,
  471. one should regularly save a manuscript, so minimizing the possibility of losing
  472. a large amount of work through a system failure (or power cut). In CP/M 3 the
  473. error message depends on the author of the BIOS. However CP/M 3 gives the
  474. opportunity for a program to maintain control after a disk error and so a 'soft
  475. landing' can be programmed.
  476.  
  477. IO device assignment:
  478.    Like CP/M 2, there are five 'logical' devices, the console keyboard, the
  479. console display, the printer, the tape reader - now called the auxiliary input
  480. device, the tape punch - now called the auxiliary output device. However these
  481. can be assigned to a maximum of 16 physical devices defined in the BIOS. Five
  482. pairs of locations in the System Control Block (see below) replace the IO byte
  483. of CP/M 2 for determining the current assignments. Each logical device can be
  484. defined to more than one physical device, if output is to be sent to several
  485. devices or input is to be collected from more than one device.
  486.  
  487. PUT and GET:
  488.    One sometimes wishes to gather up the output from a program and store it in a
  489. file: for example one might be testing a program, or one might want sample
  490. outputs for documentation. This can be done by using the command PUT before
  491. running the program. Similarly program input normally entered via the keyboard
  492. can be picked up from a file using GET which is essentially a cut down version
  493. of SUBMIT. By using a PUT command followed by a GET command one can feed the
  494. output of one program into another simulating the pipes that UNIX addicts are so
  495. fond of.
  496.  
  497. PIP and archive:
  498.    PIP is essentially the same as in CP/M 2. However there is an additional
  499. option - the archive option. Files of a disk can be flagged as 'archived'. With
  500. the archive option set PIP will copy only files which are not flagged as
  501. archived and then flag these files also as archived. This provides a very
  502. convenient way of backing up new or modified files on a disk without having to
  503. copy the entire disk after each session.
  504.  
  505. Date, password and disk label:
  506.    Files can be 'time stamped' with their creation dates and either their last
  507. access date or last update date. To use this facility the disk directory must be
  508. reorganized with each fourth directory entry containing the data for the
  509. preceding three files. Thus the maximum number of directory entries will be
  510. reduced by a quarter. I haven't tested this facility as my computer does not
  511. have a clock. One can also label a disk. This uses another directory entry
  512. location.
  513.  
  514. CP/M 3 also provides a facility for password protecting files against either
  515. unauthorized reading, writing or deleting. It's only limited protection as one
  516. could easily write a program to override it. It's my impression that security
  517. devices like this cause more trouble than they are worth. However, if you don't
  518. have an Official Information Act in your household you might want the limited
  519. amount of protection provided.
  520.  
  521. Help file:
  522.    CP/M 3 comes with a 62 kilobyte help file describing all the commands
  523. associated with CP/M and its standard utilities. It is organized with main
  524. headings, sub-topics, sub-sub-topics etc and comes with a little .COM file for
  525. accessing it. The help file can readily be edited or added to so you can add
  526. explanations of your own programs. It actually works pretty well, however again
  527. one keeps feeling 'wouldn't it be nice if they also included this facility'. The
  528. 62K length would pose problems for people with low capacity disks.
  529.  
  530. DIR, ERA, REN, TYPE:
  531.    The directory, erase, rename, type operations, DIR, ERA, REN, TYPE which were
  532. carried out by the CCP in CP/M 2 are now carried out by the CCP when in their
  533. most elementary form; if called with options they call separate programs stored
  534. on files DIR.COM, ERASE.COM, RENAME.COM and TYPE.COM. The options allow one to
  535. request a sorted directory with each file size and flags displayed, or request
  536. confirmation before erasing a file. RENAME does not have options, however, it
  537. prompts for the new and old name if these are not specified in the call and if a
  538. file with the new name already exists requests permission to delete it. An
  539. additional command DIRSYS is used for listing the names of system files.
  540.  
  541. System control block (SCB):
  542.    Numerous pieces of information about the current state of the operating
  543. system is included in a 100 byte block known as the system control block. This
  544. includes the number of console rows and columns, the directory search order, the
  545. input/output redirection data, the time and date, the current column position.
  546. There is a BDOS command for accessing and, in some cases, altering the SCB. 
  547.  
  548. Resident system extensions (RSX's):
  549.    Frequently one would like to squeeze a some translation between ones program
  550. and the BDOS or perhaps add extra BDOS commands. For example, I have an
  551. inexpensive imitation of Visi-calc. This program is unable provide the correct
  552. cursor positioning commands required by my display. The simplest solution is to
  553. trap the console output commands and translate them to a form suitable for my
  554. display. CP/M 3 contains the necessary facility for doing this. An RSX is a
  555. small chunk of code which is attached to a .COM file and which automatically is
  556. attached to the bottom of CP/M when the .COM file is loaded. It intercepts the
  557. appropriate BDOS commands and passes the others on to the BDOS unmodified. It
  558. may be programmed to vanish when the program ends or stay until it is commanded
  559. to detach itself.
  560.  
  561. SUBMIT, GET, PUT and also SAVE (which must be entered before the program to be
  562. saved is run) are examples of RSX's.
  563.  
  564. Another obvious application, is to intercept the command that returns CP/M's
  565. serial number so you can run your friend's software despite a manufacturer's
  566. attempt to prevent sharing software - but you wouldn't do that, would you?
  567.  
  568.  
  569.                                  THE UTILITIES
  570.                                  --- ---------
  571.  
  572. As well as the utilities I have already described, CP/M 3 comes with the
  573. utilities ED, MAC, RMAC, LINK, SID, LIB. In one sense it is quite a bargain, the
  574. prices of these utilities, if bought separately add up to about the same as the
  575. cost of CP/M 3. However, in fact, they don't add very much to the software I
  576. already own, and beyond what was required for generating the BIOS won't get much
  577. use from me.
  578.  
  579. ED
  580.    This is an augmented version of Digital Research's well-known editor. I have
  581. never used it or its predecessor and while I imagine it would have its uses if I
  582. ever came to grips with it, it seems very old fashioned compared with the screen
  583. editor I now use.
  584.  
  585. MAC and RMAC
  586.    MAC is an assembler (i.e. it compiles assembly language programs), very much
  587. more powerful than ASM which comes with CP/M 2, with extensive macro facilities.
  588. RMAC is a similar assembler which produces relocatable code to be linked into
  589. executable files by LINK or Microsoft's L80. RMAC's macro facilities are
  590. required for assembling some of the routines for the BIOS. However it accepts
  591. only Intel's mnemonics for the machine instructions plus some imitation ones for
  592. the Z80 codes. I consider Intel's mnemonics almost impossible to use and so
  593. prefer to use Microsoft's macro assembler, M80, which accepts the much more
  594. understandable Zilog mnemonics.
  595.  
  596. LINK
  597.    This is linking program used to link the output from RMAC, Digital's PL1
  598. compiler, and also output from Microsoft's M80 and F80 into executable code. It
  599. has a number of options which enable it to produce overlayable code or code that
  600. is relocateable at run time. It is required for linking the BIOS for CP/M 3 or
  601. for building RSX's. To use the overlay capability one needs either DR's PL1
  602. compiler to get the runtime overlay routines or one will need to do some
  603. detective work in order to write one's own. Unfortunately its run time is almost
  604. twice as long as for Microsoft's L80 so I won't be using it for linking standard
  605. programs.
  606.  
  607. LIB
  608.    This is a program for building and combining libraries of relocatable files
  609. of the type produced by RMAC. I haven't used it yet and cannot say how it
  610. compares with the equivalent Microsoft product.
  611.  
  612. SID
  613.    This is a very much augmented version of DDT (which comes with CP/M 2) and is
  614. used for debugging assembly language programs. I used it a little when bringing
  615. up CP/M 3. It, too, uses Intel mnemonics and it can be fouled up by Z80
  616. instructions. I won't use it much as I don't do much assembly language
  617. programming.
  618.  
  619.  
  620.                            COMPATIBILITY WITH CP/M 2
  621.                            ------------- ---- ---- -
  622.  
  623. Of course, CP/M 3 must be able to run most programs written for CP/M 2 if it is
  624. going to have any acceptance.
  625.  
  626. Programs are supposed to communicate only via the BDOS commands - see figure 1.
  627. However, some do access the BIOS commands or other parts of CP/M or even access
  628. the peripherals directly. The BDOS commands of CP/M 3 are extensions of those of
  629. CP/M 2 and so, as a general rule, we would expect programs that obey the rules
  630. to work correctly under CP/M 3. One exception is programs that access the disk
  631. allocation vector (which shows which disk blocks are allocated and can be used
  632. for seeing how much disk space is free). This vector, which is located using
  633. BDOS function 27 is not accessible under the banked version of CP/M 3 and so any
  634. programs that need it will have to be rewritten. A new BDOS function is
  635. available for finding the free disk space. I don't know whether this function is
  636. used much in commercial programs but as a last resort one could write an RSX to
  637. intercept BDOS function 27 and return the address of a simulated disk allocation
  638. vector with the correct free space.
  639.  
  640. Programs which access BIOS functions may or may not work. The disk functions
  641. have been modified and in any case they would be unlikely to work under the
  642. banked version of CP/M 3 since they expect to be called from the first memory
  643. bank. However the character I/O commands should still work. CP/M 3 includes a
  644. special BDOS function for accessing the BIOS functions and presumably this gets
  645. the banking right. Accessing other parts of CP/M, will work only if those parts
  646. are in common memory in the banked version and can still be located correctly.
  647.  
  648. Accessing peripherals directly via IN and OUT instructions should cause no
  649. problems. However, other methods of accessing peripherals may cause problems. My
  650. system has a memory mapped disk controller - ie, it is accessed by reading and
  651. writing to and from memory locations rather than by using IN and OUT
  652. instructions. The section of memory used is allocated to the first bank and so
  653. direct access to this is not possible under the banked version. Thus, in
  654. particular, my disk formating program which wants to access these locations will
  655. not run under the banked version and it is necessary for me to maintain an
  656. unbanked version to run this program.
  657.  
  658. Some control characters seem to be handled slightly differently. In particular,
  659. while ^s is used for stopping output as in CP/M 2, a ^q is now required to
  660. restart it, rather than any character apart from ^c. Control characters ^p, ^q,
  661. ^s, are intercepted by BDOS function 6 unless it is specially instructed not to
  662. and this causes a minor problem for one of my programs, a problem which I could
  663. overcome by writing a suitable RSX.
  664.  
  665. The IO-byte used for redirecting output is now replaced by a more sophisticated
  666. control mechanism and BDOS functions 7 and 8 now have a different use; this
  667. might affect a few programs. The functions of the utility STAT which accessed
  668. the IO-byte have now been taken over by a series of utilities, DIR, SHOW, SET
  669. but I don't think this will upset many users.
  670.  
  671. One possible area for problems is with systems that use interrupts. An interrupt
  672. is a mechanism whereby the hardware can gain temporary control of the processor,
  673. perhaps to pick up input from the keyboard or modem or to send another block of
  674. text to the printer. I do not know whether interrupts are disabled when a memory
  675. bank other than the one holding the program is being used, but if not there will
  676. be trouble.
  677.  
  678.  
  679.                           ADAPTING CP/M TO YOUR SYSTEM
  680.                           -------- ---- -- ---- ------
  681.  
  682. The first problem is getting a copy of the raw version of CP/M 3. Digital
  683. Research appears to consider it too complicated for the hobbyist to convert it
  684. for his/her own system. In fact it isn't, although it is not a project to be
  685. undertaken lightly. I doubt whether Digital Research would offer any advice or
  686. support for any amateur attempting to this. It is not widely advertized but is
  687. available from a limited number of sources.
  688.  
  689. CP/M 3 comes with reasonably detailed instructions. One needs to generate the
  690. BIOS (see figure 1), a cut down BIOS for the cold-boot loader and a program to
  691. load the cold-boot loader onto the system tracks of a floppy disk. One should
  692. start by building a minimal unbanked system and then slowly build it up till one
  693. gets the system one wants. Because the BDOS does the disk deblocking, rather
  694. than the BIOS, it is possibly a little easier than building an equivalent system
  695. for CP/M 2. The instructions for doing the full BIOS were reasonably good but I
  696. seemed to need to do a bit of detective work to build the cut-down BIOS for the
  697. cold-boot loader. The BIOS including the interface for the Semidisk involved
  698. about 1500 lines of code (a few hundred would have been copied from other
  699. sources), the cold-boot BIOS involved 270 lines and the program to set up the
  700. system tracks 350 lines.
  701.  
  702. A program GENCPM is supplied for putting everything together and the process is
  703. much more logical and less mysterious than for CP/M 2. In particular, it seems
  704. very reasonable for an amateur who can program in assembly language to modify an
  705. existing CP/M 3 BIOS to accommodate any special requirements or new pieces of
  706. hardware.
  707.  
  708.  
  709.                                  FINAL COMMENTS
  710.                                  ----- --------
  711.  
  712. I hope I have indicated some enthusiasm for this new version of CP/M. It is true
  713. that many of its features such as help files, the improved directory searching,
  714. program chaining can be implemented under CP/M 2. In addition, there still some
  715. rough edges, perhaps brought about by the realisation that it is better to have
  716. the present version now, rather than the perfect version long after the 8 bit
  717. chips are dead and buried. However, within the limitations of being compatible
  718. with CP/M 2 and the need to release it sooner rather than later, I think it
  719. represents a substantial improvement over CP/M 2, bringing together a large
  720. number of new features in a unified manner, which together add up to quite a
  721. lot.
  722.  
  723. I think there is the opportunity for a manufacturer to put his/her own mark on
  724. the system without making it incompatible with standard CP/M 3. An obvious
  725. example would be the addition of a visual CCP, perhaps with icons or pictures
  726. for program selection. However, I don't expect many CP/M 3 only programs to
  727. appear on the market.
  728.  
  729. CP/M 3 is not really a new system and the casual user would probably not notice
  730. any difference except perhaps that the familiar CP/M prompt appears immediately
  731. after a program terminates and possibly that some programs that use a lot of
  732. disk accesses run a little faster. With further use, however, he/she would find
  733. that things go wrong less often. After reading the documentation or using the
  734. HELP file he/she would begin using the line editing facilities and perhaps PUT,
  735. GET and the improved facilities of SUBMIT and begin to appreciate the host of
  736. minor additions. At this point the user might think about reorganizing the way
  737. disks are used, particularly if the system has a hard disk. This would involve
  738. the use of user numbers, time stamping files, and systematically backing up the
  739. working disks using the archive option. A programmer would appreciate some of
  740. the extra BDOS commands, the more logical structure and the extra memory.
  741.  
  742. Should you get CP/M 3? If you are given the choice, I think the answer is yes.
  743. If you are getting a hard disk system, this is a very strong yes (except that
  744. perhaps you shouldn't be buying an 8 bit system), otherwise it really depends on
  745. how much you can afford and the size of your system.
  746. t impossible to use and