nesdev.com
http://forums.nesdev.com/

NES Programming Blog
http://forums.nesdev.com/viewtopic.php?f=2&t=13676
Page 1 of 7

Author:  dougeff [ Mon Dec 28, 2015 11:31 am ]
Post subject:  NES Programming Blog

If you search for tutorials on how to program the NES in C, the examples either aren't very clear, or contain poor examples of programming the NES.

Well, you can include my tutorial / blog to that list.

https://nesdoug.wordpress.com/

This was the super top-secret other project that I've been working on for a month. It has lots of example code for programming the NES in cc65.

And, a tiny example game (vertical space shooter).

If anyone sees any factual errors, or broken links, unclear code, or just plain bad advice...please let me know. I'm hoping that someone out there can use this to get started on NES game development.

Thanks.

Author:  lidnariq [ Mon Dec 28, 2015 1:34 pm ]
Post subject:  Re: NES Programming Blog

One thing that I found really nice in thefox's KNES is this macro:
Code:
#define PPU_ADDR(a)                             \
do {                                            \
    PPU.addr = HIBYTE( a );                     \
    PPU.addr = LOBYTE( a );                     \
} while ( 0 )


Proofreading, there's several apostrophe mistakes.

Author:  dougeff [ Mon Dec 28, 2015 3:08 pm ]
Post subject:  Re: NES Programming Blog

Quote:
apostrophe mistakes
.

Huh?

Author:  lidnariq [ Mon Dec 28, 2015 3:38 pm ]
Post subject:  Re: NES Programming Blog

Apostrophes:
Post 0, paragraph 11, "mirroring) it’s map" → its (is possessive, not a contraction)
Post 10, paragraph 8, "referenced it's address" → its
Post 10, paragraph 17, "for it’s collision" → its
Post 13, paragraph 3, "the other one’s." → ones (is plural, not possessive nor a contraction)
Post 13, paragraph 13, "with it’s logic" → its

Author:  ccovell [ Mon Dec 28, 2015 4:45 pm ]
Post subject:  Re: NES Programming Blog

Image

( http://blog.writeathome.com/index.php/2 ... -teachers/ )

Anyway, of what I read so far, it looks like you explain the NES architecture in a very clear, simple way.

Author:  splitpane [ Mon Dec 28, 2015 7:34 pm ]
Post subject:  Re: NES Programming Blog

Thanks for the tutorial! I will check it out.

Author:  dustmop [ Mon Dec 28, 2015 8:28 pm ]
Post subject:  Re: NES Programming Blog

I'd recommend mentioning in "Getting Started" that this is geared towards Windows development. It becomes evident pretty quickly, but this could be a stumbling block for beginners.

Have only skimmed over this so far, but it looks pretty neat! Looking forward to reading the whole thing in depth.

Author:  dougeff [ Mon Dec 28, 2015 11:14 pm ]
Post subject:  Re: NES Programming Blog

That's so weird...

I have a little Stats menu on my blog, and I got like 9000 views yesterday, most from a referral on Reddit by zeroone. Those are almost monetizable numbers... (according to some website, if that traffic was sustainable, I could make $20 a day, or $7-8000 a year off ad revenue.)

My most popular YouTube video only got like 100 views all year.

Actually, that's almost enough to get my dropbox account suspended. Google tells me there's a 10gb bandwidth per day limit on public downloads from a free dropbox account. Hmm.

Author:  zeroone [ Tue Dec 29, 2015 8:16 am ]
Post subject:  Re: NES Programming Blog

@dougeff Awesome stuff. Blogs like this tend to be the catalyst for future projects.

Author:  dougeff [ Tue Dec 29, 2015 12:33 pm ]
Post subject:  Re: NES Programming Blog

Wow, they really tore me a new one over at Reddit (ie, didn't like the way I write code.)

https://www.reddit.com/r/programming/co ... game_in_c/

Should I edit the hell out of my example code (to make it look pretty) and add a hundred comments? I don't even know what all these things mean...

"no grouping of globals), no arrays for groups of bullets (he instead has Bullet1x,Bullet1y, Bullet2x, Bullet2y, etc.), no structs, CamelCase, magic number galore, repeated code due to the Something1...SomethingN convention, commented-out code"

What the heck is a CamelCase?
Magic numbers...I get that, I should replace with constants that describe what they are.
Commented-out code...because it was redundant, or a removed debugging element.

And, I don't know why, but some other website on cc65 (??) said 'don't use structs'...so I didn't.
Grouping of globals...they look ok to me. Am I missing something?

Author:  tepples [ Tue Dec 29, 2015 1:08 pm ]
Post subject:  Re: NES Programming Blog

You appear to be referring to the comment by _georgesim_.

CamelCase is "HelloWorld" as opposed to something like "hello_world". Different people prefer different styles. CamelCase has the connotation that you're trying to be object-oriented.

"Arrays for groups of bullets" would have been something like this:
Code:
BulletX: .res MAX_BULLETS
BulletY: .res MAX_BULLETS
BulletDX: .res MAX_BULLETS
BulletDY: .res MAX_BULLETS

That at least allows efficient indexing. I explained why structs are dispreferred on 6502.

Author:  Celius [ Tue Dec 29, 2015 1:17 pm ]
Post subject:  Re: NES Programming Blog

Most programming stuff I've seen has used the convention of camelCase instead of CamelCase.

Author:  rainwarrior [ Tue Dec 29, 2015 1:26 pm ]
Post subject:  Re: NES Programming Blog

dougeff wrote:
What the heck is a CamelCase?

If someone wants to pick an argument about an arbitrary naming convention like CamelCase, camelCase, underscores, or however you've chosen to do it, I would highly recommend that you ignore them. There is very little productive argument to be had about this. It's generally just a foolish waste of time.

As long as you're consistent with your conventions, it's probably fine.

Author:  Celius [ Tue Dec 29, 2015 1:58 pm ]
Post subject:  Re: NES Programming Blog

Quote:
As long as you're consistent with your conventions, it's probably fine.


I would agree with this. Putting multiple conventions together causes confusion and often causes one to doubt whether or not they understand what they're looking at. Camel case isn't really any better or worse than other naming conventions (I personally use a lot of dot notation for things); just as long as it's clear what it means, and is consistent with how other things are named.

Author:  mikejmoffitt [ Tue Dec 29, 2015 6:49 pm ]
Post subject:  Re: NES Programming Blog

Your blog made front-page on Hacker News!

Do you have any plans on discussing PRG bankswitching techniques from a C context?

Page 1 of 7 All times are UTC - 7 hours
Powered by phpBB® Forum Software © phpBB Group
http://www.phpbb.com/