Project:65 – Now with Blinkenlights!

The revamped Project:65 computer, with a slightly cleaner layout and exciting flashing lights!

I’ve been splitting my time between a number of projects over the last couple weeks – I’ve been playing games and demos on my newly-repaired Amiga 500, and doing some work-related projects making use of the new features in C++11. I’ve also started playing with my Project:65 breadboard computer again, and that’s what I want to talk about today.

The Project:65 computer is a homebrew 8-bit computer using a 6502 processor; you can read more about it over at this page. I’m getting back into it now because I’ve been thinking about an entry for the Retrochallenge, which is usually in July. I’m not trying to cheat and get a head start; I’m just trying to whip the machine into shape so that, if I do decide to do something, I can hit the ground running.

The first thing I did to the P:65 was take it apart and put it back together – just to make sure that I could, and to make sure that my documentation was good enough. Good enough for me, anyway – it’s mostly hand-drawn diagrams in a notebook. I’d like to make a really nice version of the schematics to put on the project page, but I’m not sure what the best format for something that complex is.

These nifty blue LEDs are hooked up to the computer’s address bus, and the patterns change when a program runs.

While I was reassembling it, I tried to clean up the layout and make the components a little more accessible. That was a partial success – the I/O circuit is a lot clearer now and the reset button is a little easier to reach, but I kind of made the EEPROM a little more difficult to reach. In the earlier stages of development, I was constantly pulling the EEPROM out to reprogram it, but I may have found a way to avoid that in the future.

The new layout uses three pieces of breadboard, and that gave me room for some new features. The one thing P:65 really needed to give it some retro style was more blinking lights. I found these cool blue bar LEDs at Sparkfun, and hooked them up to the address bus. This display would be really cool if I had a way to single-step the CPU, but even running at full speed it can be neat to see the changing patterns.

The other new feature I added was a write-protect switch for the EEPROM. A what, you ask? Well, I got the idea from Garth Wilson’s schematics that, if I was careful enough, I could reprogram the EEPROM in situ. The idea of not having to pry the EEPROM out of the breadboard to update it was really appealing, but how would it work?

With the write-protect switch in this position, I can write to the computer’s EEPROM as if it was really, really slow RAM.

When you think about it, writing to an EEPROM like the 2865 I’m using isn’t that different from writing to RAM. You just have to put your values on the address and data buses, and then set Chip Enable and Write Enable low. Now I’m actually connecting the same Output Enable and Write Enable signals to both the EEPROM and the RAM, and the address decoder logic controls the Chip Enables. My write protect switch connects the EEPROM’s Write Enable pin to either my Write Enable signal or to +5v (with the switch at +5v, I don’t have to worry about some cruddy piece of software accidentally scribbling into the ROM space, and I can just enable writing when I actually want to).

The only difference is that while a write to RAM finishes right away, the EEPROM is going to be busy for as much as 10 ms. How do you tell when it’s done? In my Arduino-based EEPROM programmer, I monitored the special-purpose READY/BUSY pin, but I didn’t have any way to look at that pin in the P:65. There’s another way to check, though: While it’s programming, if you try to read back the data you just wrote, the value on the highest bit of the data bus will be the opposite of what you wrote. So you just have to keep reading the data until it matches what you expected.

Here’s my test code for writing to the EEPROM while the computer is running:

I almost wrote a verifier routine too, but then I realized that I could just use strncmp() to test if the whole data block had been written correctly.

You’ll notice I wrote this routine in C. I’ve been using the assembler from the CC65 package for a while now, but I’ve only used the C compiler itself a couple times. I figured this would be a good application to give it a workout, since the software is going to be fairly involved. So far, I’ve only used it to test write a few characters into an unused space in the ROM, but if I’m going to write the whole thing, the programmer program is going to have to run entirely from RAM, without using any of the “operating system” calls in the EEPROM.

I think having this feature available is going to make working on the Project:65 computer a lot quicker and easier. No more swapping chips around to update the OS – at least not unless until I screw up and write a ROM image that’s too broken to load the programmer program!

Like this:

Related

Posts navigation

One comment on “Project:65 – Now with Blinkenlights!”

This is totally near and dear to my heart, I did something 6502 related for the Retrochallenge Winter Warm-Up back in January. I’m definitely going to be reading your blog religiously now. Looking forward to catching up with what you’ve been doing.