Help me write Third Reality
May 17, 2012 8:48 AM   Subscribe

I want a simple, bare-bones environment for working on my systems programming chops.

Every so often I think about how I would really love to develop the sort of discipline involved in doing something like porting Star Castle to the Atari 2600, or writing a lean mean demoscene. It's not a matter of complete ignorance -- I took a Systems Programming class in college, and I've implemented the occasional inline assembly function in C, but I haven't really gotten much in the way of rigorous practice with regards to managing extremely precious resources. That's what I'd like to do, and so I'm thinking that some sort of emulator of an older and/or simpler system is what I need. With that in mind, here are the things I'd like it to have:

1. As much applicability to future projects as is feasible. I expect that I won't be dealing with the x86 instruction set here, so that type of applicability is probably out, but I'd value any other kind. MMIXware is a good example, because I'll have an advantage if I ever decide to work through The Art of Programming.

2. Some sort of pre-existing infrastructure for a virtual display, like MMIXX, would be nice. I want this because I'm probably going to be centering my explorations here around demoscene-like projects.

3. No reliance on extra hardware for the moment. If you think that that's a good direction to go in terms of pursuing this interest, then by all means tell me. It's just that a relatively low barrier to entry is important to me at the moment.

So obviously I may have answered my own question with the whole MMIX thing, and if that's the case, great! I just think there are probably a lot of things out there that might work for me that I don't know about, and some of them might be better for my purposes.

Thanks!
posted by invitapriore to Technology (7 answers total) 4 users marked this as a favorite
 
There is a thriving scene of people making games for Arduino boards (with a tiny bit of extra hardware for analog TV output). You'd need to buy a board, but it's in the $50 range. Seems more fun than programming for an emulator to me. Just an idea.
posted by miyabo at 8:52 AM on May 17, 2012 [3 favorites]


I am going to second miyabo's Arduino suggestion. For a "normal" programmer who normally has an OS and a whole host of libraries to work with, Arduino is a fun and different sort of challenge.
posted by tylerkaraszewski at 9:18 AM on May 17, 2012


I've enjoyed Arduino coding, but as miyabo points out that's going to be a $50 board, and probably a display, a bread board, and... yeah, it could cost a few bucks.

Other suggestion is that the guy who wrote Minecraft is developing a new multiplayer game that involves a spaceship that runs a (software) CPU you can program to as part of game play. It's spec'd out at 0x10, and I know there are a couple of emulators out there and other people playing with tools, long in advance of the game shipping.
posted by straw at 9:21 AM on May 17, 2012


Best answer: One thing you could do is get involved in writing code for the DCPU-16, the computer in the upcoming game 0x01c.

Other things you could do that are on the fun side. MAME has accurate emulations for tons of existing video game platforms. I would pick one for which you could set up a decent enough tool chain.

If it were me, I'd pick the Stargate or Robotron platform. Both games use the 6809, which is a real sweetheart of a CPU. Nice and simple and only a few odd quirks (I'm looking at you 6502 - oh nevermind, I could never stay mad at you and your SED/CLD instruction). If you don't want to be fluent 6809 there is a gcc port.

What do you get with these machines? You get a 64K address space, 4 bit per pixel colormapped graphics, and in the case of Robotron, you get a blitter chip too. I think you get a basic clock in the form of a VBL interrupt. I *think*.

On top of that, the hardware is fairly well documented.

If that's too hardcode, consider a game based on the 68K, for which there are fabulous tools. Atari used the 68K heavily in the 80's, but you might have some work to get around their anti-piracy measures. At any rate, Gauntlet, Marble Madness and others were on this chip.

You can also take the same approach for the Nintendo Gameboy Advance, for which you can find emulators and full toolchains. The CPU for that is an ARM.
posted by plinth at 9:28 AM on May 17, 2012 [1 favorite]


I have found exactly the sort of challenge you describe in microcontroller programming, and got interested enough in it to try doing it professionally for a year. Really satisfying stuff, very much like classic early-'80s hacking. Every project is like writing a custom operating system from scratch.
posted by Mars Saxman at 9:57 AM on May 17, 2012


Response by poster: plinth, what you describe with the Robotron platform is exactly as hardcore as what I'm looking for.

Mars Saxman, how'd you get started?
posted by invitapriore at 10:24 AM on May 17, 2012


Best answer: I started with PICs, which pretty much suck, but I really got going when I finally bought an Arduino. I don't think there's anything easier to start out on, provided you have some familiarity with C. You plug the board in as a USB device, launch the Arduino IDE, select the appropriate board type from the menu, and push "run". It compiles your code, uploads it, and launches it. You even get a serial IO line for debugging or UI - to your computer, the Arduino board looks like a normal serial port.

What's more, there is basically nothing boxing you in to the Arduino platform itself. The source code is all open and the hardware is clearly documented, using simple, commonly-available parts. You can prototype something on an Arduino, replace any bits of their C library that you don't like with your own low-level register-bashing, and then copy the whole thing onto a custom PCB for manufacturing... whatever you want.

So that's how I got into microcontroller development: I just started building stuff, adding one piece at a time, learning how interrupts worked, how to use registers to configure a chip's subsystems, how to read datasheets, how to wire up a power supply, how to build an I2C or SPI bus... until I found myself building a MIDI drum machine, using a 72 MHz ARM chip and a custom PC board I laid out myself.

With that as a demo I was able to get a job at an engineering company. The projects I worked on there were all about low-level systems hacking. Device drivers, thread libraries, interrupt management, memory management, bootloaders, filesystems, and lots of power control - all the stuff I wished I knew how to do back when 8 MHz computers with 16K of RAM were mainstream.
posted by Mars Saxman at 12:02 PM on May 17, 2012 [3 favorites]


« Older A cluttered mind is a sign of...wait I forget.   |   Grandpa wants to see the heir apparent Newer »
This thread is closed to new comments.