It is currently Tue Apr 24, 2018 12:52 pm

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: LIGHT GUN and trigger...
PostPosted: Wed Jan 20, 2010 5:57 pm 
Offline

Joined: Fri Oct 23, 2009 8:11 am
Posts: 16
Hi!

I'm user of C128DCR and now owner of light gun Cheetah DEFENDER64.

What's my problem?

I can aim to target on screen and light gun it indicates, but I can't to get trigger status.

I tried IRQ, of course $DC01 (JoyPort1), commands COLLISION and PEN(x) in BAISC V7.
In assembler it was easier, but I can't detect if is trigger holding down or released...

Can anybody help me?

Thanks for every help.

Miro


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 20, 2010 9:58 pm 
Offline
User avatar

Joined: Mon Jun 15, 2009 6:55 pm
Posts: 79
I assume you tried Gangster or Time Traveler which I believe are Light Gun games for the Commodore 64, correct? Just trying to find out if the problem you are having is the Light Gun functioning or are you just trying to get the status interrupt only? Kinda' veg when you posted.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 20, 2010 10:16 pm 
Offline

Joined: Fri Oct 23, 2009 8:11 am
Posts: 16
Hi!

Yes, I tried games, no problem, works.

My problem is that I want to programming Light Gun.

Position is not problem, but I don't know how detect trigger.

Usually ways as $DC01, IRQ, PEN(4), COLLISION works not - exactly - some changes are in $DC01.

If I check $DC01 in assembler, when I aim at screen value $FF changes to $EF (like fire is pressed), but I don't press trigger...
...and if I press trigger, no values are changed...

Miro


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 20, 2010 10:28 pm 
Offline
User avatar

Joined: Mon Jun 15, 2009 6:55 pm
Posts: 79
In 64 Mode (Holding the C= Key down on power on) try:
Code:
100 REM * LIGHT PEN DEMO *
150 A$=CHR$(147):PRINTA$
160 PRINTTAB(10)"THREE CHOICES"
170 PRINT:PRINT
180 PRINTTAB(5)"* CHOICE ONE"
190 PRINT:PRINT:PRINT:PRINT
200 PRINTTAB(5)"* CHOICE TWO"
210 PRINT:PRINT:PRINT:PRINT
220 PRINTTAB(5)"* CHOICE THREE"
230 A=PEEK(53267):B=PEEK(53268)
240 IF A>55 THEN 230
250 IF (B>70) AND (B<80) THEN 300
260 IF (B>110) AND (B<120) THEN 330
270 IF (B>150) AND (B<160) THEN 360
290 GOT0230
300 PRINTA$
310 PRINT"CHOICE ONE"
320 GOTO 400
330 PRINTA$
340 PRINT"CHOICE TWO"
350 GOTO 400
360 PRINTA$
370 PRINT"CHOICE THREE"
400 FOR I=0 TO 1500
410 NEXT I:PRINT
420 PRINT"* CONTINUE"
430 IF PEEK(53267)<55 AND PEEK(53268) <70{2 SPACES}THEN 150
440 GOTO 430

(taken from here.)
and then run it. If I am not mistaken all a light gun is, is a light pen. Instead of pressing the pen to the screen (which makes it like the fire button) they made the trigger (switch) external.


Top
 Profile  
Reply with quote  
PostPosted: Wed Jan 20, 2010 10:37 pm 
Offline

Joined: Fri Oct 23, 2009 8:11 am
Posts: 16
Yes, I know this example.

I have also Light pen. This demo works correctly with both devices (Light gun and Light pen).
But this demo checks not trigger/light pen press...
I reprogrammed this demo for detect pressing, light pen works ok, light gun not.
There's the problem - light gun has other indicating of pressing trigger...
and I don't know it.

Miro


Top
 Profile  
Reply with quote  
PostPosted: Thu Jan 21, 2010 2:13 pm 
Offline
Site Admin

Joined: Wed Jan 11, 2006 12:22 pm
Posts: 860
Did you check the paddle triggers? Enable paddles by writing #$c0 to $dc00 and check for activity in $dc00 or $dc01. Don't forget to set the DDR registers to input...


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 25, 2010 7:02 pm 
Offline
User avatar

Joined: Mon Jun 15, 2009 6:55 pm
Posts: 79
I found this artical that shows the light gun trigger is pin 6, which is odd because that IS the fire button.

I also found this program at 64HDD under Projects. It also uses pin 6. It has a basic program that should work for you.

Let Us Know,
MisterMsk


Top
 Profile  
Reply with quote  
PostPosted: Mon Jan 25, 2010 7:37 pm 
Offline

Joined: Fri Oct 23, 2009 8:11 am
Posts: 16
Thank you for support.

I found with help that if I'm checking (pot(2)and255) it gives back to me value 2, then I'm checking coordinates normally, here's example:

100 rem * light gun demo *
110 color0,2:color4,14:color5,1
150 a$=chr$(147):printa$:x=0:y=0:z=0
160 printtab(10)"shoot targets!"
180 char1,5,5,"O"
200 char1,5,10,"O"
220 char1,5,15,"O"
230 if(pot(2)and255)<>2then230
235 a=pen(0):b=pen(1)
250 if (b>75) and (b<90) then char1,5,5,
"0":x=1
260 if (b>110) and (b<135) then char1,5,
10,"0":y=1
270 if (b>145) and (b<170) then char1,5,
15,"0":z=1
280 ifx=1andy=1andz=1thenchar1,10,20,"yo
u passed!":end
290 goto230

Also thanks for every help.

Miro


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group