• Please review our updated Terms and Rules here

CP/M & ED - editing a very large file

smp

Veteran Member
Joined
Oct 4, 2011
Messages
1,723
Location
Bedford, NH, USA
Hello all,

I am exercising CP/M on my HP86B. HP sold an "Auxiliary Processor" also known as the CP/M system. As with other systems of that time, the module contained a 4MHz Z-80 and 64K RAM, and the interfacial logic to allow the Z-80 system to run with the keyboard, display and disk drives provided by the HP-86 & peripherals.

The HP version of CP/M was extremely crippled in I/O, as HP wanted to allow the use of CP/M but keep its user base coming to HP for software. SO, absolutely no serial input to allow any software or source code files to be imported. At that time, all software came on disk from HP. Period.

Fast-forward to today, and there are methods to get files into my HP86 CP/M system, but they are quite tedious (for me) as I normally do little bits at a time, many times over. Let's not worry about that. One day, long ago, I got the source code file for fig-FORTH onto one of my HP86 CP/M disks. Never went anywhere with it at the time, IIRC. Today, I am interested in picking up that thread.

The source code file that I have needs 4-5 patches to fix things that I've found using fig-FORTH on my other CP/M systems. So, here I am with a minimal CP/M system running on one disk and the source code file that needs a few fixes on another disk drive. I can use ED - I know, UGH! but it's only a few minor edits and I'm home free. My problem is this:

The fig-FORTH source file is 54K big. That's too big to get the whole file into ED at one go. OK, so I can do some of the patches, but I cannot get enough of the file in to do the last 1 or 2. For the life of me, I cannot find the command in ED to save some of the previous portion of the file, and go and get the rest of the file so I can finish up.

Can anyone help me with what the command is, or what sequence of commands I need to use in ED to get the last portion of a large file in for editing? I start at the beginning identifying the file to ED, and once it's ready to go, I give it the #A command to go get it all. Ed only goes and gets maybe 75% of the file in, so I can do some of my patches, but then I'm at the bottom of this batch of source code, and I need to save that off and get the last 25% of the file in so I can do the last 1 to 2 patches and be done.

Is there a different way to get this done? Is there a command to read only the second half of the file, perhaps?

Any advice or assistance would be greatly appreciated!

smp
 
I believe the commands you're looking for are 'W' and 'A'. "nW" to write the first "n" lines to the output (and shift everything left in memory down), and "nA" to append the next "n" lines from the input.
 
I believe the commands you're looking for are 'W' and 'A'. "nW" to write the first "n" lines to the output (and shift everything left in memory down), and "nA" to append the next "n" lines from the input.

Yes, indeed! I managed to find this in my CP/M Bible, by Waite & Angermeyer. Tried it. It worked, and I came back here to report that same thing myself.

Thanks very much, Doug, for the assist!

smp
 
I appreciate that this may not be a help, but you never know. It would be useful to find a version of WordStar for this setup, an this system, using non-document mode - will allow editing of files much larger than memory, and in effect you're limited much more by disk size.

Another option if you have some programming facilities would be to write a prog to split the large file into a number of much smaller files, that CAN be edited within memory, and then when the job is done they can be rejoined.

Thirdly, what is the structure of the file of the source (assumed) for the forth. Is this a file of 1k 'screens'? I have Forth systems with the source in such a format. If this is the case, it is not too major a process to manipulate the file block be block, writing a fairly simple 'editor' to access a block at a time.

Aside from this, what do you know about the floppy disk format? I'm assuming the disks are CP/M format, rather than a 'forth' block format as you are at least trying to edit the file using ED. Can disks to accessed via something like 22DISK, in which case you can copy whatever you need to the system?

Geoff
 
I appreciate that this may not be a help, but you never know. It would be useful to find a version of WordStar for this setup, an this system, using non-document mode - will allow editing of files much larger than memory, and in effect you're limited much more by disk size.
...

Thanks very much for the advice, Geoff! I had not thought of that. Since the source code is plain text, so I did not think about a word processor instead of a text editor.

Now that I've accomplished the patches and everything assembles properly, I am good to go. Once I am in FORTH, it assumes that it owns the entire system, and (once I get the editor commands typed in, and then use the editor commands to type them in a second time so I can save a file) will blindly save 1K blocks to the disk. This means after I get FORTH running, I have to swap out the disk for a FORTH-data disk. No big deal.

All of this is contained in a CP/M blob file concocted by HP to keep their customers captured. So, on the physical disk, all one sees is a couple of files called CPM and CPMSYS. The entire CP/M environment is within the CPMSYS file. HP will boot from that and after booting, everything looks like a normal CP/M system to the user. If you want to put a file into the CP/M system, it requires file manipulation of the CPMSYS file via CPMTools or 22Disk, or a third disk manipulator that I have that I forget the name of. Cumbersome. I like playing with this system, but the tedious nature of this file transfer will put me off again, eventually.

Thanks again for your thoughts!

smp
 
Thanks VERY much for the update. Things like this with disk systems interest me a lot.

So, once you've got Forth working OK with it's own format (just a mass of sector/block files) than you could use a PC to manipulate the files outside the control of HP?

But, could you do the same with CP/M? You seem to be saying that HP were trying to make this NOT. Interesting.

You've not said what type of disk you use. I looked up about this machine, and found a reference to a HP 9121 dual disk drive, which seems to be a pair of 3.5" disks, but they show as SS/DD with a format of 270k per disk. Not sure if that's data capacity, or total format capacity incl system space, directory space, etc.

When I check my 22DISK stuff, I see an entry for HP 86,87 and 125, but this refers to a 5.25" disk, and it's DS/DD type, 40T, with 16 @ 256 byte sectors each. Prob about 300k data capacity after reserved tracks etc. Not sure how they've arranged this in the context of the 'blob' file you mention, would be interesting to see one of the disks.

22DISK I assume will be looking at the whole disk, so I'm not sure how it would get around the 'blob', unless the whole thing is logical rather than actual. Even more interesting.

If you can sort something, then you can copy whatever you need to the HP machine via floppy disk. And back again?

Geoff
 
Hi Geoff,

Yes, HP made completely sure that they controlled everything. When you format a disk within CP/M, you create the CPMSYS file on the physical disk, and as I tried to say, your CP/M environment is within that blob file. So when you format a disk to have it for a data disk for FORTH, the same thing - you end up with a blank disk for data but it is within the CPMSYS blob. So, within CP/M it appears like a blank disk and FORTH can write its blocks to it, but you cannot manipulate it from outside of CP/M on the HP86 without one of the CP/M disk manipulation tools.

Yes, I have a 9121 dual 3.5 inch disk drive. I end up with 240K available storage on a floppy disk.

I have the CPMDISKDS.DEF and TMP.LST files that contain the definitions for the HP 3.5 inch disks. I don't know how I obtained them, but I did, back when I obtained the HP CP/M System boot disk image. I think I ended up using a different tool from 22DISK. I'll have to go out into the garage and see if that special PC I have is still working to remember what the tool name is. That tool and those two files I mentioned were what I needed to create the physical boot disk from the image, and also the tool looks right into the CPMSYS file and it appears like you are just looking at another CP/M disk for file transfer. It's been a looong time since I've done it. Memory is foggy.

smp

EDIT: The TMP.LST file has a header announcing that it is for the 22DISK application, so I guess that's the tool that I used in the past. Just don't remember that well.
 
Last edited:
Thanks for the extra information. Sounds like the CPMSYS file might be something like the disk image files we use so much now regarding emulators for older computers, thet I use quite a bit regarding the Amstrad PCW I have (CP/M machine). All even more interesting.

I had not seen any mention before that 22DISK could operate into an image, but the TMP.LST file must be doing something like that, to kid its operation that the CPMSYS file is the actual disk?

The disk definiton I have already is for the 5.25" disk, but it should not be a big deal to create a new definition for the 3.5" disk although the file you have - CPMDISKDS.DEF should already have such a definition. There's a utility that comes with the 22DISK system that converts the .DEF file to text for editing, and another that converts back to a new working file - do you have these?

I'll have a look on the web to see if there are any disk images available for this system, could be useful to explore this more. I'd guess someone has had to do something already? Otherwise I'll have to plead with you to make one?? Oh, just seen the mention of 'image' in your last message - There IS something available - somewhere. Any chance you could attach it?

Thanks again.

Geoff
 
Found a link to a HP Museum site, that has a lot of images (incl for WordStar if you need that). There's an image for the CP/M disk, I've downloaded that, and I'll explore it. I think it's a .TD0 image, but I've used them before, I think I need to convert it into something else initially, maybe an .IMD or just a binary image?

Geoff
 
Well, Geoff, I was feeling like I was letting you down by not doing anything on my side, so I went on out into my garage and fired up my old PC that I used to use for reading & writing CP/M disks. The PC fired up OK, but the hard drive did not - a small rap on the side of it got it spinning again. Whew!

Indeed, I have 22Disk, and I navigated DOS to get into that directory. Then I had to take a look at all the files to see which one to execute - aha! CMENU. That brought up the menu of actions, including setting the CP/M disk type. Thank goodness for the on-screen hints. I looked through the list and yes, type HP2 was the one for HP 3.5 inch floppies. The only thing I did was to take a look at the directory of a CP/M data disk that I have that contains 3 files. If you look at the disk in the HP BASIC OS on the HP86, it shows the CPMSYS file. In 22Disk, I see the 3 CP/M files. Magic!

So, I am somewhat back up to speed with all this. I can again use my PC-in-the-garage for transferring files into my HP86 system in CP/M if I want to.

Thanks for your encouragement, Geoff. If you would like me to send you a copy of the CPMDISKS.DEF and TMP.LST files that I have, send me a PM with an e-mail address that I can send them to.

smp
 
Hello,

I've had a study of the disk I downloaded. It does not seem to be the same as the one you describe, but this may be just details. The one I have refers to the 87 rather than the 86. The image is just less than 300k data, which could be for a SS/DD 3.5" disk?

Looking at the raw binary data, I see a lot of system prog which I assume is the CP/M system (BIOS and BDOS etc) ate near the start is some sort of header, which includes something that looks like a directory, but is NOT a CP/M directory. This includes references to files:

CP/MSYS '
Autost '
CP/M '
CP/M

The ' (tick/apostrophe) seems to be significant and part of the filename.
So this ties in somewhat with the description you gave.

The system etc data/prog continues to near &H3000, with some padding. At &H3000 the normal CP/M directory starts, showing various os the standard CP/M utilities, and this looks normal for a CP/M disk.

So, it looks to me that if the DPB data is correct, and the number of Reserved/System tracks is appropriate, then this disk would appear to a normal CP/M system as a normal CP/M disk. For example, 22DISK may well be able to read and write to is without any assistance? So maybe it's not THAT strange?

It's totally up to the loading machine as to what it does with the first track(s). Once the system is booted, then they are normally disregarded anyway. The start of the proper disk/data is the start of the directory, and the DPB defines where that is.

In the case of the HP86 (and 87 ?) there may be something else in the system area to give the pretence of another directory, and a different file system?? If the system is booting from this disk, I'd guess that the system just disregards this, loads the BOOT loader, the BIOS, the BDOS, the CCP and proceeds as normal, untroubled.

Still, interesting.

I'll have to make an actual disk from the image, and make a 22DISK definition to match, and see what 22DISK makes of it.

Still, interesting.

As I post this, I see your new message. I'll check that now.

Geoff
 
Back
Top