Difference between revisions of "Talk:PPU registers"

From Nesdev wiki
Jump to: navigation, search
m
Line 4: Line 4:
 
Bregalad 21:29, 24 February 2010 (UTC)
 
Bregalad 21:29, 24 February 2010 (UTC)
  
<br/>
+
 
 +
<hr/>
 +
 
  
 
It depends. It's not only Tepples that promoted those names. I'm a firm believer that using symbolic constants makes the code easier to read.  As long both are available in the wiki I don't see the issue.
 
It depends. It's not only Tepples that promoted those names. I'm a firm believer that using symbolic constants makes the code easier to read.  As long both are available in the wiki I don't see the issue.
Line 37: Line 39:
  
 
[[User:Banshaku|Banshaku]] 01:35, 25 February 2010 (UTC)
 
[[User:Banshaku|Banshaku]] 01:35, 25 February 2010 (UTC)
 +
 +
 +
<hr/>
 +
  
 
Well it's fun because I always do it like your "bad example" exept I write numbers in hex instead of binary, and I never had problems reading it. Symbolic names just makes the thing longer and more confusing. In fact I think it is the exact opposite of what you said - it makes things harder to read in my opinion. Then it depends if you remember best words or numbers - I know I remember numbers better personally.
 
Well it's fun because I always do it like your "bad example" exept I write numbers in hex instead of binary, and I never had problems reading it. Symbolic names just makes the thing longer and more confusing. In fact I think it is the exact opposite of what you said - it makes things harder to read in my opinion. Then it depends if you remember best words or numbers - I know I remember numbers better personally.
Line 44: Line 50:
 
Again I don't want to force anything but I'd vote for at least replacing all instances which ONLY have the symbolic names to show the true register instead.
 
Again I don't want to force anything but I'd vote for at least replacing all instances which ONLY have the symbolic names to show the true register instead.
 
Bregalad 08:20, 25 February 2010 (UTC)
 
Bregalad 08:20, 25 February 2010 (UTC)
 +
 +
 +
<hr/>
 +
 +
 +
I was not aware that some page of the wiki only refer to the name.  In that case, yes it can be confusing since there is no official standard for naming them.  To make both crowd happy, we could always put both at the same time too.
 +
 +
Which pages are like that?
 +
 +
As for using constants For the registers, the benefit is quite negligible since there is not that much but for flags or your own values in your game, it will save you from many headache when you use the same value many time.  Of course, if you use long name and you have to remember all of them by heart, everybody will agree with you and say it's quite a pain in the butt (I do agree) but with a good editor, the editor will give you suggestion once you start to type a word. For example, in Visual Studio, Eclipse and many IDE, if I would type PPU, it would give me a suggestion list of all the words that start with PPU.  In the case of nes programming this is an issue because there is no such editor that gives that functionality. I wanted to make one for that reason since I cannot remember all my constants, which is normal.
 +
 +
[[User:Banshaku|Banshaku]] 12:05, 25 February 2010 (UTC)

Revision as of 06:05, 25 February 2010

Am I the only one being annoyed by those "PPUMASK" "PPUSCROLL" etc... names ? Because Mr Tepples often refers them as it doesn't mean everyone often refers them as it. I like to use plain $2000, $2005, etc... Personally I'd vote for removing references to those names from the Wiki but I don't want to force it if other people disagree. Bregalad 21:29, 24 February 2010 (UTC)




It depends. It's not only Tepples that promoted those names. I'm a firm believer that using symbolic constants makes the code easier to read. As long both are available in the wiki I don't see the issue.

I can give you an example as code. Which one is clearer when you read back the code?

This:

lda #%1010000
sta $2000

Or:

In another file (nes.h)

PPU_CTRL_NMI %10000000
PPU_CTRL_SPRITE8x16 %00100000
PPU_CTRL $2000

...

Somewhere in the code

lda #PPU_CTRL_NMI + PPU_CTRL_SPRITE8x16
sta PPU_CTRL


Once you know the convention, it makes the code easier to read. Of course for the registers only it could be argued for a while since there is not that much on the nes but it's always good to follow good programming practice. In a professional environment, I will always promote the second once since it makes the code clearer.

You don't know how many time I saw code samples for newb with no comments at all and you have to figure out what the hell was done with anonymous labels to make it worst. At the least those constants give some visual feedback on what you're trying to do. It's only a matter of getting used to the naming convention.

In brief, I think it's a good practice to use them but nobody is forcing you do to so. There's just there to try to make a convention and of course not everyone will agree with it (i.e. see how many linux distro..)


Banshaku 01:35, 25 February 2010 (UTC)




Well it's fun because I always do it like your "bad example" exept I write numbers in hex instead of binary, and I never had problems reading it. Symbolic names just makes the thing longer and more confusing. In fact I think it is the exact opposite of what you said - it makes things harder to read in my opinion. Then it depends if you remember best words or numbers - I know I remember numbers better personally.

Like you said, as long as there is both there isn't any problem... but my issue is that I found several pages on the Wiki which ONLY refers the symbolic names which are nothing official anyways. So my proposal would be to not touch this page, but change the others to mirror the numbers (e.g. $2001) instead of symbolic names that makes few sense (PPUMASK really makes no sense to me it sounds like carnival or something).

Again I don't want to force anything but I'd vote for at least replacing all instances which ONLY have the symbolic names to show the true register instead. Bregalad 08:20, 25 February 2010 (UTC)




I was not aware that some page of the wiki only refer to the name. In that case, yes it can be confusing since there is no official standard for naming them. To make both crowd happy, we could always put both at the same time too.

Which pages are like that?

As for using constants For the registers, the benefit is quite negligible since there is not that much but for flags or your own values in your game, it will save you from many headache when you use the same value many time. Of course, if you use long name and you have to remember all of them by heart, everybody will agree with you and say it's quite a pain in the butt (I do agree) but with a good editor, the editor will give you suggestion once you start to type a word. For example, in Visual Studio, Eclipse and many IDE, if I would type PPU, it would give me a suggestion list of all the words that start with PPU. In the case of nes programming this is an issue because there is no such editor that gives that functionality. I wanted to make one for that reason since I cannot remember all my constants, which is normal.

Banshaku 12:05, 25 February 2010 (UTC)