nfiltrator is a way to analyze code inside an emulated environment. Essentially to steer away from the video for a little bit, I’ve done my own research on the side. It simulates a game in ram and manages memory effectively so that game graphics can be located quickly to reduce reverse engineering time. The core of this serious centers around reviewing code for some famous game titles such as Dragon’s Lair and Ghostbusters.
To make this possible, it provides the user with multiple tools to complete such tasks. When the tool is first launched, there are a series of buttons labeled .PRG, VICE, HEX, DIS, SPR, BMP, C&S, and SINE. In description, the .PRG is used to import prg files into memory (such as those created in VICE). The VICE button is used to load game snapshots that were taken while using the VICE C64 emulator. HEX is a built in hexadecimal viewer. The button called SPR allows sprites to be loaded into RAM and breaks down their locations. BMP controls the ability to see bitmap graphics, such as those found in start up loading screens for the Commodore 64. The C&S button is used to evaluate the character set graphics and discover where they reside in memory. Finally the SINE button gives you access to see the RAM memory displayed as pixels, such as those seen in a bitmap example. It gets the name SINE, which is short for sine waves, since it analyzes this with the game logos and sprites.
The PDF states that the primary purpose of this tool is to identify where the code and graphics reside for an application loaded into its RAM memory. Infiltrator was developed using the Lazarus IDE. Although not tested for any 64 bit operating system, I have found little difficulty using it under many Windows versions.
When the topic discussion began, I focused on the memory location $Dc00, which manages CIA Data Port A. This area communicates with outside devices by writing bits of data to registers and sending them to external devices. This area is also responsible for reading the keyboard. There are various bit positions that when set control different movement of the joystick and send calls to the keyboard. Here is the pattern broken down according to Mapping the Commodore 64 as seen in the screenshot example.
The context of this live stream for twitch.tv evolved around extensive use of the book called Mapping the Commodore 64 and 64C. This book is paramount for anyone wanting to seriously drive your skills in Basic, assembly language, and even an understanding of the hardware of your C64. It contains all the ingredients to escalate anyone’s level of knowledge and is used by experts to this day.
I started evaluating a code sample from Dragon’s Lair at memory location $0E57 that was first identified by the Infiltrator tool in the Memory window for the CIA 1 register. This gave me a glimpse into how the RAM memory was searching the joystick locations and the code that corresponded to this. The example screenshot illustrates that this is loading a $7f (127) into memory register $DC00 (56320). This is likely just setting a default setting for the joystick, which is the value outputted in Basic when the joystick is idle.
Next I transitioned over to looking at the RAM memory for the popular Ghostbusters game for the Commodore 64 in Infiltrator. Opening up the Sprite tool, I demonstrated how the application detected the sprites in the game. They are patterned in a grid spanning 8 x 8. It divided them into their individual cells starting at memory location $4000 and up to $4E00 + 8 rows. The Ghostbusters game was written and developed by David Crane in 1984 and ported in many different systems in that era. It was the idea based off the famous movie in that generation.
Afterward I executed the Ghostbusters game in the VICE C64 environment. I think by this time I was over anxious and wanted to play it anyway. I was also trying to find a direction for the Twitch.tv stream to see where it could lead to.
To manage an effective stream, it requires quite a diligence since you have to monitor the chat statements to keep the audience engaged and answer questions. I am still a beginner and learning, but people can also accept donations and setup title screens as well. I never got quite that involved, but enjoyed the short time I was active there.
For the next part of the video, I opened up the Bitmap viewer in Infiltrator. Using the memory window I was able to see some of the background graphics for the main screen that the player navigates the Ghostbuster sprite on. It was evident here that they utilized some of the background graphics to paint up the houses and scenery around the player. Scrolling through the Memory window area on the left offers the ability to view other segments of memory of the game. It could also open the door to modifying your own hack of the game’s graphics.
Then I wanted to see what the character sets looked like in the game. Infiltrator can look at individual character bitmaps in an 8×8 format using the Charsets and Screen tool. You can also change any of the 4 different color modes that are available. The tool, identical to the others, also allows you to scan through various parts of memory banks to see the different characters sets resident in those areas. The Commodore 64 refers to these as multicolor graphics, which are contained in memory locations $D020-$d024.