Writing

Feed Software, technology, sysadmin war stories, and more.

Tuesday, July 5, 2011

Forget the games, I want to create some plumbing

Some people get computers and write games. I always tended to write utilities. I didn't think this was too unusual until I looked back at some programming which happened in a nontraditional environment: a graphing calculator. Again, most of the people in school who had one of these things and had some desire to program on it wrote games. I didn't. What I did do seems almost ridiculous in retrospect.

I wrote a BBS, as in a bulletin board system... for my graphing calculator. The idea was that it would be a place where you could share messages with other people, just like the "true" concept of a BBS. Before it became all about warez monkeys, a bulletin board was about communicating with others who were part of that community. I wanted to do the same thing, and besides, what else was I supposed to do in class?

The "system" in question had basic array/matrix access for numbers, but nothing of the sort for strings. As a result, early iterations just had a single message which could be active at a time. If user A sent a message to B, nobody else could enter something until B logged in and read it. Then it could be recycled. It was only a single line of text, but it was better than nothing!

That was fine for a first cut. Then I decided this thing could be better than that, and hacked up a way to split up that string. Messages were still just a single line of text, but now there was a delimiter which said "okay, this one is over, and a new one is starting". A matrix of numbers kept track of who the recipient would be for each part.

Well this was pretty cool, but I wanted more. So my next hack took that string and added yet another magic character which meant "this is the end of this line, but is not the end of a message". Now, upon logging in, it would read that buffer character by character and keep track of where it was. If it reached a message destined for you, it would start displaying them until it hit its own EOL marker, then it would jump down and repeat until reaching EOM.

This worked well. This actually worked too well. Having multi-message and multi-line support at the same time added up to some seriously long strings. It needed some way to prune this stuff. Finally, I wound up doing something where it would look at the spool, and if nothing was unread in it, then it would reset that string to being empty.

I guess I basically re-invented my own broken little garbage collector.

But yes, when most people were writing games where you walk around DOOM type levels and shoot at things which looked like Barney, I built a (gag) "social network" (to abuse a term for what we'd call it today)... on a calculator. I guess I'm a plumber to my core.