young indiana jones new ppu discovery, nestopia help...

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

User avatar
Zepper
Formerly Fx3
Posts: 3220
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Thu Jun 10, 2010 2:45 pm

- Sorry, but if I'm not making any confusion, reading/writing $2005/6/7 is not allowed during rendering, an old info.

lidnariq
Posts: 9690
Joined: Sun Apr 13, 2008 11:12 am
Location: Seattle

Post by lidnariq » Thu Jun 10, 2010 3:19 pm

Right, but now he's documented the specifics of what happens when you read from $2007 during rendering -- and, better & worse, found a game that uses this 'prohibited' behavior.

User avatar
jwdonal
Posts: 719
Joined: Sat Jun 27, 2009 11:05 pm
Location: New Mexico, USA
Contact:

Post by jwdonal » Thu Jun 10, 2010 3:35 pm

lidnariq wrote:Right, but now he's documented the specifics of what happens when you read from $2007 during rendering -- and, better & worse, found a game that uses this 'prohibited' behavior.
Exactly.

User avatar
Zepper
Formerly Fx3
Posts: 3220
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Thu Jun 10, 2010 4:07 pm

*Amen* :)

User avatar
*Spitfire_NES*
Posts: 306
Joined: Fri May 21, 2010 4:10 pm

Post by *Spitfire_NES* » Thu Jun 10, 2010 4:11 pm

sorry if this a stupid or newb question as obviously i dont have any idea on ppu inner workings but besides the relevant code in this thread is there any way to try this out with like an ips patch or let's say a hex edit of the rom?

just curious and if this comes off as a stupid question i do apologize...

once again excellent work! looks like theres always something new with the nes eh? lol

User avatar
Disch
Posts: 1849
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch » Thu Jun 10, 2010 5:12 pm

Well the change presented in this thread is one that would need to be applied to emulators, not to the ROM. So no, there's no way to put it in an IPS patch.

You could probably hack the ROM another way to remove the glitch, but that would be a completely different task.

User avatar
Disch
Posts: 1849
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch » Thu Jun 10, 2010 6:48 pm

You know this behavior seems like it'd be relatively easy to test and confirm with a dev cart / Powerpak.

Code: Select all

; assume rendering is disabled
LDA  #>SomeAddress
STA $2006
LDA #<SomeAddress
STA $2006

LDA #$18
LDX #$00

STA $2001 ; enable (should probably be timed, see below)
BIT $2007 ; read
STX $2001 ; disable

; confirm how PPU address changed from SomeAddress here
You should probably time this so the write happens between dots 260-320 (when the PPU is unlikely to change the PPU address on its own).

This wouldn't cover possible edge cases when the $2007 read happens at the same time that the PPU is adjusting the address for rendering, but it could at least confirm the basic idea is right.

tepples
Posts: 22054
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Thu Jun 10, 2010 7:40 pm

It is the 2010s and there is time for Boing 2007. Put this on a PowerPak, put the PowerPak in an NTSC NES, and follow the bouncing ball. As they used to say on alt.aol-sucks: "Your will be amasing."


EDIT: Attached here too
Attachments
boing2k7.zip
(17.6 KiB) Downloaded 191 times

User avatar
Bregalad
Posts: 7951
Joined: Fri Nov 12, 2004 2:49 pm
Location: Chexbres, VD, Switzerland

Post by Bregalad » Fri Jun 11, 2010 2:46 am

Now the question is "what happens when there is a warp arround" ? Is the circuitry that detects the end of name-table (and warp it to the top/left of the next nametable) is still active when it comes to $2007 reads during rendering ?

When a column is skipped, does the horizontal scroll become back to normal value next line ? (I'm pretty sure so, else Zelda would be f** up when scrolling vertically)

And last, but not least : Is there a way to predict WHAT the $2007 read will return ? A new way of synchronization maybe ?
Useless, lumbering half-wits don't scare us.

User avatar
blargg
Posts: 3715
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg » Fri Jun 11, 2010 5:14 am

I wrote a test that runs what Disch suggested and added the output to the Wiki for group analysis: Reading 2007 during rendering

It sets the VRAM address to 141F before the code, since that seemed to reveal the most operation. If I set it to 0000 for example, you wouldn't see bit 10 getting toggled. the 1F allows that to happen. And the 0400 allows you to see it toggle 1000 sometimes, etc. I'm not up to speed on all the PPU details, so I was mostly just trying values and choosing this one as the most useful.

tepples
Posts: 22054
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Fri Jun 11, 2010 5:40 am

Yeah, I saw it clock both the H and V positions at some points on the scanline when I was testing boing $2007.

User avatar
James
Posts: 429
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL
Contact:

Post by James » Fri Jun 11, 2010 7:30 am

blargg wrote:And the 0400 allows you to see it toggle 1000 sometimes
Can you explain this? I'm assuming that, in your test, 2000.2 is set (i.e. address increment = 32). In that case, any read of $2007 would clock FV (bits 12-13), toggling 0x1000, no?

Do you think the +1 increment relative to dummy, in most of the reads, is simply a timing difference?

BTW, YIJC doesn't actually do anything with the $2007 read:

Code: Select all

$FB66:8D 00 20  STA $2000
$FB69:AD 02 20  LDA $2002
$FB6C:A5 A7     LDA $00A7
$FB6E:8D 05 20  STA $2005
$FB71:A9 00     LDA #$00
$FB73:8D 05 20  STA $2005
$FB76:A5 A9     LDA $00A9
$FB78:8D 06 20  STA $2006
$FB7B:A5 AA     LDA $00AA
$FB7D:8D 06 20  STA $2006
$FB80:A5 A8     LDA $00A8
$FB82:29 04     AND #$04
$FB84:F0 0C     BEQ $FB92
$FB86:AD 07 20  LDA $2007
$FB89:AD 07 20  LDA $2007
$FB8C:AD 07 20  LDA $2007
$FB8F:AD 07 20  LDA $2007
$FB92:AC 9F 04  LDY $049F
$FB95:A9 00     LDA #$00
Looks like it's there to simply increment VT by one based on the value of $00A8. Why this couldn't be done before writing to $2005/$2006 is unclear to me.

User avatar
Dwedit
Posts: 4354
Joined: Fri Nov 19, 2004 7:35 pm
Contact:

Post by Dwedit » Fri Jun 11, 2010 7:51 am

Sounds like they did the monkeys and typewriters approach - Keep trying something until it works.
Here come the fortune cookies! Here come the fortune cookies! They're wearing paper hats!

User avatar
James
Posts: 429
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL
Contact:

Post by James » Fri Jun 11, 2010 8:19 am

I may be off in my analysis... FV is a 3-bit counter, so clocking it 4 times won't necessarily cause a carry into the VT counter.

Maybe they're doing this so that can draw data from 2 halves of different tiles?

Code: Select all

tile 1:   tile 2:   new tile:
aaaaaaaa  xxxxxxxx  aaaaaaaa
aaaaaaaa  xxxxxxxx  aaaaaaaa
aaaaaaaa  xxxxxxxx  aaaaaaaa
aaaaaaaa  xxxxxxxx  aaaaaaaa
bbbbbbbb  yyyyyyyy  xxxxxxxx
bbbbbbbb  yyyyyyyy  xxxxxxxx
bbbbbbbb  yyyyyyyy  xxxxxxxx
bbbbbbbb  yyyyyyyy  xxxxxxxx
?

User avatar
James
Posts: 429
Joined: Sat Jan 22, 2005 8:51 am
Location: Chicago, IL
Contact:

Post by James » Fri Jun 11, 2010 9:20 am

tepples wrote:It is the 2010s and there is time for Boing 2007.
Very cool!
get nemulator
http://nemulator.com

Post Reply