It is currently Wed Oct 18, 2017 8:02 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: Light Zapper
PostPosted: Thu Jun 01, 2006 5:42 pm 
Offline
User avatar

Joined: Tue May 30, 2006 10:11 am
Posts: 29
Who is the Light Zapper research? You can write a simple demonstration of the procedure for me?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 7:51 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10051
Location: Rio de Janeiro - Brazil
I think all the zapper does is detect the presence of white... So, to check if it hit anything on the screen, you have to paint it all black (when the trigger is pressed), and have a white square in the area that you are checking for a hit. If the gun detects white, the target was hit.

Objects you can hit must be checked one at a time, so that you know wich one was hit.

You may want to avoid cheating, when someone points the gun to a white light and pulls the trigger, meaning he'll alway get a hit. To avoid that, you first make the screen all black before checking for the individual hits. If you get a hit with a black screen, the person is cheating, and you can ignore that shot.

I don't have any code though, sorry.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 9:07 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19094
Location: NE Indiana, USA (NTSC)
tokumaru wrote:
I think all the zapper does is detect the presence of white

It may be sensitive to other colors, but nobody has studied this in depth.

Quote:
Objects you can hit must be checked one at a time, so that you know wich one was hit.

Almost. If you light up a group of objects at once, then you know that the object that is hit is either inside the group (if the gun registers light) or outside the group (if the gun registers dark).


Top
 Profile  
 
 Post subject:
PostPosted: Thu Jun 01, 2006 9:14 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10051
Location: Rio de Janeiro - Brazil
tepples wrote:
Almost. If you light up a group of objects at once, then you know that the object that is hit is either inside the group (if the gun registers light) or outside the group (if the gun registers dark).

Yeah, like a binary search you say? You narrow down until you reach the one object that was hit... That would be good for a big number of objects. But do you think the number of objects the NES can display at once would justify a binary search? I don't know...


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 9:53 am 
Offline
User avatar

Joined: Fri Nov 19, 2004 7:35 pm
Posts: 3943
Binary search means less frames of a dark screen.

_________________
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 12:57 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1389
Dwedit wrote:
Binary search means less frames of a dark screen.


It is also only useful if you have 4 or more targets on the screen at once. There's also the fact that even with 6 targets, the overall delay (1/10th of a second) when doing one at a time is still very short.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 02, 2006 1:09 pm 
Offline
Site Admin
User avatar

Joined: Mon Sep 20, 2004 6:04 am
Posts: 3470
Location: Indianapolis
I have a zapper demo here:

http://www.parodius.com/~memblers/nes/zappa.zip

It's really simple though, it doesn't check the trigger and it displays an all-white screen. It changes the pitch of the sound depending on where on the screen it's pointed.

To read the zapper, you have to poll it constantly. Like every scanline (114 cpu cycles or so), reading it only during vblank like a controller won't work. The good part of that is that you can narrow down the target by counting the scanlines, but the bad part is that it keeps the CPU busy for most of the frame.


Top
 Profile  
 
 Post subject:
PostPosted: Fri Jun 09, 2006 9:35 pm 
Offline
User avatar

Joined: Tue May 30, 2006 10:11 am
Posts: 29
I understand the basic principles, but I have never made a successful demonstration of the procedure.
I write the nes have not appeared in the simulator gun sights.
Zappa.nes I have read, it is not a complete zapper demonstration procedures.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 8:26 am 
Offline
User avatar

Joined: Tue May 30, 2006 10:11 am
Posts: 29
a zapper demo :
http://zgh3000.ik8.com/fc/zapper.zip


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 8:52 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1389
zgh4000 wrote:


I'm not quite sure what it's supposed do, but I don't think it's working properly. When it starts up on my CopyNES, it displays a bunch of junk on the screen (probably due to writing to VRAM while rendering is turned on), then displays a blue semicircle moving diagonally across the screen. When I fire at it, it flashes white for 1 frame but does nothing else, whether I hit it or not.

It might aid in the debugging process if you included the ASM sources with the demo.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 3:44 pm 
Offline
User avatar

Joined: Tue May 30, 2006 10:11 am
Posts: 29
Quote:
It might aid in the debugging process if you included the ASM sources with the demo.

OK.
http://zgh3000.ik8.com/fc/zapperdemo.rar

Image


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 4:46 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1389
Taking a look, I can now see why it was getting graphical glitches on powerup - you must do the...
Code:
   lda #%10000000      
   sta $2000
   lda #%00011110
   sta $2001

...after the "jsr load_palette". Also, you should really be doing...
Code:
   lda #0
   sta $2000
   sta $2001

...immediately after the SEI/CLD at the top of your reset routine.

The reason it doesn't actually detect anything properly is because the Zapper only detects white as it is rendered - in other words, you need to constantly poll $4017 for the entire duration of the frame (and give up if another NMI comes along) and wait if it ever senses white. Evidently, NNNesterJ does not emulate the Zapper with correct timing - the latest build of my emulator (over at http://nintendulator.sourceforge.net/) has reasonably correct behavior (verified against actual hardware) if you want to perform additional testing.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 5:11 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19094
Location: NE Indiana, USA (NTSC)
Quietust wrote:
the Zapper only detects white as it is rendered - in other words, you need to constantly poll $4017 for the entire duration of the frame (and give up if another NMI comes along) and wait if it ever senses white.

Constantly meaning that it fades after how many cycles? Is polling once a scanline enough, or should I unroll the loop to poll once every 6 CPU clocks for a scanline at a time? And does "only detects white" mean that it will return false for lighter colors such as $10 and $31-$3C?


Top
 Profile  
 
 Post subject:
PostPosted: Sun Jun 18, 2006 5:23 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1389
1. Once a scanline should be enough, since that's approximately how often the Zapper updates the read signal.
2. Light colors will also trigger it, but for a shorter period of time (normally, if you aim the zapper at a solid white screen, it will register a hit for about 25 scanlines or so).

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Sat Jul 15, 2006 4:19 am 
Offline
User avatar

Joined: Tue May 30, 2006 10:11 am
Posts: 29
No wrong-ray gun demonstration

http://zgh3000.ik8.com/fc/new_zapper.zip

Nintendulator
Nestopia


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 21 posts ]  Go to page 1, 2  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Tomy and 5 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