📜 ⬆️ ⬇️

Infinitely profitable program

A recent article on Slashdot about how to program games in assembler for Atari ( Donkey Kong and I ) reminded of assembler applications that I wrote from my youth, and about the computers that we had then.

At first, I gained experience on the DEC PDP-8 , but the buzz began when CP / M appeared . CP / M was originally a “business operating system”, but it was also a system that one could afford to have at home — a serious thing for a young budding geek.

Then I worked at Tatung . They assembled computers, and so I had a chance to have some fun with a very expensive thing: two five-inch drives and so on! I mainly worked on debugging the ERSO BIOS. It happened to sit at the computer of Tatung Einstein , who used a compatible, but more sophisticated version of CP / M called Xtal DOS.

For a while, Einstein really was a great machine (until computers with MS-DOS took over). It launched all sorts of CP / M programs like VisiCalc, WordStar, etc.

Also, sound and graphics (colors and sprites!) Were built in there, so you could play around with toys. And all for 499 pounds (remember, it was the year 1984). By then the standards a lot!
')
Pete's Utilities

I wrote articles in Einstein magazines for Tatung (they are still lying somewhere). And he wrote commercial programs. The most successful was the software package, which I quite creatively called "Pete's Utilities" (1986).

The utilities were written in the Z80 assembler (I didn’t know about C yet) and included an undelete, hex editor, a program for hanging commands on function keys (resident!), An autoloader of programs, a printer controller, a typewriter emulator (yes, I actually used the word
'typewriter') and a bunch of other things. Sometimes I think about the fact that if I ported it all under MS-DOS, I could become Peter Norton (I suppose he earned a lot of money from Norton's Utilities , but I didn't)! I recently found a contract for Pete's Utilities: I received a whole pound for one copy.

For the sake of completeness, it is worth telling how the Pete Utilities were written. This is quite interesting and also conveys the spirit of the time.

I wrote them on a commercial machine with CP / M - another brainchild of Tatung (TPC-2000 is the rightmost computer in the picture).

!

On the left in the picture Tatung Einstein'y.

The TPC-2000 was faster than Einstein and had more memory, so my macro assembler worked on it much more efficiently. In addition, there was a “clean” CP / M, so I could be sure that I wouldn’t use any Einstein-specific features when developing. Having assembled the program on the TPC-2000, I ported it to Einstein using the special program Kermit. There I could test and debug it properly! A complete cycle of code / build / test of those times!

GO.COM

Users (both TPC-2000 and Einstein) often complained that they had to close the current application (VisiCalc, WordStar, etc.) in order to perform a simple disk operation, for example, to find a file on one of the n diskettes. This is really annoying. Imagine that you are running a popular word processor WordStar and you want to edit an existing file. Suppose you do not know which of a dozen diskettes it is on, that is, to find it you need to execute the CP / M - DIR builtin command. But for this, you first need to exit WordStar. Of course, when you find the file, you will have to run WordStar again from a floppy disk, which is terrible in itself, given the speed of the disk drive turtle (“chunk-chunk-chunk”, who remembers, he will understand)!

To solve this problem, I came up with GO.COM - perhaps the most successful and infinitely profitable program ever written.

When a program for CP / M is loaded into memory, it is always located starting from the same address, 0100h is the beginning of the so-called 'Transient Program Area' (TPA). Own CP / M programs, such as DIR, are loaded elsewhere.

I realized that since WordStar is still in memory (although the user left it, the TPA area remained unchanged), it would be quite useful to somehow restart it directly from the TPA instead of rebooting from a floppy disk. In fact, why load what is already in memory? To restart WordStar after doing DIR or something else, you just need to execute the code located at address 0100h. But how to do this? It is impossible to write a regular program containing, say, the instruction “go to address 0100h”, because this program will be loaded into TPA from address 0100h and will wipe what was there.

This is where GO.COM appeared.

GO.COM did not contain a single instruction, it was absolutely empty. However, although empty, from the point of view of CP / M, it was still a full-fledged program, so the CP / M bootloader (the part of the system that reads the program from the disk and places it into the TPA) quietly loaded it.

How could this help us? Consider the following scenario:


So GO.COM, which consisted of 0 bytes of code and sold for 5 pounds per copy, turned out to be the most profitable in the world - any other program brought in much less pounds per byte!

Was it infinitely profitable? Well, if we talk about how much I earned on it, then of course not - I am not infinitely rich. However, GO.COM can actually serve as an example of getting “money out of nothing”. For example, the price per byte can be calculated as follows:



I remember funny phone calls and letters about GO.COM (there were no emails then). Some buyers who, obviously, “understood computers”, called Tatung and asked me to find out how and why I hide the size of the program (the DIR showed that it contained 0 bytes). When I told them that the program really took 0 bytes, some began to resent: “How dare you take 5 pounds for nothing ?!” I replied that they were wrong: they got a useful thing in return.

It is a pity that the command interpreter CP / M did not contain more built-in commands. There were quite a few useful disk commands:


Later, I ported GO.COM to early versions of MS-DOS — until the .EXE format appeared. And she worked great there too!

From the translator: thanks to KVie for editing the translation.

Source: https://habr.com/ru/post/147075/


All Articles