It is currently Tue Nov 21, 2017 9:05 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 98 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next
Author Message
 Post subject: NES Programming Blog
PostPosted: Mon Dec 28, 2015 11:31 am 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1826
Location: DIGDUG
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.

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


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 1:34 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6447
Location: UK (temporarily)
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.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 3:08 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1826
Location: DIGDUG
Quote:
apostrophe mistakes
.

Huh?

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


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 3:38 pm 
Offline

Joined: Sun Apr 13, 2008 11:12 am
Posts: 6447
Location: UK (temporarily)
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


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 4:45 pm 
Offline

Joined: Sun Mar 19, 2006 9:44 pm
Posts: 919
Location: Japan
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.

_________________
http://www.chrismcovell.com


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 7:34 pm 
Offline
User avatar

Joined: Mon Nov 23, 2015 7:53 pm
Posts: 11
Thanks for the tutorial! I will check it out.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 8:28 pm 
Offline
User avatar

Joined: Wed Oct 16, 2013 7:55 am
Posts: 130
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.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Mon Dec 28, 2015 11:14 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1826
Location: DIGDUG
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.

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


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 8:16 am 
Offline
User avatar

Joined: Mon Dec 29, 2014 1:46 pm
Posts: 729
Location: New York, NY
@dougeff Awesome stuff. Blogs like this tend to be the catalyst for future projects.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 12:33 pm 
Offline
User avatar

Joined: Fri May 08, 2015 7:17 pm
Posts: 1826
Location: DIGDUG
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?

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


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 1:08 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 19239
Location: NE Indiana, USA (NTSC)
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.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 1:17 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2136
Location: Minneapolis, Minnesota, United States
Most programming stuff I've seen has used the convention of camelCase instead of CamelCase.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 1:26 pm 
Offline
User avatar

Joined: Sun Jan 22, 2012 12:03 pm
Posts: 5825
Location: Canada
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.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 1:58 pm 
Offline
User avatar

Joined: Sun Jun 05, 2005 2:04 pm
Posts: 2136
Location: Minneapolis, Minnesota, United States
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.


Top
 Profile  
 
 Post subject: Re: NES Programming Blog
PostPosted: Tue Dec 29, 2015 6:49 pm 
Offline
User avatar

Joined: Sun May 27, 2012 8:43 pm
Posts: 1311
Your blog made front-page on Hacker News!

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


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 98 posts ]  Go to page 1, 2, 3, 4, 5 ... 7  Next

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:  
cron
Powered by phpBB® Forum Software © phpBB Group