Oldskooler Ramblings

the unlikely child born of the home computer wars

Archive for January, 2008

Fine, I’ll do it myself

Posted by Trixter on January 27, 2008

All (and I really do mean all) of the hardware info for low-level PC programming available on the internet today is for ATs and later. Which didn’t help me debug my keyboard handler, as I’m on an XT and the behavior is different.

So I got fed up with looking and decided to just locate the BIOS’ own keyboard handler and see what it’s doing:

c:\>debug
-u f000:0d78
F000:0D78 50            PUSH    AX
F000:0D79 53            PUSH    BX
F000:0D7A 51            PUSH    CX
F000:0D7B 52            PUSH    DX
F000:0D7C 56            PUSH    SI
F000:0D7D 57            PUSH    DI
F000:0D7E 1E            PUSH    DS
F000:0D7F 06            PUSH    ES
F000:0D80 FC            CLD
F000:0D81 E88EEC        CALL    FA12
F000:0D84 E460          IN      AL,60
F000:0D86 93            XCHG    BX,AX
F000:0D87 E461          IN      AL,61
F000:0D89 8AE0          MOV     AH,AL
F000:0D8B 0C80          OR      AL,80 <--Hey, that's
F000:0D8D E661          OUT     61,AL <--new!!
F000:0D8F 86E0          XCHG    AH,AL
F000:0D91 E661          OUT     61,AL
F000:0D93 FB            STI
F000:0D94 93            XCHG    BX,AX
F000:0D95 B44F          MOV     AH,4F
F000:0D97 F9            STC

So, after reading the scan code from port 60h like on ATs and later, the PC/XT is also finding it necessary to acknowledge the scancode by setting bit 7 on port 61. Thanks for nothing, intarweb!

This is an example of why I tell my co-workers at my Unix sysadmin job that my old DOS knowledge from 1983 helps me in all of my computer work: Because basic troubleshooting skills are basic troubleshooting skills. Computers are pretty much the same; if you train yourself to think a certain way, it will lend itself to other computer problems.

If this post seems incoherent and not an example of my best writing, that’s because I just got finished playing my first game of Team Fortress 2 and my vision is still blurred. The last online FPS I played, Counter-Strike, was in 2004… I’m way out of practice and still quite disoriented.

Posted in Programming, Vintage Computing | 2 Comments »

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 »