e now continue along with the Spelunker Commodore 64 live stream for Twitch.tv. In this session, we continue analyzing the Ghostbusters game.  After all it never gets old right, the saying “Who ya gonna call? Ghostbusters!”

Excuse me for being random at times, but when I first discovered the Infiltrator tool I was immediately hooked. So at the dawn of this video I was demonstrating how to surf through the code with the page up/down keys. It is no different than paging in any other editor, but I was getting pretty intrigued at learning more about the structure of the Ghostbusters game at that moment. I’ll be honest to admit that this video is pretty advanced for beginners and I should have given a fair warning of that. Sometimes I’m not aware that I can be talking about assembly language instructions as if anyone could follow along. That is the purpose of my Machine Language Tutorial series as I really wanted to stop assuming so much, and provide real information about memory, cycles, etc. directly from the Commodore 64 books themselves.

Keep in mind that the whole point of doing this Twitch.tv series was mostly experimentation for my part. I just wanted to see what I could learn by picking through game code samples and see what hidden gems were below the service. After all that is what keeps me going and the YouTube channel for C64 Brain. It is the desire to push further into the rabbit hole to see how far it goes. It’s my own Alice and Wonderland adventurous spirit that is the medicine of curing those boring moments of burnout and forcing myself to descend further until something new is discovered.

Even when I sat down to write out what the video was about, I started realizing the complexity in following my logic. Anyway I am continuing each video in succession so bear with me as we push through this to get to the good stuff later. Hopefully though, there are still some concepts that stand out for beginners to inspire them to investigate assembly language and have their go at it. So I found myself studying at memory location $4640 in hopes of locating where the game was writing routines for the character set design.

Sprite ShapesNext I began exploring with the Sprites tool again to study this memory register. I didn’t immediately identify it. I have no idea why I kept saying it was “the vacuum”. Now see that it is the sprite for the proton streams that spray from the proton packs.  Each sprite is measured at 24 bits (8 x 3) wide and 21 bits high. The makes a total accumulation of 24 * 21 = 504 bytes in size. Any of these bits can be allocated to create any type of sprite character you can imagine. Each square on the sprite represents a pixel. They are read from left to right and use a numbering system of 128 64 32 16 8 4 2 1 to the power of the bit calculated. We will learn in other tutorials how to calculate these areas to create a sprite, but tools such as SpritePad can be used to design your own sprite shapes.

Pitfall for Atari 2600After evaluating the sprites for a while I started talking about the author of the game. With all due credit, Ghostbusters was originally created by David Crane. I first discovered the game when a neighborhood friend invited me to visit his house one day to see his new Commodore 64 computer. I still fondly remember the myriad of colors that illuminated from his desktop as I watched him play some pretty cool games. In that stack of disks, he pulled out Ghostbusters and the rest is history. Anyway, the author had put together quite a masterpiece from the popular movie. He first came to recognition from a game called Pitfall that became a best seller for the company he created called Activision. I wanted to give him credit since his works likely inspired other programmers to explore and write their own games as the C64 started gaining momentum in the marketplace. The screenshot here is the original game as first seen on the Atari 2600. I then provided a history lesson that the Atari 2600 was the most popular gaming console in the world before the Nintendo Entertainment system rose to fame.

Before long, my prospects had led me to discover another code segment that manages the game graphics. The one that I focused on was memory location $d01c (53276). This is the area where the multicolor sprites resided. Located in the realm of this code region, I started talking about memory locations $d000 and $d002 to mark that I found the areas where sprites are positioned on the screen. Then I speculated that maybe this is where “the ghosts start at”, however I had no idea. The concept here is exploring to learn where the hidden things exist at so making a change can help you possibly learn what that segment of code is responsible for.

Soon I started investigating memory location $d012 (53276). To elaborate further details, I mentioned that the book Mapping the Commodore 64 is a great way to learn more about the memory of the computer. So this memory register is responsible for reading the current raster scan line. The book states clearly that it “tells which screen the electron beam is currently scanning”. An explanation is required. The Commodore 64 screen consists of 262 horizontal lines (for the NTSC) display screen. These lines are scanned and every 60 seconds they are updated. A game programmer can trap these raster lines to create a multicolor display by writing values to this register during an interrupt phases. This effect can provide the capability to split a sprite until it is multiplied all across the lines being scanned during the raster read.

C64 Skate or DieLikely losing my concentration and letting my anticipation take over, I launched Microsoft Word to show that I had saved a copy of the code for the game known as Skate or Die (by Electronic Arts).  Then I demonstrated that this code was loaded into Infiltrator earlier and using the copy/paste method I was able to create a document reserved for it. My reasons doing this are so that I could jot down comments to the right of the code routines in order to “learn” from them as usual.

C64 Memory location $D011Probably another cool technique to having your own game code copy is that you can use Microsoft Word to search for memory registers that are of interest. As an example, I used the Control F feature (find) and searched for memory location $d011.  The area in the C64’s memory manages the vertical fine scrolling of the screen when Bits 0-2 are set.  When you are controlling this memory location, the C64 screen can be scrolled in a vertical direction (up or down). This was made very popular by many Commodore 64 hit games in that era and is an excellent step for anyone wanting to create a very professional game. I have pasted a screenshot of the sample code that I was discussing in the video.