Friday, December 12, 2014

Arduino Retro Computer: Intro

I love the simplicity of vintage '70s / '80s computers. Hook them up to your TV, switch the power on, and you're instantly at a prompt with BASIC ready to go. Want to play a game? Plug in the cartridge, restart, and it loads instantly (well, with ROM based games anyways - definitely not tape). There is no waiting for startup, waiting for shutdown, or worrying about drivers. Of course tablet computers such as the iPad have basically brought this concept back. Well almost - modern tablets throw you in to a bunch of useful programs rather than an ominous "READY" BASIC screen. :-)

Back in 5th grade my teacher would give out points for doing well on assignments that we could spend on certain activities. I don't remember what all we could do with the points; I always used mine to play on the TI 99/4A computer at the back of the classroom. Now, this computer was already obsolete by that time, but it didn't make it any less fun. At the end of the school year the teacher actually gave it to me. (I was probably the only one that used it anyways.) I not only still have that computer; it still works! I've owned several modern computers that didn't even last 3 years, this thing is over 30!

In addition to being interested in these older computers, I've also wanted to get as close to building a useful computer from scratch as possible. There are quite a few crazies out there that have built anywhere from simple calculators to actual 8-bit computers with a breadboard and too many wires to count. (I mean crazy is a sincere way!)

I've been tempted to try building a computer with one of these older chips, but I'm thinking building one with a more modern ATmega chip would be a bit more useful. An Arduino that boots to BASIC that can access all the GPIOs could lead to some very fast prototyping! I've found a handful of others online that have done similar with their Arduinos, but all of them have severe limitations (display, program size, etc). My goal will be something far more substantial and useful.

It's easy to get overwhelmed or lose interest in a project like this, so my strategy is as follows: Get it up and running as quickly as possible with ready to go components. Then replace those components one by one with my own custom solutions as time and desire permits.

Step 1: Start with a Arduino Mega with a Gameduino shield (for the video/sound output).
Step 2: Code an initial operating system. Use PS/2 keyboard connected to Arduino for input.
Step 3: Add joysticks for game control.
Step 4: Add additional memory for user programs.
Step 5: Code a BASIC interpreter.
Step 6: Add a SD card interface.
Step 7: Replace the Arduino Mega board with the individual components (use a standalone ATmega chip). Basically make it no longer an Arduino, but it will still be semi-Arduino compatible.
Step 8: Replace the Gameduino shield with my own video/sound implementation.
Step 9: Build integrated keyboard / computer case.

I think step #8 will be the most challenging, but that's why it is near the end. I've actually already done steps #1 and #2. I've purchased joystick components for step #3, FRAM for step #4, and a SD card reader for step #6. I've got running ideas for the BASIC interpreter, but I imagine that will be an evolving piece for the entirety of the project. I did see some BASIC interpreters that have been loaded on Arduinos, but I wasn't very happy with them. Not a problem - coding that is a big part of the fun.

Arduino Mega + Gameduino + PS/2 Interface + Button Inputs (Pseudo-Joystick)

At this time the "computer" boots up instantly to a prompt. It only supports a handful of commands now, but a nifty feature I added is the ability to swap between screens. It operates similar to command line Linux where you can change between consoles that are running different programs with a key press. My goal is to be able to run 2+ BASIC programs simultaneously. Each BASIC program is full screen, but you can select which one is visible at any time. This will be multitasking, not multithreading - the Arduino will have to flip back and force between the programs' instructions to execute them - they aren't actually executing simultaneously, but it will still be a neat feature.

The two lines below the = divider are for command input. The 0 in the divider denotes that I'm on screen 0. If I press PAGE UP/DOWN I can switch between different screens.

I have a son now (2 months old!), and I like the idea of my creation here being his first computer. He wants to do something with the computer? Well there is the BASIC prompt, tell it what to do! My poor kid doesn't get the easy route with an iPad playing Angry Birds. (Dean, if you read this some day, sorry? :-) ) My deadline is to make it useful before he outgrows its capabilities! I guess I'm in a rush to add features to delay the inevitable. :-)

This will be one of my long term projects so I'll post updates at major milestones.

No comments:

Post a Comment