home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / enterprs / cpm / text / inputcpm.txt < prev    next >
Encoding:
Text File  |  1994-07-13  |  57.3 KB  |  1,341 lines

  1. CP/M ON THE C128 (ARTICLE 1)
  2.  
  3. by Noel Nyman
  4.  
  5. [Edited by Gary J. Stagliano]
  6.  
  7. (Copyright 1986 by Geoduck Developmental Systems. Permission
  8. to reprint this material is hereby granted, provided this
  9. notice is included in the reprinted material.) [These articles
  10. originally appeared in a Canadian magizine called INPUT]
  11.  
  12. In this column we plan to explore CP/M (Control Program for
  13. Microcomputers) and how to use it on the C128.  
  14.  
  15. To understand the what and why of CP/M, we have to go back
  16. to the early days of microcomputing.  In this primitive time
  17. there were mainframes, huge and expensive computers.
  18. Communicating with one required a "console" which had a
  19. keyboard and an output device.  The output was frequently a
  20. printer, although the cathode ray tube (CRT or tv screen)
  21. was becoming more common. Refurbished teletype machines were
  22. often used as consoles.
  23.  
  24. In the early 1970's a revolution began that would change the
  25. course of computing...the LSI (Large Scale Integration)
  26. micro chip.  It became possible to produce on a single piece
  27. of silicon all the logic in CPU's (Central Processing Units)
  28. requiring several circuit boards on the mainframes.  The
  29. first popular microprocessor chip, the 8080 designed by
  30. Intel, was used to make intelligent terminals.  These were
  31. consoles that contained a keyboard and CRT monitor, a small
  32. amount of RAM (Random Access Memory) and some means of
  33. communicating with a mainframe.
  34.  
  35. The large hard disks and tape drives used by the main frames
  36. were too complex for a microcomputer to control (there
  37. wasn't enough RAM to hold the controller program required).
  38. So the micros used paper tape. A punch poked rows of up to
  39. seven holes in the half-inch wide tape, each hole
  40. representing a bit in a seven bit character or command.  A
  41. paper tape reader translated these holes into binary data to
  42. store in the micro.  Storing a program was noisy and slow.
  43.  
  44. In 1973 IBM developed the first floppy disks as alternatives
  45. to the then popular punch cards used on mainframes.  Gary
  46. Kildall at Intel obtained a used drive from a small company
  47. named Shugart and began working on a controller program to
  48. interface it with an 8080 based microcomputer.  He and John
  49. Torode developed the controller into a full disk drive
  50. operating system, which they called CP/M.  Intel wasn't much
  51. interested in the project, and Kildall and Torode began
  52. marketing the product on their own through Digital Research
  53. in 1976. The rest, as they say, is history.
  54.  
  55. CP/M is an operating system.  Every computer needs an
  56. operating system in order to interface with the console, the
  57. disk drives, and any other peripherals such as modems and
  58. printers.  In the relatively advanced age we live in, home
  59. computers usually come with their operating systems in ROM
  60. (Read Only Memory). When you power up your C128, it "knows"
  61. how to talk to the keyboard, screen, etc.  The Commodore
  62. disk drives have their operating systems in ROM also.  You
  63. don't need to LOAD any program in order to type on the
  64. keyboard, print characters on the screen, or find a file on
  65. a floppy disk.
  66.  
  67. In 1973 computers were much less smart. Partly this was due
  68. to the high costs of both RAM and ROM. A 32K machine cost in
  69. excess of $3000 without peripherals (1973 dollars, gasoline
  70. was still under $0.20 a litre then).  ROM was very expensive
  71. and difficult to program, EPROM's (Erasable Programmable
  72. Read Only Memory) weren't available.
  73.  
  74. Each time you turned the power on, you had to teach the
  75. computer how to be a computer all over again.  You did that
  76. by writing a program called the operating system, and
  77. SAVEing on disk or paper tape.  You used another smaller
  78. program that often was typed in by hand each time to LOAD
  79. the larger program.  This method of using a program to LOAD
  80. other programs was called "bootstrapping" since the
  81. computer was in a sense lifting itself by its own
  82. bootstraps.  The idea of "BOOTing" an operating system
  83. remains with us, and is a command recognized by Basic 7.0.
  84.  
  85. CP/M provided a standardized operating environment on many
  86. different computers.  For example, the TRS-80 machines use
  87. the command LPRINT to send strings to a printer.  Commodore
  88. uses PRINT# followed by a file number. But any printer
  89. routine written on a machine running under CP/M will run on
  90. any other CP/M machine (I'm not sure why "running under" is
  91. used, but that's the proper term).
  92.  
  93. CP/M comes in four main sections.  The first is the LOADing
  94. routine, which is usually on reserved tracks on CP/M disks.
  95. On the C128, the LOADer is found in ROM.  The two workhorses
  96. of CP/M are the BDOS (Basic Disk Operating System) and the
  97. BIOS (Basic Input-Output System).  Note that the term
  98. "Basic" as used here is a synonym for "primary" or
  99. "essential" and does not refer to the BASIC programming
  100. language.
  101.  
  102. The BDOS is identical for all CP/M systems of the same
  103. version.  BDOS works much like the Kernal jump table in
  104. Commodore machines, providing access to the routines for
  105. opening disk files, printing strings, and such by simply
  106. calling them by number.  The BIOS is customized for each
  107. computer model.  When the BDOS is asked to open a file, it
  108. uses several BIOS routines which are customized for the disk
  109. drives, data buss structure, etc.
  110.  
  111. The last section is a program call CCP (Console Command
  112. Processor).  The CCP accepts input from the keyboard,
  113. displays it on the screen, and places it in memory where
  114. appropriate for execution by other programs.  On most
  115. systems the CCP must be reLOADed after other programs finish
  116. execution.  On the C128, the CCP is always resident.
  117.  
  118. There have been several versions of CP/M produced since
  119. 1973.  The C128 runs under CP/M 3.0 (sometimes called
  120. CP/M+).  This is the most advanced CP/M available, used
  121. computers with bank switching capability and over 64K of RAM
  122. can use it.
  123.  
  124. If you'd like to read more about CP/M, there are many books
  125. available.  Since it's a relatively old system, your library
  126. may be a good source of information.  Try to get material
  127. for CP/M+, since some commands for older CP/M versions are
  128. different.  Some good references are:
  129.  
  130. THE CP/M PLUS HANDBOOK, Alan R. Miller, Sybex
  131.  
  132. CP/M AND THE PERSONAL COMPUTER, Dwyer & Critchfield,
  133. Addison-Wesley
  134.  
  135. If the date on the screen when you BOOT CP/M is older than
  136. December 4, 1985, you should get a copy of the new operating
  137. system.  This is available from CompuServe, Q-Link, 
  138. or perhaps a user in your area has one.
  139.  
  140. [Ed. Note-The latest version of CP/M+ for the C128 is the
  141. May 87 version.  This version supports the 790K 1581 3.5"
  142. drive.  It also supports external terminals and true 6551 
  143. UART chip for improved RS232 communications.  It also has
  144. an experimental 4.0 Mz mode that works on some C128.]
  145.  
  146. ----Some additional references----
  147.  
  148. DR DOBB'S JOURNAL, especially earlier issues, covers CP/M
  149. extensively, you local library may have past issues
  150. available.  For an interesting article by Gary Kildall on
  151. the start of CP/M, see the January 1980 issue.
  152.  
  153. Old copies of BYTE, KILOBAUD MICROCOMPUTING, and INTERFACE
  154. AGE also have articles on CP/M.  For a series on CP/M+,
  155. check the February 1983 issue of MICROSYSTEMS.
  156.  
  157. The C128 HSG: c/o Gary J. Stagliano 182-J Homestead St.
  158. has an extensive collection of CP/M software for the C128.
  159.  
  160. The Dwyer & Critchfield book above has excellent reference
  161. sections on programming under CP/M in Z80 and 8080 machine
  162. code.  For more details on Z80, try:
  163.  
  164.     Z80 ASSEMBLY LANGUAGE PROGRAMMING
  165.     Lance Leventhal
  166.     Osborne/McGraw-Hill
  167.  
  168.     Z80 ASSEMBLY LANGUAGE ROUTINES
  169.     Leventhal and Saville
  170.     Osborne/McGraw-Hill
  171.  
  172. Before we look at how to work with CP/M, it's important to
  173. understand what CP/M isn't.
  174.  
  175. CP/M is NOT a programming language.  Commodore operating
  176. systems rely heavily on the BASIC programming language ROM
  177. to communicate with the user.  CP/M has no high level
  178. language in it.  To program in BASIC, you must LOAD a BASIC
  179. language into the computer.
  180.  
  181. CP/M does NOT contain a word processor, data base, or any
  182. other sophisticated programs.  It is only an operating
  183. system.  It gives you the ability to LOAD other programs and
  184. utilities, to view disk directories and text files, and to
  185. rename or erase disk files.  It combines some of the
  186. features of the Commodore DOS 5.1 wedge and a sequential
  187. file reading program.  It also gives programs written in
  188. 8080 or Z80 microprocessor machine code a universal way to
  189. access the screen, keyboard, disk drives, printer, and
  190. modem.  Most of these programs will run on the C128, even
  191. though they were written many years ago on different
  192. machines running under an earlier version of CP/M.
  193.  
  194. To start or BOOT CP/M on the C128, place the "system" disk
  195. (the disk that has the CP/M operating system on it) in your
  196. disk drive and turn on the computer or reset it with the
  197. reset button next to the power switch.  If you are in C128
  198. mode, you can type the command BOOT instead.
  199.  
  200. The older CP/M operating systems supplied with the C128 used
  201. either the forty or eighty column screens.  The systems
  202. dated December 4th and later use only eighty columns.  To
  203. use CP/M effectively, you should be using the newest
  204. version.  This will require an eighty column monitor.
  205.  
  206. You can use an RGBI monitor, such as the 1902, simply by
  207. plugging in the 9 pin connecting cable.  You can have
  208. excellent eighty column video at much lower cost by using a
  209. monochrome monitor.  Some are even available with audio
  210. amplifiers, for under $100.  You can also use a 1702 monitor
  211. for monochrome with lower resolution.
  212.  
  213. To use a 1702 or monochrome monitor, you'll need a cable
  214. with an RCA type phono plug on one end and a DB-9 connector
  215. on the other.  You can make one (connect the center of the
  216. RCA plug to pin 7 and the shield to pin 1 of the DB-9), or
  217. purchase one ready made.  Check with your local dealer, or
  218. the ads in Commodore oriented magazines.
  219.  
  220. Once you BOOT CP/M, you'll see the opening message with the
  221. date and finally
  222.  
  223. A>
  224.  
  225. with a flashing cursor behind it.  This is the user prompt,
  226. the CP/M equivalent of Commodore's "READY".  CP/M is
  227. awaiting your command.
  228.  
  229. The tasks that CP/M can be told to perform in direct mode
  230. are called "utilities".  Six of these utilities are called
  231. "resident" because they are a permanent part of CP/M as it
  232. sits in the C128's RAM.  All other utilities are
  233. "transient", they must be LOADed from disk into memory and
  234. executed, just like a program.
  235.  
  236. To execute a utility, just type its name at the system
  237. prompt.  For example, type the following:
  238.  
  239. A> dir
  240.  
  241. and press RETURN.  The disk drive will spin briefly and
  242. you'll see the names of the files on the disk in drive A.
  243. CP/M uses letters to identify drives, where Commodore uses
  244. numbers.  The C128 CP/M system supports four disk drives,
  245. plus a ram drive. The defaults are:
  246.  
  247.        A=8   B=9   C=10   D=11    M=Ram
  248.  
  249. These can be changed, as we'll see later.  If you only have
  250. one disk drive, the CP/M system will let you use drive E as
  251. a "virtual" drive.  Drive E doesn't exist, but when you
  252. refer to it, CP/M will use available RAM in place of a
  253. drive, or prompt you to put the "E" disk in drive A.  You'll
  254. use drive E to hold files when copying, much as the program
  255. 1541 BACKUP uses the C64 RAM to hold files when copying
  256. disks on a single drive.
  257.  
  258. Each file listed on the directory has two parts, the name
  259. and the extension.  For the program CPM+, the extension is
  260. SYS.  The name and extension together are called the
  261. "filespec".  Files on a CP/M disk can have as many as eight
  262. characters in their file names and up to three character
  263. extensions.  Although the "dir" command shows the file names
  264. and extensions separated by spaces on your screen, you'll
  265. enter filespecs by separating the name and extension with a
  266. "."  as in
  267.  
  268.      CPM+.SYS
  269.  
  270. Since CP/M uses the "." to tell where the name ends and the
  271. extension begins, don't use a "." as part of the file name.
  272. In fact, it's best to avoid any characters in file names
  273. except letters and numbers.
  274.  
  275. You can use any extension you like when naming or renaming a
  276. file.  Some of the extensions have special meaning to CP/M
  277. or some utilities.  But unlike the Commodore DOS, CP/M will
  278. let you rename any program, including its extension, at any
  279. time.
  280.  
  281. The most important extension for now is ".COM".  Files with
  282. this extension are "command" files.  They are Z80 or 8080
  283. machine language programs.  Usually they are self starting.
  284. To "RUN" a command file, simply type its name at the system
  285. prompt.  Do NOT type the ".COM" extension.  There is [in 
  286. public domain] a simple card game called TWENTY1.COM.  Try
  287. the game now by typing:
  288.  
  289. A> twenty1
  290.  
  291. The disk drive will spin, the program will be LOADed and RUN
  292. automatically.  To end the game at any time hold the CONTROL
  293. key and press the "C" key.  This is the CP/M equivalent of
  294. RUN/STOP-RESTORE plus SYS 64738, and is usually abbreviated
  295. CTRL-C or sometimes shown as an "up-arrow C" in texts that
  296. can print an up-arrow symbol.
  297.  
  298. If you have a second disk drive, you can LOAD programs or
  299. other files from it in one of two ways.  First try
  300.  
  301. A> b:twenty1
  302.  
  303. If you forgot to move the disk to drive B, you'll get a
  304. "TWENTY1?" from CP/M, which is asking you if that's really
  305. what you meant to type.  With the disk in drive B, the
  306. program will LOAD and RUN.  Use CTRL-C to exit, and type
  307.  
  308. A> b:
  309.  
  310. and you should see
  311.  
  312. B>
  313.  
  314. To change the system or "default" drive at any time, simply
  315. type the new drive number at the system prompt.  Don't
  316. forget the colon, or CP/M will look for a file named "B.COM"
  317. on drive A.
  318.  
  319. With the system drive changed to B, you can enter the name
  320. of any ".COM" file on the disk in that drive without
  321. including the drive as part of the filespec.
  322.  
  323.  
  324. Before we discuss more resident utilities, let's look at
  325. using disk drives with the C128 in CP/M mode.  The 1571
  326. drive which was designed to work with the C128 will read
  327. regular 1541 type disks and also the MFM type disks used by
  328. many 5 1/4 inch CP/M disk machines.  This has led to some
  329. confusion about just what a "CP/M" disk is.
  330.  
  331. Commodore uses a process called GCR (Group Character
  332. Recognition) to record data on its disks.  GCR describes the
  333. way in which the disk electrical system works.  It does not
  334. have anything to do with the number of tracks or sectors, or
  335. their placement on the disk.  Apple also uses a form of GCR,
  336. but their track layout is quite different.
  337.  
  338. When a disk is formatted on a 1541, the DOS (Disk Operating
  339. System) puts 35 tracks on the disk containing 664 sectors.
  340. A 1571 uses exactly the same layout on the "front" of the
  341. disk, then repeats it on the "back", for a total of 70
  342. tracks and 1328 sectors.
  343.  
  344. When you format a disk using the CP/M utility "FORMAT.COM",
  345. the layout of the tracks and sectors is IDENTICAL to that
  346. used in the standard 1541 or 1571.  The CP/M disk has its
  347. directory area on different tracks and places a BOOT sector
  348. on each formatted disk, but the layout is the same.  You can
  349. prove this by examining a Commodore CP/M disk in C64 mode
  350. with a "disk doctor" program.
  351.  
  352. This means that you can use any combination of 1541's and
  353. 1571's in a C128 CP/M system.  The CP/M disk that came with
  354. your C128 is a single sided (1541) disk.  You can read it
  355. with either disk drive.  You must turn it over to read the
  356. "back" side.  You can also copy a single sided (1541) CP/M
  357. disk with any "bit" copier or with the backup command on a
  358. dual drive such as the MSD.
  359.  
  360. However, CP/M is NOT practical with a single 1541 disk
  361. drive.  It's just too slow.  If you want to learn about the
  362. CP/M system, or experiment with some of the programs, the
  363. speed will be tolerable.  But any serious programming,
  364. database or word processor work will take too long.  You are
  365. much better off with existing C64 programs for those tasks.
  366. Using one of the many "fast load" programs or cartridges
  367. will make a C64 system much faster and easier to use than a
  368. 1541 CP/M system.
  369.  
  370. If you have a 1571, you can use a 1541 as the "B" drive with
  371. better results.  The disk operations will still be slow on
  372. the 1541.  But you can do your primary work with the faster
  373. drive.
  374.  
  375. If you are contemplating the purchase of a C128 and two
  376. 1571's JUST to run CP/M, I advise against it.  For the same
  377. money you could purchase a low end or used CP/M computer
  378. such as a Kaypro which will run CP/M many times faster than
  379. a C128.  However, for the combination of a fantastic Basic,
  380. excellent sound and graphics, C64 compatibility (mostly) and
  381.  CP/M as frosting on the cake, the C128/1571 system is a
  382. good bargain.
  383.  
  384. Last time we used the "DIR" resident utility to look at a
  385. disk directory.  Enter the command again, and look at the
  386. bottom of the listing.  If your boot disk is in your
  387. drive, you'll see the phrase "System file(s) exist".  Now
  388. enter the command
  389.  
  390. A> dirsys
  391.  
  392. You should see only the file "CCP.COM" followed by the
  393. phrase "Non-system file(s) exist".
  394.  
  395. The term "system" refers to an "attribute" or characteristic
  396. given to certain files.  It does NOT refer to the extension
  397. ".SYS".  Notice that the file "CPM+.SYS" appears when you
  398. used the "DIR" command, but is not listed with "DIRSYS".
  399.  
  400. The system attribute is important for hard disk or
  401. multi-user systems.  We'll look at it more closely when we
  402. discuss the "USER" command.  But system files are also less
  403. likely to be accidentally erased.  To erase a system file,
  404. you must use a special command.  So it makes sense to
  405. protect your most valuable files in this way.  We'll use a
  406. utility called "SET.COM" to change "CPM+.SYS" to a system
  407. file.
  408.  
  409. Place the original CP/M disk you received with your C128 in
  410. drive A and use "DIR" to be sure you have the side
  411. containing "SET.COM".  Then if you have two disk drives,
  412. place the a disk with the cpm+.sys in drive B and type:
  413.  
  414. A> set b:cpm+.sys[system]
  415.  
  416. Don't leave a space between the ".sys" and the left bracket.
  417.  Be sure to use brackets, shifted ":" and ";".  If you  have
  418. only one drive, type:
  419.  
  420. A> set e:cpm+.sys[system]
  421.  
  422. In either case, CP/M will LOAD the program "SET.COM" from
  423. the disk in drive A.  For a two drives, CP/M will then
  424. change the attribute of the file on the disk in drive B.
  425. For one drive, CP/M will prompt you to place the "E" disk in
  426. drive A, and then changes the attribute.
  427.  
  428. Now use "DIR" and "DIRSYS" to check your work.  "SET.COM"
  429. has many other uses we'll look at later.
  430.  
  431. USER is a utility that was designed for systems with hard
  432. disk drives or multi-user systems.  It allows you to have
  433. sixteen "user areas" on a single disk.  To illustrate this,
  434. type:
  435.  
  436. A> user 5
  437.  
  438. Don't forget the space ahead of the number.  CP/M responds
  439. with
  440.  
  441. 5A>
  442.  
  443. The system will now only look at disk files that were SAVEd
  444. to disk in the user 5 area.  When you type the DIR command,
  445. you'll get a "no files" message because all the files on
  446. your disk are in user 0.  The user number would be handy for
  447. keeping your files separate from another user's on a hard
  448. disk you both share.  It's not very useful to us, because
  449. you can't access another user area files from the current
  450. user area.  This means that any utilities are shut off from
  451. you unless you copy them into the new user area. However,
  452. when you type a file name, CP/M will look for a ".COM" file
  453. with that name in the current user area.  If it doesn't find
  454. one, it will look for the file in user 0, and LOAD it if it
  455. has a "system attribute".  As we saw last time, the system
  456. attribute is not the same as a ".SYS" extension.  If you
  457. want utilities available in other user areas, use SET.COM to
  458. change them to system attribute files.  Change back to user
  459. 0 now by typing:
  460.  
  461. 5A> user 0
  462.  
  463. "ERASE" and "RENAME" are used to erase (scratch) or rename
  464. files on a disk.  The commands can be abbreviated "ERA" and
  465. "REN".  To change the name of the game TWENTY1.COM on a disk,
  466. type:
  467.  
  468.  A> ren d:TWENTONE.COM=d:TWENTY1.COM
  469.  
  470. This is similar to the Commodore DOS format where the new
  471. name comes first.  The "d:" represents the drive number
  472. containing the disk with the file you want renamed.  You can
  473. omit if if the file is on the currently logged drive.  Don't
  474. use more than eight characters for the name and three for
  475. the extension.  If you forget the extension, the file will
  476. be named "TWENTONE.   ".  You can change any extensions at
  477. any time, but some utilities expect certain extensions.
  478. Avoid ".HEX", ".MAC", ".ASM", ".BAS", ".HLP" and ".COM" for
  479. general files.  However, if you find a file on a public
  480. domain disk with ".OBJ" (object code file), or ".BIN"
  481. (binary code file), try changing the extension to ".COM" to
  482. get the program to run under CP/M+.
  483.  
  484. The Commodore DOS wild card rules apply to CP/M as well.
  485. You can use "?" as a single character wild card, or "*" as a
  486. file name or extension wild card in most commands.  For
  487. example
  488.  
  489. A> dir *.COM
  490.  
  491. will show you only the ".COM" files on the disk in drive A.
  492. Using
  493.  
  494. A> ren d:*.bak=d:*.txt
  495.  
  496. changes all ".TXT" (text) files to ".BAK" (backup) on the
  497. drive specified by "d:".  Typing
  498.  
  499. A> era *.*
  500.  
  501. will erase ALL the file on drive A...be careful!  If you use
  502. a wild card in ERA or REN, CP/M will prompt you for a
  503. "YES/NO" before executing the command.
  504.  
  505. Although DIR, REN, and ERA are resident utilities, they are
  506. "bare bones" versions.  They have all have advanced features
  507. that require too much memory to keep in RAM.  If you try to
  508. use one of these features, you must have the corresponding
  509. ".COM" file on disk.  For example, place any disk except the
  510. CP/M system disk in the drive and enter
  511.  
  512. A> dir [full]
  513.  
  514.  
  515. You will get the message "DIR     COM required".  The
  516. advanced [full] option requires LOADing DIR.COM.  Now place
  517. the CP/M system disk in the drive and re-issue the command.
  518. An easy way to repeat a command on the C128 is to tap the
  519. CURSOR DOWN key next to the SHIFT key, not the one at the
  520. top of the keyboard.  The last command entered will be
  521. retyped on the screen.  Press RETURN to execute it, or use
  522. the cursor and DEL keys to change it.
  523.  
  524. You should now see a much more complete directory listing.
  525. The files are listed in alphabetical order, and their sizes
  526. in bytes and records are shown. The sizes will be in 1K
  527. increments for single sided disks and 2K for double sided.
  528. CP/M records are 128 bytes each.  The attributes of each
  529. file are shown, either DIR or SYS and either RW for "read or
  530. write" or RO for "read only".  RO files cannot be changed
  531. without changing them to RW with the SET.COM utility.
  532.  
  533. The [full] option also shows total bytes used and free on
  534. the disk, total files found and directory entries used.
  535. Long files may take up two directory entries.  You can see
  536. the same display on a disk that doesn't have DIR.COM by
  537. typing
  538.  
  539. a> dir [drive=b]
  540.  
  541. Place the disk containing DIR.COM in drive A and the disk
  542. you want to view in drive B.  If you have only one drive,
  543. replace the "b" with "e".  CP/M will LOAD DIR.COM and prompt
  544. you for the new disk.
  545.  
  546. The last resident utility, TYPE, allows you to look at files
  547. on your screen and print them on a printer.  All files on a
  548. CP/M disk are either ASCII (text) files or binary machine
  549. code files.  You can only use TYPE with ASCII files.  You
  550. can't harm anything if you accidentally use TYPE on a binary
  551. file, but you'll only see gibberish on the screen, and CP/M
  552. may crash.  If that happens, just re-BOOT the system.
  553.  
  554. Any file with ".DOC", or ".TXT" extensions can usually be
  555. viewed with TYPE.  If you have a file named readme.tex on 
  556. a disk, enter
  557.  
  558. A> type readme.txt
  559.  
  560. CP/M will display part of the file README.TXT on the screen.
  561. When the screen is full, a prompt will appear to press
  562. RETURN (almost any key will do), and more of the file will
  563. be displayed.  If you want to exit TYPE, just press CTRL-C.
  564.  
  565. You can print a text file on your printer by pressing CTRL-P
  566. before issuing the TYPE command.  CTRL-P toggles the printer
  567. on line, and anything that appears on the screen will be
  568. printed as well.  The CTRL-P command produces a tone when
  569. the printer is toggled on.  Pressing CTRL-P again toggles
  570. the printer off and no tone is heard.
  571.  
  572. While CTRL-P gives you hard copy from TYPE, it also has all
  573. those "Press RETURN..." prompts in it.  You can avoid them,
  574. by using an advanced TYPE option.  Enter
  575.  
  576. A> type readme.txt[nopage]
  577.  
  578. The file will scroll up your screen without stopping, and
  579. will print completely.  Since [nopage] is a non-resident
  580. feature of TYPE, TYPE.COM must be on the disk for it to
  581. work.  You can use [nopage] on another disk by typing
  582.  
  583. A> type d:readme.txt[nopage]
  584.  
  585. where "d:" is any valid disk drive.
  586.  
  587. There are many other utility options, too many to discuss
  588. here.  You can find out about them in the DIGITAL RESEARCH
  589. CP/M PLUS USER'S GUIDE.  This is part of the package you get
  590. by mailing in the card bound in the CP/M section of the C128
  591. SYSTEM GUIDE that came with your C128.  The Digital Research
  592. documentation is extensive and a great bargain at the
  593. offered price.  However, it was written by computer folks
  594. for other computer folks.  For easier reading, you may also
  595. want to purchase the CP/M PLUS HANDBOOK by Alan Miller.
  596.  
  597. You should always keep back-up copies of your system disk
  598. and important utilities.  You can copy files with the
  599. utility PIP.COM.  PIP is explained briefly in the C128
  600. SYSTEM GUIDE.  You can also use DIR+.COM found in public
  601. domain.  You can make full disk copies of any single
  602. sided CP/M disk using a C64 or C128 bit or nibble copier or
  603. a dual drive copier program in non-CP/M mode.  You cannot
  604. use any program that uses BAM or directory references to
  605. copy a disk. [Fast hack-em, and Mavrick do an excellent job.]
  606.  
  607. Commodore put some excellent features in CP/M on the C128.
  608. The information on how to use them, as well as many of the
  609. regular CP/M commands, can be found in a "HELP" file on the
  610. disk that came with your computer.  HELP.COM is a CP/M
  611. utility that uses special text files with ".HLP" extensions.
  612. The text file is organized alphabetically by subjects and
  613. may contain several levels of subtopics on each subject.
  614.  
  615. Entering "HELP" at a system prompt will give you a list of
  616. the subjects available.  Be sure that both HELP.COM and
  617. HELP.HLP are on the disk.  Various commands are used to
  618. access the subtopics.  There is a lot of valuable
  619. information specific to the C128 tucked away in the HELP.HLP
  620. file.  The on-screen format is great for browsing through
  621. the information.  But it's not very handy if you need to
  622. check something while you're running another program. [Note:
  623. MS-DOS is just now putting help on DOS 5.0 and 6.0]
  624.  
  625. You could get a print-out of the HELP screens by using the
  626. CTRL-P option before using HELP.  This will bring your
  627. printer on line and everything displayed on the screen will
  628. be reproduced on paper as well.  All the prompts and your
  629. replies will be there too.  Also, because of the format used
  630. by HELP, only one screen will be displayed on each page,
  631. using quite a bit of paper.  The format will be eighty
  632. columns, not the best if you'd like to three-hole punch your
  633. copy for binding. 
  634.  
  635. To help you have the best access to this file, we've created
  636. a version formatted for printer output.  It comes with page
  637. numbers, and a table of contents.  It has wide margins
  638. making it easy to put notebook holes on either side. The
  639. HELP file, and a similar one for the CONFigure utility used
  640. with the December 6th operating system, are available in the
  641. public domain.
  642.  
  643. With the neat spacing and margins, this file is quite long.
  644. This is a common problem with text files.  They often
  645. contain redundant spaces and extra lines, making for good
  646. print-out, but inefficient storage.  A solution devised
  647. years ago by CP/M users is to compact or "squeeze" text
  648. files for storage on disk.
  649.  
  650. If you look at a CP/M disk directory, you'll likely see
  651. several files that have "Q" as the middle character in their
  652. extensions...FILE.TQT, or DISKDOC.AQM, for example.  The "Q"
  653. indicates that this file has been squeezed.  It cannot be
  654. viewed by TYPE, or handled in the usual manner.  It must be
  655. expanded or "unsqueezed" to it's original form first.
  656.  
  657. USQ.COM will unsqueeze the HELP and CONF files also on that
  658. disk so you can print hard copy from them.  First format a
  659. new disk using FORMAT.COM.  The unsqueezed version of the
  660. HELP file is 108K long, and will just fit with it's squeezed
  661. counterpart on a single-sided disk.  Using PIP, or DIR+ from
  662. copy the file HELP.DQT to the disk you just formatted. 
  663. Place the disk with USQ.COM in drive A and type
  664.  
  665. A>USQ
  666.  
  667. You will get a short message including the address of the
  668. author of the program.  USQ.COM and two companion programs
  669. are in the public domain, although source code for them and
  670. full documentation is available for a small fee.
  671.  
  672. When you see the "*" prompt, place the disk with HELP.DQT in
  673. drive A and type
  674.  
  675. *HELP.DQT
  676.  
  677. USQ.COM will analyze the file and produce an unsqueezed
  678. version.  This will take some time, you may want to have a
  679. good book handy.
  680.  
  681. When USQ.COM has finished, take a look at the disk
  682. directory. HELP.DQT will still be there, but HELP.DAT has
  683. been added. To get your hard copy, set up your printer with
  684. continuous form paper and place a disk with the December 6th
  685. operating system in drive A.  If you have a non-Commodore
  686. printer and an interface that allows a transparent mode,
  687. type
  688.  
  689. A>CONF PRT1=ASCII
  690.  
  691. This changes CP/M so that it sends true ASCII codes rather
  692. than PetASCII to your printer.  If you have a Commodore
  693. printer, skip this step (a few of the special characters in
  694. the file may not be reproduced correctly by your printer).
  695.  
  696. Now type
  697.  
  698. A>TYPE E:HELP.DAT[NOPAGE]
  699.  
  700. But don't press RETURN yet.  If you have two disk drives,
  701. use "B:" in place of "E:".  After you've entered the line,
  702. hold the CONTROL key and press "P".  You should hear a bell
  703. chime, indicating that the printer is now on line.  Now
  704. press RETURN, and the file will be sent to your printer. The
  705. document is 58 pages long, so have enough paper ready. Don't
  706. forget to type CTRL-P again when you're through, or your
  707. screen display will still be echoed on your printer. Follow
  708. the same procedure to make a copy of CONF.DQT.
  709.  
  710. After you've collected several CP/M disks, you'll have a
  711. number of "Q" files, and you may not remember what they all
  712. contain.  Or you may want to examine a new "Q" file before
  713. bothering to unsqueeze it.  QSHOW.COM you see the file on
  714. your screen without unsqueezing it.  To use it, enter
  715.  
  716. A>QSHOW d:FILENAME
  717.  
  718. where "d:" is the drive identifier if you have more than
  719. one, or the virtual drive "E:".  After the first part of the
  720. file is displayed, type "?" to see a list of QSHOW commands.
  721.  
  722. You may have discovered that, as good as Commodore CP/M is,
  723. it still isn't quite the way you want it.  You probably turn
  724. off the 40 column screen to make CP/M run faster and
  725. prevent timing problems in the 1200 baud mode when running
  726. IMP.COM on.  You may prefer faster keyboard response, and use
  727. CONFigure's FEEL command each time you boot the system.
  728.  
  729. There are several ways to "customize" the system to your
  730. preferences.  We'll look at the traditional way first.
  731.  
  732. Use PIP or DIR+ to create a system disk with the following
  733. files:
  734.  
  735. CPM+.SYS (the December 6th version)
  736. CCP.COM
  737. CONF.COM
  738. SUBMIT.COM
  739. DATE.COM
  740. VDE.COM
  741.  
  742. Place this disk in drive A and enter the video editor by
  743. typing
  744.  
  745. A>VDE PROFILE.SUB
  746.  
  747. This sets up VDE to create a file named "PROFILE.SUB".  Be
  748. sure the name correct.  Once you get the flashing cursor in
  749. VDE enter the following three lines exactly as shown:
  750.  
  751. CONF 40COL=OFF, FEEL=0
  752. DATE SET
  753. DATE C
  754.  
  755. Save this file to disk by pressing the ESCape key followed
  756. by "X".  When you get the system prompt, re-boot the
  757. computer.  You can do this by pressing the "reset" switch
  758. next to the power switch.  But a simpler way is to hold
  759. CONTROL and press the "ENTER" key on the numeric keypad.
  760.  
  761. You should see the system start up normally.  But as soon as
  762. the prompt appears, the first line of PROFILE.SUB will be
  763. printed on the screen.  CP/M then executes the line just as
  764. if you had typed it.  When the "DATE SET" command is
  765. executed, you'll be prompted for the date and time.  The
  766. last command causes the date and time to be displayed
  767. continuously until you press a key.
  768.  
  769. When CP/M boots, it looks for a file named "PROFILE.SUB". If
  770. one exists, SUBMIT.COM is loaded and the commands in
  771. PROFILE.SUB are executed.
  772.  
  773. Experiment with various other commands in PROFILE.SUB.  If
  774. you have a color monitor, you can change screen and
  775. character colors.  You may prefer to have your printer port
  776. default to ASCII.  Check the CONF.DAT file or type "CONF" by
  777. itself to see what other things about CP/M you can change.
  778.  
  779. One of the advantages of having an operating system in RAM
  780. is that it can be changed.  By making these changes to the
  781. system programs on disk, you can have your customized
  782. version available as soon as it loads.  This is much faster,
  783. easier, and more permanent than making changes to the C64
  784. and C128 ROM based operating systems.
  785.  
  786. Commodore has provided KEYFIG.COM, a very powerful utility
  787. to make changes in CP/M.  You should have good hard-copy of
  788. the HELP file for KEYFIG.  If not, place the disk that came 
  789. with your C128 in drive A, making sure that the side containing
  790. HELP.COM and HELP.HLP is "up".  Remember that you must "flip"
  791. this disk over to read the other side, even on a 1571 drive.
  792. Now type
  793.  
  794. A>HELP KEYFIG
  795.  
  796. KEYFIG.COM changes the characters represented by the keys on
  797. your keyboard.  Most of the keys have four "definitions"
  798. because there are four keyboard "modes".  The regular mode
  799. produces lower case characters when you press the alphabet
  800. keys.  The "shifted" mode produces upper-case letters or the
  801. characters that appear on the top of the key...a shifted-1
  802. is a "!", for example.  "Commodore" mode is entered by
  803. tapping the Commodore logo key at the bottom left of the
  804. keyboard.  It works like the "CAPS LOCK" key in C128 mode,
  805. producing upper case letters, un-shifted characters for
  806. other keys.  Typing "1" produces a "1" in Commodore mode.
  807.  
  808. "Control" mode is produced by holding the CONTROL key and
  809. pressing another key.  CTRL-M produces a carriage return.
  810. Some CTRL characters are used with CP/M files; CTRL-Z is
  811. used to end text files.  Others have special meaning to the
  812. C128's CP/M system.
  813.  
  814. With KEYFIG.COM, you can change any or all of the character
  815. definitions associated with nearly any key on the keyboard.
  816. For some keys, such as the function keys (F1 through F8),
  817. you can print whole strings with a single keystroke.
  818.  
  819. Let's walk through a sample KEYFIG session.  First, be sure
  820. you are working with a COPY of the operating system. NEVER
  821. make changes to the original!  Use PIP or DIR+ to copy
  822. CPM+.SYS and CCP.COM to a new disk before you try any KEYFIG
  823. experiments.  The disk you made to test PROFILE.SUB last
  824. time will do nicely.
  825.  
  826. If you've owned a C64, you probably aren't used to those
  827. four cursor keys at the top of the keyboard.  Since the
  828. "normal" cursor keys work in C128 mode, it makes sense that
  829. they should in CP/M too.  But they don't.  Programs like
  830. dBASE II, WordStar and VDE get downright grumpy if you don't
  831. use the upper cursor keys.  Let's fix that.
  832.  
  833. KEYFIG.COM will walk you through the key changing process,
  834. but it uses those darn upper cursor keys to do it.  In order
  835. to make the lower keys do what we want, we need to know the
  836. "key codes" for the upper cursor keys. Fortunately there's
  837. an easy way to get them.
  838.  
  839. Press these three keys all at the same time:
  840.  
  841. CONTROL
  842. RIGHT-SHIFT (just below the = sign)
  843. CURSOR LEFT (the one above the CLR-HOME key)
  844.  
  845. A colored square or "window" will appear on the bottom line
  846. of your display.  Now press the CURSOR UP key, the one just
  847. above the  -  key.  You should see "05" appear in the
  848. window. Press RETURN, then press the same three keys again
  849. and get the value for CURSOR DOWN.  These are the
  850. "hexadecimal" values assigned to each key by the CP/M
  851. system.  Here are the values for the keys we're interested
  852. in:
  853.  
  854. Upper Keyboard              Lower Keyboard
  855.  
  856. CURSOR UP     -  05         Cursor Up     -  17
  857. CURSOR DOWN   -  18         Cursor Down   -  17
  858. CURSOR LEFT   -  13         Cursor Left   -  01
  859. CURSOR RIGHT  -  04
  860.  
  861. We're going to change the definitions for the lower "normal"
  862. cursor keys so they are the same as their upper keyboard
  863. counterparts.  But the default values of these keys are
  864. useful too.  The Cursor Up/Down key will reprint the last
  865. command we entered, and the Cursor Left will move back over
  866. that command to let us edit it.  We'll keep these functions
  867. by assigning them to the F1 and F2 keys.
  868.  
  869. Type KEYFIG at a system prompt, be sure that KEYFIG.COM is
  870. on the disk in your drive.  Answer "N" to the prompt for
  871. instructions.
  872.  
  873. You'll be asked for the source for the keycodes.  Use the
  874. upper cursor keys and RETURN to select "default
  875. definitions".  At the next menu, select the "edit a key"
  876. option.  You'll see the names of the four key modes on the
  877. screen.  Press the "A" key.  The four values assigned to
  878. that key by the default definitions will appear.  Try other
  879. keys to see the effect.  Some keys, such as F3, have strings
  880. defined in some modes, but not in others.
  881.  
  882. First let's change the F1 key.  Press F1, then use the
  883. cursor keys and RETURN to select the "normal" mode.  A new
  884. menu will appear.  Use the cursor keys and RETURN to select
  885. the "assign hex value" option.  We want F1 to repeat the
  886. last CP/M command.  This was done by the Cursor Up/Down key,
  887. which had a value of 17.  Type "17" and RETURN.   The value
  888. "17" now appears opposite the "normal" label for F1.
  889.  
  890. Next move to the "shifted" mode for F1, and use the "assign
  891. hex value" option to give it a value of "01".  This
  892. corresponds to the Cursor Left editing mode for making
  893. command line changes.  Since a shifted F1 is "F2", we've
  894. just made F2 the editing key.
  895.  
  896. Next press the Cursor Up/Down key at the bottom of the
  897. keyboard.  Change it's "normal" value to "18" and it's
  898. "shifted" value to "05".  These numbers correspond to the
  899. codes used for CURSOR DOWN and CURSOR UP on the upper
  900. keyboard.  Use the same method to change the "normal" Cursor
  901. Left/Right value to "04" and it's "shifted" value to "13".
  902.  
  903. Now use the cursor keys to select "done editing". You'll be
  904. asked if you want to save the changes as current definitions
  905. or to the CP/M boot disk.  Pick the "boot disk" option, but
  906. BE SURE that your copy of the system disk is in the drive
  907. and NOT the original.
  908.  
  909. After the disk access is done, exit from KEYFIG and boot the
  910. system using CTRL-ENTER.  Type the following line, but don't
  911. press RETURN:
  912.  
  913. A>VDE TEST.TXT
  914.  
  915. Using the INST-DEL key, delete the line back to the prompt.
  916. Now press F1.  If all went well, the command should
  917. re-appear.  Shifted F1 should take you back to the left into
  918. the command for editing.  With the command intact, place a
  919. disk containing VDE.COM in the drive and press RETURN.
  920.  
  921. Once inside VDE, type a few lines.  Move around in the
  922. document using the lower cursor keys, just as you would on a
  923. C64.  They should behave the same as the upper cursor keys.
  924.  
  925. KEYFIG has far too many possibilities to discuss here. These
  926. simple cursor key changes should get you started.  Use the
  927. HELP KEYFIG file to explore the other possibilities.
  928.  
  929. The Commodore CP/M system will even allow you to change key
  930. definitions within other programs.  To see how this works,
  931. boot the system using an unmodified CP/M and enter VDE. Type
  932. a few lines and try to move the cursor up with a shifted
  933. Cursor Up/Down key.  Now press the magic
  934. CTRL/RIGHT-SHIFT/CURSOR LEFT combination.  VDE will pause
  935. and the window will show up on the bottom screen line. Hold
  936. a shift key down and press Cursor Up/Down.  A "17" will
  937. appear in the window.  Now type "05".  The numbers will also
  938. appear in the window.  Press RETURN, and VDE will resume
  939. operation.  Now try the shifted Cursor Up/Down!
  940.  
  941. Early in this series, we recommended that you use the
  942. operating system dated December 6th [or May 87]. This version
  943. is available from many sources including Commodore.  At that
  944. time, most of us had received the August 1st system disk with
  945. our computers.  Here are some of the advantages of the December
  946. 6th version:
  947.  
  948. The user port is supported, allows a modem to be used.
  949. Audible key-click when keys are depressed.
  950. Supports ASCII as well as Commodore printers.
  951. Supports dual disk drives on serial bus.
  952. Auto repeat for keys, user variable rate.
  953. Allows for easy customization using the CONF.COM utility.
  954.  
  955. However, don't discard your August 1st operating system just
  956. yet.  The user port support has its drawbacks in some
  957. applications.  Most CP/M computers expect any
  958. self-respecting RS232 port to have a piece of hardware known
  959. as a UART (Universal Asynchronous Receiver/Transmitter).  A
  960. UART gets serial input from outside and collects it into
  961. parallel information for the computer's use.  It reverses
  962. the process for computer output.  Commodore does not use a
  963. hardware UART.  Instead, this process is performed by the
  964. operating system.
  965.  
  966. That means that the CP/M system must frequently check the
  967. user port to see if a bit of serial data has arrived, and if
  968. so assemble it with other bits to make a parallel data
  969. "byte". How often the user port is checked depends on the
  970. transmission rate, or "baud" rate.  This process goes on,
  971. even if you're not using a modem or other RS232 device. Each
  972. time the system checks the user port, it stops running
  973. programs temporarily.  Although the user port check is fast,
  974. anything done 600 times a second (at 300 baud) takes some
  975. time away from the task at hand.
  976.  
  977. To see just how much time can be lost, try this experiment
  978. with the December 6th system.  Find a medium sized text
  979. file, one of these articles will do.  Type
  980.  
  981. A>TYPE filename[NOPAGE]
  982.  
  983. TYPE.COM must be on your default drive.  The file will print
  984. to the screen without stopping.  Time it with a stopwatch or
  985. sweep second hand.  Now enter
  986.  
  987. A>CONF BAUD=1200
  988.  
  989. and use TYPE again to display the file.  Now use CONF to
  990. change the baud rate to 75 and time the file display again.
  991.  
  992. You'll find that lower baud rates cause the listing to fly
  993. by on the screen.  They also make the keyboard less
  994. responsive, since lower baud rates mean fewer user port
  995. checks and the keyboard is checked at the same time.
  996.  
  997. Now try booting the August 1st system and TYPE the file (the
  998. CONF.COM utility won't work with the 8/1 system).  You
  999. should see a slightly faster listing than the default
  1000. December 6th version, but with no loss of keyboard "feel".
  1001.  
  1002. If you are using a modem, you must use the 12/6 system.  If
  1003. you run a program that does a lot of calculations or other
  1004. internal workings, use the 12/6 system but lower the baud
  1005. rate.  If you can get by with no modem and PetASCII printer
  1006. output, you may find the 8/1 system your best bet.  I use
  1007. the 8/1 system with dBase II, and the 12/6 system with most
  1008. other programs.
  1009.  
  1010. Next time we'll look at the most popular method of
  1011. distributing CP/M public domain files, "libraries".  We'll
  1012. also discuss library utilities and use one to "de-library" a
  1013. marvelous public domain database.
  1014.  
  1015. If you've tried to locate CP/M software, you know that it's hard
  1016. to find.  CP/M is an old operating system, and few new programs
  1017. are being written for it.  There are a great many programs in
  1018. public domain for CP/M.  If you live in an area with a CP/M BBS,
  1019. you can download these programs via modem.  You'll find that most
  1020. of the files have a ".LBR" extension.  These are "library file"
  1021. and cannot be used without "dissolving" the library into its
  1022. component programs.
  1023.  
  1024. Although using "library" files is relatively new to Commodore
  1025. computers, it's been around CP/M a long time.  All CP/M systems
  1026. save files on disk in groups called blocks.  Don't confuse this
  1027. with the Commodore term; we sometimes use "block" instead of
  1028. "sector" when talking about 1541 type disks.  The CP/M blocks may
  1029. be 1K, 2K, or even larger, depending on the disk format in use. 
  1030. All files are saved in increments of one block.  So, if you have
  1031. a double-sided 1571 CP/M disk and store a 2000 character file on
  1032. it, the file will occupy one 2K block.  If you save a file with
  1033. only one character, it will still take up one 2K block on the
  1034. disk!
  1035.  
  1036. Most CP/M files in the public domain are composed of several
  1037. parts: the source code (which we'll explain later), some
  1038. documentation (usually squeezed to save space), and the ".COM"
  1039. files themselves.  Since older CP/M systems didn't have much
  1040. program memory, programs are often split into separate sections
  1041. and loaded from disk individually.  Each of these files will take
  1042. up at least one 2K block on a disk.  This would be very wasteful
  1043. of space on a BBS or a public domain library disk.
  1044.  
  1045. The library system links all the files together into one large
  1046. file.  This makes for compact storage.  It's convenient for
  1047. exchanging programs because all the support files are
  1048. automatically included.  To dissolve a ".LBR" file, you'll need a
  1049. library utility, such as NULU15.COM.
  1050.  
  1051. NULU15 is actually version "1.5" of the New Universal Library
  1052. Utility.  Computer folks often use a number to indicate the major
  1053. revision of a program, and a second number separated from the
  1054. first by a period to indicate minor revisions.  Since the "." is
  1055. an illegal character in CP/M file names, "1.5" has become "15". 
  1056. To use the program, type
  1057.  
  1058. A> NULU15
  1059.  
  1060. NULU will load, then check for any library files on the disk on
  1061. the default drive.  Then the free space on drive A
  1062. is displayed, followed by the prompt
  1063.  
  1064. -Open a library A0:>
  1065.  
  1066. The copyright notice displayed insures that no one can sell
  1067. NULU15.  It is in the public domain as explained in the
  1068. documentation file.
  1069.  
  1070. All of NULU's commands begin with a "-".  To see the menu of
  1071. commands, type "-H".  We won't discuss most of the commands here.
  1072.  
  1073. In order to dissolve a library (NULU uses the term "extract"), we
  1074. first must open it.  Since NULU has its "open a library" prompt
  1075. already displayed, simply type 
  1076.  
  1077. > FREEBASE
  1078.  
  1079. Note that the ".LBR" is unnecessary.  If the library you want to
  1080. extract from is on another disk, type
  1081.  
  1082. > -U d:
  1083.  
  1084. instead, where d: is the drive your file is on.  If you misspell
  1085. the library file name, NULU will ask if you want to create the
  1086. library.  Just press RETURN, and re-enter the name correctly. 
  1087. When NULU opens the library, it shows you how many files it
  1088. contains.  FREEBASE has nine files.  To see what they are, type
  1089.  
  1090. >-L
  1091.  
  1092. The names of the files in FREEBASE will be displayed, along with
  1093. their extensions.  The numbers following each file name need not
  1094. concern us here, but are explained in the NULU15 documentation
  1095. file.  You can now extract any of the files with the "-E"
  1096. command.  For example, to extract the FREEBASE.DOC file, type
  1097.  
  1098. -E FREEBASE.DOC
  1099.  
  1100. In some libraries, the files will be squeezed to save even more
  1101. disk space.  These files will have a "Q" as the middle letter of
  1102. their extensions.  You can unsqueeze and extract these files at
  1103. the same time by using the "-Q" command instead of "-E" above. 
  1104. To extract and unsqueeze all files from a library, type   
  1105.  
  1106. -Q *.*
  1107.  
  1108. If you precede the file name with a drive designator, NULU will
  1109. place the extracted file on a different disk. This will often be
  1110. necessary since the set of extracted files may not fit on the
  1111. same disk as the library.  If you have a formatted empty CP/M
  1112. disk, extract all the FREEBASE files to it by entering
  1113.  
  1114. -E d:*.*
  1115.  
  1116. You don't need the "-Q" command, since none of the FREEBASE files
  1117. is squeezed.  If you have only one disk drive, use "E:" as the
  1118. drive identifier.  You'll be prompted to swap disks by the CP/M
  1119. system.  If you don't have a disk handy, use the "-X" command to
  1120. exit NULU, and use FORMAT.COM to prepare one.  Then extract the
  1121. FREEBASE files.
  1122.  
  1123. FREEBASE is a small free-form database system designed by David
  1124. Brown.  I've removed a few bugs and adapted it for the C128
  1125. terminal commands.  The system allows you to create records of up
  1126. to 127 characters each.  No fields are used within the records,
  1127. what you type is up to you.  Each record is numbered by the
  1128. system.  When you want to search for information, you use the
  1129. SEARCH command at a system prompt, followed by the name of the
  1130. file to be searched, followed by one or more words to search for.
  1131.  
  1132.  
  1133. One of the FREEBASE files is a file called DEMO.FBR.  This file
  1134. contains several sample records to demonstrate FREEBASE.  To see
  1135. how SEARCH works, be sure you're at a system prompt and type
  1136.  
  1137. A> SEARCH DEMO.FBR kemp
  1138.  
  1139. The DEMO.FBR file contains a catalog of several articles from
  1140. INPUT.  The search string asks for all the records that contain
  1141. "Kemp".  So, all the articles by Phil Kemp will be displayed on
  1142. the screen.  It's best to use only lower case letters in your
  1143. search string.  SEARCH will then find any lower or upper case
  1144. matches.  If you want to look for articles by either Kemp or
  1145. McGuire, enter both names, but separate them with a "pipe"
  1146. symbol.  This is produced on the C128 by holding the CTRL key
  1147. while pressing the "up arrow" key (the one next to RESTORE, not a
  1148. cursor up key).
  1149.  
  1150. One of the advantages of FREEBASE is its lack of structure.  You
  1151. can store anything in a record, mixing data of all types together
  1152. in one file.  For example, try
  1153.  
  1154. A> SEARCH DEMO.FBR fred
  1155.  
  1156. You'll find Fred"s name in a file of January birthdays (his is
  1157. the 3rd), and also in his own file with address and other data. 
  1158. If you'd met the fictional Fred at a user group meeting, you
  1159. might have entered this information about him.  Later on, you may
  1160. have forgotten all about Fred's interest in Multiplan.  But now
  1161. you need to import some data from the IMB-PC at work to use in
  1162. Multiplan on your C128.  To see if you have any information in
  1163. your database that might help, type
  1164.  
  1165. A> SEARCH DEMO.FBR multiplan
  1166.  
  1167. You'll find that Phil Kemp wrote an article on this very subject
  1168. in the March '86 issue of INPUT.  But Fred's record also appears
  1169. since he is a Multiplan user. He may be able to help you with the
  1170. project.  This mixing of data types gives you some powerful ways
  1171. in which to locate and use information.  SEARCH can locate any
  1172. record based on a word or words anywhere in the file.  It can
  1173. even search several database files, either by specifying them
  1174. individually after typing "SEARCH", or by using the "*" wild card
  1175. character.  
  1176.  
  1177. A> SEARCH d:*.dat joystick
  1178.  
  1179. will look for the term "joystick" in all files on drive "d:" that
  1180. have a ".DAT" extension.  You can print the records found by
  1181. using the CTRL-P command after you enter the SEARCH command, but
  1182. before pressing RETURN.  You can change the entered records by
  1183. using RANDOM.  The FREEBASE.DOC file explains how to do this.
  1184.  
  1185. NULU15 has several other options which are described in the
  1186. documentation file NULU15.WS.  The ".WS" extension identifies a
  1187. WordStar file.  WordStar is a very popular CP/M word processor. 
  1188. It is a commercial program by MicroPro and is NOT in public
  1189. domain.  WordStar is expensive and not very user friendly.  So
  1190. many special commands are required that the program comes with
  1191. glue on key cap labels to help you remember which keys to push. 
  1192. WordStar also creates files that have imbedded command codes that
  1193. can raise havoc with printers if a TYPE command is used to try to
  1194. print hardcopy from them.
  1195.  
  1196. Fortunately there's an easy way to print WordStar files for those
  1197. who don't own the program.  FILT7.COM, which gives you the options
  1198. of filtering out all the WordStar codes, while retaining it's form
  1199. feed commands.  To get a good hard copy of the NULU15 documentation,
  1200. use PIP to copy NULU15.WS to a fresh disk, then type
  1201.  
  1202. A> FILT7 d:NULU15.WS d:NULU15.DOC
  1203.  
  1204. Answer the prompts "T" for text, "1" to remove the WordStar dot
  1205. commands, and "Y" for tabs.  You can use the TYPE command with
  1206. the [NOPAGE] option and CTRL-P to get a hard-copy of the filtered
  1207. file NULU15.DOC.  Or you can use LISTT get a left hand margin and
  1208. page numbering.  Be sure to respond "Y" to the form feeds prompt
  1209. in LISTT.
  1210.  
  1211. Last time we looked at "library" files.  Libraries are used to
  1212. store several related programs in one large file.  This may be
  1213. done to hold a set of programs together on a BBS or in a user
  1214. group library.
  1215.  
  1216. Libraries are also used to save disk space.  CP/M stores programs
  1217. in large increments called "blocks".  If you store many short
  1218. programs on a disk, you may lose several thousand bytes in the
  1219. process.  Collecting all the small programs into one library file
  1220. can recover most of the unused disk area.
  1221.  
  1222. Using a utility such as NULU15.COM you could extract any program
  1223. you needed from the library.  But this would be an awkward procedure
  1224. for any programs you need often. The program LRUN23.COM, allows you
  1225. to run a program in a library file without extracting it.  The
  1226. demonstration file COMMAND.LBR contains the programs ENTER.COM,
  1227. SEARCH.COM, and RANDOM.COM from the FREEBASE library.  To test
  1228. LRUN23, be sure that the file DEMO.FBR from the FREEBASE library
  1229. is extracted and available on the same disk.  Then type
  1230.  
  1231. A> LRUN23 SEARCH d:DEMO.FBR mcguire
  1232.  
  1233. The first command loads and executes LRUN23.COM.  LRUN23 looks
  1234. for a library file name.  Not finding one, it uses the default
  1235. name COMMAND.LBR.  It looks through the library for SEARCH.COM,
  1236. and executes that program.  SEARCH then looks on drive "d:" for
  1237. the file DEMO.FBR and displays all the records in that database
  1238. which contain the name "McGuire".  Except for the "LRUN23" part,
  1239. this is the same type of command we used last time to execute
  1240. SEARCH after extracting it from the library.  By using LRUN23, we
  1241. can avoid extracting SEARCH.COM.
  1242.  
  1243. To see the other options available, type
  1244.  
  1245. A> LRUN23
  1246.  
  1247. with no other commands.
  1248.  
  1249. One of the benefits of CP/M is the availability of computer
  1250. languages that run under it.  Excellent implementations of Forth,
  1251. Pascal, Fortran, Prolog, C, and many others are in the public
  1252. domain.  These are often more complete versions than those
  1253. available for Commodore mode.  Working with these languages is a
  1254. bit different than programming in BASIC on the C128, however.  In
  1255. most cases, you use an editor of your own choosing to create
  1256. "source code".  Then a program called a "compiler" creates an
  1257. executable program from the text file you wrote.  
  1258.  
  1259. You can use the VDE editor from to examine one of the source 
  1260. code files. Type
  1261.  
  1262. A> VDE d:ENTER.ASM
  1263.  
  1264. This file is the source code for ENTER.COM.  It is written in
  1265. assembly  language for the 8080 microprocessor.  As you browse
  1266. through the file, you'll find comments used extensively.  If
  1267. you're familiar with 6502 machine code, you'll be able to figure
  1268. out much of this program.
  1269.  
  1270. Near the end of the file, you'll find the screen display messages
  1271. and the cursor positioning commands.  These commands would have
  1272. to be changed by others who use the program on different
  1273. computers.  For this reason, CP/M public domain programs are
  1274. often supplied in source code.  Creating an executable program
  1275. from a machine language source code file is called "assembly" and
  1276. the program that does it is called an "assembler".
  1277.  
  1278. We can't give you all the information you might need to make
  1279. changes in source code.  But we will show you the procedure to
  1280. assemble any ".ASM" files you find.
  1281.  
  1282. First, look for files labeled ".OBJ", or ".BIN".  Use the rename
  1283. utility to change this extension to ".COM" and try executing the
  1284. file.  If this works, you don't need to assemble the
  1285. corresponding ".ASM" file.
  1286.  
  1287. To assemble a ".ASM" or ".MAC" file, you'll need MAC.COM.  This
  1288. program, and several others, are available from Commodore.  To
  1289. get them, mail in the card bound in the CP/M section of the
  1290. User's Guide that came with your C128.  MAC.COM is a commercial
  1291. program, not public domain. 
  1292.  
  1293. If the file extension is ".MAC", use rename to change it to
  1294. ".ASM".  The ".MAC" extension is there to tell you that MAC.COM
  1295. is required to assemble this file.  The older ASM.COM cannot be
  1296. used on ".MAC" files.  Now type
  1297.  
  1298. A> MAC d:filename    
  1299.  
  1300. MAC.COM will create a file called "filename.HEX".  This is the
  1301. assembled code in a special format devised by Intel Corp.  Early
  1302. CP/M machines used paper tape for storage.  The tape was limited
  1303. to seven bit ASCII.  Machine code instructions need eight bits. 
  1304. Intel solved this problem by storing each eight bit number as two
  1305. hexadecimal ASCII codes.  The ".HEX" file also contains data on
  1306. file size and location.  We can now forget about the Intel format
  1307. and type
  1308.  
  1309. A> HEX d:filename
  1310.  
  1311. HEX.COM, which is also on the disk you obtain from Commodore,
  1312. looks for "filename.HEX" and converts it to "filename.COM", a
  1313. ready-to-execute file.
  1314.  
  1315. A similar procedure is used to write programs in other languages
  1316. under CP/M.  An editor such as VDE is used to create source code.
  1317.  A program is then run which compiles the source code into 8080
  1318. machine code, or a psuedo-machine code in some cases.
  1319.  
  1320. There is a compiled version of BASIC called EBASIC. Use TYPE
  1321. or VDE to look at the files READ.ME and EBASIC.DOC which
  1322. explain EBASIC in detail, and tell you how to compile source
  1323. code.  A demo program, both source code and compiled versions,
  1324. shows you some of the commands.  If you're familiar with
  1325. Commodore BASIC, you should be able to write programs using
  1326. EBASIC easily.  You will have to compile the source code each
  1327. time you want to "run" the program after making a change.
  1328.  
  1329. In this series we've introduced you to the basic concepts of
  1330. CP/M.  We've given you enough information to get the system
  1331. operating, and a few programs to use.  But we've just scratched
  1332. the surface.  There's much more you can do with CP/M.  For
  1333. further information, check the references listed at the end of
  1334. the first article in this series.
  1335.  
  1336. All of these articles, and all the public domain programs we've
  1337. discussed, are available on a set of four CP/M disks from the
  1338. C128.HSG c/o Gary J. Stagliano 182-J Homestead St. Manchester,
  1339. CT 06040 203-647-8187
  1340.  
  1341.