Page 4 of 4

Re: Reset handler/reset vector confusion?

Posted: Fri Jan 20, 2017 3:23 am
by tokumaru
WheelInventor wrote:Has this been mentioned in previous threads? I haven't informed myself on this.
I normally mention it every time someone posts code with that comment. The code itself isn't wrong, it's just the comment that's misleading. $2003 doesn't "set the low byte of the address", seeing as the sprite DMA always starts copying from $XX00, $XX being the value you write to $4014. What $2003 does is select the DESTINATION address, inside the OAM, where the data will be written to.

Re: Reset handler/reset vector confusion?

Posted: Fri Jan 20, 2017 3:30 am
by rainwarrior
WheelInventor wrote:That's really useful! Must TAS scripts be played @ real-time emulation speed?
No, they play back at whatever rate you're emulating. You can step through frame by frame or however you want to do it.

Re: Reset handler/reset vector confusion?

Posted: Fri Jan 20, 2017 3:35 am
by FrankenGraphics
tokumaru: That's quite a difference. :lol:

rainwarrior: That's even more useful, then. Very good for complete control over factors when trying to figure what's causing what and when in a bug.

Re: Reset handler/reset vector confusion?

Posted: Fri Jan 20, 2017 7:00 am
by Pokun
tokumaru wrote:
WheelInventor wrote:Has this been mentioned in previous threads? I haven't informed myself on this.
I normally mention it every time someone posts code with that comment. The code itself isn't wrong, it's just the comment that's misleading. $2003 doesn't "set the low byte of the address", seeing as the sprite DMA always starts copying from $XX00, $XX being the value you write to $4014. What $2003 does is select the DESTINATION address, inside the OAM, where the data will be written to.
Yeah I myself had a similar comment in my older projects. It confused me why the lower and upper byte of the OAM address should be set to a PPU port register and a CPU register respectively, until I looked them up in the wiki and unsterstood that it was a misunderstanding of how they work. I always thought I had made this misunderstanding by myself, but I guess the comment really came from the Nerdynights tutorial.

A correct comment should probably be something like this:

Code: Select all

obj_update:
  lda #$00
  sta $2003            ;make sure OAM address $00 is selected as destination start address
  lda #$02
  sta $4014            ;set the RAM page to be used as source address and invoke OAM-DMA
OAM is an internal memory in the PPU that is different from VRAM. It's only 256 byte so it doesn't need 16-bit addresses.

Re: Reset handler/reset vector confusion?

Posted: Fri Jan 20, 2017 2:01 pm
by tokumaru
Precisely. Does anyone still maintains the NN tutorials? Is there anyone who can fix this to stop propagating this misconception?

Re: Reset handler/reset vector confusion?

Posted: Fri Jan 20, 2017 11:25 pm
by Pokun
Maybe someone with an account over on Nintendo Age can raise the topic there? I don't have a Nintendo Age account.

Re: Reset handler/reset vector confusion?

Posted: Sun Jan 22, 2017 11:37 am
by hundonostudy
Pokun wrote:Maybe someone with an account over on Nintendo Age can raise the topic there? I don't have a Nintendo Age account.
When I'm finished with my PONG I plan to submit the code there. I can request that members of NESDEV who helped me complete it would like this updated.