8-bit CPU with 256 bytes of RAM (Lodestar microcomputer)

Over the last couple of months I've developed an 8-bit CPU and 256-byte RAM chip. Together I believe they represent the fastest and most versatile computer made in LBP to date. I call this system the Lodestar.

The Lodestar is an 8-bit microcomputer that supports arithmetic, logic, conditional jumps, a stack, subroutines, serial I/O and interrupts. It can also generate music.

The most challenging part of developing the CPU were signal timing issues. To make the best use of each frame the system runs unclocked at 30 Hz, resulting in speeds of around 3 instructions per second.

One of the problems with past computers in LBP is how poorly documented they were by their authors. With this post I hope to provide a comprehensive guide to the system.

1.1 SPECIFICATION

Accumulator architecture

256 bytes of memory

2 addressing modes

Serial I/O ports

3 bars of thermo

Internally the system is split into 2 chips: the CPU and RAM. Together they use 4000 components total.

These chips are mounted on a board above the switch assembly.

1.2 DESIGN AND INTERFACE

The Lodestar's front panel has 20 lights and 12 flip switches. Since I'm a fan of vintage computers the front panel is inspired by machines like the PDP-8 and Altair 8800.

There are 4 control switches: RUN starts and stops a program, EXA examines a memory address, DEP deposits a value into memory, DAT toggles display of the accumulator or data bus.

The address lights show the current memory address. The data lights show either the contents of memory or the accumulator depending on the position of the DAT switch. The status lights indicate the internal state of the machine, such as overflow and I/O port activity.

On the right side of the machine are the serial input and output ports.

This program performs 5 x 4. There are two variables used: x and i. The variable x is initially set to zero and accumulates the result with each iteration of the loop. The variable i is decremented once per iteration and acts as a counter, when it reaches zero the program halts.

2.4 INPUT AND OUTPUT

Located on the right side of the Lodestar are both the serial input port and serial output port. These can be used to connect peripherals or to create networks of Lodestar systems.

On receiving a byte via the input port an interrupt is triggered. An interrupt pushes the current memory address to the stack and the CPU jumps to address 0. After an interrupt has been handled a RTI instruction can be used to return the CPU to the prior address.

This is a powerful program that listens to the input port, copying whatever it receives to memory. This means we can hook up a keyboard to the system, so programs can be entered easier and faster. In fact, all the programs in this tutorial were written using this program and a keyboard.

Although not necessary, this program uses the stack to temporarily store the interrupt. The stack starts at address FF and decrements down. This is a handy way to pass data around without using lots of LDA and STA instructions.

2.5 GRAPHICS

Using the serial output port it's possible to communicate with peripherals such as a monitor.

This program sends a region of memory to the serial output port, byte by byte. The monitor treats these bytes as pixel coordinates and updates the screen. In this case, the pixel data is 3 bytes long and draws a triangle.

By combining this program with the program in the previous section it's possible to copy programs and data from one Lodestar system to another.

2.6 SOUND

Lastly, the Lodestar is also capable of generating music. The lowest 4 bits of the accumulator determine the pitch when the SPK instruction is used.

Thanks!

Tried it, couldn't get it to work. It needs a manual of some kind to know what to do with the buttons. All it said was "HI" which then faded away into nothingness. Good idea, I have something that might work.