Re: [stella] Light gun/pen

Subject: Re: [stella] Light gun/pen
From: Eckhard_Stolberg@xxxxxxxxxxxxxxxxxxxxx (Eckhard Stolberg)
Date: Wed, 1 Oct 1997 20:37:49 +0200
>The Atari 8-bit has discrete hardware registers for reading a light pen
>(light pens work better than guns for obvious reasons).  It does a fairly
>rough job on the horizontal ;)  The important thing isn't whether or not a
>light gun detects light (which will just give you on or off), it is
>finding a way for the computer to determine the X and Y coordinates of
>where the beam is hitting the TV, and THEN cross referencing this with
>your objects.

You are right. I took a look at the Sentinel code and it seems the 
lightgun just sets the joystick button signal low, when it detects
enough light, and high otherwise.

Sentinel checks the coordinates like this:
When the guntrigger (joystick up signal) is pressed, it sets all 
colour registers to white for one frame. During that frame it does
the following for the visible part of every scanline:

     BIT INPT4
     BPL pos1
     BIT INPT4
     BPL pos2
     BIT INPT4
     BPL pos3
     ...

pos1 STX ypos ; X-reg contains the current scanline
     LDA #70
     STA xpos
     BNE end

pos2 STX ypos
     LDA #85
     STA xpos
     BNE end

pos3 STX ypos
     LDA #100
     STA xpos
     BNE end
     ...

That way it gets a horizontal resolution of 11 different spots and
a vertical resolution of 192 or smaller depending on the sensitivity 
of the gun.


Ciao, Eckhard Stolberg


--
Archives updated once/day at http://www.biglist.com/lists/stella/archives/
Unsubscribing and other info at http://www.biglist.com/lists/stella/stella.html

Current Thread