.op
.cs 5
.mt 5
.mb 6
.pl 66
.ll 65
.po 10
.hm 2
.fm 2
.he CP/M Operating System Manual              1.6  Transient Commands
.ft                                1-%
.pc 1
.sp 2
.tc         1.6.5  ED Command
.sh
1.6.5  ED Command
.qs
.sp
.ul
Syntax:
.qu
.sp 0
.sp
.ti 8
ED ufn
.pp 5
The ED program is the CP/M system context editor that allows creation and
alteration of ASCII files in the CP/M environment.  Complete details of
operation are given in Section 2.  ED allows the operator to create and
operate upon source files that are organized as a sequence of ASCII
characters, separated by end-of-line characters (a carriage 
return/line-feed
sequence).  There is no practical restriction on line length (no single
line can exceed the size of the working memory) that is defined by the
number of characters typed between carriage returns.
.pp
The ED program has
a number of commands for character string searching, replacement, and
insertion that are useful for creating and correcting programs or text
files under CP/M.  Although the CP/M has a limited memory work 
space area (approximately 5000 characters in a 20K CP/M system), the file
size that
can be edited is not limited, since data are easily paged through this
work area.
.pp
If it does not exist, ED creates the specified source file and opens the
file for access.  If the source file does exist, the
programmer appends data for editing (see the A command).  The appended data
can then be
displayed, altered, and written from the work area back to the 
disk (see the W command).  Particular points in the program can be
automatically paged and
located by context, allowing easy access to particular
portions of a large file (see the N command).
.pp
If you type the following command line:
.sp
.ti 8
ED X.ASM
.sp
the ED program creates an intermediate work file with the name
.sp
.ti 8
X.$$$
.sp
to hold the edited data during the ED run.  Upon completion of ED, the
X.ASM file (original file) is renamed to X.BAK, and the edited work file is
renamed to X.ASM.  Thus, the X.BAK file contains the original unedited
file, and the X.ASM file contains the newly edited file.  The operator can
always return to the previous version of a file by removing the most recent
version and renaming the previous version.  If the current X.ASM file has
been improperly edited, the following sequence of commands reclaim the
back-up file.
.sp 2
.nf
.in 8
DIR X.*               Checks to see that BAK file is
                      available.

ERA X.ASM             Erases most recent version.

REN X.ASM=X.BAK       Renames the BAK file to ASM.
.fi
.in 0
.sp 2
You can abort the edit at any point (reboot, power failure, CTRL-C,
or CTRL-Q command) without destroying the original file.  In this case, the
BAK file is not created and the original file is always intact.
.pp
The ED program allows the user to edit the source on one disk and create the
back-up file on another disk.  This form of the ED command is
.sp
.ti 8
ED ufn d:
.sp
where ufn is the name of the file to edit on the currently logged disk and d
is the name of an alternate drive.  The ED program reads and processes the
source file and writes the new file to drive d using the name ufn.  After
processing, the original file becomes the back-up file.  If the operator is
addressing disk A, the following command is valid.
.sp
.ti 8
ED X.ASM b:
.sp
This edits the file X.ASM on drive A, creating the new file X.$$$ on
drive B.  After a successful edit, A:X.ASM is renamed to A:X.BAK, and
B:X.$$$ is renamed to B:X.ASM.  For convenience, the currently logged disk
becomes drive B at the end of the edit.  Note that if a file
named B:X.ASM exists before the editing begins, the following 
message appears on the screen:
.bp
.sp
.ti 8
FILE EXISTS
.sp
This message is a precaution against accidentally destroying
a source file.  You should first erase the existing file and then restart
the edit operation.
.pp
Similar to other transient commands, editing can take place on a drive
different from the currently logged disk by preceding the source filename
by a drive name.  The following are examples of valid edit 
requests:
.sp 2
.in 25
.ti -17
ED A:X.ASM       Edits the file X.ASM on drive A, with new file and back-up
on drive A.
.sp
.ti -17
ED B:X.ASM A:    Edits the file X.ASM on drive B to the temporary file X.$$$
on drive A.  After editing, this command changes X.ASM on drive B to X.BAK
and changes X.$$$ on drive A to X.ASM.
.in 0
.ll 65
.sp 2
.tc         1.6.6  SYSGEN Command
.sh
1.6.6  SYSGEN Command
.qs
.sp
Syntax:
.sp
.ti 8
SYSGEN
.pp
The SYSGEN transient command allows generation of an initialized disk
containing the CP/M operating system.  The SYSGEN program prompts the
console for commands by interacting as shown.
.sp 2
.in 24
.ti 8
SYSGEN <cr>
.sp
Initiates the SYSGEN program.
.sp 2
.ti 8
SYSGEN VERSION x.x
.sp
SYSGEN sign-on message.
.sp 2
.in 8
.nf
SOURCE DRIVE NAME
(OR RETURN TO SKIP)
.in 24
.sp
.fi
Respond  with  the  drive name (one of the letters A, B, C, or D) of the
disk containing a CP/M system, usually A.  If a copy of CP/M already exists
in memory due to a MOVCPM command, press only a carriage return.  Typing a
drive name d causes the response:
.sp 2
.ti 8
SOURCE ON d THEN TYPE RETURN
.sp
Place a disk containing the CP/M operating
system on drive d (d is one of A, B, C, or D).  Answer by pressing a carriage
return when ready.
.sp 2
.ti 8
FUNCTION COMPLETE
.sp
System is copied to memory.  SYSGEN then prompts with the following:
.sp 2
.nf
.in 8
DESTINATION DRIVE NAME
(OR RETURN TO REBOOT)
.fi
.sp
.in 24
If a  disk is  being initialized, place the new disk into a drive
and answer with the drive name.  Otherwise, press a carriage return
and the system reboots from drive A.  Typing drive name d causes
SYSGEN to prompt with the following message:
.sp 2
.nf
.in 8
DESTINATION ON d
THEN TYPE RETURN
.fi
.in 24
.sp
Place new  disk into drive d; press return when ready.
.sp 2
.ti 8
FUNCTION COMPLETE
.sp
New disk is initialized in drive d.
.in 0
.sp 2
The DESTINATION prompt is repeated until a single carriage return is
pressed at the console, so that more than one disk can be initialized.
.pp
Upon completion of a successful system generation, the new disk contains
the operating system, and only the built-in commands are available.  An
IBM-compatible disk appears to CP/M as a disk with an
empty directory; therefore, the operator must copy the appropriate COM files
from an existing CP/M disk to the newly constructed disk using the
PIP transient.
.pp
You can copy all files from an existing disk by typing the following
PIP command:
.sp
.ti 8
PIP B: = A:*.*[v]
.bp
This command copies all files from disk drive A to disk drive B and verifies
that
each file has been copied correctly.  The name of each file is displayed at
the console as the copy operation proceeds.
.pp
Note that a SYSGEN does not destroy the files that already
exist on a disk; it only constructs a new operating system.  If a
disk is being used only on drives B through P and will never be the
source of a bootstrap operation on drive A, the SYSGEN need not take place.
.sp 2
.tc         1.6.7  SUBMIT Command
.sh
1.6.7  SUBMIT Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
SUBMIT ufn parm#1 ... parm#n
.pp
The SUBMIT command allows CP/M commands to be batched for automatic
processing.  The ufn given in the SUBMIT command must be the filename of a
file that exists on the currently logged disk, with an assumed file type of
SUB.  The SUB file contains CP/M prototype commands with possible parameter
substitution.  The actual parameters parm#1 ... parm#n are substituted into
the prototype commands, and, if no errors occur, the file of substituted
commands are processed sequentially by CP/M.
.pp
The prototype command file is created using the ED program, with
interspersed $ parameters of the form:
.sp
.ti 8
$1 $2 $3 ...$n
.sp
corresponding to the number of actual parameters that will be included when
the file is submitted for execution.  When the SUBMIT transient is executed,
the actual parameters parm#1 ... parm#n are paired with the formal parameters
$1 ... $n in the prototype commands.  If the numbers of formal and actual
parameters do not correspond, the SUBMIT function is aborted with an error
message at the console.  The SUBMIT function creates a file of substituted
commands with the name
.mt 5
.hm 2
.sp
.ti 8
$$$.SUB
.sp
on the logged disk.  When the system reboots, at the termination of the
SUBMIT, this command file is read by the CCP as a source of input rather
than the console.  If the SUBMIT function is performed on any disk other
than drive A, the commands are not processed until the disk is inserted into
drive A and the system reboots.  You can abort command processing at
any time by pressing the rubout key when the command is read and echoed.  In
this case, the $$$.SUB file is removed and the subsequent commands come
from the console.  Command processing is also aborted if the CCP detects an
error in any of the commands.  Programs that execute under CP/M can abort
processing of command files when error conditions occur by erasing any
existing $$$.SUB file.
.pp
To introduce dollar signs into a SUBMIT file, you can type a $$
which reduces to a single $ within the command file.  A caret,
^, precedes an alphabetic character s, which produces a single CTRL-X
character within the file.
.pp
The last command in a SUB file can initiate another SUB file, allowing
chained batch commands:
.pp
Suppose the file ASMBL.SUB exists on disk and contains the prototype commands
.sp
.in 8
.nf
ASM $1
DIR $1.*
ERA *.BAK
PIP $2:=$1.PRN
ERA $1.PRN
.fi
.in 0
.sp
then, you issue the following command:
.sp
.ti 8
SUBMIT ASMBL X PRN
.sp
The SUBMIT program reads the ASMBL.SUB file,
substituting X: for all occurrences of $1 and PRN for all occurrences of
$2.  This results in a $$$.SUB file containing the commands:
.sp
.in 8
.nf
ASM X
DIR X.*
ERA *.BAK
PIP PRN:=X.PRN
ERA X.PRN
.fi
.in 0
.sp
which are executed in sequence by the CCP.
.pp
The SUBMIT function can access a SUB file on an alternate drive by preceding
the filename by a drive name.  Submitted files are only acted upon when
they appear on drive A.  Thus, it is possible to create a submitted file
on drive B that is executed at a later time when inserted in drive A.
.pp
An additional utility program called XSUB extends the power of the SUBMIT
facility to include line input to programs as well as the CCP.  The XSUB
command is included as the first line of the SUBMIT
file.  When it is executed, XSUB self-relocates directly below the CCP.  All
subsequent SUBMIT command lines are processed by XSUB so that programs that
read buffered console input, BDOS Function 10, receive their input directly
from the SUBMIT file.  For example, the file SAVER.SUB can contain the
following SUBMIT lines:
.sp
.in 8
.nf
XSUB
DDT
|$1.COM
R
GO
SAVE 1 $2.COM
.fi
.in 0
.sp
a subsequent SUBMIT command, such as
.sp
.ti 8
A>\c
.sh
SUBMIT SAVER PIP Y
.qs
.sp
substitutes X for $1 and Y for $2 in the command stream.  The XSUB
program loads, followed by DDT, which is sent to the command lines PIP.COM,
R, and G0, thus returning to the CCP.  The final command SAVE 1 Y.COM is
processed by the CCP.
.pp
The XSUB program remains in memory and prints the message
.sp
.ti 8
(xsub active)
.sp
on each warm start operation to indicate its presence.  Subsequent SUBMIT
command streams do not require the XSUB, unless an intervening cold start
occurs.  Note that XSUB must be loaded after the optional
CP/M DESPOOL utility, if both are to run simultaneously.
.sp 2
.tc         1.6.8  DUMP Command
.sh
1.6.8  DUMP Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
DUMP ufn
.pp
The DUMP program types the contents of the disk file (ufn) at the console in
hexadecimal form.  The file contents are listed sixteen bytes at a time,
with the absolute byte address listed to the left of each line in
hexadecimal.  Long typeouts can be aborted by pressing the rubout key during
printout.  The source listing of the DUMP program is given in Section 5 as
an example of a program written for the CP/M environment.
.sp 2
.tc         1.6.9  MOVCPM Command
.sh
1.6.9  MOVCPM Command
.sp
.ul
Syntax:
.qu
.sp
.ti 8
MOVCPM
.pp
The MOVCPM program allows you to reconfigure the CP/M system for any
particular memory size.  Two optional parameters can be used to indicate the
desired size of the new system and the disposition of the new system at
program termination.  If the first parameter is omitted or an * is given,
the MOVCPM program reconfigures the system to its maximum size, based
upon the kilobytes of contiguous RAM in the host system (starting at 0000H).
If the second parameter is omitted, the system is executed, but not
permanently recorded; if * is given, the system is left in memory, ready
for a SYSGEN operation.  The MOVCPM program relocates a memory image of CP/M
and places this image in memory in preparation for a system generation
operation.  The following is a list of MOVCPM command forms:
.sp 2
.in 23
.ti -15
MOVCPM         Relocates and executes CP/M for management of the current
memory
configuration (memory is examined for contiguous RAM, starting at 100H).
On completion of the relocation, the new system is executed but not
permanently recorded on the disk.  The system that is constructed
contains a BIOS for the Intel microcomputer development system 800.
.sp
.ti -15
MOVCPM  n      Creates a relocated CP/M system for management of an n kilobyte
system (n must be in the range of 20 to 64), and executes the system as
described.
.sp
.ti -15
MOVCPM  * *    Constructs a relocated memory image for the current memory
configuration, but leaves the memory image in memory in preparation for a
SYSGEN operation.
.sp
.ti -15
MOVCPM  n *    Constructs a relocated memory image for an n kilobyte memory
system, and leaves the memory image in preparation for a SYSGEN operation.
.in 0
.sp
.pp
For example, the command,
.sp
.ti 8
MOVCPM  * *
.sp
constructs a new version of the CP/M system and leaves it in
memory, ready for a SYSGEN operation.  The message
.sp
.in 8
.nf
READY FOR 'SYSGEN' OR
'SAVE 34 CPMxx.COM'
.fi
.in 0
.sp
appears at the console upon completion, where xx is the current memory
size in kilobytes.  You can then type the following sequence:
.sp 2
.in 35
.ti -27
SYSGEN                     This starts the system generation.
.sp
.nf
.ti -27
SOURCE DRIVE NAME          Respond with a carriage return
.sp 0
.fi
.ti -27
(OR RETURN TO SKIP)        to skip the CP/M read operation, because the
system is already in memory as a result of the previous MOVCPM operation.
.sp
.nf
.ti -27
DESTINATION DRIVE NAME     Respond  with B  to  write new
.sp 0
.fi
.ti -27
(OR RETURN TO REBOOT)      system to the disk in drive B.  SYSGEN 
prompts with the following message:
.sp
.mb 5
.fm 1
.nf
.ti -27
DESTINATION ON B,          Place the  new disk on drive B
.sp 0
.fi
.ti -27
THEN TYPE RETURN           and press the RETURN key when ready.
.in 0
.bp
.mb 6
.fm 2
.pp
If you respond with A rather than B above, the system is
written to drive A rather than B.  SYSGEN continues to print this 
prompt:
.sp
.ti 8
DESTINATION DRIVE NAME (OR RETURN TO REBOOT)
.sp
until you respond with a single carriage return, which stops the
SYSGEN program with a system reboot.
.pp
You can then go through the reboot process with the old or new
disk.  Instead of performing the SYSGEN operation, you can
type a command of the form:
.sp
.ti 8
SAVE 34 CPMxx.COM
.sp
at the completion of the MOVCPM function, where xx is the value indicated
in the SYSGEN message.  The CP/M memory image on the currently logged disk is
in a form that can be patched.  This is necessary when operating in a
nonstandard environment where the BIOS must be altered for a particular
peripheral device configuration, as described in Section 6.
.pp
The following are valid MOVCPM commands:
.sp 2
.in 23
.ti -15
MOVCPM  48     Constructs a 48K version of CP/M and starts execution.
.sp
.mb 5
.fm 1
.ti -15
MOVCPM  48 *   Constructs a 48K version of CP/M in preparation for permanent
recording; the response is
.sp
.nf
READY FOR 'SYSGEN' OR
 'SAVE 34 CPM48.COM'
.fi
.sp
.ti -15
MOVCPM * *     Constructs a maximum memory version of CP/M and 
starts execution.
.in 0
.pp
The newly created system is serialized with the number attached to the
original disk and is subject to the conditions of the Digital Research
Software Licensing Agreement.
.sp 2
.he CP/M Operating System Manual             1.7  BDOS Error Messages
.tc    1.7  BDOS Error Messages
.sh
1.7  BDOS Error Messages
.qs
.mb 6
.fm 2
.pp
There are three error situations that the Basic Disk Operating System
intercepts during file processing.  When one of these conditions is detected,
the BDOS prints the message:
.sp
.ti 8
BDOS ERR ON d: error
.bp
where d is the drive name and error is one of the three error messages:
.sp
.in 8
.nf
BAD SECTOR
SELECT
READ ONLY
.fi
.in 0
.pp
The BAD SECTOR message indicates that the disk controller electronics has
detected an error condition in reading or writing the disk.  This
condition is generally caused by a malfunctioning disk controller or an
extremely worn disk.  If you find that CP/M reports this
error more than once a month, the state of the controller electronics and the
condition of the media should be checked.
.pp
You can also encounter this condition in reading files generated 
by a controller produced by a different manufacturer.  Even 
though controllers claim to be IBM..-compatible, one
often finds small differences in recording formats.  The Model 800 controller,
for example, requires two bytes of one's following the data CRC byte, which
is not required in the IBM format.  As a result, disks generated by the
Intel microcomputer development system can be read by almost all 
other IBM-compatible system, while disk files generated on other 
manufacturers' equipment produce the BAD SECTOR message when read 
by the microcomputer development system.  To recover from this 
condition, press a CTRL-C to reboot (the safest course), or a 
return, which ignores the bad sector in the file operation.
.sp
.sh
Note:  \c
.qs
pressing a return might destroy disk integrity if the
operation is a directory write.  Be sure you have adequate
back-ups in this case.
.pp
The SELECT error occurs when there is an attempt to address a drive beyond
the range supported by the BIOS.  In this case, the value of d in the error
message gives the selected drive.  The system reboots following any input
from the console.
.pp
The READ ONLY message occurs when there is an attempt to write to a
disk or file that has been designated as Read-Only in a STAT command or
has been set to Read-Only by the BDOS.  Reboot CP/M by
using the warm start procedure, CTRL-C, or by performing a cold start
whenever the disks are changed.  If a changed disk is to be read but
not written, BDOS allows the disk to be changed without the warm or
cold start, but internally marks the drive as Read-Only.  The status of the
drive is subsequently changed to Read-Write if a warm or cold start occurs.
On issuing this message, CP/M waits for input from the console.  An automatic
warm start takes place following any input.
.sp 2
.he CP/M Operating System Manual  1.8  Operation of CP/M on the Model 800
.tc    1.8  CP/M Operation on the Model 800
.sh
1.8  CP/M Operation on the Model 800
.pp
This section gives operating procedures for using CP/M on the 
Intel Model 800 microcomputer development system microcomputer development 
system.  Basic knowledge of the microcomputer development system
hardware and software systems is assumed.
.pp
CP/M is initiated in essentially the same manner as the Intel ISIS operating
system.  The disk drives are labeled 0 through 3 on the 
microcomputer development system, corresponding
to CP/M drives A through D, respectively.  The CP/M system disk is
inserted into drive 0, and the BOOT and RESET switches are pressed in
sequence.  The interrupt 2 light should go on at this point.  The space bar
is then pressed on the system console, and the light should go 
out.  If it does not, the user should check connections and baud rates.  The
BOOT
switch is turned off, and the CP/M sign-on message should appear at the
selected console device, followed by the A> system prompt.  You
can then issue the various resident and transient commands.
.pp
The CP/M system can be restarted (warm start) at any time by pushing the
INT 0 switch on the front panel.  The built-in Intel ROM monitor can be
initiated by pushing the INT 7 switch, which generates an RST 7, except when
operating under DDT, in which case the DDT program gets control instead.
.pp
Diskettes can be removed from the drives at any time, and the system can be
shut down during operation without affecting data integrity.  Do
not remove a disk and replace it with another without rebooting the
system (cold or warm start) unless the inserted disk is Read-Only.
.pp
As a result of hardware hang-ups or malfunctions, CP/M might 
print the following message:
.sp
.ti 8
BDOS ERR ON d: BAD SECTOR
.sp
where d is the drive that has a permanent error.  This error can occur when
drive doors are opened and closed randomly, followed by disk operations, or
can be caused by a disk, drive, or controller failure.  You can
optionally elect to ignore the error by pressing a single return at the
console.  The error might produce a bad data record, requiring
reinitialization
of up to 128 bytes of data.  You can reboot the CP/M system and try
the operation again.
.pp
Termination of a CP/M session requires no special action, except that it is
necessary to remove the disks before turning the power off to avoid
random transients that often make their way to the drive electronics.
.pp
You should use IBM-compatible disks rather than disks
that have previously been used with any ISIS version.  In particular, the
ISIS FORMAT operation produces nonstandard sector numbering throughout the
disk.  This nonstandard numbering seriously degrades the performance of
CP/M, and causes CP/M to operate noticeably slower than the distribution
version.  If it becomes necessary to reformat a disk, which 
should not be the case for standard disks, a program can be 
written under CP/M that causes the Model 800 controller to 
reformat with sequential sector numbering (1-26) on each track.
.pp
Generally, IBM-compatible 8-inch disks do not need to be formatted.
However, 5 1/4-inch disks need to be formatted.
.sp 2
.ce
End of Section 1
.nx two
