Hello, guys!
First of all, thank you for the stuff you are doing. It's really amazing to see such a big and interesting community.
I've decided to test my skills and try building an NES game (jRPG). I'm accustomed to high-level programming languages, like C++, so ASM 6502 is quite new for me. I've decided to use ASM6 at the moment. With the help of your handful guides, I was able to build an NROM-256 image with 32KB PRG, 8KB CHR and vertical mirorring. Eventually, I will switch to the cart with PRG-RAM, I assume (but this doesn't matter at the moment, as I'm still learning).
At the moment, I'm failing to understand the concept how to change contents of nametables and "scroll" the world map and will appreciate any help. I've read a lot of articles/posts, but still failing to undertsand the concept.
So, PPU is drawing tiles based on the content nametables ($2000 and $2400 in my case) and scroll position.
Let's assume that I've loaded the "world map" at $2000. Red rectangle corresponds to the area that is "seen" on the screen (screenshot). Then:
The updates should be done in a vBlank during NMI, because it's the only time when PPU is not "busy". That is why it is critical to "buffer" the change, reserve space at $0100 address area of NES to hold the "shadow" copy of the row/column that we are changing and then to do the writes via $2007 during NMI using the data of that "buffer". "Buffer" should be updated outside of NMI.
Am I understanding the concept correctly or missing something really vital? Should I consider an option to switch to a CHR-RAM based cart right away? Thank you in advance for wasting some time and helping me out and sorry for my Eglish.
First of all, thank you for the stuff you are doing. It's really amazing to see such a big and interesting community.
I've decided to test my skills and try building an NES game (jRPG). I'm accustomed to high-level programming languages, like C++, so ASM 6502 is quite new for me. I've decided to use ASM6 at the moment. With the help of your handful guides, I was able to build an NROM-256 image with 32KB PRG, 8KB CHR and vertical mirorring. Eventually, I will switch to the cart with PRG-RAM, I assume (but this doesn't matter at the moment, as I'm still learning).
At the moment, I'm failing to understand the concept how to change contents of nametables and "scroll" the world map and will appreciate any help. I've read a lot of articles/posts, but still failing to undertsand the concept.
So, PPU is drawing tiles based on the content nametables ($2000 and $2400 in my case) and scroll position.
Let's assume that I've loaded the "world map" at $2000. Red rectangle corresponds to the area that is "seen" on the screen (screenshot). Then:
- A. If player decides to go the the right, I should:
- 1. Update the left-most column of $2400 with new data.
- 2. Scroll by 16 pixels to the right.
- Result: here.
- B. If player decides to go to the left, I should:
- 1. Update the right-most column of $2400 with new data.
- 2. Flip nametables $2400 and $2000 by changing last 2 bits of $2000 (or it will result in this).
- 3. Scroll by 16 pixels to the left.
- Result: here.
- C. If player decides to go down, I should:
- 1. Update the top-most row of $2000 with new data.
- 2. Scroll the screen 16 pixels to the bottom.
- Result: here.
- D. If player decides to go up, I should:
- 1. Update the bottom-most row of $2000 with new data.
- 2. Scroll the screen 16 pixels to the top (it is done by decrementing Y scroll, so I should take care of the the 0->FF change, it should be 0->EF to avoid glitches).
- Result: here.
The updates should be done in a vBlank during NMI, because it's the only time when PPU is not "busy". That is why it is critical to "buffer" the change, reserve space at $0100 address area of NES to hold the "shadow" copy of the row/column that we are changing and then to do the writes via $2007 during NMI using the data of that "buffer". "Buffer" should be updated outside of NMI.
Am I understanding the concept correctly or missing something really vital? Should I consider an option to switch to a CHR-RAM based cart right away? Thank you in advance for wasting some time and helping me out and sorry for my Eglish.