It is currently Sun Jan 20, 2019 11:55 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: Sun Dec 09, 2018 1:39 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 117
Location: Edmonton, Canada
I have a strange bug in mesen, that I can also reproduce in real NES. I have "ppu_Off" subroutine that does

Code:
lda #0
sta PPU_MASK


But it does not seem to turn off the render and when I reload palette, I have garbage on the screen for a frame. I do it just after NMI is done, and there is nothing in NMI except OAM DMA and scroll reset. Is there anything I'm missing?


Top
 Profile  
 
PostPosted: Sun Dec 09, 2018 1:47 pm 
Offline
User avatar

Joined: Thu Mar 31, 2016 11:15 am
Posts: 464
Don't think anyone can help much without seeing code and/or an example ROM.

Anyway, changing the palette outside of VBLANK causes colored lines to appear on the screen. Search the wiki for more info. Even with rendering off, you have to change the palette inside VBLANK.


Top
 Profile  
 
PostPosted: Sun Dec 09, 2018 1:59 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2390
Location: DIGDUG
Set a breakpoint for writes to 2001. Make sure the code is doing what you think.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Sun Dec 09, 2018 2:00 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 117
Location: Edmonton, Canada
pubby wrote:
Anyway, changing the palette outside of VBLANK causes colored lines to appear on the screen. Search the wiki for more info. Even with rendering off, you have to change the palette inside VBLANK.


I think that was the case. Thank you.


Top
 Profile  
 
PostPosted: Sun Dec 09, 2018 5:07 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11094
Location: Rio de Janeiro - Brazil
The exact time at which you disable and enable rendering matters too: if you do it mid-screen, you'll get half-rendered frames on the screen, which aren't nice. Better wait for vblank in those cases too.


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 9:20 am 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 117
Location: Edmonton, Canada
tokumaru wrote:
The exact time at which you disable and enable rendering matters too: if you do it mid-screen, you'll get half-rendered frames on the screen, which aren't nice. Better wait for vblank in those cases too.


This is what I was doing, I was waiting for another NMI before turning rendering off. What I did not do, I was not waiting for another NMI after loading nametable and before loading palette.


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 10:57 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 2390
Location: DIGDUG
Load the palette first, then the nametable. Then you don't have to wait for a 2nd v-blank.

_________________
nesdoug.com -- blog/tutorial on programming for the NES


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 11:10 am 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 117
Location: Edmonton, Canada
dougeff wrote:
Load the palette first, then the nametable. Then you don't have to wait for a 2nd v-blank.


Yeah... My nametable load code erases palette. Hence the warning in the code.
Code:
.warning "Fix loadnametable, so it does not erase palette"


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 1:15 pm 
Offline
User avatar

Joined: Thu Sep 15, 2016 6:29 am
Posts: 855
Location: Denmark (PAL)
Unless you are doing a quick scene flip, like exiting the edge of a screen to enter another, waiting for an extra vblank isn't really expensive. A couple of frames is practically no wait to anyone playing the game. :)


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 1:48 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 117
Location: Edmonton, Canada
Sumez wrote:
Unless you are doing a quick scene flip, like exiting the edge of a screen to enter another,


That's exactly what I'm doing. But now I'm at the stage where I can run between screens, and that's it. So I'm tabling this bug down for a while, and get back to it when I have more actual game features working.

Because I reload whole nametable, I will still have 3 frames dropped, and I don't think I can do it in less than 2. So it will flash the screen a little anyways. I might add fade in/out, which will give me even more time to do any work.


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 1:56 pm 
Online

Joined: Sun Apr 13, 2008 11:12 am
Posts: 7973
Location: Seattle
Battle Kid took some ribbing for being a flip-screen platformer that blanks the screen for 5-ish vblanks between each screen. It just looks a little sloppy.

On the other hand, it might count as the first widespread commercial modern homebrew, and there's a lot to be said for completing a project at all.


Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 3:10 pm 
Offline

Joined: Tue Aug 28, 2018 8:54 am
Posts: 117
Location: Edmonton, Canada
lidnariq wrote:
Battle Kid took some ribbing for being a flip-screen platformer that blanks the screen for 5-ish vblanks between each screen. It just looks a little sloppy.


It is currently quite quick, and I am able to make it one frame shorter. But I don't even have any npc/objects just yet, so it may become visually annoying without fading.


Attachments:
game.nes [48.02 KiB]
Downloaded 27 times
Top
 Profile  
 
PostPosted: Mon Dec 10, 2018 4:15 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11094
Location: Rio de Janeiro - Brazil
Flipping screens in action games can be a little annoying in some situations. I remember a couple of screens in Battle Kid where you had to jump from platforms near the top of the screen and the successive flashes caused by switching to the screen above and quickly falling back multiple times were a little hard on the eyes. Not only that, but the enemies kept resetting their positions on every screen switch, which was disorienting.

I don't know if there's a better way to handle that on the NES... I guess you could "pause and fade" to eliminate the flashing, but then the slowness of moving around gets annoying, specially if you want to reach a distant place quickly.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: slembcke, Sour and 2 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