M20 Olivetti M20

How to read and write disk images for the M20 system

The disc format used by the Olivetti M20 is rather peculiar. The differences between the PCOS format and the MS-DOS one makes rather cumbersome to share file and data between the two systems. Anyway, in the mid-80 and more recently, several authors have written software able to read and write PCOS disks from a MS-DOS machine with a 360kB drive. For technical reasons, 1.2MB drives do not work.

You have a few possible solutions:
  • Using the RDM20 and WRM20 commands
  • Using PCOSFILE.BAS and FILE-DOS.BAS under GW-BASIC and a PC
  • Dave Dunfield's ImageDisk
  • Using Teledisk
  • Using dd and sdd commands under Linux
We will describe all of those strategies.

RDM20 and WRM20

by Dwight K. Elvey

This first solution available is based on three programs contained in this packet . They are able to read and write a disk image of a 320kB PCOS disk and to format a M20 disk on a MS-DOS based computer. 640kB disks cannot be copied with this program. The main problem is that the PCOS formats the track 0 as 128bit/sector using MF. This is a format which can not be used by standard controllers present in IBM compatibles. The other tracks are formatted as 256bit/sector with MFM and can be treated by PC drives.

Many bugs and enhancements have been fix and changed. This file is for release 6/20/06. If you've had troubles in the past on your machine with these programs, you may find that it now works correctly on your machine.

For enhancements:

  • If you have a controller that handles FM, both WRM20 and RDM20 will transfer the first track. This may or may not be what you want for your situation.
    • If using WRM20 with the 0 option and the image file does not have a proper first sector in track 0 it aborts the operation.
    • If the image has an incorrect first sector compared with the rest of the image, you may want to keep the first track from the PCOS formatting of the disk. In this case, don't use the 0 option with the WRM20.
    • If your PC machine errors on RDM20 with the 0 option, do not use this option for RDM20 or WRM20. RDM20 uses a default first track that may or may not be compatible with the rest of the image so keep this in mind when using WRM20 with the 0 option on a FM compatible PC machine
  • WRM20 requires that you still use a pre-formatted disk with the PCOS format. It does not format the disk, even with the 0 option. If your controller supports FM try using FTM20 first to preformat the disk.
  • RDM20 and WRM20 do not currently work right if the image file is on another floppy. Transfer to and from the hard disk only! I'm working on this problem but I've not found a good solution yet
  • When using RDM20 make sure to start with a good disk. It will abort on a bad sector read or may just hang. Even though the disk may seem to function on the M20, it may have a bad sector not currently used by the M20. I recommend also formatting a fresh disk with vformat and then copying the files with fcopy *.*. Do not use vcopy. This may simply copy the error to the new disk.
    I may add future enhancements that would allow it to skip bad sectors but for now, that is how it is. This would be useful if the information can't be recovered any other way
  • As with all my programs, you may see usage by entering the commands, WRM20 or RDM20, without parameters.
  • If you have failures, I have debug messages that can be printed out. If you have a "d" or "D" as the last character on the line, separated with a space, it will display a bunch of hex values. For the most part, these only have meaning to me.
    If you experience problems, you can display these values and send me the last 100 or so values. It will help me to improve my program if I can understand where it is failing on your machine. You can mail to DKnospamELVEYatnospamHOTMAILdotCOM. You'll need to fix my address first. If I'm no longer using that address, a search of the web will often find me.
  • Use these programs in pure DOS, not in a DOS window under Windows. You must first boot to DOS on your PC!!!! Use a DOS boot floppy if needed. DO NOT BOOT TO WINDOWS and expect these programs to work!!!!
  • WRM20 and RDM20 only support 320K
  • If your controller supports FM, you can use FTM20 to preformat the disk for WRM20. If it does not support FM, you'll need to preformat the disk on a M20 with the vf command.

Carlo Merlano describes his experiences in using Dwight's utilities:

The PC used to transfer the disks The computer on which I could use the programs is an 8086 based assembly, with 640kB of RAM, a 8087 mathematical coprocessor (I believe it is unnecessary for this operation), a 720kB drive (A:), a 360kB drive, a MFM 20MB hard disk and MS-DOS version 3.3 plus. It is not a general rule, but often 360kB disk drives are black.

The PC used to transfer the disks On the PC monitor, it appears the confirmation that everything was OK! I first transferred on disk the 2.0 PCOS, as the version 4.0 I own requires at least a 128kB RAM memory expansion.

You can find the detailed description in Carlo's pages

PCOSFILE.BAS and FILE-DOS.BAS

(Many thanks to Luigi Serrantoni and Ettore Migliori)

A second solution was a program written by Ettore Migliori in GWBASIC, which ran on a M24 with a 360kB disc drive and a 20MB hard disc, and was prepared in order to read PCOS 1.1a floppies. You can download it here. Ettore wrote two tools:

PCOSFILE.BAS reads a disc with a PCOS filesystem and create a file named PCOS.DAT, containing the disc image. The sector access of the disc was made using some lines in assembly language. The default drive is A: and all the work was inspired by Peter Norton's books. With the M24, the conversion was done in 20-25 minutes.

FILE-DOS.BAS is instead dedicated to the extraction of files contained in the disc image PCOS.DAT. As PCOS and MS-DOS used different file naming conventions, the auxiliary file PCOS.DIR is created, containing the PCOS file listing and other information. For space and speed reason, the program can extract up to 112 files, which was the limit of old versions of MS-DOS. Deleted files are extracted and their name begins with @.
This second pass is faster. On the M24, it was executed in 2 or 3 minutes.

The author has tried using this programs on newer machines. On a Pentium 200 PC, with a TX mainboard and with a 360kB floppy, he has confirmed the possibility to run these programs, using the Windows 95 DOS prompt and the GWBASIC 2.0. FILE-DOS.BAS is compatible with the QBASIC.EXE you can find in the installation CD of Windows 95. PCOSFILE.BAS does not work with QBASIC, as the assembler calling convention has changed from GWBASIC.

Dave Dunfield's ImageDisk

ImageDisk is a general purpose disk image utility written by Dave Dunfeld. It is possible to use it with M20 disks, but one needs to be careful about the 0 track, since MF is not supported by all controllers. Anyway, you can find all relevant information about the use of this utility on Dave's pages.

Teledisk

Teledisk is a program which reads a floppy diskette into an image file on the PC, and can recreate a nearly exact copy of the floppy at a later date from that image file. It can be used for M20 disks, but it is a closed source commercial software which is no longer sold by its former vendors. There is some useful information in Dave Dunfeld's Teledisk pages.

Disk images under Linux: dd and sdd

by Christian Groessler

In order to read and write real M20 floppies, a dd like tool which supports skipping (not by reading and discarding, but by seeking) the input and output files is needed. I use sdd by Jörg Schilling, you can find it on this ftp site.

fdutils-5.4 for Linux, you can get it from here. The fdutils are needed to access non-standard (e.g. 256 byte sectors) floppies, like those used on the M20.

On NetBSD, you'll need the patch in PR15199 to access non-standard floppies.

Reading and writing diskette images

After installing fdutils and sdd, you can get an image of an existing M20 floppy by issuing the commands

# set floppy parameters (here we're using the 2nd drive)
# do this after inserting the disk into the drive
setfdprm /dev/fd1 OLI320
# read diskette image
sdd iseek=4096 oseek=4096 if=/dev/fd1 of=m20disk.img bs=256 count=1104

Please note that we're skipping the first 4096 bytes of the floppy. These are the blocks of Track 0/Head 0. Track 0/Head 0 is formatted in FM mode, which isn't readable by many PC floppy controllers.

This is no problem when reading existing M20 floppies as there seems nothing important to be stored in this area. I was able to read all files of a full disk without reading this area.

It _is_ a problem when creating new disks on the PC as the M20 doesn't accept disks where this area is formatted differently. So you cannot create new M20 disks on the PC. What is possible is to format the disk on the M20 and then write a new image to it on the PC.

The command to write a new/modified M20 image to floppy disk is something like this:

# set floppy parameters (here we're using the 2nd drive)
# do this after inserting the disk into the drive
setfdprm /dev/fd1 OLI320

# write image to diskette
sdd iseek=4096 oseek=4096 of=/dev/fd1 if=m20disk.img bs=256 count=1104

In the time between reading the image and writing the image back you can modify the image's contents with the supplied "m20" command :-)

Page log

  • December 24, 2022 - Added the page log, correction of typos, verification and correction of dead links.
  • May 1, 2007 - Page creation.

M20 lineart decoration

UpdatesUpdates


Search in the M20 site
Search in the Internet