home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-07-13 | 57.3 KB | 1,341 lines |
- CP/M ON THE C128 (ARTICLE 1)
-
- by Noel Nyman
-
- [Edited by Gary J. Stagliano]
-
- (Copyright 1986 by Geoduck Developmental Systems. Permission
- to reprint this material is hereby granted, provided this
- notice is included in the reprinted material.) [These articles
- originally appeared in a Canadian magizine called INPUT]
-
- In this column we plan to explore CP/M (Control Program for
- Microcomputers) and how to use it on the C128.
-
- To understand the what and why of CP/M, we have to go back
- to the early days of microcomputing. In this primitive time
- there were mainframes, huge and expensive computers.
- Communicating with one required a "console" which had a
- keyboard and an output device. The output was frequently a
- printer, although the cathode ray tube (CRT or tv screen)
- was becoming more common. Refurbished teletype machines were
- often used as consoles.
-
- In the early 1970's a revolution began that would change the
- course of computing...the LSI (Large Scale Integration)
- micro chip. It became possible to produce on a single piece
- of silicon all the logic in CPU's (Central Processing Units)
- requiring several circuit boards on the mainframes. The
- first popular microprocessor chip, the 8080 designed by
- Intel, was used to make intelligent terminals. These were
- consoles that contained a keyboard and CRT monitor, a small
- amount of RAM (Random Access Memory) and some means of
- communicating with a mainframe.
-
- The large hard disks and tape drives used by the main frames
- were too complex for a microcomputer to control (there
- wasn't enough RAM to hold the controller program required).
- So the micros used paper tape. A punch poked rows of up to
- seven holes in the half-inch wide tape, each hole
- representing a bit in a seven bit character or command. A
- paper tape reader translated these holes into binary data to
- store in the micro. Storing a program was noisy and slow.
-
- In 1973 IBM developed the first floppy disks as alternatives
- to the then popular punch cards used on mainframes. Gary
- Kildall at Intel obtained a used drive from a small company
- named Shugart and began working on a controller program to
- interface it with an 8080 based microcomputer. He and John
- Torode developed the controller into a full disk drive
- operating system, which they called CP/M. Intel wasn't much
- interested in the project, and Kildall and Torode began
- marketing the product on their own through Digital Research
- in 1976. The rest, as they say, is history.
-
- CP/M is an operating system. Every computer needs an
- operating system in order to interface with the console, the
- disk drives, and any other peripherals such as modems and
- printers. In the relatively advanced age we live in, home
- computers usually come with their operating systems in ROM
- (Read Only Memory). When you power up your C128, it "knows"
- how to talk to the keyboard, screen, etc. The Commodore
- disk drives have their operating systems in ROM also. You
- don't need to LOAD any program in order to type on the
- keyboard, print characters on the screen, or find a file on
- a floppy disk.
-
- In 1973 computers were much less smart. Partly this was due
- to the high costs of both RAM and ROM. A 32K machine cost in
- excess of $3000 without peripherals (1973 dollars, gasoline
- was still under $0.20 a litre then). ROM was very expensive
- and difficult to program, EPROM's (Erasable Programmable
- Read Only Memory) weren't available.
-
- Each time you turned the power on, you had to teach the
- computer how to be a computer all over again. You did that
- by writing a program called the operating system, and
- SAVEing on disk or paper tape. You used another smaller
- program that often was typed in by hand each time to LOAD
- the larger program. This method of using a program to LOAD
- other programs was called "bootstrapping" since the
- computer was in a sense lifting itself by its own
- bootstraps. The idea of "BOOTing" an operating system
- remains with us, and is a command recognized by Basic 7.0.
-
- CP/M provided a standardized operating environment on many
- different computers. For example, the TRS-80 machines use
- the command LPRINT to send strings to a printer. Commodore
- uses PRINT# followed by a file number. But any printer
- routine written on a machine running under CP/M will run on
- any other CP/M machine (I'm not sure why "running under" is
- used, but that's the proper term).
-
- CP/M comes in four main sections. The first is the LOADing
- routine, which is usually on reserved tracks on CP/M disks.
- On the C128, the LOADer is found in ROM. The two workhorses
- of CP/M are the BDOS (Basic Disk Operating System) and the
- BIOS (Basic Input-Output System). Note that the term
- "Basic" as used here is a synonym for "primary" or
- "essential" and does not refer to the BASIC programming
- language.
-
- The BDOS is identical for all CP/M systems of the same
- version. BDOS works much like the Kernal jump table in
- Commodore machines, providing access to the routines for
- opening disk files, printing strings, and such by simply
- calling them by number. The BIOS is customized for each
- computer model. When the BDOS is asked to open a file, it
- uses several BIOS routines which are customized for the disk
- drives, data buss structure, etc.
-
- The last section is a program call CCP (Console Command
- Processor). The CCP accepts input from the keyboard,
- displays it on the screen, and places it in memory where
- appropriate for execution by other programs. On most
- systems the CCP must be reLOADed after other programs finish
- execution. On the C128, the CCP is always resident.
-
- There have been several versions of CP/M produced since
- 1973. The C128 runs under CP/M 3.0 (sometimes called
- CP/M+). This is the most advanced CP/M available, used
- computers with bank switching capability and over 64K of RAM
- can use it.
-
- If you'd like to read more about CP/M, there are many books
- available. Since it's a relatively old system, your library
- may be a good source of information. Try to get material
- for CP/M+, since some commands for older CP/M versions are
- different. Some good references are:
-
- THE CP/M PLUS HANDBOOK, Alan R. Miller, Sybex
-
- CP/M AND THE PERSONAL COMPUTER, Dwyer & Critchfield,
- Addison-Wesley
-
- If the date on the screen when you BOOT CP/M is older than
- December 4, 1985, you should get a copy of the new operating
- system. This is available from CompuServe, Q-Link,
- or perhaps a user in your area has one.
-
- [Ed. Note-The latest version of CP/M+ for the C128 is the
- May 87 version. This version supports the 790K 1581 3.5"
- drive. It also supports external terminals and true 6551
- UART chip for improved RS232 communications. It also has
- an experimental 4.0 Mz mode that works on some C128.]
-
- ----Some additional references----
-
- DR DOBB'S JOURNAL, especially earlier issues, covers CP/M
- extensively, you local library may have past issues
- available. For an interesting article by Gary Kildall on
- the start of CP/M, see the January 1980 issue.
-
- Old copies of BYTE, KILOBAUD MICROCOMPUTING, and INTERFACE
- AGE also have articles on CP/M. For a series on CP/M+,
- check the February 1983 issue of MICROSYSTEMS.
-
- The C128 HSG: c/o Gary J. Stagliano 182-J Homestead St.
- has an extensive collection of CP/M software for the C128.
-
- The Dwyer & Critchfield book above has excellent reference
- sections on programming under CP/M in Z80 and 8080 machine
- code. For more details on Z80, try:
-
- Z80 ASSEMBLY LANGUAGE PROGRAMMING
- Lance Leventhal
- Osborne/McGraw-Hill
-
- Z80 ASSEMBLY LANGUAGE ROUTINES
- Leventhal and Saville
- Osborne/McGraw-Hill
-
- Before we look at how to work with CP/M, it's important to
- understand what CP/M isn't.
-
- CP/M is NOT a programming language. Commodore operating
- systems rely heavily on the BASIC programming language ROM
- to communicate with the user. CP/M has no high level
- language in it. To program in BASIC, you must LOAD a BASIC
- language into the computer.
-
- CP/M does NOT contain a word processor, data base, or any
- other sophisticated programs. It is only an operating
- system. It gives you the ability to LOAD other programs and
- utilities, to view disk directories and text files, and to
- rename or erase disk files. It combines some of the
- features of the Commodore DOS 5.1 wedge and a sequential
- file reading program. It also gives programs written in
- 8080 or Z80 microprocessor machine code a universal way to
- access the screen, keyboard, disk drives, printer, and
- modem. Most of these programs will run on the C128, even
- though they were written many years ago on different
- machines running under an earlier version of CP/M.
-
- To start or BOOT CP/M on the C128, place the "system" disk
- (the disk that has the CP/M operating system on it) in your
- disk drive and turn on the computer or reset it with the
- reset button next to the power switch. If you are in C128
- mode, you can type the command BOOT instead.
-
- The older CP/M operating systems supplied with the C128 used
- either the forty or eighty column screens. The systems
- dated December 4th and later use only eighty columns. To
- use CP/M effectively, you should be using the newest
- version. This will require an eighty column monitor.
-
- You can use an RGBI monitor, such as the 1902, simply by
- plugging in the 9 pin connecting cable. You can have
- excellent eighty column video at much lower cost by using a
- monochrome monitor. Some are even available with audio
- amplifiers, for under $100. You can also use a 1702 monitor
- for monochrome with lower resolution.
-
- To use a 1702 or monochrome monitor, you'll need a cable
- with an RCA type phono plug on one end and a DB-9 connector
- on the other. You can make one (connect the center of the
- RCA plug to pin 7 and the shield to pin 1 of the DB-9), or
- purchase one ready made. Check with your local dealer, or
- the ads in Commodore oriented magazines.
-
- Once you BOOT CP/M, you'll see the opening message with the
- date and finally
-
- A>
-
- with a flashing cursor behind it. This is the user prompt,
- the CP/M equivalent of Commodore's "READY". CP/M is
- awaiting your command.
-
- The tasks that CP/M can be told to perform in direct mode
- are called "utilities". Six of these utilities are called
- "resident" because they are a permanent part of CP/M as it
- sits in the C128's RAM. All other utilities are
- "transient", they must be LOADed from disk into memory and
- executed, just like a program.
-
- To execute a utility, just type its name at the system
- prompt. For example, type the following:
-
- A> dir
-
- and press RETURN. The disk drive will spin briefly and
- you'll see the names of the files on the disk in drive A.
- CP/M uses letters to identify drives, where Commodore uses
- numbers. The C128 CP/M system supports four disk drives,
- plus a ram drive. The defaults are:
-
- A=8 B=9 C=10 D=11 M=Ram
-
- These can be changed, as we'll see later. If you only have
- one disk drive, the CP/M system will let you use drive E as
- a "virtual" drive. Drive E doesn't exist, but when you
- refer to it, CP/M will use available RAM in place of a
- drive, or prompt you to put the "E" disk in drive A. You'll
- use drive E to hold files when copying, much as the program
- 1541 BACKUP uses the C64 RAM to hold files when copying
- disks on a single drive.
-
- Each file listed on the directory has two parts, the name
- and the extension. For the program CPM+, the extension is
- SYS. The name and extension together are called the
- "filespec". Files on a CP/M disk can have as many as eight
- characters in their file names and up to three character
- extensions. Although the "dir" command shows the file names
- and extensions separated by spaces on your screen, you'll
- enter filespecs by separating the name and extension with a
- "." as in
-
- CPM+.SYS
-
- Since CP/M uses the "." to tell where the name ends and the
- extension begins, don't use a "." as part of the file name.
- In fact, it's best to avoid any characters in file names
- except letters and numbers.
-
- You can use any extension you like when naming or renaming a
- file. Some of the extensions have special meaning to CP/M
- or some utilities. But unlike the Commodore DOS, CP/M will
- let you rename any program, including its extension, at any
- time.
-
- The most important extension for now is ".COM". Files with
- this extension are "command" files. They are Z80 or 8080
- machine language programs. Usually they are self starting.
- To "RUN" a command file, simply type its name at the system
- prompt. Do NOT type the ".COM" extension. There is [in
- public domain] a simple card game called TWENTY1.COM. Try
- the game now by typing:
-
- A> twenty1
-
- The disk drive will spin, the program will be LOADed and RUN
- automatically. To end the game at any time hold the CONTROL
- key and press the "C" key. This is the CP/M equivalent of
- RUN/STOP-RESTORE plus SYS 64738, and is usually abbreviated
- CTRL-C or sometimes shown as an "up-arrow C" in texts that
- can print an up-arrow symbol.
-
- If you have a second disk drive, you can LOAD programs or
- other files from it in one of two ways. First try
-
- A> b:twenty1
-
- If you forgot to move the disk to drive B, you'll get a
- "TWENTY1?" from CP/M, which is asking you if that's really
- what you meant to type. With the disk in drive B, the
- program will LOAD and RUN. Use CTRL-C to exit, and type
-
- A> b:
-
- and you should see
-
- B>
-
- To change the system or "default" drive at any time, simply
- type the new drive number at the system prompt. Don't
- forget the colon, or CP/M will look for a file named "B.COM"
- on drive A.
-
- With the system drive changed to B, you can enter the name
- of any ".COM" file on the disk in that drive without
- including the drive as part of the filespec.
-
-
- Before we discuss more resident utilities, let's look at
- using disk drives with the C128 in CP/M mode. The 1571
- drive which was designed to work with the C128 will read
- regular 1541 type disks and also the MFM type disks used by
- many 5 1/4 inch CP/M disk machines. This has led to some
- confusion about just what a "CP/M" disk is.
-
- Commodore uses a process called GCR (Group Character
- Recognition) to record data on its disks. GCR describes the
- way in which the disk electrical system works. It does not
- have anything to do with the number of tracks or sectors, or
- their placement on the disk. Apple also uses a form of GCR,
- but their track layout is quite different.
-
- When a disk is formatted on a 1541, the DOS (Disk Operating
- System) puts 35 tracks on the disk containing 664 sectors.
- A 1571 uses exactly the same layout on the "front" of the
- disk, then repeats it on the "back", for a total of 70
- tracks and 1328 sectors.
-
- When you format a disk using the CP/M utility "FORMAT.COM",
- the layout of the tracks and sectors is IDENTICAL to that
- used in the standard 1541 or 1571. The CP/M disk has its
- directory area on different tracks and places a BOOT sector
- on each formatted disk, but the layout is the same. You can
- prove this by examining a Commodore CP/M disk in C64 mode
- with a "disk doctor" program.
-
- This means that you can use any combination of 1541's and
- 1571's in a C128 CP/M system. The CP/M disk that came with
- your C128 is a single sided (1541) disk. You can read it
- with either disk drive. You must turn it over to read the
- "back" side. You can also copy a single sided (1541) CP/M
- disk with any "bit" copier or with the backup command on a
- dual drive such as the MSD.
-
- However, CP/M is NOT practical with a single 1541 disk
- drive. It's just too slow. If you want to learn about the
- CP/M system, or experiment with some of the programs, the
- speed will be tolerable. But any serious programming,
- database or word processor work will take too long. You are
- much better off with existing C64 programs for those tasks.
- Using one of the many "fast load" programs or cartridges
- will make a C64 system much faster and easier to use than a
- 1541 CP/M system.
-
- If you have a 1571, you can use a 1541 as the "B" drive with
- better results. The disk operations will still be slow on
- the 1541. But you can do your primary work with the faster
- drive.
-
- If you are contemplating the purchase of a C128 and two
- 1571's JUST to run CP/M, I advise against it. For the same
- money you could purchase a low end or used CP/M computer
- such as a Kaypro which will run CP/M many times faster than
- a C128. However, for the combination of a fantastic Basic,
- excellent sound and graphics, C64 compatibility (mostly) and
- CP/M as frosting on the cake, the C128/1571 system is a
- good bargain.
-
- Last time we used the "DIR" resident utility to look at a
- disk directory. Enter the command again, and look at the
- bottom of the listing. If your boot disk is in your
- drive, you'll see the phrase "System file(s) exist". Now
- enter the command
-
- A> dirsys
-
- You should see only the file "CCP.COM" followed by the
- phrase "Non-system file(s) exist".
-
- The term "system" refers to an "attribute" or characteristic
- given to certain files. It does NOT refer to the extension
- ".SYS". Notice that the file "CPM+.SYS" appears when you
- used the "DIR" command, but is not listed with "DIRSYS".
-
- The system attribute is important for hard disk or
- multi-user systems. We'll look at it more closely when we
- discuss the "USER" command. But system files are also less
- likely to be accidentally erased. To erase a system file,
- you must use a special command. So it makes sense to
- protect your most valuable files in this way. We'll use a
- utility called "SET.COM" to change "CPM+.SYS" to a system
- file.
-
- Place the original CP/M disk you received with your C128 in
- drive A and use "DIR" to be sure you have the side
- containing "SET.COM". Then if you have two disk drives,
- place the a disk with the cpm+.sys in drive B and type:
-
- A> set b:cpm+.sys[system]
-
- Don't leave a space between the ".sys" and the left bracket.
- Be sure to use brackets, shifted ":" and ";". If you have
- only one drive, type:
-
- A> set e:cpm+.sys[system]
-
- In either case, CP/M will LOAD the program "SET.COM" from
- the disk in drive A. For a two drives, CP/M will then
- change the attribute of the file on the disk in drive B.
- For one drive, CP/M will prompt you to place the "E" disk in
- drive A, and then changes the attribute.
-
- Now use "DIR" and "DIRSYS" to check your work. "SET.COM"
- has many other uses we'll look at later.
-
- USER is a utility that was designed for systems with hard
- disk drives or multi-user systems. It allows you to have
- sixteen "user areas" on a single disk. To illustrate this,
- type:
-
- A> user 5
-
- Don't forget the space ahead of the number. CP/M responds
- with
-
- 5A>
-
- The system will now only look at disk files that were SAVEd
- to disk in the user 5 area. When you type the DIR command,
- you'll get a "no files" message because all the files on
- your disk are in user 0. The user number would be handy for
- keeping your files separate from another user's on a hard
- disk you both share. It's not very useful to us, because
- you can't access another user area files from the current
- user area. This means that any utilities are shut off from
- you unless you copy them into the new user area. However,
- when you type a file name, CP/M will look for a ".COM" file
- with that name in the current user area. If it doesn't find
- one, it will look for the file in user 0, and LOAD it if it
- has a "system attribute". As we saw last time, the system
- attribute is not the same as a ".SYS" extension. If you
- want utilities available in other user areas, use SET.COM to
- change them to system attribute files. Change back to user
- 0 now by typing:
-
- 5A> user 0
-
- "ERASE" and "RENAME" are used to erase (scratch) or rename
- files on a disk. The commands can be abbreviated "ERA" and
- "REN". To change the name of the game TWENTY1.COM on a disk,
- type:
-
- A> ren d:TWENTONE.COM=d:TWENTY1.COM
-
- This is similar to the Commodore DOS format where the new
- name comes first. The "d:" represents the drive number
- containing the disk with the file you want renamed. You can
- omit if if the file is on the currently logged drive. Don't
- use more than eight characters for the name and three for
- the extension. If you forget the extension, the file will
- be named "TWENTONE. ". You can change any extensions at
- any time, but some utilities expect certain extensions.
- Avoid ".HEX", ".MAC", ".ASM", ".BAS", ".HLP" and ".COM" for
- general files. However, if you find a file on a public
- domain disk with ".OBJ" (object code file), or ".BIN"
- (binary code file), try changing the extension to ".COM" to
- get the program to run under CP/M+.
-
- The Commodore DOS wild card rules apply to CP/M as well.
- You can use "?" as a single character wild card, or "*" as a
- file name or extension wild card in most commands. For
- example
-
- A> dir *.COM
-
- will show you only the ".COM" files on the disk in drive A.
- Using
-
- A> ren d:*.bak=d:*.txt
-
- changes all ".TXT" (text) files to ".BAK" (backup) on the
- drive specified by "d:". Typing
-
- A> era *.*
-
- will erase ALL the file on drive A...be careful! If you use
- a wild card in ERA or REN, CP/M will prompt you for a
- "YES/NO" before executing the command.
-
- Although DIR, REN, and ERA are resident utilities, they are
- "bare bones" versions. They have all have advanced features
- that require too much memory to keep in RAM. If you try to
- use one of these features, you must have the corresponding
- ".COM" file on disk. For example, place any disk except the
- CP/M system disk in the drive and enter
-
- A> dir [full]
-
-
- You will get the message "DIR COM required". The
- advanced [full] option requires LOADing DIR.COM. Now place
- the CP/M system disk in the drive and re-issue the command.
- An easy way to repeat a command on the C128 is to tap the
- CURSOR DOWN key next to the SHIFT key, not the one at the
- top of the keyboard. The last command entered will be
- retyped on the screen. Press RETURN to execute it, or use
- the cursor and DEL keys to change it.
-
- You should now see a much more complete directory listing.
- The files are listed in alphabetical order, and their sizes
- in bytes and records are shown. The sizes will be in 1K
- increments for single sided disks and 2K for double sided.
- CP/M records are 128 bytes each. The attributes of each
- file are shown, either DIR or SYS and either RW for "read or
- write" or RO for "read only". RO files cannot be changed
- without changing them to RW with the SET.COM utility.
-
- The [full] option also shows total bytes used and free on
- the disk, total files found and directory entries used.
- Long files may take up two directory entries. You can see
- the same display on a disk that doesn't have DIR.COM by
- typing
-
- a> dir [drive=b]
-
- Place the disk containing DIR.COM in drive A and the disk
- you want to view in drive B. If you have only one drive,
- replace the "b" with "e". CP/M will LOAD DIR.COM and prompt
- you for the new disk.
-
- The last resident utility, TYPE, allows you to look at files
- on your screen and print them on a printer. All files on a
- CP/M disk are either ASCII (text) files or binary machine
- code files. You can only use TYPE with ASCII files. You
- can't harm anything if you accidentally use TYPE on a binary
- file, but you'll only see gibberish on the screen, and CP/M
- may crash. If that happens, just re-BOOT the system.
-
- Any file with ".DOC", or ".TXT" extensions can usually be
- viewed with TYPE. If you have a file named readme.tex on
- a disk, enter
-
- A> type readme.txt
-
- CP/M will display part of the file README.TXT on the screen.
- When the screen is full, a prompt will appear to press
- RETURN (almost any key will do), and more of the file will
- be displayed. If you want to exit TYPE, just press CTRL-C.
-
- You can print a text file on your printer by pressing CTRL-P
- before issuing the TYPE command. CTRL-P toggles the printer
- on line, and anything that appears on the screen will be
- printed as well. The CTRL-P command produces a tone when
- the printer is toggled on. Pressing CTRL-P again toggles
- the printer off and no tone is heard.
-
- While CTRL-P gives you hard copy from TYPE, it also has all
- those "Press RETURN..." prompts in it. You can avoid them,
- by using an advanced TYPE option. Enter
-
- A> type readme.txt[nopage]
-
- The file will scroll up your screen without stopping, and
- will print completely. Since [nopage] is a non-resident
- feature of TYPE, TYPE.COM must be on the disk for it to
- work. You can use [nopage] on another disk by typing
-
- A> type d:readme.txt[nopage]
-
- where "d:" is any valid disk drive.
-
- There are many other utility options, too many to discuss
- here. You can find out about them in the DIGITAL RESEARCH
- CP/M PLUS USER'S GUIDE. This is part of the package you get
- by mailing in the card bound in the CP/M section of the C128
- SYSTEM GUIDE that came with your C128. The Digital Research
- documentation is extensive and a great bargain at the
- offered price. However, it was written by computer folks
- for other computer folks. For easier reading, you may also
- want to purchase the CP/M PLUS HANDBOOK by Alan Miller.
-
- You should always keep back-up copies of your system disk
- and important utilities. You can copy files with the
- utility PIP.COM. PIP is explained briefly in the C128
- SYSTEM GUIDE. You can also use DIR+.COM found in public
- domain. You can make full disk copies of any single
- sided CP/M disk using a C64 or C128 bit or nibble copier or
- a dual drive copier program in non-CP/M mode. You cannot
- use any program that uses BAM or directory references to
- copy a disk. [Fast hack-em, and Mavrick do an excellent job.]
-
- Commodore put some excellent features in CP/M on the C128.
- The information on how to use them, as well as many of the
- regular CP/M commands, can be found in a "HELP" file on the
- disk that came with your computer. HELP.COM is a CP/M
- utility that uses special text files with ".HLP" extensions.
- The text file is organized alphabetically by subjects and
- may contain several levels of subtopics on each subject.
-
- Entering "HELP" at a system prompt will give you a list of
- the subjects available. Be sure that both HELP.COM and
- HELP.HLP are on the disk. Various commands are used to
- access the subtopics. There is a lot of valuable
- information specific to the C128 tucked away in the HELP.HLP
- file. The on-screen format is great for browsing through
- the information. But it's not very handy if you need to
- check something while you're running another program. [Note:
- MS-DOS is just now putting help on DOS 5.0 and 6.0]
-
- You could get a print-out of the HELP screens by using the
- CTRL-P option before using HELP. This will bring your
- printer on line and everything displayed on the screen will
- be reproduced on paper as well. All the prompts and your
- replies will be there too. Also, because of the format used
- by HELP, only one screen will be displayed on each page,
- using quite a bit of paper. The format will be eighty
- columns, not the best if you'd like to three-hole punch your
- copy for binding.
-
- To help you have the best access to this file, we've created
- a version formatted for printer output. It comes with page
- numbers, and a table of contents. It has wide margins
- making it easy to put notebook holes on either side. The
- HELP file, and a similar one for the CONFigure utility used
- with the December 6th operating system, are available in the
- public domain.
-
- With the neat spacing and margins, this file is quite long.
- This is a common problem with text files. They often
- contain redundant spaces and extra lines, making for good
- print-out, but inefficient storage. A solution devised
- years ago by CP/M users is to compact or "squeeze" text
- files for storage on disk.
-
- If you look at a CP/M disk directory, you'll likely see
- several files that have "Q" as the middle character in their
- extensions...FILE.TQT, or DISKDOC.AQM, for example. The "Q"
- indicates that this file has been squeezed. It cannot be
- viewed by TYPE, or handled in the usual manner. It must be
- expanded or "unsqueezed" to it's original form first.
-
- USQ.COM will unsqueeze the HELP and CONF files also on that
- disk so you can print hard copy from them. First format a
- new disk using FORMAT.COM. The unsqueezed version of the
- HELP file is 108K long, and will just fit with it's squeezed
- counterpart on a single-sided disk. Using PIP, or DIR+ from
- copy the file HELP.DQT to the disk you just formatted.
- Place the disk with USQ.COM in drive A and type
-
- A>USQ
-
- You will get a short message including the address of the
- author of the program. USQ.COM and two companion programs
- are in the public domain, although source code for them and
- full documentation is available for a small fee.
-
- When you see the "*" prompt, place the disk with HELP.DQT in
- drive A and type
-
- *HELP.DQT
-
- USQ.COM will analyze the file and produce an unsqueezed
- version. This will take some time, you may want to have a
- good book handy.
-
- When USQ.COM has finished, take a look at the disk
- directory. HELP.DQT will still be there, but HELP.DAT has
- been added. To get your hard copy, set up your printer with
- continuous form paper and place a disk with the December 6th
- operating system in drive A. If you have a non-Commodore
- printer and an interface that allows a transparent mode,
- type
-
- A>CONF PRT1=ASCII
-
- This changes CP/M so that it sends true ASCII codes rather
- than PetASCII to your printer. If you have a Commodore
- printer, skip this step (a few of the special characters in
- the file may not be reproduced correctly by your printer).
-
- Now type
-
- A>TYPE E:HELP.DAT[NOPAGE]
-
- But don't press RETURN yet. If you have two disk drives,
- use "B:" in place of "E:". After you've entered the line,
- hold the CONTROL key and press "P". You should hear a bell
- chime, indicating that the printer is now on line. Now
- press RETURN, and the file will be sent to your printer. The
- document is 58 pages long, so have enough paper ready. Don't
- forget to type CTRL-P again when you're through, or your
- screen display will still be echoed on your printer. Follow
- the same procedure to make a copy of CONF.DQT.
-
- After you've collected several CP/M disks, you'll have a
- number of "Q" files, and you may not remember what they all
- contain. Or you may want to examine a new "Q" file before
- bothering to unsqueeze it. QSHOW.COM you see the file on
- your screen without unsqueezing it. To use it, enter
-
- A>QSHOW d:FILENAME
-
- where "d:" is the drive identifier if you have more than
- one, or the virtual drive "E:". After the first part of the
- file is displayed, type "?" to see a list of QSHOW commands.
-
- You may have discovered that, as good as Commodore CP/M is,
- it still isn't quite the way you want it. You probably turn
- off the 40 column screen to make CP/M run faster and
- prevent timing problems in the 1200 baud mode when running
- IMP.COM on. You may prefer faster keyboard response, and use
- CONFigure's FEEL command each time you boot the system.
-
- There are several ways to "customize" the system to your
- preferences. We'll look at the traditional way first.
-
- Use PIP or DIR+ to create a system disk with the following
- files:
-
- CPM+.SYS (the December 6th version)
- CCP.COM
- CONF.COM
- SUBMIT.COM
- DATE.COM
- VDE.COM
-
- Place this disk in drive A and enter the video editor by
- typing
-
- A>VDE PROFILE.SUB
-
- This sets up VDE to create a file named "PROFILE.SUB". Be
- sure the name correct. Once you get the flashing cursor in
- VDE enter the following three lines exactly as shown:
-
- CONF 40COL=OFF, FEEL=0
- DATE SET
- DATE C
-
- Save this file to disk by pressing the ESCape key followed
- by "X". When you get the system prompt, re-boot the
- computer. You can do this by pressing the "reset" switch
- next to the power switch. But a simpler way is to hold
- CONTROL and press the "ENTER" key on the numeric keypad.
-
- You should see the system start up normally. But as soon as
- the prompt appears, the first line of PROFILE.SUB will be
- printed on the screen. CP/M then executes the line just as
- if you had typed it. When the "DATE SET" command is
- executed, you'll be prompted for the date and time. The
- last command causes the date and time to be displayed
- continuously until you press a key.
-
- When CP/M boots, it looks for a file named "PROFILE.SUB". If
- one exists, SUBMIT.COM is loaded and the commands in
- PROFILE.SUB are executed.
-
- Experiment with various other commands in PROFILE.SUB. If
- you have a color monitor, you can change screen and
- character colors. You may prefer to have your printer port
- default to ASCII. Check the CONF.DAT file or type "CONF" by
- itself to see what other things about CP/M you can change.
-
- One of the advantages of having an operating system in RAM
- is that it can be changed. By making these changes to the
- system programs on disk, you can have your customized
- version available as soon as it loads. This is much faster,
- easier, and more permanent than making changes to the C64
- and C128 ROM based operating systems.
-
- Commodore has provided KEYFIG.COM, a very powerful utility
- to make changes in CP/M. You should have good hard-copy of
- the HELP file for KEYFIG. If not, place the disk that came
- with your C128 in drive A, making sure that the side containing
- HELP.COM and HELP.HLP is "up". Remember that you must "flip"
- this disk over to read the other side, even on a 1571 drive.
- Now type
-
- A>HELP KEYFIG
-
- KEYFIG.COM changes the characters represented by the keys on
- your keyboard. Most of the keys have four "definitions"
- because there are four keyboard "modes". The regular mode
- produces lower case characters when you press the alphabet
- keys. The "shifted" mode produces upper-case letters or the
- characters that appear on the top of the key...a shifted-1
- is a "!", for example. "Commodore" mode is entered by
- tapping the Commodore logo key at the bottom left of the
- keyboard. It works like the "CAPS LOCK" key in C128 mode,
- producing upper case letters, un-shifted characters for
- other keys. Typing "1" produces a "1" in Commodore mode.
-
- "Control" mode is produced by holding the CONTROL key and
- pressing another key. CTRL-M produces a carriage return.
- Some CTRL characters are used with CP/M files; CTRL-Z is
- used to end text files. Others have special meaning to the
- C128's CP/M system.
-
- With KEYFIG.COM, you can change any or all of the character
- definitions associated with nearly any key on the keyboard.
- For some keys, such as the function keys (F1 through F8),
- you can print whole strings with a single keystroke.
-
- Let's walk through a sample KEYFIG session. First, be sure
- you are working with a COPY of the operating system. NEVER
- make changes to the original! Use PIP or DIR+ to copy
- CPM+.SYS and CCP.COM to a new disk before you try any KEYFIG
- experiments. The disk you made to test PROFILE.SUB last
- time will do nicely.
-
- If you've owned a C64, you probably aren't used to those
- four cursor keys at the top of the keyboard. Since the
- "normal" cursor keys work in C128 mode, it makes sense that
- they should in CP/M too. But they don't. Programs like
- dBASE II, WordStar and VDE get downright grumpy if you don't
- use the upper cursor keys. Let's fix that.
-
- KEYFIG.COM will walk you through the key changing process,
- but it uses those darn upper cursor keys to do it. In order
- to make the lower keys do what we want, we need to know the
- "key codes" for the upper cursor keys. Fortunately there's
- an easy way to get them.
-
- Press these three keys all at the same time:
-
- CONTROL
- RIGHT-SHIFT (just below the = sign)
- CURSOR LEFT (the one above the CLR-HOME key)
-
- A colored square or "window" will appear on the bottom line
- of your display. Now press the CURSOR UP key, the one just
- above the - key. You should see "05" appear in the
- window. Press RETURN, then press the same three keys again
- and get the value for CURSOR DOWN. These are the
- "hexadecimal" values assigned to each key by the CP/M
- system. Here are the values for the keys we're interested
- in:
-
- Upper Keyboard Lower Keyboard
-
- CURSOR UP - 05 Cursor Up - 17
- CURSOR DOWN - 18 Cursor Down - 17
- CURSOR LEFT - 13 Cursor Left - 01
- CURSOR RIGHT - 04
-
- We're going to change the definitions for the lower "normal"
- cursor keys so they are the same as their upper keyboard
- counterparts. But the default values of these keys are
- useful too. The Cursor Up/Down key will reprint the last
- command we entered, and the Cursor Left will move back over
- that command to let us edit it. We'll keep these functions
- by assigning them to the F1 and F2 keys.
-
- Type KEYFIG at a system prompt, be sure that KEYFIG.COM is
- on the disk in your drive. Answer "N" to the prompt for
- instructions.
-
- You'll be asked for the source for the keycodes. Use the
- upper cursor keys and RETURN to select "default
- definitions". At the next menu, select the "edit a key"
- option. You'll see the names of the four key modes on the
- screen. Press the "A" key. The four values assigned to
- that key by the default definitions will appear. Try other
- keys to see the effect. Some keys, such as F3, have strings
- defined in some modes, but not in others.
-
- First let's change the F1 key. Press F1, then use the
- cursor keys and RETURN to select the "normal" mode. A new
- menu will appear. Use the cursor keys and RETURN to select
- the "assign hex value" option. We want F1 to repeat the
- last CP/M command. This was done by the Cursor Up/Down key,
- which had a value of 17. Type "17" and RETURN. The value
- "17" now appears opposite the "normal" label for F1.
-
- Next move to the "shifted" mode for F1, and use the "assign
- hex value" option to give it a value of "01". This
- corresponds to the Cursor Left editing mode for making
- command line changes. Since a shifted F1 is "F2", we've
- just made F2 the editing key.
-
- Next press the Cursor Up/Down key at the bottom of the
- keyboard. Change it's "normal" value to "18" and it's
- "shifted" value to "05". These numbers correspond to the
- codes used for CURSOR DOWN and CURSOR UP on the upper
- keyboard. Use the same method to change the "normal" Cursor
- Left/Right value to "04" and it's "shifted" value to "13".
-
- Now use the cursor keys to select "done editing". You'll be
- asked if you want to save the changes as current definitions
- or to the CP/M boot disk. Pick the "boot disk" option, but
- BE SURE that your copy of the system disk is in the drive
- and NOT the original.
-
- After the disk access is done, exit from KEYFIG and boot the
- system using CTRL-ENTER. Type the following line, but don't
- press RETURN:
-
- A>VDE TEST.TXT
-
- Using the INST-DEL key, delete the line back to the prompt.
- Now press F1. If all went well, the command should
- re-appear. Shifted F1 should take you back to the left into
- the command for editing. With the command intact, place a
- disk containing VDE.COM in the drive and press RETURN.
-
- Once inside VDE, type a few lines. Move around in the
- document using the lower cursor keys, just as you would on a
- C64. They should behave the same as the upper cursor keys.
-
- KEYFIG has far too many possibilities to discuss here. These
- simple cursor key changes should get you started. Use the
- HELP KEYFIG file to explore the other possibilities.
-
- The Commodore CP/M system will even allow you to change key
- definitions within other programs. To see how this works,
- boot the system using an unmodified CP/M and enter VDE. Type
- a few lines and try to move the cursor up with a shifted
- Cursor Up/Down key. Now press the magic
- CTRL/RIGHT-SHIFT/CURSOR LEFT combination. VDE will pause
- and the window will show up on the bottom screen line. Hold
- a shift key down and press Cursor Up/Down. A "17" will
- appear in the window. Now type "05". The numbers will also
- appear in the window. Press RETURN, and VDE will resume
- operation. Now try the shifted Cursor Up/Down!
-
- Early in this series, we recommended that you use the
- operating system dated December 6th [or May 87]. This version
- is available from many sources including Commodore. At that
- time, most of us had received the August 1st system disk with
- our computers. Here are some of the advantages of the December
- 6th version:
-
- The user port is supported, allows a modem to be used.
- Audible key-click when keys are depressed.
- Supports ASCII as well as Commodore printers.
- Supports dual disk drives on serial bus.
- Auto repeat for keys, user variable rate.
- Allows for easy customization using the CONF.COM utility.
-
- However, don't discard your August 1st operating system just
- yet. The user port support has its drawbacks in some
- applications. Most CP/M computers expect any
- self-respecting RS232 port to have a piece of hardware known
- as a UART (Universal Asynchronous Receiver/Transmitter). A
- UART gets serial input from outside and collects it into
- parallel information for the computer's use. It reverses
- the process for computer output. Commodore does not use a
- hardware UART. Instead, this process is performed by the
- operating system.
-
- That means that the CP/M system must frequently check the
- user port to see if a bit of serial data has arrived, and if
- so assemble it with other bits to make a parallel data
- "byte". How often the user port is checked depends on the
- transmission rate, or "baud" rate. This process goes on,
- even if you're not using a modem or other RS232 device. Each
- time the system checks the user port, it stops running
- programs temporarily. Although the user port check is fast,
- anything done 600 times a second (at 300 baud) takes some
- time away from the task at hand.
-
- To see just how much time can be lost, try this experiment
- with the December 6th system. Find a medium sized text
- file, one of these articles will do. Type
-
- A>TYPE filename[NOPAGE]
-
- TYPE.COM must be on your default drive. The file will print
- to the screen without stopping. Time it with a stopwatch or
- sweep second hand. Now enter
-
- A>CONF BAUD=1200
-
- and use TYPE again to display the file. Now use CONF to
- change the baud rate to 75 and time the file display again.
-
- You'll find that lower baud rates cause the listing to fly
- by on the screen. They also make the keyboard less
- responsive, since lower baud rates mean fewer user port
- checks and the keyboard is checked at the same time.
-
- Now try booting the August 1st system and TYPE the file (the
- CONF.COM utility won't work with the 8/1 system). You
- should see a slightly faster listing than the default
- December 6th version, but with no loss of keyboard "feel".
-
- If you are using a modem, you must use the 12/6 system. If
- you run a program that does a lot of calculations or other
- internal workings, use the 12/6 system but lower the baud
- rate. If you can get by with no modem and PetASCII printer
- output, you may find the 8/1 system your best bet. I use
- the 8/1 system with dBase II, and the 12/6 system with most
- other programs.
-
- Next time we'll look at the most popular method of
- distributing CP/M public domain files, "libraries". We'll
- also discuss library utilities and use one to "de-library" a
- marvelous public domain database.
-
- If you've tried to locate CP/M software, you know that it's hard
- to find. CP/M is an old operating system, and few new programs
- are being written for it. There are a great many programs in
- public domain for CP/M. If you live in an area with a CP/M BBS,
- you can download these programs via modem. You'll find that most
- of the files have a ".LBR" extension. These are "library file"
- and cannot be used without "dissolving" the library into its
- component programs.
-
- Although using "library" files is relatively new to Commodore
- computers, it's been around CP/M a long time. All CP/M systems
- save files on disk in groups called blocks. Don't confuse this
- with the Commodore term; we sometimes use "block" instead of
- "sector" when talking about 1541 type disks. The CP/M blocks may
- be 1K, 2K, or even larger, depending on the disk format in use.
- All files are saved in increments of one block. So, if you have
- a double-sided 1571 CP/M disk and store a 2000 character file on
- it, the file will occupy one 2K block. If you save a file with
- only one character, it will still take up one 2K block on the
- disk!
-
- Most CP/M files in the public domain are composed of several
- parts: the source code (which we'll explain later), some
- documentation (usually squeezed to save space), and the ".COM"
- files themselves. Since older CP/M systems didn't have much
- program memory, programs are often split into separate sections
- and loaded from disk individually. Each of these files will take
- up at least one 2K block on a disk. This would be very wasteful
- of space on a BBS or a public domain library disk.
-
- The library system links all the files together into one large
- file. This makes for compact storage. It's convenient for
- exchanging programs because all the support files are
- automatically included. To dissolve a ".LBR" file, you'll need a
- library utility, such as NULU15.COM.
-
- NULU15 is actually version "1.5" of the New Universal Library
- Utility. Computer folks often use a number to indicate the major
- revision of a program, and a second number separated from the
- first by a period to indicate minor revisions. Since the "." is
- an illegal character in CP/M file names, "1.5" has become "15".
- To use the program, type
-
- A> NULU15
-
- NULU will load, then check for any library files on the disk on
- the default drive. Then the free space on drive A
- is displayed, followed by the prompt
-
- -Open a library A0:>
-
- The copyright notice displayed insures that no one can sell
- NULU15. It is in the public domain as explained in the
- documentation file.
-
- All of NULU's commands begin with a "-". To see the menu of
- commands, type "-H". We won't discuss most of the commands here.
-
- In order to dissolve a library (NULU uses the term "extract"), we
- first must open it. Since NULU has its "open a library" prompt
- already displayed, simply type
-
- > FREEBASE
-
- Note that the ".LBR" is unnecessary. If the library you want to
- extract from is on another disk, type
-
- > -U d:
-
- instead, where d: is the drive your file is on. If you misspell
- the library file name, NULU will ask if you want to create the
- library. Just press RETURN, and re-enter the name correctly.
- When NULU opens the library, it shows you how many files it
- contains. FREEBASE has nine files. To see what they are, type
-
- >-L
-
- The names of the files in FREEBASE will be displayed, along with
- their extensions. The numbers following each file name need not
- concern us here, but are explained in the NULU15 documentation
- file. You can now extract any of the files with the "-E"
- command. For example, to extract the FREEBASE.DOC file, type
-
- -E FREEBASE.DOC
-
- In some libraries, the files will be squeezed to save even more
- disk space. These files will have a "Q" as the middle letter of
- their extensions. You can unsqueeze and extract these files at
- the same time by using the "-Q" command instead of "-E" above.
- To extract and unsqueeze all files from a library, type
-
- -Q *.*
-
- If you precede the file name with a drive designator, NULU will
- place the extracted file on a different disk. This will often be
- necessary since the set of extracted files may not fit on the
- same disk as the library. If you have a formatted empty CP/M
- disk, extract all the FREEBASE files to it by entering
-
- -E d:*.*
-
- You don't need the "-Q" command, since none of the FREEBASE files
- is squeezed. If you have only one disk drive, use "E:" as the
- drive identifier. You'll be prompted to swap disks by the CP/M
- system. If you don't have a disk handy, use the "-X" command to
- exit NULU, and use FORMAT.COM to prepare one. Then extract the
- FREEBASE files.
-
- FREEBASE is a small free-form database system designed by David
- Brown. I've removed a few bugs and adapted it for the C128
- terminal commands. The system allows you to create records of up
- to 127 characters each. No fields are used within the records,
- what you type is up to you. Each record is numbered by the
- system. When you want to search for information, you use the
- SEARCH command at a system prompt, followed by the name of the
- file to be searched, followed by one or more words to search for.
-
-
- One of the FREEBASE files is a file called DEMO.FBR. This file
- contains several sample records to demonstrate FREEBASE. To see
- how SEARCH works, be sure you're at a system prompt and type
-
- A> SEARCH DEMO.FBR kemp
-
- The DEMO.FBR file contains a catalog of several articles from
- INPUT. The search string asks for all the records that contain
- "Kemp". So, all the articles by Phil Kemp will be displayed on
- the screen. It's best to use only lower case letters in your
- search string. SEARCH will then find any lower or upper case
- matches. If you want to look for articles by either Kemp or
- McGuire, enter both names, but separate them with a "pipe"
- symbol. This is produced on the C128 by holding the CTRL key
- while pressing the "up arrow" key (the one next to RESTORE, not a
- cursor up key).
-
- One of the advantages of FREEBASE is its lack of structure. You
- can store anything in a record, mixing data of all types together
- in one file. For example, try
-
- A> SEARCH DEMO.FBR fred
-
- You'll find Fred"s name in a file of January birthdays (his is
- the 3rd), and also in his own file with address and other data.
- If you'd met the fictional Fred at a user group meeting, you
- might have entered this information about him. Later on, you may
- have forgotten all about Fred's interest in Multiplan. But now
- you need to import some data from the IMB-PC at work to use in
- Multiplan on your C128. To see if you have any information in
- your database that might help, type
-
- A> SEARCH DEMO.FBR multiplan
-
- You'll find that Phil Kemp wrote an article on this very subject
- in the March '86 issue of INPUT. But Fred's record also appears
- since he is a Multiplan user. He may be able to help you with the
- project. This mixing of data types gives you some powerful ways
- in which to locate and use information. SEARCH can locate any
- record based on a word or words anywhere in the file. It can
- even search several database files, either by specifying them
- individually after typing "SEARCH", or by using the "*" wild card
- character.
-
- A> SEARCH d:*.dat joystick
-
- will look for the term "joystick" in all files on drive "d:" that
- have a ".DAT" extension. You can print the records found by
- using the CTRL-P command after you enter the SEARCH command, but
- before pressing RETURN. You can change the entered records by
- using RANDOM. The FREEBASE.DOC file explains how to do this.
-
- NULU15 has several other options which are described in the
- documentation file NULU15.WS. The ".WS" extension identifies a
- WordStar file. WordStar is a very popular CP/M word processor.
- It is a commercial program by MicroPro and is NOT in public
- domain. WordStar is expensive and not very user friendly. So
- many special commands are required that the program comes with
- glue on key cap labels to help you remember which keys to push.
- WordStar also creates files that have imbedded command codes that
- can raise havoc with printers if a TYPE command is used to try to
- print hardcopy from them.
-
- Fortunately there's an easy way to print WordStar files for those
- who don't own the program. FILT7.COM, which gives you the options
- of filtering out all the WordStar codes, while retaining it's form
- feed commands. To get a good hard copy of the NULU15 documentation,
- use PIP to copy NULU15.WS to a fresh disk, then type
-
- A> FILT7 d:NULU15.WS d:NULU15.DOC
-
- Answer the prompts "T" for text, "1" to remove the WordStar dot
- commands, and "Y" for tabs. You can use the TYPE command with
- the [NOPAGE] option and CTRL-P to get a hard-copy of the filtered
- file NULU15.DOC. Or you can use LISTT get a left hand margin and
- page numbering. Be sure to respond "Y" to the form feeds prompt
- in LISTT.
-
- Last time we looked at "library" files. Libraries are used to
- store several related programs in one large file. This may be
- done to hold a set of programs together on a BBS or in a user
- group library.
-
- Libraries are also used to save disk space. CP/M stores programs
- in large increments called "blocks". If you store many short
- programs on a disk, you may lose several thousand bytes in the
- process. Collecting all the small programs into one library file
- can recover most of the unused disk area.
-
- Using a utility such as NULU15.COM you could extract any program
- you needed from the library. But this would be an awkward procedure
- for any programs you need often. The program LRUN23.COM, allows you
- to run a program in a library file without extracting it. The
- demonstration file COMMAND.LBR contains the programs ENTER.COM,
- SEARCH.COM, and RANDOM.COM from the FREEBASE library. To test
- LRUN23, be sure that the file DEMO.FBR from the FREEBASE library
- is extracted and available on the same disk. Then type
-
- A> LRUN23 SEARCH d:DEMO.FBR mcguire
-
- The first command loads and executes LRUN23.COM. LRUN23 looks
- for a library file name. Not finding one, it uses the default
- name COMMAND.LBR. It looks through the library for SEARCH.COM,
- and executes that program. SEARCH then looks on drive "d:" for
- the file DEMO.FBR and displays all the records in that database
- which contain the name "McGuire". Except for the "LRUN23" part,
- this is the same type of command we used last time to execute
- SEARCH after extracting it from the library. By using LRUN23, we
- can avoid extracting SEARCH.COM.
-
- To see the other options available, type
-
- A> LRUN23
-
- with no other commands.
-
- One of the benefits of CP/M is the availability of computer
- languages that run under it. Excellent implementations of Forth,
- Pascal, Fortran, Prolog, C, and many others are in the public
- domain. These are often more complete versions than those
- available for Commodore mode. Working with these languages is a
- bit different than programming in BASIC on the C128, however. In
- most cases, you use an editor of your own choosing to create
- "source code". Then a program called a "compiler" creates an
- executable program from the text file you wrote.
-
- You can use the VDE editor from to examine one of the source
- code files. Type
-
- A> VDE d:ENTER.ASM
-
- This file is the source code for ENTER.COM. It is written in
- assembly language for the 8080 microprocessor. As you browse
- through the file, you'll find comments used extensively. If
- you're familiar with 6502 machine code, you'll be able to figure
- out much of this program.
-
- Near the end of the file, you'll find the screen display messages
- and the cursor positioning commands. These commands would have
- to be changed by others who use the program on different
- computers. For this reason, CP/M public domain programs are
- often supplied in source code. Creating an executable program
- from a machine language source code file is called "assembly" and
- the program that does it is called an "assembler".
-
- We can't give you all the information you might need to make
- changes in source code. But we will show you the procedure to
- assemble any ".ASM" files you find.
-
- First, look for files labeled ".OBJ", or ".BIN". Use the rename
- utility to change this extension to ".COM" and try executing the
- file. If this works, you don't need to assemble the
- corresponding ".ASM" file.
-
- To assemble a ".ASM" or ".MAC" file, you'll need MAC.COM. This
- program, and several others, are available from Commodore. To
- get them, mail in the card bound in the CP/M section of the
- User's Guide that came with your C128. MAC.COM is a commercial
- program, not public domain.
-
- If the file extension is ".MAC", use rename to change it to
- ".ASM". The ".MAC" extension is there to tell you that MAC.COM
- is required to assemble this file. The older ASM.COM cannot be
- used on ".MAC" files. Now type
-
- A> MAC d:filename
-
- MAC.COM will create a file called "filename.HEX". This is the
- assembled code in a special format devised by Intel Corp. Early
- CP/M machines used paper tape for storage. The tape was limited
- to seven bit ASCII. Machine code instructions need eight bits.
- Intel solved this problem by storing each eight bit number as two
- hexadecimal ASCII codes. The ".HEX" file also contains data on
- file size and location. We can now forget about the Intel format
- and type
-
- A> HEX d:filename
-
- HEX.COM, which is also on the disk you obtain from Commodore,
- looks for "filename.HEX" and converts it to "filename.COM", a
- ready-to-execute file.
-
- A similar procedure is used to write programs in other languages
- under CP/M. An editor such as VDE is used to create source code.
- A program is then run which compiles the source code into 8080
- machine code, or a psuedo-machine code in some cases.
-
- There is a compiled version of BASIC called EBASIC. Use TYPE
- or VDE to look at the files READ.ME and EBASIC.DOC which
- explain EBASIC in detail, and tell you how to compile source
- code. A demo program, both source code and compiled versions,
- shows you some of the commands. If you're familiar with
- Commodore BASIC, you should be able to write programs using
- EBASIC easily. You will have to compile the source code each
- time you want to "run" the program after making a change.
-
- In this series we've introduced you to the basic concepts of
- CP/M. We've given you enough information to get the system
- operating, and a few programs to use. But we've just scratched
- the surface. There's much more you can do with CP/M. For
- further information, check the references listed at the end of
- the first article in this series.
-
- All of these articles, and all the public domain programs we've
- discussed, are available on a set of four CP/M disks from the
- C128.HSG c/o Gary J. Stagliano 182-J Homestead St. Manchester,
- CT 06040 203-647-8187
-