Abnormal programming
Assembler
Demoscene
Old hardware
29 January

Making a demo for an old phone — AONDEMO

I wanted to make a demo ever since I saw the classic Polish mega demo Lyra II for first time in 1997. I also wanted to do something for the largest Russian demo party Chaos Constructions for a long while, but have never gotten around that, being occupied with other duties. Finally, in 2018 the time has come, and I fulfilled both desires at once, Van Damm's double impact style — made a demo called AONDEMO that entered ZX Spectrum 640K Demo compo at Chaos Constructions.


I bet the red thing you've just seen does not look much a Spectrum to you. Here's the story.


In Soviet Russia


For a long time consumer electronics market of Soviet Union was lagging behind the contemporary world by a good decade. It didn't have much of advanced tech to offer, and until late 80s it was a country of rotary dial phones, vacuum tube based TV sets, and vinyl turntables. Near the dissolution of the Union, the borders started to get loose, allowing some of foreign electronics to get it, while local makers started to attempt to satisfy raising public demand by creating similar products, so all kinds of technical wonders, such as VCRs, home computers, and even things as basic as a push dial phone, started to be more and more accessible to the general public.

Around 1989 a new device appeared on the radio markets, starting to gain popularity. Widely known by the acronym AON, which roughly translates as «an automatic caller identifier», also referred to as «electronic secretary» in the manuals, it basically was a remote ancestor of the modern smartphones — a microprocessor powered landline phone that was able to identify and display numbers of the incoming calls by exploiting functionality of the phone stations meant for special purposes rather than public use. The phone logged incoming and outgoing calls into a journal, had a phone book that allowed to categorize calls, assign them different melodies, block some unwelcome calls, use alarms, night mode, quick dials, redials, and so on, and so forth — a very feature packed thing for its time.

During 15 years of its popularity it had quite a history. Started out as a creation and side job product of amateur individuals — usually students, or unemployed electronics engineers (those were difficult times in Russia), who often happen to produced handmade ZX Spectrum clones, too — public demand soon helped to turn it into somewhat legit private businesses, and some of them eventually grew up into large official enterprises. In the middle of 90s AON phones found their way into about every other home, up to the point that many phone users were familiar enough with it to be able to distinguish the presence of AON just by the way the status tones sounded. This popularity lasted into early 2000s. The decline was influenced by the fact that landline operators, being not happy with increased load on their special equipment, first attempted to turn caller ID service into a paid option, then completely replaced it with a newer incompatible European standard. With following rise of the cellphones that came quickly after, landline services became a technological underground, where remains of its hideous consumer market occasionally see releases of modern «premium» versions of the AON descendants, such as Paliha, to this very day.

Community of AON makers in its inception days was much alike Russian home computers community of the time, kind of its alternate, vaguely interconnected reality. It shared the same amateur radio roots, similar hardware and interests, similarly fashioned approach to the wild development and homebrew manufacturing processes (such as putting new PCBs into existing phone bodies). Much like ZX Spectrum game development scene in the UK, it brought country wide fame to some of the makers despite them being very young. For one, Pavel Sukhodolsky, who programmed the most popular AON firmware Rus, was just 15 at the time.

Phone phreaking, hacking to borrow each others pieces of code, naive copyrights and their violation, messages to the competing parties hidden in the binary code complete with FidoNet addresses, articles in the radio magazines, books, manuals, urban myths, and a lot more — a significant chunk of dawn of the digital age history covered by the sands of time, waiting for brave explorers to come.

Me, myself and AON


The first time I saw an AON was in early 90s, sometime after I played my first games on ZX Spectrum and NES clones, but just before I got knee deep into programming myself. I was fascinated with this technical novelty, and spent a lot of time experimenting with button sequences to discover features in fresh or unfamiliar versions of the firmware, listening to popular melodies in the single voice execution, as well as the computer speech that it was able to synthesize, and reading manuals to puzzle over mentions of never seen features and artifacts such as tape control, security loop, voice board, or beeper (which was a device to access the phone functions remotely via tone dial control). My mate helped his dad with making such phones, and, being interested in electronics and started to develop interest to the computers, I was able to join the secret knowledge of Z80, 8255, and other magic symbols. At the same time AONs started to appear all around, they often broke, and as there was no official support or services to fix it, they ended up in my hands in order to attempt to fix them, more often unsuccessful than not. This activity of mine lasted until 2000.

In 2013 I was cleaning up my place, and in the farthest corner I discovered a couple of old AON phones, which reminded me the good old days. A bit later my experiments in the 1-bit music field, DIY synthesizers, and very old computers such as KIM-1, led to an idea that AON is kind of a single board computer that could be re-purposed for some electronic music uses, such as drum machine, or a sequencer. I get pretty enthusiastic about this possibility, and started to gain needed information that was buried at the depths of ancient Internet, program an AON emulator, and other related activity. However, soon after it turned out that the rediscovered hardware accidentally found its way out along with the other garbage, and this idea had to be put on hold.

In the following years I pursued many different projects and interests. PCSPE development, browsing a web collection of rare Soviet electronic components (don't miss out these amazing segment displays!), recovering some bits of the AONs history, reiterating old ideas about making music software for them, buying a lot of AONs through a local bulletin board, obtaining parts and equipment for unrelated electronics projects, continuing work on the AON emulator, and so forth. Little by little, all pieces of the puzzle come together. A week before Multimatograf 2018 demo party the connection between «demo» and «phone» has been established in my mind (if I remember correctly, a joke about «demo for a calculator» contributed to this), and I started to work on this project for real. Of course, I wasn't able to complete anything on such a tight deadline, and the work slowed down, but resumed just as the Chaos Constructions 2018 date appeared in the close sight. In the best scene tradition, an enormous effort has been put into just two days and a night before the party, during which I designed, programmed, and debugged most of the ideas I had for this demo, then filmed and put together a video about it. Finished entry was sent to the contest in early morning of the party day, mere hours before deadline.

Some time after the party I learned out that 7-segment displays aren't an uncommon thing in Wild Compo entries, but somehow it never caught my eye before, so my design didn't have such influences.

The hardware




The hardware under the hood of an AON is a pretty basic and straightforward 8-bit single board computer, equipped with a 7-segment LED display, a phone keypad, and a landline interfacing circuit. During its 15-year popularity span, the hardware evolved a lot, staring from an i8080 based schematics in 1989, and ending with a custom made R100-XP MCU (i8051 core, required peripherals, and a AY-3-8910 clone in a single chip) developed by Rus-Telecom in 2003. A lot of versions and forks did exist in between.

I decided to stick to the most classic 1990 version that is pretty close to ZX Spectrum in the hardware and spirit: Z80 CPU at 4 MHz, 2K to 8K of SRAM, 8K to 64K of ROM, 8255-based parallel port for internal hardware, and 8253 programmable timer at 1 MHz. One of the timer channels generates CPU interrupts, another one produces single channel square wave sound, and the third one is either not used at all, or acting like a system watchdog. This schematics was presented with two most common types of PCB, a classic «large» one, and an updated «small» one. The large one was designed to be installed into the body of Latvian made VEF-TA-12, which was about the only accessible push dial phone model at the time. The small board didn't have such model-specific dimensions and mount points, and was installed into various imported phones, mostly represented with clones of the Panasonic office phones. Numerous firmware were available to run on these Z80-powered boards, including Arctur-36, Selena, Lira, Allo, and the most popular of all — Rus (up to version 23, later it was reprogrammed for 8051-based boards).

Reprogramming AON is pretty easy, any 5V EEPROM chip and a compatible burner will do the trick. I re-purposed some EEPROMs from old PC motherboards, ordered some fresh Winbond W27C512 from China, and used an affordable WizardProg-87 burner to program these chips.

The biggest challenge with the hardware was the condition of the ROM sockets on a quarter century old PCBs. They never were of high quality to begin with, and today bad contact is very common in these, which makes it difficult to distinguish whether an issue is caused by a program bug, or it is just a faulty connection. I attempted to fix this problem by installing a ZIF socket, but the small board crowded with tall components didn't allow this, and attaching the socket using a stack of DIP28 connectors to accommodate the height issue was prone to bad contact by itself.

Development




Before starting development of the actual demo, I had to finish my AON emulator, roughly sketched out in 2014. I sorted out a few tricky things that weren't covered up in the old docs, and integrated a third party 8253 timer core to make interrupts and sound function correctly. Having an emulator at hand, even with crude debugging features, helps to speed up any retro development by orders of magnitude. Once I got the emulator working, I used it to test and debug all demo code, running it on the hardware once in a while to make sure everything is working properly and looks fine on the multiplexed LED display, which I wasn't able to emulate authentically enough.

The code was written with SjAsmPlus, a Z80 cross assembler popular among modern ZX Spectrum and MSX developers. AON features a quite funky memory map, likely the result of minimizing hardware changes while migrating to larger ROM sizes for newer firmware. Although it is possible to install a 64K ROM chip, only 32K of the ROM memory is available to the CPU at any given time, and these 32K are interleaved with RAM in 8K chunks. Two halves of the 64K ROM can be swapped by a port write, but my demo didn't use this, as it successfully fit into just 32K. The ROM burner needs to have all code chunks in order to work properly, so assembler directives and BAT automation has been used to organize the necessary interleaved memory layout, and save it as a linear binary image.

About a half of the demo effects has been properly programmed via code, while another half was implemented as a set of simple animations, due to lack of time. A LED animation making tool has been made in order to accomplish this task fast enough. It is available for download at my website.



Considering the high density of effects in the demo, which is about 4 seconds per effect, and constant rearranging order of effects, near the deadline it turned out that demo is completely missing 16 second long segment in the middle, when pseudo polyphonic music is playing at full intense. A blatant filler effect with falling LED segments has been hacked together to close this gap. It has been interleaved with previously programmed spectrum analyzer to further increase scene time. I hoped that busy sound part will distract viewers attention from the protracted poor visuals in this scene.

First names in the greetings section are a tribute to the enthusiasts of the past, those are names of the AON firmware creators found in various ROM images.

Although it wasn't exactly related thematically, there would be no excuse to miss out an opportunity to display the iconic EGGOG (Error) message that originates from the early Soviet made programmable calculators (that's a whole different story). The most logical place to put it was the very end of the demo — as it started out with imitation of a glitch, it would make sense to end it with an error message.

There is not much point to go into details on how particular effects were programmed, everything is straightforward there. What is worth to mention, though, is likely the most prominent feature of the hardware platform, the software driven multiplexed LED indication.

The 9-digit 7-segment LED display controlled via 7 segment outputs and 9 digit selection outputs, thus the hardware can only display one digit at a time, and software needs to quickly alternate between all the digits in order to have a full display. I implemented this via timer interrupts at quite high frequency of 960 Hz (~4166 CPU clocks between interrupts, which is about 500 meaningful CPU operations). A variable length list is used to set up an arbitrary order sequence of digits to display. This approach allowed to implement two effects. First is system freeze imitation that is visually distinct with a unusually bright 8 in one of digits (when phone crashes, multiplexing stops and the last displayed digit remains active). The second effect is pseudo brightness control in the KITT effect done by lighting up some digits for longer time than others. During regular display the update rate is about 106 Hz, which eliminated noticeable flickering and helps to avoid artifacts during filming the action on video.

Music


AON sound hardware is pretty much like the PC Speaker, just a loudspeaker driven by one of the 8253 channels. It can produce a square wave tone while CPU is busy with other duties. There is no wave shape or volume control. I was well into the classic monophonic PC Speaker music making at the moment (which later came into fruition with System Beeps album release), so I had PCSPE VST at hand already, and gained a lot of experience in arranging such music, with only one note playing at any given time. PCSPE is a plugin for any modern digital audio workstation that emulates specifics of the PC Speaker, and allows to create music in a very convenient way. Using it to compose music that could be converted easily was an obvious choice over designing a whole new 1-bit sound synthesis engine that would sound much more impressive, but would take a while to make. It was fitting at conceptual level as well — authentic sound that raises the bar within familiar restrictions.



The music was composed using Reaper, a popular DAW. My idea for the beginning part was to imitate the piece of start up melody from the original Rus firmware. I also imitated other typical sounds, such as button presses and default ringtone. Having them ready provided the idea to compose a rhythmic structure out of these. The song then developed in an extensive way, by adding more and more layers to create illusion of polyphony. The most complex effect of the demo, a bright symbol that is running side to side, reminded me of the Knight Rider KITT's scanner bar, so I added an excerpt of the main theme from the series.

As the visual capabilities of the platform are poor to say the least, it was clear from the beginning that I should do a trackmo, i.e. a demo that has a tight sync between its audio and visuals. Thus writing of the demo script and music composition has been done in parallel. Unlike chiptune trackers that only display a small portion of the song, Reaper allows to see the whole duration and structure of the track, and move and swap parts easily. This helped to make better and easier decisions on the demo structure.

Unfortunately, it was not possible to sync up action with the music well enough. There was just not enough time to tune it up using the real hardware. Neither I had time to add a proper sync markers system that would help to solve this issue (such system is implemented in all of my following demo productions). As the result, sync in some parts of the demo is a bit off, and that is noticeable visually. I spent some of remaining time on manually syncing the stuff up the best I could before I had to give up and just leave it as is.

A noteworthy sound feature of AONs is that besides the recognizable beeps, late versions of the firmware had some rudimentary sample-based speech synthesis used to spell out things like incoming call numbers or current time, which was pretty impressive for the time. Out of curiosity, I reverse engineered the data formats (some used 4-bit samples at ~4500 Hz, played back using a timer-based PWM technique), listened to all the samples, and found out that there was 3-4 different voice sets that migrated between firmware of different authors. An urban myth has been confirmed too, some of those indeed featured some obscene expressions played back to the most unwanted callers. I had an idea to cut up some fun speech using these samples and add it to the demo, but I was out of time to come up with a good idea, so it had to be omited.

Video


To order to show up a demo for an uncommon hardware, while being not able to attend the party with the hardware in person, I had to film and cut together a small video. Not a big deal, but is not really a common thing for a programmer to do — usually it is just recording a screen cast, without dealing with camera, lights, physical object placements, and stuff like this.



A couple of AON phones has been used during development. One was a small board version, beaten up a lot. The second was a very good condition classic red VEF-TA-12 with the large board. I mostly used the first one to run tests, and recorded the final product using the second one. Interestingly enough, despite having the same exact LED display type (ALS318), the latter unit had visually larger digits, maybe because it is placed not as deep inside the phone body, and it was beneficial for the video.

Those LED displays, originally developed for pocket calculators, tend to deteriorate over the time. Every single phone I have has a noticeable difference in brightness between the digits. The reason is likely that AONs were prone to frequent freezes and crashes, and once it crashed, the display multiplexing would get stuck with one of digits being turned on for a long period of time. I actually had some replacement displays in better condition at hand, but decided to keep more authentic look for the video.

The video has been filmed with a cheap camcorder in major hurry at the very last moment. Then it was hacked together using Blender's built-in video NLE — just because I knew how to use it, and didn't have anything better around. The intro part was intended to remind what this thing is, and to explain how the program was uploaded. I also thought to film up how the ROM gets inserted into the socket, but had to omit it because the condition of the socket would require to use both hands and make a lot of obscene groans in the process.

Release


The demo had an amusing story related to entering a particular compo.

Two weeks before Chaos Construction 2018 the rules got a slight update. ZX Spectrum 640K Demo compo was basically turned into Combined Oldschool Demo, by allowing entries for any other home computers released before 1991. For some reason, likely to satisfy conflicting scene parties, the organizers decided to keep the old compo name despite of this change. Heated up with the long standing discussion on what to consider a ZX Spectrum (there is a ton of expanded clones out there), it inevitably ended up with some confusion and criticism.

As I was in quite a zombie mode in the early morning after a lengthy development marathon, I was in doubt and took a now questionable decision to send my entry in the newly changed category. Additionally, organizers joined all entries from the Wild Demo and some other compos into Combined Demo, so only one non-ZX entry besides mine ended up in ZX Spectrum category. Looking back, the correct decision would be to stick to the Wild compo. My excuse points at the time were that AON had some qualities of a platform in my eyes, like being real hardware from the past, the possibility to easily repeat the running process (unlike an ATM or a photo camera demo), and it was not just an one of a kind device, but a common standard with a number of different interchangeable firmware.

This situation eventually turned into a scene meme. Later in 2018 I actually ported demo to ZX Spectrum, closing the circle. In 2019 the red phone got featured on some of the Chaos Constructions merchandise, and even appeared as one of important objects in a scene meme based game presented at CaFe 2019. I myself exploited it in my 2019 NES demo. So in the retrospective, maybe this release quirk wasn't too bad, after all.

Download


AONDEMO with source code
ZX Spectrum port (video)
AONZ80Emu for Windows
LED9ED for Windows
PCSPE for a VSTi-enabled DAW

+9
1.3k 0
Leave a comment