A Simple Guide To Bit Banged I2C On The 6502

We covered [Anders Nielsen]’s 65duino project a short while ago, and now he’s back with an update video showing some more details of bit-banging I2C using plain old 6502 assembly language.

Obviously, with such a simple system, there is no dedicated I2C interface hardware, so the programmer must take care of all the details of the I2C protocol in software, bit-banging it out to the peripheral and reading back the response one bit at a time.

The first detail to concern us will be the I2C addresses of the devices being connected to the bus and how low-level bit manipulation is used to turn the 7-bit I2C address into the byte being bit-banged. As [Anders] shows, setting a bit is simply a logical-OR operation, and resetting a bit is a simple logical-AND operation using the inversion (or one’s complement) bit to reset to form a bitmask. As many will already know, this process is necessary to code for a read or a write I2C operation. A further detail is that I2C uses an open-collector connection scheme, which means that no device on the bus may drive the bus to logical high; instead, they must release the drive by going to the high impedance state, and an external pull-up resistor will pull the bus high. The 6532 RIOT chip (used for I/O on the 65unio) does not have tristate control but instead uses a data direction register (DDR) to allow a pin to be an input. This will do the job just fine, albeit with slightly odd-looking code, until you know what’s going on.

From there, it’s a straightforward matter to write subroutines that generate the I2C start, stop, and NACK conditions that are required to write to the SSD1306-based OLED to get it to do something we can observe. From these basic roots, through higher-level subroutines, a complete OLED library in assembly can be constructed. We shall sit tight and await where [Anders] goes next with this!

We see I2C-connected things all the time, like this neat ATtiny85-based I2C peripheral, and whilst we’re talking about the SSD1306 OLED display controller, here’s a hack that shows just how much you can push your luck with the I2C spec and get some crazy frame rates.

Continue reading “A Simple Guide To Bit Banged I2C On The 6502”

Hackaday Prize 2023: 65uino 6502 Learning In A Familiar Package

[Anders Nielsen] presents his entry for the 2023 Hackaday Prize: The 65uino. Which as you might be able to guess, is a 6502-based microcomputer wedged into an Arduino Uno form factor (well, almost wedged in, but we’ll let it slide) The premise is simple, older micros are easier to understand, the board can be build up from new-old or salvaged stock, and that’s more chips on boards and less sitting on a dusty shelf. After all, even though the 6502 in its original form is long obsolete, it’s far better to be pushing some electrons around, than sitting there decaying.

The OLED frame buffer is bigger than the host’s entire RAM. No problem!

From an educational perspective, the first lesson is the hand-soldering of through-hole DIP components and a smattering of straightforward surface mount parts in their supporting roles.  Then on to setting up the cc65 toolchain. To say this is a pure 6502 system is a little misleading, it actually uses the 6507 device variant, which is a die-bond variant of the same device but with only 28 of the pins utilized.

The use of the 6532 RIOT (RAM-I/O-Timer) chip provides two 8-bit ports of GPIO as well as a timer and 128 bytes of SRAM, making the design more compact. There is a socket that will accept a 24 or 28-pin E(E)PROM device, with the extra four pins removable and the PCB snapped off if fitment into a standard ‘Uno case is desirable. Neat!

Full hardware build and PCB design (using KiCAD) are available on the 65uino GitHub page. Just remember folks, with everything minimal 6502 related — some assembly required :D

We see the 6502 a lot, let’s be fair. But why not? Here’s a slightly more practical board with a bit more resources, an absolute beast of a luggable dual-6502 machine, and yet another 6502 verilog implementation ready to be dropped into a spare corner of a FPGA project that needs a little extra.

Squeezing A Minimalist 6502 Retrocomputer Onto A Single Breadboard

Over the years, and especially lately, we’ve seen tons of single-board retrocomputer builds. That’s fine with us — the more, the merrier. But they all start to run together a bit, with little to distinguish between them. Not so this about-as-compact-as-possible 6502 computer that fits on a single breadboard.

Now, when you do the math, it seems like there’s no way that [Anders Nielsen] would have been able to fit even a minimal chipset onto a standard solderless breadboard. The 40-pin 6502 alone takes up nearly two-thirds of the connections available; add in equally large but necessary chips like the 6522 interface adapter, ROM and RAM chips, and some support ICs, and one breadboard isn’t going to cut it. Luckily, some frugal engineers at MOS back in the 70s came up with the 6507, a variant on the 6502 in a 28-pin DIP. The other key to this build is the 6532 RAM-I/O-timer chip or RIOT, which puts a tiny amount of RAM and some IO lines on a single 40-pin DIP. Along with a 28-pin ROM, a 14-pin hex inverter, and a little crystal oscillator, the entire chipset just barely fits on a single breadboard.

But what can this minimalist 6502 actually do? As you can see in the video below, anything a 555 timer can do, and maybe a little bit more. That’s not a dig, of course — [Anders] actually calls out his initial blinkenlight application as a little more than a glorified 555, and actually comes up with a marginally more complex application just to prove the point. The interesting part here is dealing with the constraints imposed by the limited resources available on this machine.

We’re looking forward to whatever comes next for this clever build. It’s hard to see how some of the plans [Anders] has for it will still fit on a single breadboard, though — these things tend to spread out as they go.

Continue reading “Squeezing A Minimalist 6502 Retrocomputer Onto A Single Breadboard”

Philly Fixers Guild Will Teach You How To Fish

One crisp Saturday afternoon a couple of weeks ago, the Philly Fixers Guild held its second Repair Fair. Not second annual, mind you; the first fair was held in September. People came from miles around, hauling with them basement and attic treasures that needed, well, fixing. [Fran] is one of the Guild’s volunteer fixers, and she shot some video of the event which is waiting for you after the break.

The Philly Fixers Guild aims to promote sustainability in the surrounding community by teaching interested parties to repair their possessions that might otherwise end up in a landfill. The fairs are not meant to be a drop-off repair site—attendees are expected to stay and learn about what’s wrong with their item and how it can or can’t be fixed.

The Guild is open to volunteers who are interested in teaching people how to fish, as it were. Expertise is not limited to electronics repair; guild members are just as interested in teaching people how to sew a replacement button on their winter coat or building that thing they bought at IKEA.

Nowhere near Pennsylvania? Several groups like the Philly Fixers Guild have already been established in a few larger US cities. If you’re not near any of those either (and we can sympathize), you could do worse than to start your own. If you’re part of a ‘space, creating such a guild would be a good way to spread the word about it and the gospel of DIY.

In the video, [Fran] discusses an Atari 2600’s control problem with its owner. She re-seats the 6532 RIOT chip and explains that this may or may not have solved the problem. If not, [Fran] is confident that new old stock chips are available out there on the hinterwebs. There might still be some landfill carts on ebay if the owner gets it up and running. [Fran] also fixes the controls on a Peavey amp and gets some Pink Floyd to issue forth from a previously non-functioning Zenith portable AM/FM radio that’s old enough to have a snap cover.

Continue reading “Philly Fixers Guild Will Teach You How To Fish”