Introductions and the 6502 ALU

Before I tell you about the juicy guts of the 6502 microprocessor, let me introduce myself and tell you a bit about the people behind the project.

My name is Jaimesh Mistry and I am a fourth year Electronics and Communications Engineering student, studying at the University of Bristol. I’ve been ripping apart electronics and changing the way they work ever since I got my first RC car and went exploring in my dad’s crazy toolbox. These days I’m building all sorts of wacky projects with the skills I’ve gained at university – from  autonomous robots to central heating systems that you can control from your smart phone. Hacking consumer tech is one of my passions, so a project like this where we mix a range of technologies from a range of eras in computing is right up my street.

Jeremy Dalton completes our duo and is also an Electronic and Electrical engineer in training at the University of Bristol. Like me, he is into all sorts of software and hardware hacking, has ‘tweaked’ many a working thing until it stops working and we’ve successfully collaborated on a good few projects in the past. However, one of his growing passions is in dirty great power electronics and motor drives, which recently landed him on an episode of Channel 5’s Motor Morphers where he helped convert a two-tonne milk float into a rubber burning dragster!

Anyway, enough about us. As promised, I’ll walk you through the MOS Technology 6502, why we chose it over other classic processors and our simplified design for implementation in 7400/relay logic.

MOS Technology 6502

MOS Technology 6502

The 6502 is an 8-bit microprocessor from the 1970’s and is one of the most popular processors in its era due to its low price. Despite being the least expensive, it was still a fully featured processor and thus dominated the market over offerings from competitors such as Intel and Motorola. The 6502 was used in a whole variety of computers and game consoles such as the BBC Micro, Atari 2600, Apple II and the Commodore 64. We chose the 6502 over competitors such as the Zilog Z80 (as used in the ZX Spectrum) because of its popularity and importance in computing history.

BBC Micro

BBC Micro

The Arithmetic Logic Unit (ALU) is the heart of a CPU and, as its name implies, it is responsible for carrying out fundamental binary arithmetic and logical operations based on the operation code (OPCODE) that is supplied. Although the 6502 ALU only has five elements (ADD, OR, XOR, AND, Shift Right), the other structures in the processor allow it to perform other operations like multiplication and subtraction over multiple CPU cycles.

ALU Top Level Overview

ALU design to be implemented

Please note that the above block diagram is a work in progress and will be updated as the project progresses. However, most of the important features are present at this stage. As many of the hardware savvy of you may know, the ALU reads from two 8-bit input registers (A and B) and outputs its result on the (you guessed it) Output register. What lies between them are the combinational logic blocks which perform the arithmetic and logical manipulation of the input data.

These logic blocks are always powered, active and performing their operations. This poses a problem as only one of them can be allowed to write to the output register. To select which of the logic blocks’ output is written to the output register, the CPU decodes the OPCODE and asserts a control signal such as ORS. This activates the output of the buffer which is attached to the OR circuitry and the data is pushed to the register. We have yet to work out why this technique that gates the buffers outputs’ was used in the 6502 instead of a multiplexer. Please leave a comment below if you’re more clued up.

In our implementation, the host computer will take care of the control signals, along with clocking data into and out of the registers. By inserting data into the registers A and B, and applying the correct control signal, the ALU can be configured to carry out any of its inbuilt operations (ADD, OR, XOR, AND, SR). You may be wondering where the multiplication, division and subtraction takes place. These operations haven’t been forgotten as they can be performed using combinations or repetitions of the above calculations.

So, we now have a top level design for our 6502 based, internet connected ALU – the Twitalu (twit-a-loo).


One thought on “Introductions and the 6502 ALU

  1. Pingback: The 6502 ALU in 7400 Logic | Twittithmetic Logic Unit

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s