Rule 90 on the Cosmac ELF Membership Card

Elf Membership Card
Elf Membership Card

At VCF East this spring I demonstrated one of my vintage computer systems.  My table was placed between two individuals using switches to enter software on their systems.

I was greatly intrigued by this idea, as I had never had a system that could be operated at such a low level.

When I heard that a large exhibit around the COSMAC (RCA 1802) processor would be at VCFMW, I considered that this would be an excellent time to assemble one of the Elf Membership Card kits in order to understand what the systems were all about.

After packing for VCFMW a day early, I found myself with some time the day before.  I dug out the membership card, and looked for something interesting to do with a short program and the lights on the front.

I considered a number of things before doing some research into Conway’s Game of Life.  Normally a 2D cellular automaton, I wondered if perhaps there wasn’t a 1D form.  This led me to Rule 90, which describes the operation of a one dimensional “life form.”

Rule 90 can be characterized by one simple rule.

  1. If a cell has one and only one live neighbor cell, it will be alive in the next generation.

Initially, I considered the complexity of processing each bit at a time, but quickly realized that this is the XOR of the neighbor bits.  As a result, the computation of all the bits can be easily implemented by computing the XOR of the current state shifted left once, and right once.  This can be easily implemented by the below program.

The program reads the state of the switches as the initial state of the automaton.  It then displays each generation on the LEDs.

00:     90	GHI     R0
01:     B1	PHI     R1
02:     F8 F0   LDI     F0  ; Temp
04:     A1	PLO     R1
05:     E1	SEX     1
06:     6C	INP     4
07:     A2	PLO     R2  ; Loop: Save current
08:     F6	SHR
09:     51	STR     R1  ; Save shifted right
0A:     F8 02   LDI     02
0C:     B3	PHI     R3
0D:     23      DEC     R3  ; Wait
0E:     93	GHI     R3
0F:     3A 0D   BNZ     Wait
11:     82	GLO     R2  ; Get current state
12:     FE	SHL         ; Shift left
13:     F3	XOR         ; XOR shifted right
14:     51	STR     R1  ; Save result
15:     64	OUT     4
16:     21	DEC     R1
17:     30 07   BR	Loop

F0:     00                  ; Temp

One thought on “Rule 90 on the Cosmac ELF Membership Card”

  1. Nice! This is my favorite membership card program over a couple years of messing with it.

    Thanks for this.

Comments are closed.