C


4
Feb 06

A lil’ bit of retro

Note: this is a repost of an old post from my previous blog(s); it’s probably quite obsolete by now and is included here for archival purposes.

It’s been a while since I’ve last posted. I’ve been quite busy lately, finishing my grade school, so I haven’t really had time (or the will) to write here. I’ve had a few ideas for the articles, but I didn’t cared enough to sit down and research them, and I didn’t want to post just another rant, so that went to /dev/null.

The today’s theme isn’t rocket science, either. Today I’ve read this article, exposing a cool xscreensaver hack. That reminded me of countless hours I’ve spent, first in front of a Commmodore 64 (my first computer), and years later, in front of the DEC and IBM terminals at University Computing Centre (SRCE).

While hanging there (I’ve met some great friends there, we used to hang around there and socialize even if we didn’t use the terms at all), I’ve written a small game, a clone of Microsofts’ Nibbles, for use on the DEC VT. It was one of my first C programs, and I believe the first one using the ncurses library.

Seeing the terminal emulation hack, I decided I’d run my game under that. With some minor tweaks i got it to run under 40×24 with not-so-good terminal capabilities (cursor droppings and reverse video problems with ncurses).

An obligatory “intro”, showing the year of creation, 1997. This is the oldest program I’ve kept sources to, and it brings back nostalgia.

Ah, the good ol’ times when men were real men, women were real women, and small ugly text-mode terminals were real small ugly text-mode terminals…


5
Jan 06

There Be Dragons

Note: this is a repost of an old post from my previous blog(s); it’s probably quite obsolete by now and is included here for archival purposes.

It’s 4 AM, and the night is still and quiet. I’m sitting in front of my computer, lit by the pale light of the LCD screen, and I’m losing my mind. My life for the past several days (excluding the New Year’s) has been no different than tonight. Thinking, coding, debugging, debugging, debugging, …

I’m working on an embedded environment project for my diploma thesis. I have infinite power over the computer, my software need not obey anyone’s laws. Except my own, which I have to keep in my head at all times. Can’t write them down, they’re changing too swiftly.

It’s hard, and it’s fun. The most challenging part is that I have to be aware of the entire picture, down to the every detail. From the overall design, down to the stack allocation and word width issues.

And it gets ugly. I’m using some 3rd party components (like libc), which aren’t exactly bug-free. Just a few minutes ago, after a few hours of poking around in my code (debugger? what debugger? I’m lucky I have printf() :-) I’ve traced the error to strdup() and malloc() implementations. Great..

So, frustrated and tired, I just wiped out the entire malloc code and created my own, which leakes everything (no free()) but at least correctly produces usable blocks of memory. After I did this, I tried to remember what I was working on when the problem occurred…hm, who knows. I’m tired and I don’t want to play any more…

It’s hard, but it’s fun. There’s no hacking like kernel hacking.