TLC-MBC: Taking Her First Baby Steps

It’s the week end and it’s time the TLC-MBC came to life! This post will be a little different from most, it will be written in more-or-less real time. This is so that I don’t forget to document details, this post is as much for me as it is for you. If everything goes as planned this should be posted by lunchtime.

Goals for this Session

Pretty basic really, I want to:

  1. Hook up the 65C02 on a bread board.
  2. Provide a reset button and circuit.
  3. Provide a clock.
  4. Get the processor free-running.
  5. Verify it’s operation with Hex Display.

For the reset I’m using a DS1813 a 3pin IC that provides the reset pulse at both power-up and when a button is pressed. I’ve also got a 1Mhz oscillator to provide the clock signal. Apart from a few pull-up resistors that is the complete circuit. To verify the 65C02 works is to make it operate in a predictable fashion. When a 6502 based computer is turned on or manually reset, the processor first does some internal housework and then looks at addresses $FFFC and $FFFD and stores those two bytes as an address in it’s Program Counter. So for example if $FFFC contained $00 and $FFFD contained $A0 then the Program Counter would jump to $A000 and start executing the instructions there.

This means there is usually some kind of Read Only Memory, situated at the top end of memory, that contains the vector at $FFFC/D and a runnable program/operating system. But, in the case of TLC-MBC, there is no ROM here to tell it what to do, so when it is reset there will be random data at those addresses so it can jump anywhere in memory and find more random data to try to execute.

To side-step this problem and make TLC-MBC operate predictably I am going to fix the Data Bus with a value so that I know where it will jump to and what it will find there. A candidate for this is $EA which happens to be the No Operation (NOP) instruction. If $EA was on the Data Bus then at reset the processor would look at $FFFC/D and find $EA in both locations, store it in the Program Counter and jump to address $EAEA where it would find another $EA and so on.

TLC-MBC: First Run

TLC-MBC first run, what address is that??

TLC-MBC first run, what address is that??

I’ve built the circuit and powered it up and I’m still none the wiser. All I saw on Hex Display was “8888” with the most significant byte flickering. So something is happening – just can’t tell what it is. I need to do one of two things, either provide a MUCH slower clock or add some single-step circuitry. I’ve had a look around and I haven’t got any 555 timers to make an oscillator and I haven’t got any 7414s to make a single-step circuit!!! But I do have Arduino Unos and Nanos, one of them could, with the right software, provide both.

So I’m going away again, to add an Arduino, it might be overkill but it saves me going out and getting ripped off at Maplins, back in a while.

TLC-MBC Nano Variable Clock and Single-Step stuff

Nano Variable Clock and Single-Step stuff

I’m back… I chose to use a Nano as I can plug it into the bread board, it keeps everything contained and easily transportable. The additions have been made as follows:

  • Analog Pin 0: Is a mode switch, the orange lead, when at +5v the clock is in free run mode, when at GND it’s in Single-Step mode.
  • Analog Pin 1: Is connected to the momentary push button for Single-Step mode.
  • Analog Pin 2: Is connected to the wiper of the potentiometer, to vary the length of the clock pulse.
  • Digital Pin 3: Is the clock pulse output, the blue lead.

On the left in the picture, the orange lead is connected to the 1Mhz oscillator, the yellow lead is connected to pin 37 of the 65C02, these combined with the clock pulse (blue lead) make a “toggle switch” so I can select between the oscillator and the Nano clock. The potentiometer, below the yellow button, allows me to vary the length of the clock pulse from 1 to 1024ms, not terribly fast but it’s not meant to be, I want to be able to read the Hex Display.

The driving software for the Nano is essentially a loop that checks what mode it is in. If it’s in free run mode it produces a clock pulse and loops again. If it’s in single step mode, it checks the state of the button. If it’s pressed now and at the last check it wasn’t then a clock pulse is produced and then it loops. And that’s it. If you want to have a look at the code, I shall be uploading it to Git Hub later along with schematics.

So that’s it, I have completed the goals for this session. As she stands TLC-MBC is brain dead so next time I shall have to give her some memories. While you wait for that post here is a short video showing TLC-MBC going trough the reset sequence. Enjoy.



You may also like...