Oldskooler Ramblings

the unlikely child born of the home computer wars

Back to the Future

Posted by Trixter on January 25, 2008

I couldn’t save my old XT keyboard (enter key died, and that’s pretty much the #1 most important key on the damn thing) so it has been tossed into the spare parts bin. My remaining keyboard, however, survived my pokings and I have a functional XT keyboard again. My last, but beggars can’t be choosers.

Thanks to a functional keyboard, I started working on MONOTONE again, starting with the interface (the design docs are done — yes, design docs — hey, stop laughing!) except that I was immediately sidelined by my custom keyboard handler.

A keyboard handler, for the uninitiated, is a little routine that “replaces” the “hold-key-down-and-watch-it-repeat-after-a-short-delay” behavior with “hold-key-down-and-it-stays-down-without-beeping-incessantly” behavior. This is good behavior, if you want to make your keyboard act like a piano. But my trusted old handler code locked up the machine after the first keypress.

Here is the code in question, which I had been using since 1994:

Procedure New9handler; Interrupt;
Var
  b: Byte;
Begin
  port [$20] := $20; {send end-of-interrupt to PIC}
  b := port [$60];   {read scancode from keyboard}
  If b < 128
    Then kbd [b] := True
    Else kbd [b And 127] := False;
End;

On keyboard interrupt, grab a friggin’ character and stuff it in a bitmask array. Easy as pie. Yet the XT locked up, so I am clearly doing something that the XT is allergic to (or, more likely, forgetting to do something). So now I get to research early XT keyboards/signals and try to figure out what I’m doing wrong. Luckily, I have a lot of programming books to consult; here are the ones I’m going to take to bed:

  • Compute’s Mapping the IBM PC and PCjr by Russ Davies
  • The Undocumented PC by Frank Van Gilluwe (founder of V Communications — thanks for Sourcer, Frank!)
  • Sam’s IBM PCjr Assembler Language by David C. Willen (why a PCjr-only book? Because eventually monotone will support PCjr — ssh, keep it a secret!)
  • Compute’s Beginner’s Guide to Machine Language on the IBM PC and PCjr by Christopher D. Metcalf and Marc. B. Sugiyama
  • Assembly Language Primer for the IBM PC & XT by Robert Lafore

Overkill, but I want to check them all so that I can get all the info on handling a keyboard interrupt and then pick out what I need.

I know all this seems stupid and unnecessary, and makes me seem like a freak, but honestly it is the reason over the years I have gravitated towards older and slower platforms to code for fun on. It’s the same reason people still code demos on the Commodore 64 and other legacy platforms: They are fixed in nature, which means you can truly discover the absolute fastest way to accomplish a particular task on them. It’s impossible to do this on a modern winbox, because winboxen are moving targets. It also explains perfectly why modern demos have evolved in the last decade the way they have, but that’s a topic for another day.

PS: The last book by Robert Lafore is the best book you can read to learn assembler on an IBM PC. It teaches you the basics by making you assemble, by hand, in DEBUG. It sounds incredibly scary and hardcore, but it’s actually very fun!

Posted in Demoscene, Programming, Vintage Computing | 6 Comments »

Black Hole

Posted by Trixter on January 23, 2008

I am smarter than most people. I am aware how very conceited and pretentious that sounds, but it’s true. And it sucks.

“Boo hoo, poor me,” I hear you say. Yeah, I get it. It still sucks. It results in “conversations” with people where the exchange is typically something like this:

Hey <person>, you can’t perform process X without first processing Y.

“Why not?”

Because you don’t know what procedure to follow until you have the results from Y.

“But I always follow schedule A to process it!”

(let out a sigh) Without checking the results of Y?

“It’s always worked before…”

But that’s a coincidence. I’m amazed the service is still up. You really should read the documentation and follow the proper process.

“But I like my eggs sunny-side up!”

If that last line doesn’t make any sense, it shouldn’t. That is quite seriously how much of my conversations have gone today. You try to have a rational interaction with someone, and they let out a statement that so utterly and completely misses the point, misses all points ever made, that your brain completely blows the stack and dumps core.

The frequency of this happening at my workplace is increasing over time. I am beginning to think that it’s a natural defense of stupid people — to feign ignorance until the protagonist at a loss for words.

There are days when dealing with people becomes an exercise in endurance, where you struggle to communicate basic tenements of logic in a futile effort to get something done. These days I can handle, as I am fairly patient. But then there are days where you are clutching to a ledge by your fingernails struggling to avoid getting sucked into a black hole of mass idiocy. These are the days I can’t handle, and must resort to playing loud repetitive 1990s acid house in my earbuds to drown out the frustration.

I wish I could expand on the kind of day I am having in glorious sarcastic detail, but I can’t, since a few co-workers read my blog and I wish to keep my job position. At least I have my broken XT keyboard to “play” with tonight after the family is asleep, which should take my mind off of things.

Or a game, I suppose. But that wouldn’t be very productive, and after today, I sure as hell need to get something done.

Posted in Sociology | 4 Comments »

When design was king

Posted by Trixter on January 21, 2008

A lot of old gamers continue to beat the dead horse of “The games were better when I was a kid!”  While there are a ton of reasons why this is just nostalgia rearing its ugly head, there is one very strong reason this is true in some cases:  Since the graphics and sound of early home computers were so terrible compared to arcades of the day, game designers had to focus on actual game design and not just excuses to blow shit up.

I bring this up because my eight-year-old son Max and I just finished playing Archon for the last 90 minutes.  We didn’t even play it on one of the “cool” platforms, like NES or Amiga, but rather on one of the ugliest ports: The IBM PC.  Terrible sound, horrible graphics, and yet none of that mattered.  In 3 minutes I was able to explain the basics, and then 90 minutes later we were still laughing at each other for some crazy battle.  The entire time, I couldn’t get over how basic game design still reigns supreme, 25 years later.

Posted in Family, Gaming, Vintage Computing | 1 Comment »

Small setback

Posted by Trixter on January 20, 2008

The 5160 (PC/XT) has gotten significant use this weekend; not only was I finishing up the design docs for BeeperTracker (which Jason Scott is heavily lobbying to rename MONOTONE, which will ultimately prove successful), but Max was bored and we spent time playing old games on it.  Unfortunately for me, the use was significant enough that the keyboard’s spacebar stopped working.  Normally I’d whip out another one and keep going, but this was, in fact, my last 83-key keyboard that had a functioning spacebar.  I pried all of the keys off and cleaned out all of the gunk… only to find that the spacebar doesn’t go back on the way it came off, as there are two metal prongs that need to fit into holes.

I’m terrified of taking the plate off of the back (buckling springs everywhere!) so I’ve asked the Classic Computer Mailing List for a more official way to repair it.  Until then, I’ll be playing Half-Life: Episode 2.

Posted in Vintage Computing | 5 Comments »

Sweating the small stuff

Posted by Trixter on January 13, 2008

I formally committed to a talk at Block Party 2008 and informally committed to a wild compo entry.  The former I must deliver on; the latter I want to deliver on.  I’m just so high-strung about both that I’m not so sure about the latter.

My idea for a wild compo entry was an old-school style megademo for a stock IBM PC with CGA.  (To date, there has been only one, by Sourcerers, back in 1989.)  By “stock”, I mean no hard drive, no sound blaster… just a floppy drive and the PC speaker.  But nothing is as simple as it sounds, and so I find myself in the following thought process:

  1. A megademo will need sound, or else it will not impress.
  2. The sound engine must not impact the onscreen full-framerate effects, and must use the PC speaker.
  3. The only type of sound engine that could do such a thing is a simple arpeggiator.
  4. There are no trackers that can write or play such music, especially using 60Hz as a timebase (most MOD-style trackers use 50Hz).
  5. I will have to create such a playback engine, and hope I can optimize it to work in a handful of scanlines.
  6. I must write a tracker to create the data that will be used to test such an engine.

So tonight I found myself writing a PC Speaker tracker.  I’m calling it “BeeperTracker” so that the initials can be “bt” to deliberately avoid being called “st” because that would be sacrilegious. Tonight’s accomplishment? Spending 2 hours writing docs (planning) and 1 hour populating a frequency table with the twelfth root of 2.

I’m so screwed.

Posted in Demoscene | 2 Comments »

Step 1: Detox

Posted by Trixter on January 1, 2008

As I wrote before in 12-step program, I’m going to try to change my lifestyle to become more healthy and fit. While weight loss will inevitably ensue, it is not the focus of this change. I’ve yo-yo’d between a high and low of 30 pounds in the last four years, and it’s starting to wear me down. Half the days of the week I walk around in general malaise. Time to change.

Every step will take a month, because some smart person ran some smart study that found it takes about 20 days to establish a new habit. I’m going to attempt one habit at a time. Nice and slow.

The month of January is step 1: Detox. By “detox”, I really mean “stop eating pure shit”. With the exception of carbonated drinks (don’t worry, that’s a later step), I’m going to try to stay away from food that was prepared or treated with chemicals; I’m going to only eat food that I either prepare myself, or that I can watch being prepared (ie. a sandwich). I know this may paint me as some sort of organic “whole foods” vegan nutcase, but it’s not that at all; I’m still going to eat burgers and the like but this time I’m going to make them myself out of raw ingredients so that I can maximize my food-to-chemicals ratio. No more chips, candy bars, or cookies; no more frozen meals or appetizers (which I sometimes inhale as meals). This also means most fast food is out, which means I must bid adieu to my good friends McDonald’s and Taco Bell. We’ve had good times, but I’m afraid the love is gone. Don’t let the door hit you on the way out.

Lack of snacks are going to be tough, but luckily I have my old popcorn tricks to tide me over. And pop, for now.

Posted in Weight Loss | 6 Comments »

Coming out of the closet

Posted by Trixter on December 20, 2007

No, I’m not gay. But I feel as if I can relate to the GLBT community because I subscribe to a belief system that usually changes how people treat me once they know it. I rarely open up to people about it for fear of being ostracized, and of ruining friendships or business relationships. Like being gay, my belief system is a personal choice and doesn’t hurt anyone, yet half of the people I open up to seem threatened by it and never treat me the same way afterwards.

I’m tired of hiding it so I’m going to get it off my chest and be done with the misplaced panic and frustration. My belief system is simply this: I don’t have a belief system. I’m an atheist.

Previously I would only tell people that I knew (from personal experience) were kind, forgiving, and open-minded. But even for such people (especially the devout religious), it’s harsh, so I sometimes soften the blow with a quick follow-up that I’m “really more of a skeptic”, and just haven’t been presented any credible proof that deities exist. If I’m lucky, they accept that and move on, probably with an internal understanding that “I’ll find my proof some day and join the rest of the population in believing in [insert personal deity here].” If I’m unlucky, I’ll have to field questions about the Bible. And then there are days where I have made a horrible calculation in judgment about a person, for which I am sent a barrage of “scientific” proof that $DEITY exists that I am expected to comment on. (These usually start with The Lost Day and quickly go downhill from there.)

Being an atheist is becoming easier in an increasingly modern world, but I can’t shake the feeling that society still has many years to go before athiests are treated fairly. Unlike similar issues of sexual and racial tolerance, there is no modern social identity of a “defense” for atheism. For example: If you discriminate against a minority race, you’re shunned by society as a racist. Same goes for discrimination against sexual orientation; you’re seen as a “gay basher” and similarly shunned. But tell people you’re an atheist, and it’s open season, no consequences. I have even had the pleasure of having my character questioned, I swear I am not making this up, by a gay, religious, African-American. The irony of the event was not lost on me, I assure you.

There are no feel-good Lifetime Original Movies for people who come out of the closet about being atheist. There are no moments over the Thanksgiving turkey where a family member proclaims, “I’m proud of you for being true to yourself.” Instead, it usually goes something like this:

“Why don’t you believe in [insert personal deity here]?” Because I haven’t been presented credible evidence that your deity exists. I’m a practical, scientific person; I usually require proof of something before I subscribe to it.

“What would it take for you to believe in [insert personal deity here]?” A giant flaming hand that lowers out of the sky and points directly at me, while a thunderous booming voice fills the heavens with a single “Believe in me!” (That’s not a joke answer — I’m being serious.)

“How would you know that such proof was ‘real’ and not faked?” In the case of a giant flaming hand coming out of the sky, would it matter? Either it would be true (ie. $DEITY exists), or it would be a truly phenomenal feat of engineering, optics, and science. Both explanations would warrant unconditional worship!

“What about the [insert religious text here]? Isn’t that proof that [insert religious text’s deity here] exists?” Nope. Text without verification is fiction. Can you prove that the events in the text actually happened?

Not coincidentally, this is the most common place for the conversation to break down. How they react to that question is a good barometer of how much longer I will be able to talk to this person; hopefully measured in decades, but sometimes only in days. When it goes bad, it goes in multiple directions, none of them salvageable:

“What do you tell your kids?” I tell them the truth: Some people believe in a single God (with optional messiah in human form). Others don’t, preferring instead to believe in multiple gods. Still others eschew deities entirely, choosing to hold belief systems in reincarnation, nature, crystals, inner Chi, the Force, or the Flying Spaghetti Monster. And some don’t believe in any of that. I trust my children to be intelligent individuals who will research any religion or belief system that interests them. It’s completely their choice; as long as they remain intellectually curious, I am satisfied.

“Christianity is the most popular religion in the world.” No, it’s the third most popular. Hindus and Muslims have you beat.

“You’re going to Hell for your heresy.” If I believed in Hell, I guess I’d be scared. Got any travel brochures?

“If you don’t believe in Heaven, aren’t you afraid of dying?” Yes, but my fear of dying is the inverse of a love of life. It is the most amazing and wonderful opportunity we will ever have, this existence, and I find at least one gift in every day. It saddens me to know not everyone can do the same.

So. I’m an atheist. I’m out of the closet.

I hope we can still be friends.

Posted in Sociology, Uncategorized | 14 Comments »

12-Step Program

Posted by Trixter on December 19, 2007

While previous attempts at losing weight and feeling better have been successful, I fall squarely into the 90% of the population who eventually give up (I prefer the term “losing interest”) and gain it all back. So I’ve decided to take things easy and make small, gradual changes meant to help me feel better. While weight loss will probably follow, it’s not the main goal. I have some severe life changes coming up in the next 18 months of my life and I want to be physically able to handle them. Mental ability will follow.

Every new month will bring about a change. “New month resolutions”, if you will. Should be fun.

Posted in Lifehacks, Weight Loss | 2 Comments »

Playing Between The Lines

Posted by Trixter on November 26, 2007

I finished Half-Life 2 today for the first time (yes, I really did wait until the Orange Box until I bought and played Half-Life 2 — I’m a very patient man) and I have to say that was easily one of the top five games I’ve ever played.

I have a friend that didn’t like Half-Life 2 as much as the later Episodes 1 and 2 (which I have not started yet), and, if I remember his opinion correctly, it was because there was “no story”. I am assuming what he meant by that was that he didn’t feel there was enough explanation as to what was going on. I can see his point; there is no narration, and little dialog directly explains key elements. But I think the reason people like HL2 so much is because of what is not explicitly said — what you get between the lines.

There are lots of little things you can pick up if you listen to all of the dialog (4-speaker audio helps, so you can separate distant/soft dialog from environmental sound effects) and keep your eyes peeled, and while they may not offer direct answers, they give you something much more powerful: Empathy. Gordon Freeman is not Duke Nukem; he’s a scientist who has been thrust into a situation where he’s just as disoriented as everyone else. To the resistance, he’s almost mythical, able to survive and accomplish what no other person has done. Being confronted with that while at the same time being partially in the dark really gives you a sense of what he must be going through. He’s just as confused as everyone else, and only quick wits and the luck of having a hazard suit is what keeps him a hair away from death.

For example (spoiler alert), there’s one place you can look at before the bridge area where there is a series of oil tanks behind a chain link fence. There is a part of the fence that is damaged that you can climb over. There are no supplies, ammunition, or new weapons in this area; there is no reason to go to the trouble of entering it. But if you do, what you find is a person slumped in the corner, dead of a self-inflicted shot to the head, revolver still near his hand. Marked on the wall next to him are three side-view anatomy illustrations of the heads of a monkey, a human, and a human with a Combine soldier mask on. It is after a few seconds of looking at these that it dawns on you that the soldier is not merely wearing a mask, but that the mask is physically part of his anatomy, along with other subtle modifications. That completely changes the tone of the game: You are not only made aware of something insidious and quite disturbing, but worse, the people you meet later in the game don’t know this, and are assuming that the soldiers are simply “police”, or otherwise people on the wrong side of the conflict. They’re fighting what they think is some sort of a civil war, when you secretly know the truth. It’s those kinds of moments, extremely powerful moments through very subtle delivery, that immerse you in Gordon’s situation.

I became more emotionally involved in Half-Life 2 than I have any other game. I was (sometimes simultaneously) surprised, shocked, disgusted, anxious, angry, determined, vengeful, and awestruck. And, I’m not ashamed to admit, I got so worked up sometimes that two nights last week I had to go to bed early and sleep for 12 hours, having made myself quite sick through sheer concentration and stress while playing.

I’ve been a fan of Roger Ebert since the early 1980s, but he is truly mistaken when he has declared, several times, that video games are not art. I think just two hours with Half-Life 2, the same time he spends watching a movie, would change his mind.

Posted in Gaming | 1 Comment »

Using A Sharper Stick

Posted by Trixter on November 22, 2007

I met with Brian the other day to help out with some MobyGames infrastructure activities and we rekindled the idea of allowing video submissions. These could be actual videos of gameplay, or video reviews, or commercials… but before we work all that out, we have to work out how feasible it is from a technical standpoint. Which gives me yet another excuse to toy with video :-)

Before we posed our own internal technical questions, I decided to try to figure out how YouTube was encoding their videos, so that we could have a baseline to work from in terms of user expectations. The viewing public seems to accept YouTube as generally “watchable”. If MobyGames were to implement video, it would have to be at least as decent as YouTube.

So we’ve got a few questions to answer here: What video and audio codecs is YouTube using? What parameters (approximately) is YouTube using to encode video?

Thankfully for me, my friend Mike Melanson has already answered most of these questions: It’s Flash video, using Sorensen Spark (h.263 with some limitations) for video and MP3 for audio. To determine the encoding parameters, I grabbed a few .flvs from YouTube and ran “ffmpeg -i myvideo.flv” to see what ffmpeg could glean from the file format, and it identified the audio stream as 22050Hz audio, 1 channel (mono), at 56kbps. But it couldn’t identify the video stream other than to tell me it was indeed using flv’s limited h.263. I asked Mike how he thought it was being encoded, and also what best practices were.

“No idea; I’m not really that much of an encoder guy.” Luckily, I am.

The first thing I wanted to determine was how the bitrate control was. Was it quality-based or bandwidth-based? I encoded two test videos, a simple one (few changes per frame) and a complex one (many changes per frame), both one minute in length. (By the way, I noticed a few people other than Mike and myself doing this, with names from the innocent “video quality test” to the unabashedly-named “ffmpeg FLV encoding raw audio mux test”.) After letting YouTube encode them, I sucked the end results back and immediately it was apparent that the encoder was bandwidth-based because both file sizes were identical. If it were quality-based (“constant quantization” for the encoding nerds out there), the simple file would have been substantially smaller.

After figuring this out, of course I had to determine what that constant bitrate setting was. After some manual binary partitioning trials, I narrowed it down to 240kb/s. Matching youtube’s 56kbps mp3 audio and encoding my originals, a setting of 240kb/s for video resulted in nearly the same filesize as the encoded YouTube .flvs.

I was happy with this until I actually viewed my encoding results, which looked substantially worse than YouTube’s files. It took a few more viewings of the “simple” example before I noticed that the YouTube video had a very long GOP (group of pictures). Meaning, a very long time went by before the entire frame was repainted with a keyframe. In my trials, my keyframe was changing every 15 frames; that’s twice a second @ 30fps. Since intraframes (keyframes) are much larger than interframes (frames where only the differences are stored), this was eating up my bandwidth, and visual quality suffered. I was able to determine YouTube’s intraframe interval by staring at a static section of the “simple” file, hitting a stopwatch when it changed, then hitting the stopwatch again when it changed again. I measured 8 seconds, which is 240 frames @ 30fps. Setting the GOP to an interval of 240 frames, my encoded files now matched YouTubes’ results. For the video encoding nerds out there, I can even see some of the same DCTs being used in the same places :-)

If you want to reproduce YouTube encoding yourself, possibly to see how your encoded video will look on YouTube without waiting for the upload+processing, grab yourself a command-line version of FFMPEG and use this syntax:

ffmpeg -i (inputfilename.whatever) -s 320x240 -b 240kb -ab 56kb -ar 22050 -ac 1 -g 240 (outputfilename.flv)

I’m sure it’s not 100% complete, but it certainly gets you 98% of the way there.

Will MobyGames improve on this? Most likely. For one thing, I didn’t agree with the decision of limiting everything to mono sound. For the typical YouTube talking head over laptop speakers, it makes perfect sense, but for stereo video game music or positional sound effects, it doesn’t. I was also not happy with the video quality at 240kb/s because, for fast-moving sources like FPS games, everything becomes a blocky mess. We will also probably come up with some convention (read: Encode It Yourself Dammit) for frame sizes over 320×240, like games that run 640×480 and are simple (ie. have very little motion or changes between frames). One of the “obvious” optimizations that turns out to be not so obvious is 2-pass encoding to spread out the bits more optimally, but this was only a benefit (in my tests) for complex sources. It actually made simple/static sources more blocky in the static parts.

After all this discovery, I was bothered by something. Check YouTube’s parameters again:

  • 240 lines (framesize is 320×240)
  • 240 kbps (video bitrate)
  • 240 frames in a GOP

I’m a big fan of Occam’s Razor, but I was depressed to apply the Razor here because, after doing so, it sure seems like the YouTube guys were taking blind stabs at encoding parameters (ie. “Hey, let’s set everything to 240 and see what happens!”).

Posted in Digital Video, MobyGames | 14 Comments »