tokumaru wrote:Yeah, the listing will show $6000 because you told the assembler that the PC for that part was $6000, but that doesn't mean the code will actually end up at $6000.unregistered wrote:Honestly, I made the mistake of just looking at the .lst file and it showed the values written to $6000 just like it always shows the values written to ROM.
Contrary to what may seem at first, commands like .org and .base don't force data into a particular address, they just let the assembler know where the code will be loaded so that labels and stuff have the correct values during execution.
NES programs don't start with .org $8000 because that causes the code to be put at $8000. The code will be loaded into $8000 no matter what, even if you write .org $3A9B instead, but all the labels will be wrong and the program won't function correctly.
EDIT: BTW, I said that .base wasn't doing anything in the code you posted, but now that I think of it, it's probably causing your ROM to be 256 bytes longer than it should, making it invalid. I believe that's the case because later you reset the PC to the value it had before the table, so the table is inserted into the ROM but the space it takes is not taken into consideration by the assembler since you manipulated the PC for that part.
Thank you so much tokumaru; that is extremely helpful to learn.
Returned early in the morning because I wanted to say that the code has been moved into its own file and I placed the .incsrcs at the top of each bank so that there wouldn't be 240 bytes of nothing between the end of that code I posted above (the beginning of page $BF) and the start of -reset_stub. And I also wanted to say that while laying in my bed I remembered this very helpful post where booker did a superb job of helping me to grasp the RAM/ROM issue that you, tokumaru, explained to me again.
edit: tokumaru, here is where you recommended me to use -reset_stub. If you scroll up there is the code found on the nesdev wiki, a link to that page, and some conversation about the problem I was having. This is linked here to help y'all to fully understand this post.
edit2 20171006: thought it would be good to say that the code I mentioned "posted above" was reduced to
Code: Select all
.rept 256
.db <$
.endr