Since a while, the Multiple Arcade Machine Emulator (MAME) 1 has a driver for the Olivetti L1 M20, enabling MAME to run M20 floppy images, boot PCOS and execute programs2, almost like on the original machine. This article is based on MAME v0.212 on Linux Mint 19.2 (Aug 27th 2019).
After installing MAME, one needs to separately download the M20’s ROM contents (e.g. m20.zip from wowroms3). For legal reasons, most ROMs are not included in MAME 4.
Floppy disk images can be sdd/ rdm20-img (M20 floppy-sector-dumps), Teledisk-td0, or ImageDisk-imd files, as found in the disk images section. Most of these images will run right away.
Disk images can also be (converted to) MAME-mfi format image (e.g. system disk or games disk). In MAME < v0.212, only mfi-images are writable.
To get started right away, download ROM data and floppy images into a local directory and run:
$ mame m20 -bios 0 -rompath . -flop1 <image1> [-flop2 <image2>] [-cfg_directory ~/.mame/cfg] [-window]
MAME currently supports the following M20 bios versions:
Not all images are running with MAME right away. When imaging real M20 floppies, the first 4096 bytes (Track 0/ Head 0) are not readable by many PC floppy controllers and then need to be skipped. This is the case with most rdm20 disk images in the disc images section. It is however possible to transfer Track 0 information from one image to another, to make the image usable with the M20 emulator. The file pcos102.img for example has Track0 data which can be used. Transfering it to another image using dd:
$ dd conv=notrunc if=pcos102.img of=startrek_en.img bs=4096 count=1
After this, startrek_en.img can be loaded as flop1 into MAME and will boot and run.
Use e.g. hexdump to find out if an image has a missing Track0. The first bytes of the file would then be all zero, and the image would need a transplant:
$ hexdump startrek_en.img |head -n 1 0000000 0000 0000 0000 0000 0000 0000 0000 0000 $ hexdump pcos102.img |head -n 1 0000000 0401 2300 1002 0001 0a00 c400 8600 001e
MAME supports reading multiple floppy image formats: mfi (MAME floppy image), img (M20 floppy sector dumps, we will also call this format “M20”), imd (Image Disk), td0 (Teledisk). Only some of these images are writable in MAME:
MAME supplies a tool6 for converting between these different formats, with the same limitations for write support, e.g.:
$ floptool convert IMD MFI floppy1.imd floppy1.mfi
will convert an ImageDisk floppy image into a writable MAME floppy image.
Alternatively, load the image to be converted and an existing mfi image into the emulator. If you want to create an new mfi image, boot from your existing image, then open the file manager (Scrl-Lock, TAB) and chose “create” in the second drive. One of the two images needs to be a system disk in slot0, be able to boot into PCOS, and contain the vcopy tool (see M20 PCOS and BASIC command reference). The source image needs a correct Track0 as described above. When in doubt, use the provided system disk in slot0 and copy over it. Then boot PCOS and copy the source image over to the target .mfi image.
$ mame m20 -rompath . -flop1 pcos20german.mfi -flop2 startrek_en.img
On PCOS, copy flop2 (1:) over flop1 (0:):
0> vc 1: 0:
In order to retrieve files written to floppy images, the image needs to be converted back into the M20-format. Again you can use floptool (>= 0.212). If your OS ships with an older version of MAME, consider compiling it from source.
$ floptool convert MFI M20 floppy.mfi floppy.img
A regular M20-img file can then be read with m20floppy.
Note that BASIC files are usually saved in a compressed (big endian) binary format. In order to save them as ASCII files, which can be exported to a PC, save files under PCOS BASIC with the “A” option:
# SAVE "0:<filename>",A
The latest version of MAME is the github master branch7. On Linux just type “make” in the checked out tree. To compile floptool etc. as well, type “make TOOLS=1”.
Christian Groessler has a fork of MAME on github8 which only compiles the M20 driver and hence compiles significantly faster. Compile it with “make SUBTARGET=m20”.
On a real M20, with the 8086 addon board, you can boot MSDOS. This also works with MAME, by selecting bios >=1 and the msdos floppy image from the disk images section.
$ mame m20 -bios <1, 2> -rompath . -flop1 msdos.img
When asked if you want to boot the alternative CPU (8086), press “y” to boot into MSDOS.
Run mame with the follwing extra arguments:
$ mame m20 -rs232 null_modem -bitb socket.127.0.0.1:4321
0> rs232 0> +scom: 0> +dcom:
Then connect to the socket with e.g. telnet
$ telnet 127.0.0.1 4321
The keyboard layout depends on the language of the loaded PCOS. M20 special keys are usually:
ScrollLock toggles between emulated keyboard and MAME keyboard. ScrollLock + Tab9 opens the MAME in-game settings menu and can be used to modify the key mappings. If you don’t have a Scroll-Lock key (e.g. laptop) you can change the “UI toggle” to another key by opening MAME:
$ mame [-cfg_directory ~/.mame/cfg] [-window]
and selecting -> Configure Options -> General Inputs -> User Interface -> UI Toggle. It makes sense to specify a consistent config directory, as MAME might decide to pick different config locations when called with different options.
While you are at it, look into other useful options, like recording screenshots (F12) and recording video (LSHIFT + F12).
This little BASIC program can be used to compare different key combinations with the key code tables in the command reference manual.
0 REM return decimal and hexadecimal values of pressed keys 10 CLEAR 20 G$=INKEY$: IF G$="" THEN GOTO 20 30 PRINT ASC(G$) HEX$(ASC(G$)) 40 GOTO 20
https://github.com/groessler/mame.git, branch "m20-mame" ↩︎