The Apple-1 Software Library Beta

Browse all the Apple-1 programs that ever existed. A tribute to history and their hackers.
Run them in any emulator, or instantly on the (real) machine.

Hamurabi

by David H. Ahl in 1971

Rule as the King of Sumeria in this economic simulation game.

apple tapebasicwithin 8k

Also referred to as Hammurabi. Sold by Apple Computer on cassette tape for $5, order code A1T005X.

History

The game was ported to BASIC by David H. Ahl around 1971 and published in 101 BASIC Computer Games around 1973. It was developed at DEC originally, in the FOCAL programming language on a PDP-8 minicomputer, back in 1968.

This article on Wikipedia gets into more detail:

In 1968, however, Digital Equipment Corporation (DEC) employee Doug Dyment gave a talk about computers in education at the University of Alberta, and after the talk a woman who had once seen The Sumerian Game described it to him. Dyment decided to recreate the game as an early program for the FOCAL programming language, recently developed at DEC, and programmed it for a DEC PDP-8 minicomputer. He named the result King of Sumeria. Needing the game to run in the smallest memory configuration available for the computer, he included only the first segment of the game. He also chose to rename the ruler to the more famous Babylonian king Hammurabi, misspelled as "Hamurabi". Dyment's game, sometimes retitled The Sumer Game, proved popular in the programming community: Jerry Pournelle recalled in 1989 that "half the people I know wrote a Hammurabi program back in the 1970s; for many, it was the first program they'd ever written in their lives".

Around 1971, DEC employee David H. Ahl wrote a version of The Sumer Game in the BASIC programming language. Unlike FOCAL, BASIC was run not just on mainframe computers and minicomputers, but also on personal computers, then termed microcomputers, making it a much more popular language. In 1973, Ahl published BASIC Computer Games, a best-selling book of games written in BASIC, which included his version of The Sumer Game. The expanded version was renamed Hamurabi and added an end-of-game performance appraisal.

Instructions

Several resources have to be managed in this game: people, acres of land and bushels of grain. The computer asks questions and the player has to answer them with a number. In the book 101 BASIC Computer Games Hamurabi is introduced as:

In this game you direct the administrator of Sumeria, Hamurabi, how to manage the city. The city initially has 1000 acres, 100 people and 3000 bushels of grain in storage.

You may buy and sell land with your neighboring city-states for bushels of grain, the price will vary between 17 and 26 bushels per acre. You also must use grain to feed your people and as seed to plant the next year's crop.

You will quickly find that a certain number of people can only tend a certain amount of land and that people starve if they are-not fed enough. You also have the unexpected to contend with such as a plague, rats destroying stored grain, and variable harvests.

You will also find that managing just the few resources in this game is not a trivial job over a period of say ten years. The crisis of population density rears its head very rapidly.

Winning Strategy

Spoiler alert! Efforts of Jeff Quast found a winning strategy for this game:

The winning strategy is to systematically starve 3% of the population each turn, to wish for plagues, and to leave as little food as possible available to be eaten by rats by buying land with any excess grain (and selling land to make up for any deficiencies).

With this strategy you can win 99% of games, 94% of them with the highest score.

References

Screenshot of Hamurabi

Historical reference : hardware

In 1976, the Apple-1 Computer was advertised for $666.66 and came with 4K of on-board memory. For a $120 extra, this doubled to 8K of RAM. The provided Operation Manual included the circuit diagram and assembly code of the monitor program.

The Apple-1 Computer main board
The Apple-1 Computer main board.

The Cassette Interface (or ACI) was used to load and save programs from cassette tape. The ACI Manual showed how to install it (the main board had to be jumpered correctly) and explained how it had to be used. Priced at $75, it included a cassette of Apple BASIC.

The Apple-1 Cassette Interface or ACI
The Apple-1 Cassette Interface or ACI.
Cassette with Apple BASIC
Cassette with Apple BASIC.

Software

Its BASIC was written by Woz himself. It did not support floating point arithmetic, but was tiny enough to fit in 4K of memory. The software itself was free. The Preliminary Apple BASIC Users Manual explained how to write your own games and programs with it.

Cassette tapes could be bought as an original accessory to your new Apple-1. A total of nine programs were available and listed $5 each. Pick one below and go back in time.

At the time, people were also inspired by publications like 101 BASIC Computer Games. They spent their evenings and nights to key-in the games, but soon were disappointed to discover that some of these did not work at all because of the missing floating points... Arghh.

Dive deeper? Read more here and here.

How to emulate?

It is easy to run the software with one of these emulators:

View a comparison of emulators here.

...and run a program

First, start the emulator of choice and have it run Wozmon (or BASIC), then use the Wozmon button to copy-paste the program code into the emulator.

For example: open Apple 1js in another browser tab. Hit CLS to clear the screen and RESET to enter Wozmon. Then paste the copied Wozmon code from this website.

In-website transfer to an Apple-1 Available soon

This website can connect directly (and locally) to the Keyboard Serial Terminal from 8BitFlux.com. It uses the Web Serial API for this and is supported by Chrome or Edge browsers. The Wozmon code of any program can be transferred quickly.

The Keyboard Serial Terminal connected to an Apple-1
The Keyboard Serial Terminal connected to an Apple-1.

Use the Serial button to transfer the current program to the Apple-1. For example, BASIC takes around 20 seconds to transfer at a speed of 57.6 kbps. The board is compatible with the higher-speed TurboType™ format (with CRC check).

After the transfer of the game or program, switch over to the normal Apple-1 keyboard (by pressing a button) and enjoy it. This makes also a great kit for museums and public events. Kits available soon »

Further exploration


Credits

This library is an initiative of 8BitFlux.com. It can be put to full use with a Keyboard Serial Terminal adapter board, which let you run software instantly on a (real) Apple-1.

Many thanks to Uncle Bernie for his support and provision of his TurboType™ algorithm, which is part of his Apple-1 Toolchain.

Last but not least, all this was not possible by all the authors of Apple-1 software and emulators. The hobby computer enthusiasts of the past, but also people of the present, who keep this hobby so alive. Thank you all.

Disclaimer

This website is not associated with Apple Inc. in any way.

It tries to be a tribute to (their) history. It wants to list only software that is already considered to be in the public domain, or its license permits further publication. The (online) sources of the program and other references are listed when known.

Mistakes happen, as this website is not generated by any AI, please report any nonconformities.

Like it?

Buy me a ☕ coffee.

Check out my products, or just spread the word! Incorrect or missing content can be reported here. Thanks!

No trackers and zero cookies 🍪

Made behind an 🍎 in The Netherlands.