It is currently Fri Nov 17, 2017 10:43 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 53 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
PostPosted: Sun Jul 26, 2015 5:10 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5821
Location: Canada
In case the poem is unclear, you have to use a different controller reading routine if you're playing DPCM samples, because they cause a conflict with the read (usually showing up as incorrectly pressing right now and then while samples are playing). This is kind of disastrous for 2048 gameplay.

Many emulators don't emulate this conflict. If you need an emulator to test the problem on, I would recommend Nintendulator.

I think puNES also attempts to emulate this conflict, but it doesn't appear to like your ROM at the moment.


Top
 Profile  
 
PostPosted: Sun Jul 26, 2015 9:43 pm 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
Nice job, this is definitely a unique and skilled creation; I woulda rented it as an NES game as a kid, maybe even bought it.


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 1:15 am 
Offline
User avatar

Joined: Sat May 31, 2014 4:12 pm
Posts: 139
rainwarrior wrote:
In case the poem is unclear, you have to use a different controller reading routine if you're playing DPCM samples, because they cause a conflict with the read (usually showing up as incorrectly pressing right now and then while samples are playing). This is kind of disastrous for 2048 gameplay.

Many emulators don't emulate this conflict. If you need an emulator to test the problem on, I would recommend Nintendulator.

I think puNES also attempts to emulate this conflict, but it doesn't appear to like your ROM at the moment.


Tested on FCEUX during development. How should the controller reading routine be changed?


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 4:40 am 
Offline
User avatar

Joined: Tue Jun 02, 2015 9:17 pm
Posts: 35
Location: Florida
What a lot of games do is read the controller twice in a row, and only act on it if both reads were exactly the same. The sample DMA will only corrupt one read. Or just keep reading it in a loop until it gets two of the same result in a row.


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 8:02 am 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5821
Location: Canada
Dreamwriter wrote:
...just keep reading it in a loop until it gets two of the same result in a row.

This is the approach I prefer. There have been some lengthy threads on the most optimal/clever thing, etc. but this method is very simple and easy to implement if you already have a regular controller read, and it works quite well.

It's also what Super Mario Bros. 3 and a number of other games do. Here's a quick disassembly of SMB3's method:
Code:
        jsr poll_controller  ; 0F:FEB9:20 0B FF  JSR $FF0B
reread: lda controller       ; 0F:FEBC:A5 00     LDA $0000 = #$00
        pha                  ; 0F:FEBE:48        PHA
        jsr poll_controller  ; 0F:FEBF:20 0B FF  JSR $FF0B
        pla                  ; 0F:FEC2:68        PLA
        cmp controller       ; 0F:FEC3:C5 00     CMP $0000 = #$00
        bne reread           ; 0F:FEC5:D0 F5     BNE $FEBC

FCEUX does not emulate DPCM conflicts, so you'll never catch it if it's your only testing emulator.


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 10:34 am 
Offline
User avatar

Joined: Sat May 31, 2014 4:12 pm
Posts: 139
Seems simple enough. I'll make the change today and repost. I would have definitely noticed something was wrong when I attempted my first transfer to cart coming soon. Is there any risk that it could get caught in a loop that ends only at the start of the next Vblank or will it surely be resolved within a few small loops?


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 11:16 am 
Offline
User avatar

Joined: Mon Jan 03, 2005 10:36 am
Posts: 2978
Location: Tampere, Finland
Nestopia is another emulator that emulates the glitch.

_________________
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: kkfos.aspekt.fi


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 11:20 am 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6437
Location: UK (temporarily)
It was decided that the highest number of rereads is (practically speaking) five, if a person changes what button they're pressing just after a glitch:
- correct, old
- corrupted, old
- correct, old
- correct, new
- correct, new


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 12:15 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19219
Location: NE Indiana, USA (NTSC)
In practice, two reads should be enough because

And while you're at it, are you making sure to read both D0 and D1 of $4016? Famicom owners would appreciate it, as D0 is for hardwired controllers and D1 is for plug-in controllers on that system.


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 1:43 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 10112
Location: Rio de Janeiro - Brazil
tepples wrote:
In practice, two reads should be enough because

Because...? Come on tepples, the suspense is killing me! :mrgreen:


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 2:17 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19219
Location: NE Indiana, USA (NTSC)
...because a Threes clone isn't as twitchy as, say, Street Fighter series. Read twice and if they disagree, use the previous frame's presses.

Sorry, I got distracted by real life while composing that post.


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 5:48 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5821
Location: Canada
lidnariq wrote:
It was decided that the highest number of rereads is (practically speaking) five, if a person changes what button they're pressing just after a glitch:
- correct, old
- corrupted, old
- correct, old
- correct, new
- correct, new

The worst case is very slightly worse than that. For most controller read loops, the DPCM at is fastest will be dormant for at least 2 passes through the poll routine, but it might be able to corrupt a 3rd consecutive one. So the worst case is really six:
- correct, old
- corrupted, old
- correct, old
- correct, new
- corrupt, new
- correct, new
- correct, new

Of course, you have to be lucky/unlucky to even get a conflict in the first place. It won't corrupt EVERY third loop, just ones where the $4016 read aligns with the DPCM read. I think it's normally like once per hundreds of frames. For it to happen twice consecutively would be exceedingly rare, and then on top of that you'd have to manage to press a button during, so... rare * rare * rare = has it ever happened ever?

raydempsey wrote:
Is there any risk that it could get caught in a loop that ends only at the start of the next Vblank or will it surely be resolved within a few small loops?

Not really. It's quite robust in any use I've seen. SMB3 seems pretty stable to me, I doubt the controller read loop ever caused a problem.

Like, if you hooked a machine up to the controller port that changed the input on every strobe, it would hang the game in the controller loop, but this is kind of pathological. I don't think anyone would do that except if they were trying to build a turbo-button controller and didn't know that many games will read in a loop like this.


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 10:57 pm 
Offline
User avatar

Joined: Sat May 31, 2014 4:12 pm
Posts: 139
I used Nintendulator to observe the problem you were describing about the DPCM creating false right button presses. I fixed it the way rainwarrior suggested and it works better now. Here is the new uploaded version. Thanks for finding the bug. I didn't even know that was a thing. I'll let you know how uploading to cart is coming as I attempt it.


Attachments:
BlurredLines2048.nes [384.02 KiB]
Downloaded 52 times
Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 11:49 pm 
Offline
User avatar

Joined: Sat May 31, 2014 4:12 pm
Posts: 139
My first attempt to upload BlurredLines2048 to a cartridge has failed. I have a TKROM 512 PRG 256 CHR flash cart WRAM w/ battery pack and I am attempting to use INL retro-prog v1.1 beta. Before I uploaded it, I trimmed a copy of my .nes file down so that the first 16 bytes went away causing the file to be 16 bytes shorter. Do I have to upload the PRG and CHR separately? I don't know if the file extension makes a difference but I tried uploading it when it was saved as both .nes and .bin but still no luck. No matter what I try to do, the program instantly crashes the moment I attempt to write to the cart. I never did this before.

I bought it from here: http://www.infiniteneslives.com/kazzo.php


Top
 Profile  
 
PostPosted: Mon Jul 27, 2015 11:57 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6437
Location: UK (temporarily)
raydempsey wrote:
Do I have to upload the PRG and CHR separately?
Yes.
Quote:
No matter what I try to do, the program instantly crashes the moment I attempt to write to the cart.
That's weird, but I'd assume it's because the resulting file isn't a power of two.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 1 guest


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:  
Powered by phpBB® Forum Software © phpBB Group