It is currently Fri Oct 19, 2018 11:10 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 29 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: Sat Sep 22, 2018 8:49 am 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1437
HastatusXXI wrote:
However, I want to know if this is normal (PPU manages memory in a big-endian fashion, AFAIK), since the wiki states that the colour of a row of 8 pixels in a 8x8 tile is determined by using the corresponding byte of pattern table 0 as 0 bit values and the corresponding byte of pattern table 1 as 1 bit values and this is how I implemented my program.


According to the PPU pattern tables article on the wiki, the most significant bit of tile data (i.e. 0x80) represents the leftmost pixel of said tile, and the least significant bit (0x01) represents the rightmost pixel.

HastatusXXI wrote:
Is YYCHR flipping the sprites prior to drawing them?

No, it is not, since a given tile can be interpreted as either sprite or background, and background tiles are never flipped.

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


Top
 Profile  
 
PostPosted: Sun Sep 23, 2018 4:38 am 
Offline

Joined: Sat Aug 25, 2018 7:21 am
Posts: 29
Okay, solved. My algorithm was flipping the pixels prior to drawing them. Thank you, Quietust.


Top
 Profile  
 
PostPosted: Mon Sep 24, 2018 9:27 am 
Offline

Joined: Sat Aug 25, 2018 7:21 am
Posts: 29
Hello again, I'm making some progress here with the PPU. I'm using Nintendulator PPU and CPU memory maps dumps to comprehend image generation. I understand backgrounds now, but I need OAM dumps to practise everything concerning sprites. Is there any possibility to do this in Nintendulator? (I only see the option of dumping CPU and PPU, but nothing about OAM/SPR).


Top
 Profile  
 
PostPosted: Mon Sep 24, 2018 4:51 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1437
HastatusXXI wrote:
Hello again, I'm making some progress here with the PPU. I'm using Nintendulator PPU and CPU memory maps dumps to comprehend image generation. I understand backgrounds now, but I need OAM dumps to practise everything concerning sprites. Is there any possibility to do this in Nintendulator? (I only see the option of dumping CPU and PPU, but nothing about OAM/SPR).

The "Dump PPU" button dumps everything related to the PPU: pattern tables, nametables, sprites, and palettes (in that order).

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


Top
 Profile  
 
PostPosted: Tue Sep 25, 2018 1:41 am 
Offline

Joined: Sat Aug 25, 2018 7:21 am
Posts: 29
Quietust wrote:
HastatusXXI wrote:
Hello again, I'm making some progress here with the PPU. I'm using Nintendulator PPU and CPU memory maps dumps to comprehend image generation. I understand backgrounds now, but I need OAM dumps to practise everything concerning sprites. Is there any possibility to do this in Nintendulator? (I only see the option of dumping CPU and PPU, but nothing about OAM/SPR).

The "Dump PPU" button dumps everything related to the PPU: pattern tables, nametables, sprites, and palettes (in that order).


Okay, I see. Thank you, Quietust.


Top
 Profile  
 
PostPosted: Wed Sep 26, 2018 12:37 pm 
Offline

Joined: Sat Aug 25, 2018 7:21 am
Posts: 29
I successfully rendered one frame of Donkey Kong (many things were hardcoded, such as the palettes). Now I'm trying to do it properly and, following the wiki article on PPU registers, I check PPUCTRL via the CPU dump at $2000 (I know that't not the way to do it, it's temporary). I found the value $A5, so the pattern table 0 is chosen, but pattern table 1 (I hardcoded this previously) should be chosen instead. Of course the rendered image is a mess.

What's the problem here?


Top
 Profile  
 
PostPosted: Wed Sep 26, 2018 1:55 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6895
Location: Canada
Debugging Donkey Kong I see writes of $14 at the beginning of NMI and $94 when it finishes during gameplay frames. (The two writes disable then re-enable NMI so that it won't interrupt itself, that's a pattern a few Nintendo games use.) Where did you get $A5?


Top
 Profile  
 
PostPosted: Wed Sep 26, 2018 2:42 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3639
Location: Mountain View, CA
I tried to use Mesen's Trace Logger feature to get me exactly what I needed (a log of writes to $2000), but it seems incredibly buggy/weird/busted in ways that are off-topic (I'll have to file a GitHub issue :-) ). So I stuck with a breakpoint on any writes to effective address $2000, with a conditional of value == $A5 -- nothing turned up from power-on onwards. I then changed the breakpoint to any write to effective address $2000. From power-on all the way into the attract mode (where the game plays by itself), these are the values you're going to see written to $2000 at varying points:

$10
$14
$90
$94

No other values were seen, at least not during the parts I tested.

$A5 sounds to me like either the wrong data being shown, ex. an opcode (that would be lda $zp), an internal value you might be using for PPU state, or maybe you reported to us the wrong value.


Top
 Profile  
 
PostPosted: Wed Sep 26, 2018 4:42 pm 
Offline

Joined: Sun Feb 07, 2016 6:16 pm
Posts: 525
koitsu wrote:
I tried to use Mesen's Trace Logger feature to get me exactly what I needed (a log of writes to $2000), but it seems incredibly buggy/weird/busted in ways that are off-topic (I'll have to file a GitHub issue :-) )
Just tried on my end and it works as expected with the following condition: "address == $2000 && iswrite"


Top
 Profile  
 
PostPosted: Wed Sep 26, 2018 6:12 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 9:28 pm
Posts: 3639
Location: Mountain View, CA
Sour wrote:
koitsu wrote:
I tried to use Mesen's Trace Logger feature to get me exactly what I needed (a log of writes to $2000), but it seems incredibly buggy/weird/busted in ways that are off-topic (I'll have to file a GitHub issue :-) )
Just tried on my end and it works as expected with the following condition: "address == $2000 && iswrite"

I'll file a GitHub Issues for the behaviours I see that are bizarre/weird. There's no issue with the conditionals, the problems pertain to other things.


Top
 Profile  
 
PostPosted: Thu Sep 27, 2018 8:37 am 
Offline

Joined: Sat Aug 25, 2018 7:21 am
Posts: 29
I got the value $A5 from a random CPU dump of the title screen of Donkey Kong using Nintendulator. The value I'm giving to you comes from the dump at position $2000, not from watching a breakpoint. In fact, Nintendulator only shows $FF when I trace a breakpoint at $2000. I'm puzzled.


Last edited by HastatusXXI on Thu Sep 27, 2018 9:05 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Thu Sep 27, 2018 9:02 am 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20676
Location: NE Indiana, USA (NTSC)
If the last value written read or written on any PPU register ($2000-$2007 or their mirrors at $2008-$3FFF) is $A5, then reading a write-only PPU register (such as $2000) will return $A5. This behavior, which FCEUX calls "PPUGenLatch", is a result of bus capacitance within the PPU. Coincidentally, the last time we discussed it also involved Donkey Kong. It's possible that Nintendulator's memory viewer is emulating PPUGenLatch for the $2000-$3FFF space, but I haven't tested that.

As far as I'm aware, the only NES program that actually uses PPUGenLatch on purpose is my controller test ROM when it's trying to tell the difference between an NES and a Famicom based on $4016 open bus behavior. Existing games don't, and if future games do, it might just be to set the default language to Japanese or English or change how specialty controllers are read.


Top
 Profile  
 
PostPosted: Thu Sep 27, 2018 9:11 am 
Offline

Joined: Sat Aug 25, 2018 7:21 am
Posts: 29
tepples wrote:
If the last value written read or written on any PPU register ($2000-$2007 or their mirrors at $2008-$3FFF) is $A5, then reading a write-only PPU register (such as $2000) will return $A5. This behavior, which FCEUX calls "PPUGenLatch", is a result of bus capacitance within the PPU. Coincidentally, the last time we discussed it also involved Donkey Kong. It's possible that Nintendulator's memory viewer is emulating PPUGenLatch for the $2000-$3FFF space, but I haven't tested that.

As far as I'm aware, the only NES program that actually uses PPUGenLatch on purpose is my controller test ROM when it's trying to tell the difference between an NES and a Famicom based on $4016 open bus behavior. Existing games don't, and if future games do, it might just be to set the default language to Japanese or English or change how specialty controllers are read.


Does it mean I won't be able to get a PPU register value from a CPU dump from Nintendulator? There's no option to dump PPU registers and Quietust specified above that PPU dump contains pattern tables, nametables, OAM and palettes, but he didn't mention PPU registers at all, so I infered they would be available from the CPU memory map.

koitsu mentioned Mesen's Trace Logger. I'd rather use Nintendulator, since it's compatible with Wine. I'd try a Virtual Machine with Win 7 x64 if it's necessary (the one I have now runs Win Xp x32, but Mesen's emulator is not compatible with x86 arch).

Edit: Okay, I've seen Mesen is compatible with Linux.
Edit2: I can see the values koitsu gets for $2000 in the Trace Logger. However, all the PPU mapped registers stay $00, so I can't produce a dump to continue practising. How can I solve this? Is there any other way to get the value of the PPU registers?
Edit 3: Ok, I overlooked the paragraph on PPUGenLatch in the wiki article on PPU ports. So, the values in these registers start to decay about a frame after they've been written. Shouldn't it be possible to get a CPU dump just after the values have been written, either in Nintendulator or Mesen? Do they always dump the CPU memory map in a concrete instant of time?


SUMMARY: Is there any way I can dump the CPU memory map including the PPU registers values prior to decaying?


Top
 Profile  
 
PostPosted: Thu Sep 27, 2018 12:17 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 6895
Location: Canada
Quote:
Is there any way I can dump the CPU memory map including the PPU registers values prior to decaying?

Most of the PPU state is visible in Mesen's debugger. There's a frame labelled "PPU Status" in there which has the state of $2000, $2001, the current address, and the current scanline/pixel.

In general debuggers will not return the state of write-only registers from a memory dump of CPU. There are different behaviours that may be implemented here (open bus, PPU bus storage, 00, FF, etc.) and this is not exactly consistent between emulators. Even with registers that can be read, a CPU memory view or dump may not show their contents, because reading from them may have side effects too. Again depends on the emulator, it's kind of a grey area what's appropriate to display for this kind of thing.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 7 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:  
Powered by phpBB® Forum Software © phpBB Group