ECE390: Snake Game

snake

One of the few ECE classes that I enjoy is ECE390. That being the only reason why I volunteered to be an undergraduate TA for the class. As a TA, sometimes I have to write a machine problem for the students. For their third machine problem this semester, I decided to write this game for them. It is a simple game of snake that involves interrupts, text video mode and data structures; all done in x86 assembly.

Since this is a class assignment, I will refrain from divulging too much about it. Suffice to say the original version that I completed in about 6 hours has about 1050 lines of code. That is a lot of code for assembly. So to help maintain the students' sanity, we decided to trim the amount of code they have to write by half. I would have wanted them to write the whole thing because there are subtle points that can only be illustrated by coding. However, since the assignment still involves writing 19 subroutines after the code trim down, I should not demand more.

What I learned while coding this machine problem was the fact that you cannot escape from the code a little test a little mentality. In fact it makes the program that much more fun and less frightening. It is hard to write everything without testing. Even more so when it involves replacing the interrupt vector table with your own interrupt service routines. Do this wrong and it is almost impossible to debug.

Here are some details about the game:

I can think of a few improvements for this program though:

Still this was a simple program and it is my first assignment for my students. We shall see what they think of it. At least they can actually "play" with this game.


comments powered by Disqus