Article

How do you implement a random-access database when you don’t have random-access external storage?

The Old New Thing ·The Old New Thing ·Published 2026-11-03 ·5 min read

This article discusses a clever method used in an Apple ][ telephone directory program to manage a database using only cassette storage. It explains how the program utilized self-modifying code to store and retrieve user data.

From the article

The mystery comment investigated by Beej’s Bit Bucket reminded me of a similar trick in an Apple ][ telephone directory program.

The base Apple ][ was sold without a floppy drive. The only supported external storage device in the base unit was a cassette I/O port. Yet there was a database program for digitizing your phone list.¹ How did it do database stuff when the only I/O was a cassette drive? It could not programmatically start or stop the tape, or programmatically rewind or advance it.

If you took a listing of the program (which was written in BASIC), it began with a comment block saying not to edit any lines before line 1000. And then you saw your own telephone directory stored in DATA statements.² Followed by a bunch of dummy DATA statements. And then the program began.


Share this resource


Discovered 2026-11-04 Source The Old New Thing Archive 2026-11 →