Tim Hentenaar's Blog

Refactoring for Smaller Code

Everyone loves to preach about refactoring. How you should refactor, why you should refactor, when you should refactor, etc. But, does anyone actually measure the effect of refactoring on their code? Some people do, but I'm willing to bet that a larger portion of the crowd don't. They worry about their trivial asthetic concerns and leave the compiler to its own devices in the hopes that it will magically produce better code.

Consider the case of developing an embedded application. It's one area where refactoring can substantially benfit or harm the end goal: to keep the code small and fast. With this post, I'm going to write very simple program, and then refactor it, measuring the results along the way.

Now, keep in mind the fact that optimization by the compiler may produce varied results with different compiler versions and may perform differently across different architectures. YMMV, but you can't deny that sometimes the compiler needs a helping hand. :P

Here's a little experiment...

Continue reading...

Published on: Jan 26, 2015

Expanding the Gameboy's I/O Capabilities



As a follow-up to my last post, I starting thinking about simple ways to interface with the Gameboy dev cart I now own. Of course, I could just use my arduino and a couple of 74595's, but nowadays that's a bit cliche. Not to mention, plenty of people have already done it. :P
I figured it would be much more interesting to build a Gameboy cart which can interface with other Gameboy cartridges (or any other hardware that you can drive at TTL or CMOS line levels.) Since a Gameboy cart has 29 I/O pins (if you count the bus control lines,) this new cart would have to add that many lines.

And so, my decent into madness begins...

Continue reading...

Published on: Nov 10, 2014

Inside an official GameBoy Dev Cartridge (DMG-MBC5-32M-R-FLASH)



I finally got around to getting my hands on one of these little bastards. Being the first official Nintendo development cartridge I've owned, it's not too shabby. Of course, being me, the first thing I did when it arrived in the mail was to take it apart, and go to work inspecting its innards. This thing is about as yellow as Pikachu on a Sunday morning, but let's take a look inside...

Continue reading...

Published on: Nov 07, 2014

Keeping Track of Meetings with mutt + calcurse

Like a lot of people, the environment I work in is a bit too M$ Exchange-centric in terms of email, scheduling meetings, and those sorts of things (unfortunately.) Since I use mutt to tackle my day-to-day email tasks, dealing with meeting requests is a bit of a pain. As a general rule, I never accept meeting invitations, but I figured it would be nice to have the ability to view them, and add them to my calendar from mutt. Thus, I set about integrating a few things to make the process "just work."

Here's how I got 'r done...

Continue reading...

Published on: Sep 26, 2014