Breakout, the game the course builds in HiSoft C, running on the Tatung Einstein: coloured brick rows, the bat and the ball on a black court
← Back to Courses
module
2

C On The Einstein, Honestly

Introduction

Before you type anything, you should know what you are dealing with, and this is a better story than most: the C you are about to use was sold for this machine, by a British firm, with an Einstein library in the box. That is rarer than it sounds. This section says what is known about it, what it replaced, and what nobody knows, and each paragraph says which document it comes from.

Where The Compiler Came From

HiSoft was a small software house in Dunstable that made programming tools for the Z80 home computers - a Pascal, an assembler, a Modula-2, a Forth, and this C. Its manual, in its second edition of May 1988 (the first was July 1985), lists the machines it ran on across the title page: the Amstrad CPC, "any CP/M system with at least 38K TPA", the MSX, and the Tatung Einstein. A page of notes for Einstein owners follows: the compiler runs under the Einstein's own DOS; make a backup with BACKUP and COPY; run FIXDOS to patch a bug in the DOS that upsets the editor's installer; and "an extra library of useful functions is supplied for Einstein owners called EIN.LIB; see EINLIB.HLP for information".

Both of those files are on the course disc, and EINLIB.HLP opens with "Library Functions for Einstein Computer (Hi-Soft C +++)" - a library of screen, colour, graphics, sprite and sound functions named after the commands of the Einstein's BASIC, so that anyone who knew CLS and PLOT and SHAPEDEF would know what cls() and plot() and shapedef() did.

The compiler itself signs on as version 1.35, copyright 1985. Its manual is candid about its ancestry: it "was originally written entirely in BDS C", Leor Zolman's well-known CP/M compiler, and rewritten in assembler "to achieve the size", and it was "designed to be very close to the language described in" Kernighan and Ritchie's book, with a chapter that lists, section by section against the book, every place it is not. Two books of the day taught C with it: Adam Denning's C at a Glance and Mark Harrison's Practical C for the Home Micro, both 1985.

The editor that came with it, ED80, was HiSoft's programmer's editor "for all CP/M computers", with its own manual, and the course disc's copy carries a patch file headed "for use with Hisoft ED80 and MON80 and the Tatung Einstein".

A Note On The Editor

The course disc's copy of ED80 has one peculiarity you will meet in S5: its commands are on the GRPH key instead of CONTROL, which is how HiSoft's installer lets an owner set it up. The course uses it that way.

The Other C

There was one other C compiler in the collection when this course was planned: C/80, from The Software Toolworks in California, 1983 - a generic CP/M compiler that ran on the Einstein because the Einstein's DOS runs CP/M programs, but knew nothing about the machine. The first draft of this course was written for it. C/80 compiles to assembly language and needs a second program to finish the job, has no typedef, no void, and a %% in printf that eats an argument. It is mentioned here so that you know what the alternative was.

What Einstein Owners Had

The UK Einstein Users Group ran a public domain library, and its catalogue survives on disc. It lists, across some three hundred discs: a Small-C compiler on five of them, "a valuable stepping-stone to standard C"; a C interpreter "for anyone ready to move up to the exciting world of C"; two toolkits of C source; a fourteen-chapter C tutorial, written for the IBM PC but "useful for Einstein users who want to learn C"; and programs written in C. So the tools were there, and so was the interest. What is not on record is how many people used them. Whether anyone wrote C on an Einstein in 1985 we do not know. A few probably did. Most owners, then as now, wrote BASIC.

What The Screen Did To C

C is full of curly brackets, and the Einstein's own character set draws the code for { as ¼ and } as ¾, \ as ½ and | as a double bar. That is not the emulator; it is the machine, and an owner writing C on the ordinary 40-column screen saw main() ¼ and got used to it.

Owners with the TK02 80-column card saw something else. Its manual describes a "modified character set for standard 80 column use", supplied switched on, in which exactly those characters become {, }, \, [, ] and ^. So a C programmer with the card and a monochrome monitor had proper braces on an 80-column screen - and ED80, an 80-column editor, at its best - and one without had fractions on a 40-column one. This course teaches the 40-column screen, which is what the emulator shows and what every Einstein has.

What Nobody Has

There is no Einstein-specific C manual beyond HiSoft's page of notes and EINLIB.HLP. HiSoft's manual is a good one - a tutorial, a language reference, the library, every error message - if you can find a copy; but it was written for four machines at once, and it describes version 1.2 in places where the disc is 1.35.

That is why this course was written the way it was. Every statement it makes about what the compiler or the machine does was tried on the compiler and the machine first, and where something could not be tried, the course does not say it. When the course tells you that a char here is never negative, or that a function called with the wrong number of arguments stops the machine, or that #if is not a preprocessor command, it is because a program was written to find out and the answer was read off the screen. Where this course and the manual disagree, the course is describing the disc in front of you.

What You Are Missing

Two things, both said plainly by the manual and confirmed by the compiler:

  • No fractions. float and double are "not yet implemented"; type one and the compiler stops with RESTRICTION: Floating Point not implemented. Every number in this course is a whole number.
  • No numbers past 65,535. long is accepted and is the same size as int, sixteen bits. There are unsigned numbers to 65,535, and that is the top.

Summary

HiSoft C was sold for the Einstein in 1985, with an Einstein library and an editor patched for the machine. Einstein owners had C tools in their library; how many wrote C is not known. The course was written from trying things, and says so. The screen draws braces as fractions unless you have the 80-column card, and there is no floating point and no 32-bit number.

Next

S3, Setting Up - the emulator, the ROM and the disc, and the compiler signing on on your own machine.

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.