Reset handler/reset vector confusion?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Reset handler/reset vector confusion?

Post 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.
User avatar
rainwarrior
Posts: 8731
Joined: Sun Jan 22, 2012 12:03 pm
Location: Canada
Contact:

Re: Reset handler/reset vector confusion?

Post 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.
User avatar
FrankenGraphics
Formerly WheelInventor
Posts: 2064
Joined: Thu Apr 14, 2016 2:55 am
Location: Gothenburg, Sweden
Contact:

Re: Reset handler/reset vector confusion?

Post 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.
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Reset handler/reset vector confusion?

Post 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.
User avatar
tokumaru
Posts: 12427
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Re: Reset handler/reset vector confusion?

Post by tokumaru »

Precisely. Does anyone still maintains the NN tutorials? Is there anyone who can fix this to stop propagating this misconception?
Pokun
Posts: 2675
Joined: Tue May 28, 2013 5:49 am
Location: Hokkaido, Japan

Re: Reset handler/reset vector confusion?

Post by Pokun »

Maybe someone with an account over on Nintendo Age can raise the topic there? I don't have a Nintendo Age account.
hundonostudy
Posts: 23
Joined: Sat Jan 14, 2017 8:40 am

Re: Reset handler/reset vector confusion?

Post 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.
Post Reply