Difficulty of programming different systems

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
ldsviking
Posts: 3
Joined: Mon Feb 25, 2008 5:03 pm
Location: Utah

Difficulty of programming different systems

Post by ldsviking »

Hi everybody,
How does the difficulty of programming the NES compare to other systems? I've gathered the impression that the difficulty of systems is generally in line with when they were introduced, i.e. the Atari 2600 is more difficult to program than an NES, and the modern systems are relatively easy to develop for (mostly because they can be programmed with high-level languages). Is this generally the case? If I'm interested primarily in programming the NES would I do better to start learning with the SNES, or would it be about the same? Where would the Game Boy or GBA fall? Thanks in advance...
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

SNES is probably harder than the NES. For one thing, if you're making "Hello World", you can't even make it ding without writing a second program for the sound CPU. Instead, you have to clear all the graphics registers and print "Hello World" to the screen.

If you want the path of absolute least resistance to get started in homebrew, and you already know C or C++ on Windows or another platform, I'd wholeheartedly recommend the GBA. It's much more tolerant of messy code than some of the older systems are. For instance, if you write to VRAM outside of vertical blanking time, you don't get a severely corrupted screen. Instead, you get minor momentary tearing and that's it.

This is hello world on a GBA:

Code: Select all

#include <gba.h>
#include <stdio.h>

int frame = 0;

void nmiHandler() {
	frame++;
}

int main(void) {

	// install nmi handler
	irqInit();
	irqSet(IRQ_VBLANK, nmiHandler);
	irqEnable(IRQ_VBLANK);

	// set up CHR RAM, graphics registers, and C stdout
	// for a simple text mode
	consoleInit( 0 , 4 , 0, NULL , 0 , 15);

	// set palette
	BG_COLORS[0]=RGB5(0, 0, 23);
	BG_COLORS[241]=RGB5(31,31,31);

	// turn the screen on. Notice that the GBA doesn't
	// give a sh-- whether we're in vblank or not.
	SetMode(MODE_0 | BG0_ON);

	// ansi escape sequence to set print co-ordinates
	// /x1b[line;columnH
	puts("\x1b[10;10HHello World!");
	while (1) {
		VBlankIntrWait();
		scanKeys();
	}
}
User avatar
Memblers
Site Admin
Posts: 3902
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

I've programmed for:
NES
SNES
Atari 2600 (a little)
PC (slightly)

The NES is definitely the easiest to work with, out of those. I don't know about high-level languages. There is a C compiler for 6502, I imagine it's more the libraries that you had in mind though - and the NES libraries are kinda crappy.

For writing a program in assembly from scratch, I think NES is by far the easiest of those. I imagine the old Gameboy would be pretty similar.
bunnyboy
Posts: 449
Joined: Thu Oct 27, 2005 1:44 pm
Location: CA
Contact:

Post by bunnyboy »

From what I have seen for asm programming:

Atari - hard to program, good hardware docs, very good tutorials, some sample code

NES - medium difficulty, good hardware docs, bad tutorials, very little sample code

SNES - hard difficulty, very few hardware docs, no tutorials, good intro sample code

For higher level languages absolutely go with GBA. There really isn't anything but asm for the others. If you are sticking with asm then NES is the easiest but still not basic.
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

bunnyboy wrote:NES - medium difficulty, good hardware docs, bad tutorials, very little sample code
What sample code would you like to see?
User avatar
Jeroen
Posts: 1048
Joined: Tue Jul 03, 2007 1:49 pm

Post by Jeroen »

if you want sample code: I just made a program that changes the backround to green! It's in the sticky *end self promotion*
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

Don't get me wrong, but this is *exactly* what is wrong with sample code for the NES: most of it is written by people who are just starting, and therefore don't usually write reliable code.

Maybe tepples is write... the ones who need sample code could say exactly what kind of thing they'd find helpful, and then people who actually know what they are doing would write reliable code.
User avatar
Jeroen
Posts: 1048
Joined: Tue Jul 03, 2007 1:49 pm

Post by Jeroen »

You do make a good point. But does code really have to be "reliable" I realise better is well "better" but isn't the idea for someone just starting out to get the basic idea before going all "efficient" ?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Sample code should be 1. correct, and 2. easy to understand.
bunnyboy
Posts: 449
Joined: Thu Oct 27, 2005 1:44 pm
Location: CA
Contact:

Post by bunnyboy »

tepples wrote: What sample code would you like to see?
I would like to see very simple but complete programs, like hello world, a ball bouncing, simple scrolling example, etc. These would have no optimizations so what is happening is more clear. Even the wiki sample code like the gamepad code is beyond a beginner. In the 10 minutes that I looked at SNES programming it was easy to find a hello world and scrolling demo written by some guy who I now can't remember. Would be nice to have completed examples like that instead of just code snippets.
User avatar
blargg
Posts: 3717
Joined: Mon Sep 27, 2004 8:33 am
Location: Central Texas, USA
Contact:

Post by blargg »

bunnyboy, take a look at the thread "Working on ca65 examples" where I solicited feedback on examples along the lines of what you describe. I agree that optimizations have no place in code aimed at beginners.
Post Reply