Inside the Einstein: The Disc, a TatungBytes course: XtalDOS listing the first practice disc image, on a rainbow sunburst
← Back to Modules
module
27

Where You Go From Here

What You Have Built

edisc.py is one file of Python that can take an Einstein disc image apart and put one together:

  • check that an image is what it claims to be, in either form of the container;
  • walk its tracks, read its sector lists, and fetch any sector by track and ID, whatever order the sectors are stored in;
  • read the directory, decode every entry - both widths of block number, the lock, the extents - and list the files exactly as the Einstein's DIR does;
  • turn block numbers into sectors, read whole files across extents, show text and copy anything off;
  • build a blank disc from nothing, find free space, add files of any size, rename them, and remove them - and every one of those changes is accepted by the Einstein's own disc operating system.

And you know why each byte is where it is. That was the point.

Projects

Each of these is a section's worth of work, using nothing you have not seen.

  • add --text. A switch that turns a file's line endings into 0D 0A before it goes on the disc (S22). argparse has action="store_true" for switches that are either there or not.
  • recover. S24 showed that a deleted file's entries and data survive until something reuses its blocks. Write a command that lists deleted files, says whether any of their blocks has since been given to a live file, and extracts the ones that are whole.
  • copy. Take a file from one image and add it to another, without an extract and an add in between.
  • Writing the standard variant. create --standard: the same tracks, the other header (S8).
  • Two-sided wrappers. Some programs save a one-sided Einstein disc as if it were two-sided: the header says 2 sides, the size table has 80 entries, every second one is 0, and only the 40 real tracks are in the file. MAME is happy with them; S25's edisc.py refuses them. Teach it to recognise the shape and read the real side.
  • A check command. Everything S25 tests, plus the directory: entries pointing at blocks beyond 94, two files claiming the same block, extents missing. Report it all instead of stopping at the first fault.

The Parts This Course Left Alone

  • Tracks 0 and 1. They hold what the Einstein starts up from. When the Einstein is switched on with a disc in drive 0, its ROM reads track 0 and runs what it finds there - XtalDOS, on a system disc. Making a disc that starts a program of your own is a matter of Z80 code as much as bytes, and this site's Z80 assembly course is the place to start.
  • Writing from the Einstein. The Einstein in MAME cannot change a .dsk image. MAME can write to its own .mfi disc format, which holds the disc as the magnetic pattern on the surface rather than as sectors. That is a whole subject of its own.

Where Else On This Site

The other courses on TatungBytes teach the Einstein itself - Z80 assembly, C, Turbo Pascal, the BASICs, Dr Logo - and every one of them uses disc images. Now you know what is in them.

Thank You

If you found a mistake, got stuck, or built something with edisc.py, we would like to hear about it.

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.

This form is protected by reCAPTCHA, and the Google Privacy Policy and Terms of Service apply.