C64 Lightguns/Gun stick

This lightgun is from a Spanish company (MHT Ingenieros), the strangest things about this gun are that it uses batteries and that it DOES NOT connect to the lightpen input of the Commodore computer. It connects to the DOWN connection of the joystick port. This makes it more difficult for the computer to detect but in practice it seems to work. A benefit of this setup is that you can connect 2 of these guns to a C64. Normally the C64 supports only one lightgun because it has only one lightpen input. But since this gun does not require the use of the lightpen input multiple guns can be connected to the computer. For other platforms there were multiple games available, but for the C64 it appears to be only 2.

Technically this system isn't the same as the Magnum light phaser or Stack light rifle, because it isn't capable of sensing targets at the pixel level. It works just like the Nintendo zapper. When the trigger is pulled, the screen goes black for 1 frame and during that frame the target(s) are replaced by a white block. When the gun is aiming at this block, this will result in a signal on the output of the gun, the computer detects this and knows that the gun has hit the target. When the gun was aiming somewhere else, the gun saw a black spot, generated no signal and the computer knows that the gun has missed. This means that this system suffers from a flickering effect when the trigger is pulled. However this effect is so small that it can hardly be noticed.
The whole idea behind this system is that it is a gun that potentially can work with all computermodels, this because detection isn't depending on a lightpen input of the video chip. This type of gun is easy to fake (unless prevented by the game). Simply point the gun towards a modulated light source, for instance a lightbulb. Then the gun will constantly generate pulses, which the computer registers as a hit (read the programming info below and you'll understand why this works).

The "Gun stick" lightgun has also been marketed for several other types of machines (Sinclair spectrum, CPC, MSX, etc.)
Because the room on my website is pretty limited I can't directly post the user manual here, and it is included in the downloads section combined with the games.
But for quick access to the gunstick user manual you can also go to this website: http://www.cpcwiki.eu/index.php/Gunstick

The inside

The inside of the gunstick shows the battery compartment and the sensor electronics.


Trigger switch is connected between pin 6 (Fire) and pin 8 (GND)
Light sensor (active low) is connected to pin 2 (DOWN)
Light sensor circuit power is connected to pin 7 (+5V) and pin 8 (GND)

Because this gun does not use the hardware functionality (lightpen input) of the video chip the signal of the light sensor needs to be extended to a longer period, so that the computer has enough time to detect it. This because the original signals of the lightgun sensor are approximately a few uSec wide. This is a too narrow pulse for the computer to detect reliably, so it needs to be stretched, preferably to the duration of a few lines. A value of 1mSec could be more then sufficient for a 1MHz processor.

The box of the Gun stick makes it look like there is light coming out of the Gun stick, but this really isn't true at all. There is no light source of any kind inside the Gun stick.


Programming related information (C64 only):
The X and Y coordinates and any other lightpen related register are useless for this type of lightgun. Why? Simply because it isn't connected to the lightpen/gun input of the C64. The game determines if the gun is pointing towards the target in a similar fashion as the Nintendo zapper lightgun does. When the user pulls the trigger, then the next frame will become black and contains white block at the location of targets. If the gun is aiming at the target, the gun will see the light of the white block and generates a signal (bit#1 of $DC01(port#1) or $DC00(port#2) will become low). When the gun aims somewhere else, the gun doesn't generate a signal. Well... unless the gun is aiming towards a modulated light source, because that would also generate pulses. A great advantage of this kind of system is that you do not need to worry about the colour of your targets, because the targets are replaced by a bright white block when you press the trigger.

Because the videochip of the C64 computer has a line counter detection is not that difficult. Because the game knows where the white boxes are is located, so when the line counter reaches the lines where the parts of the white blocks are located then the IO-line connected to the lightgun should be checked for a signal. If there is a signal, then there is a hit. This method of detection is rather crude, because in a situation where there are 2 targets on the same X coordinate it won't be possible to determine which one was hit. Unless the screen is flashed black for every target on that line. Regarding multiple targets on the Y coordinate there is no problem at all.

To fix the problem of cheating by pointing the gun towards a light bulb there is a simple sollution, when the trigger is pulled, the screen goes black, the program must check if there are no pulses, because the screen is black and the gun should generate absolutely no pulses. Then the white blocks are drawn onto the screen and there should be a pulse if the gun is aiming correctly. This fix makes the flashing screen more noticeable, but in practice the game does not need to check for the lightbulb cheat very time the trigger is pulled, just a few times in the game (at moments unknown to the person playing the game).


Knowing how difficult it can be to find information about Commodore related lightguns (and the games), I've made all information that I have available for download: C64_lightgun_games_and_info.zip