LittleFS: The Emphasis Is On Little

It used to be that developing for microcontrollers was relatively relaxing. These days, even a cheap micro like the Raspberry Pi Pico has multiple cores, networking (for the W, at least), and file systems. Just like desktop computers. Sort of. I found out about the “sort of” part a few weeks ago when I decided to embark on a little historical project. I wanted a file system with a large file that emulates a disk drive. The Pico supports LittleFS, and I figured that would be the easy thing to do. Turns out the Little in LittleFS might be more literal than you think. On the plus side, I did manage to get things working, but it took a… well — dare I say hack? — to make it all work.

History

I’m an unabashed fan of the RCA 1802 CPU, which is, of course, distinctly retro. The problem is, I keep losing my old computers to moves, natural disasters, and whatnot. I’ve had several machines over the years, but they seem to be a favorite target of Murphy’s law for me. I do currently have a small piece of hardware called an Elf Membership Card (by [Lee Hart]), but it lacks fancy features like disk drives, and while it could be expanded, there’s something charming about its current small size. So that led me to repurpose a 6502 emulator for the KIM-1 to act like an 1802 instead. This is even less capable than the membership card, so it was sort of a toy. But I always thought I should upgrade the Arduino inside the emulator to a processor with more memory, and that’s what I did.

I started out with a Blackpill STM32F board and called the project 1802Black. The code is a little messy since it started out as [Oscar’s] KimUNO code, and then my updates layered with new updates. Also, for now, I shut off the hardware parts so it won’t use the KimUNO hardware — you only need a Blackpill (or a Pico, see below) and nothing else, although I may reenable the hardware integration later.

It wasn’t that hard to get it running with just more memory. Still, I wanted to run [Mike Riley’s] Elf/OS operating system and I also had a pair of Raspberry Pi Picos mocking me for not using them in a project yet. The chip has excellent Arduino board support. But what sealed the deal was noticing that you can partition the Pico’s flash drive to use some of it for your program and the rest for a file system. You can get other RP2040 dev boards with 16 MB of flash, which would let me have a nearly 15 MB “hard drive,” which would have been huge in the 1802’s day. Sounds simple. If it were, though, we wouldn’t be talking.

Continue reading “LittleFS: The Emphasis Is On Little”

Old Style 1802 Computer Has MMU

When you think of an MMU — a memory management unit — you probably think of a modern 32-bit computer. But [Jeff Truck] has a surprise. His new RCA 1802 computer has bank switching, allowing the plucky little processor to address 256K of RAM. This isn’t just the usual bank-switching design, either.

The machine has several unique features. For example, an Arduino onboard can control the CPU so that you can remotely control the bus. It does not, apparently, stand in for any of the microprocessor support chips. It also doesn’t add additional memory or control its access.

The 256K of memory is under the control of the MMU board. This board generates two extra address bits by snooping the executing instruction and figures out what register is involved in any memory access. Memory in the MMU stores a table that lets you set different memory pages for each register. This works even if the register is not explicit and also for the machine’s DMA and instruction fetch cycles. If you know about the RCA “standard call and return technique,” which also needed a little patching for the MMU. [Jeff] covers that at the end of the video below.

This is a very simple version of a modern MMU and is an impressive trick for a 50-something-year-old CPU. We were surprised to hear — no offense to [Jeff] — that the design worked the first time. Impressive! There’s also some 3D printing and other tips to pick up along the way. But we were super impressed with the MMU. You might never have to do this yourself (although you could), but you can still marvel that it can be done at all.

We have a soft spot for the 1802s, real or emulated. The original ELF was great, but 256K is a lot better than the original 256 bytes!

Continue reading “Old Style 1802 Computer Has MMU”

Queen Victoria’s Secret (Teletype And COSMAC Elf)

We don’t really think anyone in the Victorian era had a COSMAC Elf — the homebrew computer based around the RCA 1802 CPU. But if they did, it might have looked like [Daniel Ross’] steampunk recreation of the system that includes an appropriate-looking teletype device. You can see the thing in a series of videos, below. There are actually quite a few videos showing different parts of the system, along with several blog postings stretching back a few months.

A magic eye tube doesn’t look out of place in this build. We especially liked the glass tube displays and the speaker, although we thought the USS Enterprise looked out of place with the technology based on stone knives and bearskins, to paraphrase Mr. Spock. On the plus side, the VFD displays have the right glowing look, although a Nixie would have been pretty good there, too.

The videos don’t have much detail, but the blog posts do if you wanted to attempt something similar. Honestly, 1802 system design is pretty easy thanks to the its on-chip DMA that allows you to load memory from switches with no actual software like a monitor. The teletype started out life as a Remington #7 from around 1900, although another newer machine donated parts to get everything working. It is a testament to how well things were built then that it took as much abuse as it did and still has working parts.

We have a soft spot for the 1802 — it was a very good design for its time. We’ve even gone as far as to simulate it.

Continue reading “Queen Victoria’s Secret (Teletype And COSMAC Elf)”

Inside CHIP-8

Certain old computers — most frequently those using the RCA 1802 — were fond of using an early form of byte-code interpreter for programs, especially games. The interpreter, CHIP-8, was very simple to create but offered high-level features that were tedious to recreate in the native assembly language. Because there are a fair number of simple games written in CHIP-8, there are of course, emulators for it, and [River Gillis] decided to look inside the CHIP-8 byte code interpreter.

Part of the power of CHIP-8 was it only had 35 virtual instructions. That was important when you were trying to shoehorn a game and the interpreter into a very small memory. Remember, in those days 1K of memory wasn’t an unusual number, although the prototypical CHIP-8 host would have 4K.

Continue reading “Inside CHIP-8”

COSMAC ELF Lives Again, In FPGA

Looking around at the personal computing markets in modern times, there seem to be a lot of choices in the market. In reality, though, almost everything runs on hardware from a very small group of companies, and software is often available across platforms. This wasn’t the case in the personal computing boom of the 70s and 80s, where different computers were wildly different in hardware and even architecture. The Cosmac ELF was one of the more interesting specimens from this era, and this one has been meticulously reproduced on an FPGA.

The original hardware was based on an RCA 1802 microprocessor and had a rudimentary (by today’s standards) set of switches and buttons as the computer’s inputs. It was low cost, even for the time, but was one of the first single-board computers available. This recreation is coded in SpinalHDL and the simplicity of the original hardware makes it relatively easy to understand. The FPGA is cycle-accurate to the original hardware, too, which makes it nearly perfect even without any of the original hardware.

The project’s creator, [Winston] aka [wel97459], found that SpinalHDL made this project fun to work on (and released his code on his GitHub page), and was able to get the code down to just 1500 lines to recreate the original hardware. It’s very impressive, and also an accessible read for anyone interested in some of the more unique computers offered during the early computer renaissance in the 70s.

KIM-1 To COSMAC Elf Conversion — Sort Of

In the mid-1970s, if you had your own computer, you probably built it. If you had a lot of money and considerable building skill, you could make an Altair 8800 for about $395 — better than the $650 to have it built. However, cheaper alternatives were not far behind.

In 1976, Popular Electronics published plans for a computer called the COSMAC Elf which you could build for under $100, and much less if you had a good junk box. The design was simple enough that you could build it on a piece of perf board or using wire wrap. We featured the online archive of the entire Popular Electronics collection, but hit up page 33 of this PDF if you want to jump right to the article that started it all. The COSMAC Elf is a great little machine built around a 40-pin RCA 1802 processor, and for many was the first computer they owned. I lost my original 1802 computer in a storm and my recent rebuild in another completely different kind of storm. But there is a way to reclaim those glory days without starting from scratch.  I’m going to repurpose another retro-computing recreation; the KIM-1.

I’ll admit it, Rewiring a real KIM-1 to take an 1802 CPU would be difficult and unnecessary and that’s not what this article is about. However, I did have a KIM UNO — [Oscar’s] respin of the classic computer using an Arduino mini pro. Looking at the keyboard, it occurred to me that the Arduino could just as easily simulate an 1802 as it could a 6502. Heck, that’s only two digits different, right?

The result is pretty pleasing. A “real” Elf had 8 toggle switches, but there were several variations that did have keypads, so it isn’t that far off. Most Elf computers had 256 bytes of memory (without an upgrade) but the 1802 UNO (as I’m calling it) has 1K. There’s also a host of other features, including a ROM and a monitor for loading and debugging programs that doesn’t require any space in the emulated 1802.

Continue reading “KIM-1 To COSMAC Elf Conversion — Sort Of”

COSMAC Elf Calculator Gets New Firmware

Everyone remembers their first. Their first CPU, that is. For many of us, it was the RCA 1802 thanks to the COSMAC Elf articles that ran in Popular Electronics. The later versions of the chip family were much better but were never as popular, but the 1805 did find its way into a printing calculator for dimensions from a company named Boyd. Some of these recently showed up on the surplus market and–of course–were subsequently hacked.

[Bill Rowe] is active in the groups that still work with the 1802. Because of some specialized uses you can still get the chips readily, some four decades after they were new. Other computers at the time were difficult to build and relatively expensive, while for $100 almost anyone could wire wrap a simple 1802-based computer together in a weekend or less.

Continue reading “COSMAC Elf Calculator Gets New Firmware”