New utility for reading and writing MITS CPM floppy disk images

510 views
Skip to first unread message

Paul Hatchman

unread,
Jan 6, 2023, 8:35:48 AM1/6/23
to Altair-Duino
Hi All,

I've put together a utility for reading and writing the MITS floppy disk images. This works with MITS CP/M format floppy disks (tested on CP/M version 2.2mits)

The functionality is similar to cpmtools, you can read/write files, get directory listings and make new disks.

If you'd like to try it out, the source code and windows exe is available at https://github.com/phatchman/altair_tools

I've tested this quite a bit, but there still may be some lurking bugs. The MITS disk format is a strange beast. So please make sure you keep backups of any disk images before you write to them using this tool.

A sample of how to use it below. More details and examples are available on github.
# format a new disk
./altairdsk -F new.dsk

# Put multiple files
./altairdsk -P new.dsk '*.COM'

#Get a directory listing
./altairdsk new.dsk -d
Name     Ext  Length Used U At
ASM      COM   8768B   8K 0 W
DDT      COM   5206B   6K 0 W
DO       COM   2329B   4K 0 W
DUMP     COM    411B   2K 0 W
ED       COM   6576B   6K 0 W
FORMAT   COM   1918B   2K 0 W
L80      COM  11508B  12K 0 W
LADDER   COM  43155B  40K 0 W
LOAD     COM   2192B   2K 0 W
LS       COM   3288B   4K 0 W
M80      COM  21509B  20K 0 W
MAC      COM  12604B  12K 0 W
NSWP     COM  12056B  12K 0 W
PIP      COM   7946B   8K 0 W
R        COM   4384B   4K 0 W
STAT     COM   5754B   6K 0 W
TEST     COM    137B   2K 0 W
W        COM   4247B   4K 0 W
WM       COM  11371B  12K 0 W
XDIR     COM  11782B  12K 0 W
20 file(s), occupying 178K of 296K total capacity
41 directory entries and 118K bytes remain


fridtjof.ma...@gmail.com

unread,
Jan 6, 2023, 9:44:32 AM1/6/23
to Altair-Duino
Thank you for this!

FredW

udo....@freenet.de

unread,
Jan 6, 2023, 10:16:42 AM1/6/23
to Altair-Duino
fridtjof.ma...@gmail.com schrieb am Freitag, 6. Januar 2023 um 15:44:32 UTC+1:
Thank you for this!

FredW

I second that, cool tool, thanks.

Walt Perko

unread,
Jan 6, 2023, 2:24:32 PM1/6/23
to Altair-Duino
Hi, 

I haven't tried it yet, but I'm wondering if the program could do 8" disks ... maybe a xMB or xxMB disk?  


.

villa...@gmail.com

unread,
Jan 6, 2023, 2:42:01 PM1/6/23
to Altair-Duino
Just been 'playing' with your program in Windows - formatting, copying to/from etc -  .........  without any problems!!!
Thank you for a great utility ..
Colin

Paul Hatchman

unread,
Jan 7, 2023, 1:44:37 AM1/7/23
to Altair-Duino
I'm not sure to be honest. But I hacked together a version today that can read the directory listing from the 5MB HDD images and it didn't need too many changes.

So that looks fairly promising. Each type of disk will need the their own parameters configured, as you can't get the information needed directly from the disk image. But hopefully  I can auto-detect based on disk image size or something else. We'll see. 
Message has been deleted

Patrick Linstruth

unread,
Jan 7, 2023, 10:50:50 AM1/7/23
to Altair-Duino
I am very happy to say your program works great on Mac too! Thank you for a great tool.

Patricks-iMac altair_tools % ./altairdsk -d cpm63k.dsk
Name Ext Length Used U At
ASM COM 8768B 8K 0 W
CRC COM 2329B 4K 0 W
DDT COM 5206B 6K 0 W
DUMP COM 411B 2K 0 W
ED COM 6576B 6K 0 W
FORMAT COM 1918B 2K 0 W
L80 COM 11508B 12K 0 W
LADDER COM 43155B 40K 0 W
LADDER DAT 548B 2K 0 W
LOAD COM 2192B 2K 0 W
LS COM 3288B 4K 0 W
LUNAR BAS 3425B 4K 0 W
M80 COM 21509B 20K 0 W
MAC COM 12604B 12K 0 W
MAZE COM 18084B 18K 0 W
MBASIC COM 26030B 24K 0 W
MOVCPM COM 11371B 12K 0 W
NSWP COM 12056B 12K 0 W
OTHELLO COM 12878B 12K 0 W
PCGET COM 959B 2K 0 W
PCPUT COM 1096B 2K 0 W
PIP COM 7946B 8K 0 W
R COM 4384B 4K 0 W
STARINS BAS 7124B 8K 0 W
STARTRK BAS 20413B 20K 0 W
STAT COM 5754B 6K 0 W
SUBMIT COM 2329B 4K 0 W
SURVEY COM 1233B 2K 0 W
SYSGEN COM 1233B 2K 0 W
TICTAK BAS 2740B 4K 0 W
VIEW COM 411B 2K 0 W
W COM 4247B 4K 0 W
WM COM 11371B 12K 0 W
WM HLP 3014B 4K 0 W
XSUB COM 822B 2K 0 W
35 file(s), occupying 288K of 296K total capacity
23 directory entries and 8K bytes remain

% ./altairdsk -g -t cpm63k.dsk startrk.bas

% ls -l startrk.bas
-rw-r--r-- 1 patrick staff 19034 Jan 7 07:47 startrk.bas

% more startrk.bas
10 REM ****
20 WIDTH 80
30 PRINT:PRINT:PRINT:PRINT
220 PRINT TAB(20);"THE USS ENTERPRISE --- NCC-1701":PRINT:PRINT
221 PRINT TAB(20);" ,------*------,"
222 PRINT TAB(20);" ,------------- '--- ------'"
223 PRINT TAB(20);" '-------- --' / /"
224 PRINT TAB(20);" ,---' '-------/ /--,"
225 PRINT TAB(20);" '----------------'":PRINT:PRINT
230 PRINT:PRINT:PRINT
260 CLEAR 600
270 Z$=" "
330 DIM G(8,8),C(9,2),K(3,3),N(3),Z(8,8),D(8)
370 T=INT(RND(1)*20+20)*100:T0=T:T9=25+INT(RND(1)*10):D0=0:E=3000:E0=E
440 P=10:P0=P:S9=200:S=0:B9=0:K9=0:X$="":X0$=" IS "
470 DEF FND(D)=SQR((K(I,1)-S1)^2+(K(I,2)-S2)^2)
475 DEF FNR(R)=INT(RND(R)*7.98+1.01)
490 Q1=FNR(1):Q2=FNR(1):S1=FNR(1):S2=FNR(1)
530 FOR I=1 TO 9:C(I,1)=0:C(I,2)=0:NEXT I
540 C(3,1)=-1:C(2,1)=-1:C(4,1)=-1:C(4,2)=-1:C(5,2)=-1:C(6,2)=-1
600 C(1,2)=1:C(2,2)=1:C(6,1)=1:C(7,1)=1:C(8,1)=1:C(8,2)=1:C(9,2)=1
670 FOR I=1 TO 8:D(I)=0:NEXT I
710 A1$="NAVSRSLRSPHATORSHEDAMCOMXXX"
820 FOR I=1 TO 8:FOR J=1 TO 8:K3=0:Z(I,J)=0:R1=RND(1)
850 IF R1>.98 THEN K3=3:K9=K9+3:GOTO 980
860 IF R1>.95 THEN K3=2:K9=K9+2:GOTO 980
> --
> You received this message because you are subscribed to the Google Groups "Altair-Duino" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to altair-duino...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/altair-duino/84578526-bc6d-4477-878f-564954557c39n%40googlegroups.com.

Message has been deleted

Paul Hatchman

unread,
Jan 11, 2023, 2:30:33 AM1/11/23
to Altair-Duino
Hi All,

I'm planning to publish a new version that supports multiple disk image types shortly. But if I could get a few people to test it out before I fully release it, I'd appreciate that. I've got limited examples of some of these disk images, so wider testing is probably beneficial.

If you want to try it out, please use the "multiformat" branch of the git repository: https://github.com/phatchman/altair_tools.git
If you don't know how to do that, it's quite simple. Clone as normal and then checkout the multiformat branch. e.g.

git checkout multiformat
cmake .
make

No windows executables yet, but this does build under Windows Subsystem for Linux (WSL) for those windows users without a unix=like environment.
Formats supported are in the help shown below:

altairdsk: -[d|r|F]Tv      <disk_image>
altairdsk: -[g|p|e][t|b]Tv <disk_image> <src_filename> [dst_filename]
altairdsk: -[G|P][t|b]Tv   <disk_image> <filename ...>
altairdsk: -h
        -d      Directory listing (default)
        -r      Raw directory listing
        -F      Format existing or create new disk image. Defaults to FDD_8IN
        -g      Get - Copy file from Altair disk image to host
        -p      Put - Copy file from host to Altair disk image
        -G      Get Multiple - Copy multiple files from Altair disk image to host
                               wildcards * and ? are supported e.g '*.COM'
        -P      Put Multiple - Copy multiple files from host to Altair disk image
        -e      Erase a file
        -t      Put/Get a file in text mode
        -b      Put/Get a file in binary mode
        -T      Disk image type. Auto-detected if possible. Supported types are:
                        * FDD_8IN - MITS 8" Floppy Disk (Default)
                        * HDD_5MB - MITS 5MB Hard Disk
                        * FDD_TAR - Tarbell Floppy Disk
                        * FDD_1.5MB - FDC+ 1.5MB Floppy Disk
                        * FDD_8IN_8MB - FDC+ 8MB "Floppy" Disk
        -v      Verbose - Prints sector read/write information
        -h      Help


The type should be auto-detected based on the size of the disk image. So normally you only need to supply -T if you are formatting a new disk. However, I've seen some disks formatted in simh which grow some extra bytes and you'll need to force the disk type to handle those. I'll try and add a work-around for this in the final release.

I think that is all the formats I could find, except for Cromemco, which I doubt is used much? And for the 1K directory entry version of the 5MB HDD images. I couldn't get that to load in simh. If someone can give me instructions on how to make it work, I'll add support for that format as well.

If you do find an issue, let me know and I can arrange for you to send me additional details. If there are any other important formats to add, let me know and I'll look into it.

Also if someone can please test formatting an 8MB image to see if my format for that works? Mine is slightly different to the blank disk that Mike posted at deramp, but I don't think the differences are actually important. But I don't know of a way to test it without the hardware.

Cheers,

Paul

Paul Hatchman

unread,
Jan 11, 2023, 2:36:30 AM1/11/23
to Altair-Duino
I forgot to add:

If you run this on the 5MB CP/M disk images supplied with the Altair Duino, you will get a few strange entries in the directory listing. This is not a bug with my code, but instead is a problem with the directory table on those images. You can confirm by doing an LS $U in CP/M to list files for all users and see the whacky results for yourself. 

I'll probably add some option to fix up broken directory tables in the final release.

Cheers.
Message has been deleted

Paul Hatchman

unread,
Jan 11, 2023, 2:54:53 AM1/11/23
to Altair-Duino
Sorry for the spam. The windows exe compiled without any changes. So I've added it to the windows directory in the multiformat branch.

Walt Perko

unread,
Jan 11, 2023, 6:37:51 AM1/11/23
to Altair-Duino
Hi, 

I tried to run the "altairdsk.exe" program on my Win10 PC, but nothing happens.  Then I tried run as Admin, still nothing happens ??? 

,  

Paul Hatchman

unread,
Jan 11, 2023, 7:47:55 AM1/11/23
to Altair-Duino
Hmm. Not sure.. I just did a fresh installation of windows 10, downloaded the exe and it works as expected.

Did you run it from a command prompt? It's a command line tool, so you need to run it from a command prompt.

The only other things I can suggest is to right-click properties on the altairdsk.exe and under Security, check the "Unblock" check box.
If that doesn't work, look in the Windows Event Viewer under System and Application to see if there are any relevant messages.

    - Paul

villa...@gmail.com

unread,
Jan 11, 2023, 12:18:07 PM1/11/23
to Altair-Duino
Have had a little play in windows - not exhaustive testing but not found any issues on create, copy, read, format on most common formats.
Colin

Walt Perko

unread,
Jan 11, 2023, 12:34:29 PM1/11/23
to Altair-Duino
Hi, 

Sorry, I was trying to run it in Windows 10, not a command line window.  

I guess, I'm hoping for a Drag 'n Drop version v. just copying files from a command line.  I can do that in the Altair or just PCGET files to a new blank drive just as easy, but a Drag 'n Drop utility to copy programs from one .DSK to another .DSK would be an awesome utility.  

This brings up another question.  Is it possible to just load four 8MB FDD .DSK images into the Altair-Duino?  


.  
Message has been deleted

fridtjof.ma...@gmail.com

unread,
Jan 11, 2023, 7:43:07 PM1/11/23
to Altair-Duino
The altair 5mb with 1k directory entries was mine... I just patched the OS on the deramp 5MB bootable image *in place*, cleared out the extra directory space and ran with it... I have never used it (or tried it) with simh. Just take your "normal" altair 5MB code... and change it to use 1024 directory entries... I'll have a look at your code, and make the needed changes.

FredW

fridtjof.ma...@gmail.com

unread,
Jan 11, 2023, 8:51:53 PM1/11/23
to Altair-Duino
Ok, the mulri-format version has a problem. The initial allocations are not just 2 allocation units. This is controlled in CP/M by the dpb. I am putting in a count for that. The initial allocations are there to "cover" the directory space. 2 units at 1k gives 2k for the directory or 64*32 bytes. But, it depends! Take dir entries * 32 / alloc unit for the number to cover. But... sometimes formats cover "extra" -- so put in the count! Adding that code as well.

Thanks for the base!
FredW

On Friday, January 6, 2023 at 8:35:48 AM UTC-5 phat...@gmail.com wrote:

fridtjof.ma...@gmail.com

unread,
Jan 12, 2023, 8:45:05 AM1/12/23
to Altair-Duino
Ok, I've hacked in HDD_5MB_1024 format, and changed the pre-allocation to a count (instead of fixed 2).

I've attached it... I have not extensively tested this yet (and won't have time until next week). But it appears to
work.
altairdsk.c

fridtjof.ma...@gmail.com

unread,
Jan 12, 2023, 8:57:05 AM1/12/23
to Altair-Duino
I just posted an update to this conversation with changes to do 1024 dir entries.
As a note, FDD_TAR was the standard distribution for CP/M "back in the day".
It wasn't called that -- this was simply the single sided, single density soft sector
format, using FM modulation (aka IBM 3740 format).

But, in context of altairdsk, calling it FDD_TAR does make sense (for that hardware).

FredW
Message has been deleted

Paul Hatchman

unread,
Jan 13, 2023, 5:32:00 AM1/13/23
to Altair-Duino
Hi Fred,

Thanks for that. I'm wondering if this can be calculated, rather than setting a parameter? The naïve way of dividing the number of directories by the number of directories per allocation doesn't work for everything. I guess I'll do some digging in the CP/M source to see if I can work it out. But the additional parameter is the simplest way for sure.

I'll merge your changes in on the weekend. I'm thinking about whether there is a way to auto-detect, but I doubt there is a reliable way to do it.

The reason I was looking for a way to get it running under SIMH is that I have a test harness set up to load files in SIMH and altairdsk and compare the file checksums, disk space used etc. It's not really clear to me why it doesn't work. Maybe it is because image provided on github isn't the same size as a normal 5MB disk image. 

Cheers,

Paul
Message has been deleted

Walt Perko

unread,
Jan 13, 2023, 7:19:19 AM1/13/23
to Altair-Duino
Hi, 

Not sure if people are using this program "SDCardImage.zip".  It creates .DSK images, but it's kind of complex logic to create a .DSK

Google Groups doesn't let me attach the .zip file or anything else to the messages and a quick search online I cannot find the source where I got the program a couple of years ago.  
.
I do have it posted on this webpage:  http://www.brainless.org/Altair/Repository.html  


.


Paul Hatchman

unread,
Jan 13, 2023, 8:21:07 AM1/13/23
to Altair-Duino

I had a quick look and don't *think* this works for the Altair 8" CP/M disk format, as that MITS disks use non-standard 137 byte sectors, need sectors, track and checksum information written to the disk by software and also uses a non-standard track skew method.  It looks like it only writes standard 128 byte sector disks (similar to CPM tools).

fridtjof.ma...@gmail.com

unread,
Jan 13, 2023, 12:11:54 PM1/13/23
to Paul Hatchman, Altair-Duino
Paul

The CP/M disk parameter specification used a bitmap for the initial allocation vector. 16 bits, so a the directory could cover up to 16 allocation
units.

And... some of the BIOS implementations had it wrong! Note that the initial allocation did not need to match the actual number of
directory entries! And, indeed, with the BURCON 330k format, it doesn't! There is always one allocation unit that is never used!

Since BURCON allows 64 directory entries, and uses a 2K allocation -- Only one allocation unit is needed to cover 64 directory
entries! And, yet two are reserved! Because the CP/M 3740 (aka Tarbell) uses 1K allocation unit, it used 2 allocation blocks for
64 entries. BURCON copied that, but did not accomodate the bitmap change! (They should have changed 0C0H to 080H in
the BIOS). This means that allocation unit 2 is always available on the BURCON floppy! Track 2, logical sector 0..15 contain the
directory, Sectors 16..30 is not used). Which means -- afaik, 330k BURCON (MITS) CP/M has OS on Tracks 0 and 1, Directory
on 2, and Data from 3..76

But... half of Track 2 is available as "scratch"... and is accessible from the BIOS interface.

Anyway... that is why I made no attempt to "compute" the .da parameter, but just added it in... For my 1024 directory entry
HDSK format. I needed to cover 8 blocks... Note that the number of directory entries could have been extended to 2048
(by changing the BIOS mask to FFFF, ad .da to 16). I tried that, but it takes longer to search files! That is done linear
from directory block 0 to N 1024 was a (in my opinion) reasonble compromise.

Hope this rambling makes some sense!

FredW
--
You received this message because you are subscribed to a topic in the Google Groups "Altair-Duino" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/altair-duino/T_YdCbTqS6k/unsubscribe.
To unsubscribe from this group and all its topics, send an email to altair-duino...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/altair-duino/56e445c9-7d4c-4c8d-ab7b-a19ac3acae4fn%40googlegroups.com.

fridtjof.ma...@gmail.com

unread,
Jan 13, 2023, 1:06:54 PM1/13/23
to Altair-Duino
Paul

I concur... 128 byte sector *and* the MITS controller BURCON CP/M changes format. Track 0 to 5 in one format, 6 to 76 in
another format. Not something SDCardImage was ever intended for... The BURCON format was a "quick hack" to get
CP/M running on the MITS controller.. I believe done by a computer store in Texas


Is Mike Douglas' history -- I never used CP/M 2.2 on an Altair "back in the day". I did use CP/M 2.2 with
a Tarbell floppy on an IMSAI "back in the day". But MITS was gone by then, anyway...

Thanks again for filling in altairdsk to commodate the MITS 88-DCDD controller! And the gaps between
cpmtools and Mike Douglas' work!

Walt Perko

unread,
Jan 13, 2023, 4:07:31 PM1/13/23
to Altair-Duino
Hi, 

That explains all the problems I had when I tried making an 8MB disk for CP/M ... 

I didn't even think about the .DSKs as being either MITS DOS or CP/M compatible!  Now I need a set for MITS DOS like my blank CP/M BOOTable and completely blank CP/M compatible .DSK files.  


.
Reply all
Reply to author
Forward
0 new messages