← Back to Courses
module
38

Appendix VIII - Running your game on a real Einstein

Everything in this course has run in the emulator, and for learning that is the right place: a second between pressing Run and seeing the result, and nothing to wear out. But a game you have finished deserves the machine it was written for, and getting it there takes one extra step: a disc.

A real Einstein boots from a floppy disc in drive 0. Most machines still running today have had that drive replaced with a Gotek, a small unit that fits in the drive's place and reads disc images from a USB stick instead of spinning a disc. So the job is: turn your finished .COM file into a disc image the Einstein will boot from, copy it to a stick, and switch on.

This appendix is optional. Nothing later in the course depends on it.

What you need

  • A Tatung Einstein with a Gotek fitted as drive 0, and a USB stick for it.
  • Your finished game, assembled. If you followed S30, that is MAIN.COM, sitting beside main.asm in your project folder. For a single-file game it is the source's name, uppercased, with .COM on the end.
  • The disc tool, described next.

The disc tool

The tool is a single Python script, einstein_dsk.py. It creates blank Einstein disc images and puts files onto them, and it can make an image that starts a program by itself when the machine is switched on.

It is coming to the Downloads page shortly, alongside the extension. Until it is there, the steps below can be read ahead but not yet followed.

It needs Python 3. If python3 --version in a terminal does not print a version number, install it the same way you installed the assembler in S2:

brew install python

Build the image

Open a terminal in the folder that holds your .COM file, and run:

python3 einstein_dsk.py create rockfall.dsk --boot MAIN.COM

Three things happen. A fresh, empty disc image called rockfall.dsk is created. MAIN.COM is copied onto it, exactly as a file on a real disc. And a small loader is written to the disc's first sector, which the Einstein runs automatically at switch-on: it reads MAIN.COM into memory at address 256 - the address every program in this course has been assembled for - and jumps to it.

That last part is what makes the disc self-starting. No disc operating system is loaded and nothing has to be typed: the machine's own built-in software boots, finds the loader, and hands over to your game. Your game only ever asked the machine for things through RST 8, and those calls live in the built-in software, so it has everything it needs.

You can put other files on the same image if you want them there - a text file, a second game to load by hand:

python3 einstein_dsk.py add rockfall.dsk NOTES.TXT

Only the file named with --boot starts automatically. The Einstein's disc format has a single directory with no folders, so everything you add lands in one flat list.

Try it in the emulator first

Before touching the real machine, boot the image in MAME the way S2 booted the bare machine, with the image in drive 0:

mame -rompath ~/roms einstein -window -skip_gameinfo -flop1 rockfall.dsk

What you should see

The *** EINSTEIN *** banner, and then your game - with no "Insert disc in drive 0" prompt in between, because there is a disc in drive 0 and it knew what to do. If the prompt appears, the machine did not find the loader: check that the create command reported it had made the disc bootable, and that you passed the .COM file, not the .asm.

Onto the Gotek

Copy rockfall.dsk onto the USB stick, put the stick in the Gotek, select the image on the Gotek's display, and switch the Einstein on. The same banner, the same game, on the machine it was written for.

The image is the same file in both places. Change the game, rebuild the image, copy it across again. There is nothing to convert.

Going further

Appendix VII describes the disc format the tool writes: the tracks and sectors, the directory, and how a file is scattered across the disc. None of it is needed to use the tool, but it explains what create and add are doing, and it is where to start if you ever want your game to save a high score to disc.

Get the Newsletter

New guides, disk images and community finds, roughly once a quarter. No spam, we promise, this isn't Tatung's marketing department.
Your subscription could not be saved. Please try again.
Your subscription has been successful.

Newsletter

Subscribe to our newsletter and stay updated.