It is currently Mon Dec 11, 2017 9:46 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Wed Sep 28, 2005 11:20 am 
Offline

Joined: Mon Apr 11, 2005 6:04 am
Posts: 20
Location: Kiev, Ukraine
I've got an idea: with the NES's many quirks, why not make a list of things that one has to do to make a game run on a real NES? This will answer the questions of the many n00bs here.

I'll start with what I know:

    - Wait two V-blanks on startup before doing anything with the gfx.

    - Read $2002 before writing to $2005/$2006.
    - Write two zeros during vblank to $2006 (if that doesn't work, write $20 then a zero to $2006).

    - Use Sprite DMA instead of $2003/$2004 whenever possible.
    - Write a zero to $2003 before doing a Sprite DMA.
    - Do all the sprite DMA during vblank.

_________________
"Wearing of this garment does not enable you to fly."
-- On a child sized Superman costume.


Last edited by family_programmer on Wed Sep 28, 2005 12:09 pm, edited 1 time in total.

Top
 Profile  
 
PostPosted: Wed Sep 28, 2005 11:52 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7312
Location: Chexbres, VD, Switzerland
family_programmer wrote:
RAM is not cleared on startup. Set all variables to zero before using them.

This causes no problem scince you don't suppose any actual value in them in your game logic. I'm pretty sure that Final Fanatasy 1 doesn't write zero the the whole RAM page anywhere in the game, I checked nearly all the main code.
Quote:
- Write two zeros during vblank to $2006 (if that doesn't work, write $20 then a zero to $2006).

I don't get why it wouldn't work. This is highly recommended to do this between the PPU writes and the $2005 upload in VBlank, however I couldn't say exactly why is that needed, nor why it wouldn't work. Many games writes $3f, $00, $00, $00 so I always do the same without asking questions.

Quote:
- Do all sprite DMAs during vblank.

Why DMAs ? Do you want to do more than one sprite DMA ???
Of course it is also possible to do it midframe if the screen is off, but it is pretty much complicated and useless for many genres of games.

_________________
Life is complex: it has both real and imaginary components.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 12:07 pm 
Offline

Joined: Mon Apr 11, 2005 6:04 am
Posts: 20
Location: Kiev, Ukraine
Quote:
I don't get why it wouldn't work. This is highly recommended to do this between the PPU writes and the $2005 upload in VBlank, however I couldn't say exactly why is that needed, nor why it wouldn't work. Many games writes $3f, $00, $00, $00 so I always do the same without asking questions.

Chris Covell's FAQ states:
Quote:
If your background is invisible, flickering, or improperly offset in some emulators, then you might not be clearing $2006 during VBlank. Right at the end of your NMI routine, write zeroes to $2006 twice ($0000 PPU address, right?), and then write whatever value you desire (or just zeroes as well) to $2005 to set up your scrolling. Also make sure that you have $2000 and $2001 set up correctly. This should make the background nice and stable. If it is still unstable, try writing $20, then $00 to $2006 (making the PPU address $2000) instead. Strangely enough, I've found that that works when #$0000 doesn't. Ahh, the joys of NES programming...

_________________
"Wearing of this garment does not enable you to fly."
-- On a child sized Superman costume.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 12:11 pm 
Offline
User avatar

Joined: Sun Sep 19, 2004 10:59 pm
Posts: 1393
Actually, the proper thing to do is not to write $00 $00 to $2006, but to write your 'origin' nametable to $2000 (lower 2 bits) and your horizontal and vertical scroll to $2005. This sets the same bits as a double-write to $2006 (more, actually) and specifies scrolling parameters as well.

_________________
Quietust, QMT Productions
P.S. If you don't get this note, let me know and I'll write you another.


Top
 Profile  
 
 Post subject:
PostPosted: Wed Sep 28, 2005 1:10 pm 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7312
Location: Chexbres, VD, Switzerland
Ah, so if he wrote only to $2006 and to $2005 but not to $2000 each frame, effectively $2005 isn't enough to setup all scroll parameters because of the name table selection bit, so $2006 should be resseted to choose name table zero....
However, write to $2000 every frame is needed as well, as Q descibed.

_________________
Life is complex: it has both real and imaginary components.


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

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 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