home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
ENTERPRS
/
CPM
/
UTILS
/
A
/
CPMREAD.ZIP
/
CPMREAD.DOC
< prev
next >
Wrap
Text File
|
1988-07-08
|
15KB
|
393 lines
CPMREAD.EXE
Read diskettes formatted under CP/M
CPMDEFLT.EXE
Set the default parameters for CPMREAD.EXE
Both programs copyright (c) 1988 by Aaron L. Brenner
IBM PC is a trademark of International Business Machines, Inc.
CP/M is a trademark of Digital Research Inc.
A Little Background
===================
A few years ago, I worked as a programmer for a company that was
using Z80-based machines running CP/M 2.2 for all of their compu-
ting. At that time, I had a true-blue IBM PC at home, and I
thought that I might be able to do some of my coding work at
home. The proverbial fly in the ointment was the fact that all my
work had to be put on the company's CP/M-format diskettes, and I
had no way (short of buying a commercial package) of going from
one format to the other.
My first attempt was a quick-and-oh-so-dirty program that did the
basic job of reading the CP/M disks on my PC. It was crude, but
it worked. Some time later, I read a message on a BBS by someone
having the same problem I had just solved. Naturally, I uploaded
the program, and thought no more about it.
A year later, I began getting phone calls from people who had
gotten a copy of the program from a BBS, and were wondering if I
would be able to make it work for them. I told them that there
was little I could do without either the exact specs for their
particular machine, or at least a CP/M diskette to analyze. One
gentleman actually sent me a diskette, and I was able to hack up
the program so that it was able to read his diskette on my own
machine. But, when I sent him a copy of the program, it wouldn't
work on his machine. I haven't heard from him since.
Just a few weeks ago, a consultant to the company I currently
work for mentioned that he had some interesting software, but it
was all on CP/M-format diskettes. Aha! I thought, I can hack up
my old program yet again, and check out his software. It turned
out that it was easier just to apply what I had learned to a
brand-new program than it was to hack on the old program. Over
the course of the next few weeks, I developed CPMREAD.
I have personally tested CPMREAD with the following CP/M formats:
Sanyo MBC 1100/1150 256 byte sectors, 40 tracks, 8 sectors
per track, 3:1 interleave.
EasyData 1024 byte sectors, 40 tracks, 10 sectors
per track, 1:1 interleave
Visual 1050 512 byte sectors, 80 tracks, 10 sectors
per track, double sided, 1:1 interleave.
CPMREAD should have no trouble reading ANY soft-sectored format,
as long as the diskette drive itself is capable of handling it.
CPMREAD
=======
Program Installation
--------------------
To install CPMREAD & CPMDEFLT, just unARC the files to the direc-
tory you want. That's all.
Program Operation
-----------------
Program operation is quite simple. At the DOS prompt, type
CPMREAD
followed by a carriage return. CPMREAD will then prompt you to do
one of the following:
1. Press the Escape key. This will cause CPMREAD to
terminate, returning you to DOS.
2. Press 'S'. This will allow you to Set the disk
parameters for your particular system.
3. Put the CP/M diskette into the A: drive, then
press any other key to begin reading the disk's
directory.
Setting the disk parameters
---------------------------
Pressing the 'S' key at the opening screen will bring up a menu
of options from A to H corresponding to the 8 changeable parame-
ters.
A) Physical sector size
This represents the number of bytes in each disk sector.
The standard PClone diskette controller supports sector
sizes of 128, 256, 512, and 1024 bytes; therefore,
CPMREAD and CPMDEFLT support only these values.
B) Maximum directory entries
This is the maximum number of 32-byte entries in the
diskette directory. Typically, this is either 64 or 128.
C) Logical records per block
This is the number of 128-byte records in each CP/M
block. For most diskettes, this value is 16, which re-
sults from a 2k block size.
D) Logical records per track
This is the number of 128-byte records in each diskette
track.
E) Logical records per directory entry
This is the number of 128-byte records that can be han-
dled by a single directory entry. For double-sided dis-
kettes under 400k in capacity, this value is usually 256.
For higher capacity diskettes, this value is usually 128.
F) Number of reserved tracks
This is the number of tracks reserved for system use by
CP/M.
G) Sector interleave
This is number of diskette sectors to skip to get sequen-
tial sectors. This can vary wildly from one system to
another.
H) Number of sides
This is the number of readable sides on the diskette.
Determining the disk parameters
-------------------------------
If you are running CP/M 3.0 or later, the SHOW utility will tell
you most of what you need to know to run CPMREAD. At the command
prompt,
SHOW A:[DRIVE]
will display all of the necessary parameters except the inter-
leave factor.
If you are running a version of CP/M earlier than 3.0, you have 2
choices: 1) experiment with CPMREAD, trying as many possibilities
as you can, until you succeed; 2) be willing to learn a few
things about the innards of CP/M. If you prefer to use trial-and-
error, you can skip the rest of this. On the other hand, if you
have as little patience as I do, you might be interested in what
you can do.
I have provided a simple disk dump utility (DDUMP.COM) to help in
determining at least some of the necessary diskette parameters.
To use DDUMP, just put the CP/M diskette in the A: drive, and
type
DDUMP <n>
where <n> is a number from 0 to 9. This number is the track number
to dump. Keep in mind that track numbers start at 0.
When DDUMP starts up, the first thing it does is figure out the
sector size for you, as well as the number of sectors per track
and the number of sides. Once that is accomplished, DDUMP will
then output to a file named CONTENTS.CPM those values followed by
a hexadecimal dump of the track you specified on the command
line. The dump will be in the same basic format as DEBUG or DDT
(the CP/M equivalent), with heading lines for each sector. For a
sample of the output of DDUMP look at the CONTENTS.CPM file from
this archive.
The sample CONTENTS.CPM file is from track 2 of a diskette for-
matted on a Sanyo MBC 1100. It shows pretty clearly some of the
disk parameters for that particular machine: 256 byte sectors, 32
records per track, 2 sides, 3 to 1 interleave, 2 reserved tracks.
However, it doesn't show the maximum directory entries, logical
records per block, or logical records per directory entry. To
figure these out, you need to analyze the dump a little. Sectors
that contain nothing but bytes of E5 have probably never been
written to, and they can be a good guide to both interleave and
max directory entries. If you see a sector full of directory
entries followed by one or more sectors full of E5, you know what
the interleave is - 3 to 1 if sector 1 is directory, then sectors
2 and 3 are E5. Also, the directory takes up the first data
block, so once you get the interleave down, you can tell where
the data blocks begin (and the directory ends). With that, you
can figure out both block size and number of directory entries.
For example, looking at the sample CONTENTS.CPM, you can see that
the directory begins in sector 1. Sector 2, however, is obviously
NOT part of the directory, as is sector 3. The directory conti-
nues in sector 4, which leads one to believe that the interleave
is 3 to 1. Since the directory continues into sectors 7, 10, and
13, you know that at least 5 physical sectors are involved - in
order, they are 1, 4, 7, 10, and 13. Sector 13 also contains a
bunch of E5 bytes, indicating that that is the last USED directo-
ry sector. By extrapolating from the interleave, you can see that
the directory would also take up sectors 16, 3 and 6. From all
this, you know that the directory takes up at least 8 physical
sectors, or 16 logical (128-byte) records, yielding 64 directory
entries. For there to be more sectors in the directory, sector 9
would ALSO have to contain either directory information or all E5
bytes - it doesn't, so there has to be a maximum of 64 directory
entries, and an interleave factor of 3. The other parameters
(block size and number of records per directory entry) are best
taken from educated guesses: if you know the approximate capacity
if the diskette, you have a good idea of these parameters. If the
disk can hold up to 400k, the probable values are 256 records per
directory entry and the block size is 16 records. If the capacity
of the diskette is higher, then you would probably want to use
128 records per directory entry.
As you can see, it ain`t always easy. But, with a little mental
effort, you can do a lot. And if that always fails, well, try
Zen.
Seriously, if you really can't figure the parameters out, you can
get in touch with me at the telephone number below. We can proba-
bly work something out.
Copying files
-------------
Once the parameters are correct and the directory is loaded, you
will be presented with something like:
BASCOM.COM submit.com
baslib.rel sysgen.com
bcload
brun.com
cpm.sys
cref80.com
dcop.com
ddt.com
disintel.com
ed.com
fbasic.com
format.com
l80.com
lib80.com
link.com
mbasic.com
obslib.rel
pip.com
rmac.com
stat.com
BASCOM.COM (253 records)
[O]utput path: D:\CPM\C\
Copy: [A]ll, [C]urrent, change [D]isks, [M]arked, [U]nmark all, [Q]uit
Arrows move around, spacebar toggles mark
The screen display consists of 20 lines of 5 columns of file
names, a line for miscellaneous messages, a line showing the size
of the currently highlighted file, a line showing the current DOS
output path, and 2 lines listing the program options. (In the
program, the letters between the "[" and "]" are in high-intensi-
ty video.) The options are:
[O]utput path
This option allows you to set the path that files will be
copied to. If that path doesn't already exist, the prog-
ram will create it for you.
[A]ll
This option will copy ALL files from the diskette to the
current output path. During the copy, you can press the
Escape key to abort.
[C]urrent
This option will copy the currently highlighted file to
the current output path. During the copy, you can press
the Escape key to abort.
change [D]isks
This option allows you to change diskettes without exi-
ting the program. It returns to the opening screen.
[M]arked
This option will copy those files that have been marked.
[U]nmark all
This option will remove the marks from any files that are
marked.
[Q]uit
This option will exit the program, returning you to DOS.
The arrow keys will move among the file names, and the Home and
End keys will move to the first and last files respectively.
Note: I have yet to try this program out on a diskette that had
more than 40 or 50 files. Consequently, the display rou-
tines are the least tested parts of the program. If any-
one finds a bug in the display, please let me know about
it.
There is also a known problem when reading high-capacity
disks on 1.2MB diskette drives: sometimes the drive can't
read them. From the limited information I've gathered, I
can't see how to tell the BIOS to expect high-capacity
diskettes that are not 1.2MB. I don't have a machine with
those kind of drives at home, and I can't do much with
the machines at work. If ANYONE out there knows how to do
this, PLEASE TELL ME. The only way I've found to read
these kind of diskettes is to do some kind of operation
with a 1.2MB disk immediately before. Just doing a direc-
tory seems to make it work.
*****************************************************************
CPMDEFLT
========
CPMDEFLT is just the 'S'et disk parameters option of CPMREAD made
into a separate program. The difference is that with CPMDEFLT,
you can make permanent changes to the disk parameters.
Program operation
-----------------
In its current incarnation, CPMDEFLT requires the executable file
CPMREAD.EXE for editing.
To start CPMDEFLT, use a command line of the format
CPMDEFLT [<exe file>[.EXE]]
where the file name parameter is optional. The default file name
is CPMREAD.EXE. You can even give the file name without the
extensions.
Once the program is started, it will behave exactly like
CPMREAD's "Set parameters" option from the startup screen; all
the options are the same. The only difference is that when you're
ready to exit to DOS, if you've made any changes you will be
asked if you want to save those changes.
The disk parameters you see in CPMDEFLT are those that CPMREAD
will default to (that's what the DEFLT stands for). The main
reason I wrote this program was to permit you, the user, to
easily change the parameters to match the disk that you will most
often be reading. You could do this each time you ran CPMREAD,
but I figure that the program should be making your life easier,
not harder.
*****************************************************************
In closing
==========
I realize that this documentation is pretty scant, but I hope
that the programs are simple enough that you won't have trouble
(famous last words, I know). Besides, programmers are not really
known for their great documentation, just their great (?) prog-
rams, right?
In the event that you DO have a problem, I can be reached at
(617)689-9749 until July 31, 1988. After that, I don't know; I'm
going to be moving. If you want to get in touch with me, my
mailing address on Genie is A.BRENNER, and I read a lot of the C
Echo messages, as well as the Programmer's Echo messages.
I have decided to release these programs free of charge, although
I retain the copyright. The source code is a different matter. If
anyone would like a copy of the source code, I will be happy to
send it to them for a small fee of $25(US). I will supply the
diskette and mailer.
Best of luck.
Aaron Brenner
7 July 1988
9 Granite St. Apt. # 14
Methuen, MA 01844
(Until 31 July 1988)